001package org.hl7.fhir.r4.formats;
002
003import java.io.IOException;
004
005import org.hl7.fhir.exceptions.FHIRFormatError;
006
007
008
009/*
010  Copyright (c) 2011+, HL7, Inc.
011  All rights reserved.
012  
013  Redistribution and use in source and binary forms, with or without modification, 
014  are permitted provided that the following conditions are met:
015  
016   * Redistributions of source code must retain the above copyright notice, this 
017     list of conditions and the following disclaimer.
018   * Redistributions in binary form must reproduce the above copyright notice, 
019     this list of conditions and the following disclaimer in the documentation 
020     and/or other materials provided with the distribution.
021   * Neither the name of HL7 nor the names of its contributors may be used to 
022     endorse or promote products derived from this software without specific 
023     prior written permission.
024  
025  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
026  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
027  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
028  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
029  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
030  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
031  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
032  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
033  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
034  POSSIBILITY OF SUCH DAMAGE.
035  
036*/
037
038// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
039import org.hl7.fhir.r4.model.*;
040import org.hl7.fhir.utilities.Utilities;
041import org.hl7.fhir.utilities.json.JsonTrackingParser.PresentedBigDecimal;
042import org.hl7.fhir.utilities.xhtml.XhtmlNode;
043
044import com.google.gson.JsonArray;
045import com.google.gson.JsonObject;
046
047public class JsonParser extends JsonParserBase {
048
049  public JsonParser() {
050    super();
051  }
052
053  public JsonParser(boolean allowUnknownContent) {
054    super();
055    setAllowUnknownContent(allowUnknownContent);
056  }
057
058  public JsonParser(boolean allowUnknownContent, boolean allowComments) {
059    super();
060    setAllowUnknownContent(allowUnknownContent);
061    setAllowComments(allowComments);
062  }
063
064  protected void parseElementProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
065    super.parseElementProperties(json, element);
066    if (json.has("extension")) {
067      JsonArray array = json.getAsJsonArray("extension");
068      for (int i = 0; i < array.size(); i++) {
069        element.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
070      }
071    };
072  }
073
074  protected void parseBackboneElementProperties(JsonObject json, BackboneElement element) 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) throws IOException, FHIRFormatError {
085    parseElementProperties(json, element);
086    if (json.has("modifierExtension")) {
087      JsonArray array = json.getAsJsonArray("modifierExtension");
088      for (int i = 0; i < array.size(); i++) {
089        element.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
090      }
091    }
092  }
093
094  protected void parseTypeProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
095    parseElementProperties(json, element);
096  }
097
098  @SuppressWarnings("unchecked")
099  protected <E extends Enum<E>> Enumeration<E> parseEnumeration(String s, E item, EnumFactory e) throws IOException, FHIRFormatError {
100    Enumeration<E> res = new Enumeration<E>(e);
101    if (s != null)
102      res.setValue((E) e.fromCode(s));
103    return res;
104  }
105
106  protected DateType parseDate(String v) throws IOException, FHIRFormatError {
107    DateType res = new DateType(v);
108    return res;
109  }
110
111  protected DateTimeType parseDateTime(String v) throws IOException, FHIRFormatError {
112    DateTimeType res = new DateTimeType(v);
113    return res;
114  }
115
116  protected CodeType parseCode(String v) throws IOException, FHIRFormatError {
117    CodeType res = new CodeType(v);
118    return res;
119  }
120
121  protected StringType parseString(String v) throws IOException, FHIRFormatError {
122    StringType res = new StringType(v);
123    return res;
124  }
125
126  protected IntegerType parseInteger(java.lang.Long v) throws IOException, FHIRFormatError {
127    IntegerType res = new IntegerType(v);
128    return res;
129  }
130
131  protected OidType parseOid(String v) throws IOException, FHIRFormatError {
132    OidType res = new OidType(v);
133    return res;
134  }
135
136  protected CanonicalType parseCanonical(String v) throws IOException, FHIRFormatError {
137    CanonicalType res = new CanonicalType(v);
138    return res;
139  }
140
141  protected UriType parseUri(String v) throws IOException, FHIRFormatError {
142    UriType res = new UriType(v);
143    return res;
144  }
145
146  protected UuidType parseUuid(String v) throws IOException, FHIRFormatError {
147    UuidType res = new UuidType(v);
148    return res;
149  }
150
151  protected UrlType parseUrl(String v) throws IOException, FHIRFormatError {
152    UrlType res = new UrlType(v);
153    return res;
154  }
155
156  protected InstantType parseInstant(String v) throws IOException, FHIRFormatError {
157    InstantType res = new InstantType(v);
158    return res;
159  }
160
161  protected BooleanType parseBoolean(java.lang.Boolean v) throws IOException, FHIRFormatError {
162    BooleanType res = new BooleanType(v);
163    return res;
164  }
165
166  protected Base64BinaryType parseBase64Binary(String v) throws IOException, FHIRFormatError {
167    Base64BinaryType res = new Base64BinaryType(v);
168    return res;
169  }
170
171  protected UnsignedIntType parseUnsignedInt(String v) throws IOException, FHIRFormatError {
172    UnsignedIntType res = new UnsignedIntType(v);
173    return res;
174  }
175
176  protected MarkdownType parseMarkdown(String v) throws IOException, FHIRFormatError {
177    MarkdownType res = new MarkdownType(v);
178    return res;
179  }
180
181  protected TimeType parseTime(String v) throws IOException, FHIRFormatError {
182    TimeType res = new TimeType(v);
183    return res;
184  }
185
186  protected IdType parseId(String v) throws IOException, FHIRFormatError {
187    IdType res = new IdType(v);
188    return res;
189  }
190
191  protected PositiveIntType parsePositiveInt(String v) throws IOException, FHIRFormatError {
192    PositiveIntType res = new PositiveIntType(v);
193    return res;
194  }
195
196  protected DecimalType parseDecimal(java.math.BigDecimal v) throws IOException, FHIRFormatError {
197    DecimalType res = new DecimalType(v);
198    if (v instanceof PresentedBigDecimal)
199      res.setRepresentation(((PresentedBigDecimal) v).getPresentation());
200    return res;
201  }
202
203  protected Extension parseExtension(JsonObject json) throws IOException, FHIRFormatError {
204    Extension res = new Extension();
205    parseExtensionProperties(json, res);
206    return res;
207  }
208
209  protected void parseExtensionProperties(JsonObject json, Extension res) throws IOException, FHIRFormatError {
210    parseTypeProperties(json, res);
211    if (json.has("url"))
212      res.setUrlElement(parseUri(json.get("url").getAsString()));
213    if (json.has("_url"))
214      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
215    Type value = parseType("value", json);
216    if (value != null)
217      res.setValue(value);
218  }
219
220  protected Narrative parseNarrative(JsonObject json) throws IOException, FHIRFormatError {
221    Narrative res = new Narrative();
222    parseNarrativeProperties(json, res);
223    return res;
224  }
225
226  protected void parseNarrativeProperties(JsonObject json, Narrative res) throws IOException, FHIRFormatError {
227    parseTypeProperties(json, res);
228    if (json.has("status"))
229      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Narrative.NarrativeStatus.NULL, new Narrative.NarrativeStatusEnumFactory()));
230    if (json.has("_status"))
231      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
232    if (json.has("div"))
233      res.setDiv(parseXhtml(json.get("div").getAsString()));
234  }
235
236  protected Meta parseMeta(JsonObject json) throws IOException, FHIRFormatError {
237    Meta res = new Meta();
238    parseMetaProperties(json, res);
239    return res;
240  }
241
242  protected void parseMetaProperties(JsonObject json, Meta res) throws IOException, FHIRFormatError {
243    parseElementProperties(json, res);
244    if (json.has("versionId"))
245      res.setVersionIdElement(parseId(json.get("versionId").getAsString()));
246    if (json.has("_versionId"))
247      parseElementProperties(getJObject(json, "_versionId"), res.getVersionIdElement());
248    if (json.has("lastUpdated"))
249      res.setLastUpdatedElement(parseInstant(json.get("lastUpdated").getAsString()));
250    if (json.has("_lastUpdated"))
251      parseElementProperties(getJObject(json, "_lastUpdated"), res.getLastUpdatedElement());
252    if (json.has("source"))
253      res.setSourceElement(parseUri(json.get("source").getAsString()));
254    if (json.has("_source"))
255      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
256    if (json.has("profile")) {
257      JsonArray array = json.getAsJsonArray("profile");
258      for (int i = 0; i < array.size(); i++) {
259        res.getProfile().add(parseCanonical(array.get(i).getAsString()));
260      }
261    };
262    if (json.has("_profile")) {
263      JsonArray array = json.getAsJsonArray("_profile");
264      for (int i = 0; i < array.size(); i++) {
265        if (i == res.getProfile().size())
266          res.getProfile().add(parseCanonical(null));
267        if (array.get(i) instanceof JsonObject) 
268          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
269      }
270    };
271    if (json.has("security")) {
272      JsonArray array = json.getAsJsonArray("security");
273      for (int i = 0; i < array.size(); i++) {
274        res.getSecurity().add(parseCoding(array.get(i).getAsJsonObject()));
275      }
276    };
277    if (json.has("tag")) {
278      JsonArray array = json.getAsJsonArray("tag");
279      for (int i = 0; i < array.size(); i++) {
280        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
281      }
282    };
283  }
284
285  protected Address parseAddress(JsonObject json) throws IOException, FHIRFormatError {
286    Address res = new Address();
287    parseAddressProperties(json, res);
288    return res;
289  }
290
291  protected void parseAddressProperties(JsonObject json, Address res) throws IOException, FHIRFormatError {
292    parseTypeProperties(json, res);
293    if (json.has("use"))
294      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Address.AddressUse.NULL, new Address.AddressUseEnumFactory()));
295    if (json.has("_use"))
296      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
297    if (json.has("type"))
298      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Address.AddressType.NULL, new Address.AddressTypeEnumFactory()));
299    if (json.has("_type"))
300      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
301    if (json.has("text"))
302      res.setTextElement(parseString(json.get("text").getAsString()));
303    if (json.has("_text"))
304      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
305    if (json.has("line")) {
306      JsonArray array = json.getAsJsonArray("line");
307      for (int i = 0; i < array.size(); i++) {
308        res.getLine().add(parseString(array.get(i).getAsString()));
309      }
310    };
311    if (json.has("_line")) {
312      JsonArray array = json.getAsJsonArray("_line");
313      for (int i = 0; i < array.size(); i++) {
314        if (i == res.getLine().size())
315          res.getLine().add(parseString(null));
316        if (array.get(i) instanceof JsonObject) 
317          parseElementProperties(array.get(i).getAsJsonObject(), res.getLine().get(i));
318      }
319    };
320    if (json.has("city"))
321      res.setCityElement(parseString(json.get("city").getAsString()));
322    if (json.has("_city"))
323      parseElementProperties(getJObject(json, "_city"), res.getCityElement());
324    if (json.has("district"))
325      res.setDistrictElement(parseString(json.get("district").getAsString()));
326    if (json.has("_district"))
327      parseElementProperties(getJObject(json, "_district"), res.getDistrictElement());
328    if (json.has("state"))
329      res.setStateElement(parseString(json.get("state").getAsString()));
330    if (json.has("_state"))
331      parseElementProperties(getJObject(json, "_state"), res.getStateElement());
332    if (json.has("postalCode"))
333      res.setPostalCodeElement(parseString(json.get("postalCode").getAsString()));
334    if (json.has("_postalCode"))
335      parseElementProperties(getJObject(json, "_postalCode"), res.getPostalCodeElement());
336    if (json.has("country"))
337      res.setCountryElement(parseString(json.get("country").getAsString()));
338    if (json.has("_country"))
339      parseElementProperties(getJObject(json, "_country"), res.getCountryElement());
340    if (json.has("period"))
341      res.setPeriod(parsePeriod(getJObject(json, "period")));
342  }
343
344  protected Contributor parseContributor(JsonObject json) throws IOException, FHIRFormatError {
345    Contributor res = new Contributor();
346    parseContributorProperties(json, res);
347    return res;
348  }
349
350  protected void parseContributorProperties(JsonObject json, Contributor res) throws IOException, FHIRFormatError {
351    parseTypeProperties(json, res);
352    if (json.has("type"))
353      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Contributor.ContributorType.NULL, new Contributor.ContributorTypeEnumFactory()));
354    if (json.has("_type"))
355      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
356    if (json.has("name"))
357      res.setNameElement(parseString(json.get("name").getAsString()));
358    if (json.has("_name"))
359      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
360    if (json.has("contact")) {
361      JsonArray array = json.getAsJsonArray("contact");
362      for (int i = 0; i < array.size(); i++) {
363        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
364      }
365    };
366  }
367
368  protected Attachment parseAttachment(JsonObject json) throws IOException, FHIRFormatError {
369    Attachment res = new Attachment();
370    parseAttachmentProperties(json, res);
371    return res;
372  }
373
374  protected void parseAttachmentProperties(JsonObject json, Attachment res) throws IOException, FHIRFormatError {
375    parseTypeProperties(json, res);
376    if (json.has("contentType"))
377      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
378    if (json.has("_contentType"))
379      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
380    if (json.has("language"))
381      res.setLanguageElement(parseCode(json.get("language").getAsString()));
382    if (json.has("_language"))
383      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
384    if (json.has("data"))
385      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
386    if (json.has("_data"))
387      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
388    if (json.has("url"))
389      res.setUrlElement(parseUrl(json.get("url").getAsString()));
390    if (json.has("_url"))
391      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
392    if (json.has("size"))
393      res.setSizeElement(parseUnsignedInt(json.get("size").getAsString()));
394    if (json.has("_size"))
395      parseElementProperties(getJObject(json, "_size"), res.getSizeElement());
396    if (json.has("hash"))
397      res.setHashElement(parseBase64Binary(json.get("hash").getAsString()));
398    if (json.has("_hash"))
399      parseElementProperties(getJObject(json, "_hash"), res.getHashElement());
400    if (json.has("title"))
401      res.setTitleElement(parseString(json.get("title").getAsString()));
402    if (json.has("_title"))
403      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
404    if (json.has("creation"))
405      res.setCreationElement(parseDateTime(json.get("creation").getAsString()));
406    if (json.has("_creation"))
407      parseElementProperties(getJObject(json, "_creation"), res.getCreationElement());
408  }
409
410  protected Count parseCount(JsonObject json) throws IOException, FHIRFormatError {
411    Count res = new Count();
412    parseCountProperties(json, res);
413    return res;
414  }
415
416  protected void parseCountProperties(JsonObject json, Count res) throws IOException, FHIRFormatError {
417    parseQuantityProperties(json, res);
418  }
419
420  protected DataRequirement parseDataRequirement(JsonObject json) throws IOException, FHIRFormatError {
421    DataRequirement res = new DataRequirement();
422    parseDataRequirementProperties(json, res);
423    return res;
424  }
425
426  protected void parseDataRequirementProperties(JsonObject json, DataRequirement res) throws IOException, FHIRFormatError {
427    parseTypeProperties(json, res);
428    if (json.has("type"))
429      res.setTypeElement(parseCode(json.get("type").getAsString()));
430    if (json.has("_type"))
431      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
432    if (json.has("profile")) {
433      JsonArray array = json.getAsJsonArray("profile");
434      for (int i = 0; i < array.size(); i++) {
435        res.getProfile().add(parseCanonical(array.get(i).getAsString()));
436      }
437    };
438    if (json.has("_profile")) {
439      JsonArray array = json.getAsJsonArray("_profile");
440      for (int i = 0; i < array.size(); i++) {
441        if (i == res.getProfile().size())
442          res.getProfile().add(parseCanonical(null));
443        if (array.get(i) instanceof JsonObject) 
444          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
445      }
446    };
447    Type subject = parseType("subject", json);
448    if (subject != null)
449      res.setSubject(subject);
450    if (json.has("mustSupport")) {
451      JsonArray array = json.getAsJsonArray("mustSupport");
452      for (int i = 0; i < array.size(); i++) {
453        res.getMustSupport().add(parseString(array.get(i).getAsString()));
454      }
455    };
456    if (json.has("_mustSupport")) {
457      JsonArray array = json.getAsJsonArray("_mustSupport");
458      for (int i = 0; i < array.size(); i++) {
459        if (i == res.getMustSupport().size())
460          res.getMustSupport().add(parseString(null));
461        if (array.get(i) instanceof JsonObject) 
462          parseElementProperties(array.get(i).getAsJsonObject(), res.getMustSupport().get(i));
463      }
464    };
465    if (json.has("codeFilter")) {
466      JsonArray array = json.getAsJsonArray("codeFilter");
467      for (int i = 0; i < array.size(); i++) {
468        res.getCodeFilter().add(parseDataRequirementDataRequirementCodeFilterComponent(array.get(i).getAsJsonObject(), res));
469      }
470    };
471    if (json.has("dateFilter")) {
472      JsonArray array = json.getAsJsonArray("dateFilter");
473      for (int i = 0; i < array.size(); i++) {
474        res.getDateFilter().add(parseDataRequirementDataRequirementDateFilterComponent(array.get(i).getAsJsonObject(), res));
475      }
476    };
477    if (json.has("limit"))
478      res.setLimitElement(parsePositiveInt(json.get("limit").getAsString()));
479    if (json.has("_limit"))
480      parseElementProperties(getJObject(json, "_limit"), res.getLimitElement());
481    if (json.has("sort")) {
482      JsonArray array = json.getAsJsonArray("sort");
483      for (int i = 0; i < array.size(); i++) {
484        res.getSort().add(parseDataRequirementDataRequirementSortComponent(array.get(i).getAsJsonObject(), res));
485      }
486    };
487  }
488
489  protected DataRequirement.DataRequirementCodeFilterComponent parseDataRequirementDataRequirementCodeFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
490    DataRequirement.DataRequirementCodeFilterComponent res = new DataRequirement.DataRequirementCodeFilterComponent();
491    parseDataRequirementDataRequirementCodeFilterComponentProperties(json, owner, res);
492    return res;
493  }
494
495  protected void parseDataRequirementDataRequirementCodeFilterComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementCodeFilterComponent res) throws IOException, FHIRFormatError {
496    parseTypeProperties(json, res);
497    if (json.has("path"))
498      res.setPathElement(parseString(json.get("path").getAsString()));
499    if (json.has("_path"))
500      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
501    if (json.has("searchParam"))
502      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
503    if (json.has("_searchParam"))
504      parseElementProperties(getJObject(json, "_searchParam"), res.getSearchParamElement());
505    if (json.has("valueSet"))
506      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
507    if (json.has("_valueSet"))
508      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
509    if (json.has("code")) {
510      JsonArray array = json.getAsJsonArray("code");
511      for (int i = 0; i < array.size(); i++) {
512        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
513      }
514    };
515  }
516
517  protected DataRequirement.DataRequirementDateFilterComponent parseDataRequirementDataRequirementDateFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
518    DataRequirement.DataRequirementDateFilterComponent res = new DataRequirement.DataRequirementDateFilterComponent();
519    parseDataRequirementDataRequirementDateFilterComponentProperties(json, owner, res);
520    return res;
521  }
522
523  protected void parseDataRequirementDataRequirementDateFilterComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementDateFilterComponent res) throws IOException, FHIRFormatError {
524    parseTypeProperties(json, res);
525    if (json.has("path"))
526      res.setPathElement(parseString(json.get("path").getAsString()));
527    if (json.has("_path"))
528      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
529    if (json.has("searchParam"))
530      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
531    if (json.has("_searchParam"))
532      parseElementProperties(getJObject(json, "_searchParam"), res.getSearchParamElement());
533    Type value = parseType("value", json);
534    if (value != null)
535      res.setValue(value);
536  }
537
538  protected DataRequirement.DataRequirementSortComponent parseDataRequirementDataRequirementSortComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
539    DataRequirement.DataRequirementSortComponent res = new DataRequirement.DataRequirementSortComponent();
540    parseDataRequirementDataRequirementSortComponentProperties(json, owner, res);
541    return res;
542  }
543
544  protected void parseDataRequirementDataRequirementSortComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementSortComponent res) throws IOException, FHIRFormatError {
545    parseTypeProperties(json, res);
546    if (json.has("path"))
547      res.setPathElement(parseString(json.get("path").getAsString()));
548    if (json.has("_path"))
549      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
550    if (json.has("direction"))
551      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), DataRequirement.SortDirection.NULL, new DataRequirement.SortDirectionEnumFactory()));
552    if (json.has("_direction"))
553      parseElementProperties(getJObject(json, "_direction"), res.getDirectionElement());
554  }
555
556  protected Dosage parseDosage(JsonObject json) throws IOException, FHIRFormatError {
557    Dosage res = new Dosage();
558    parseDosageProperties(json, res);
559    return res;
560  }
561
562  protected void parseDosageProperties(JsonObject json, Dosage res) throws IOException, FHIRFormatError {
563    parseBackboneElementProperties(json, res);
564    if (json.has("sequence"))
565      res.setSequenceElement(parseInteger(json.get("sequence").getAsLong()));
566    if (json.has("_sequence"))
567      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
568    if (json.has("text"))
569      res.setTextElement(parseString(json.get("text").getAsString()));
570    if (json.has("_text"))
571      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
572    if (json.has("additionalInstruction")) {
573      JsonArray array = json.getAsJsonArray("additionalInstruction");
574      for (int i = 0; i < array.size(); i++) {
575        res.getAdditionalInstruction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
576      }
577    };
578    if (json.has("patientInstruction"))
579      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
580    if (json.has("_patientInstruction"))
581      parseElementProperties(getJObject(json, "_patientInstruction"), res.getPatientInstructionElement());
582    if (json.has("timing"))
583      res.setTiming(parseTiming(getJObject(json, "timing")));
584    Type asNeeded = parseType("asNeeded", json);
585    if (asNeeded != null)
586      res.setAsNeeded(asNeeded);
587    if (json.has("site"))
588      res.setSite(parseCodeableConcept(getJObject(json, "site")));
589    if (json.has("route"))
590      res.setRoute(parseCodeableConcept(getJObject(json, "route")));
591    if (json.has("method"))
592      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
593    if (json.has("doseAndRate")) {
594      JsonArray array = json.getAsJsonArray("doseAndRate");
595      for (int i = 0; i < array.size(); i++) {
596        res.getDoseAndRate().add(parseDosageDosageDoseAndRateComponent(array.get(i).getAsJsonObject(), res));
597      }
598    };
599    if (json.has("maxDosePerPeriod"))
600      res.setMaxDosePerPeriod(parseRatio(getJObject(json, "maxDosePerPeriod")));
601    if (json.has("maxDosePerAdministration"))
602      res.setMaxDosePerAdministration(parseQuantity(getJObject(json, "maxDosePerAdministration")));
603    if (json.has("maxDosePerLifetime"))
604      res.setMaxDosePerLifetime(parseQuantity(getJObject(json, "maxDosePerLifetime")));
605  }
606
607  protected Dosage.DosageDoseAndRateComponent parseDosageDosageDoseAndRateComponent(JsonObject json, Dosage owner) throws IOException, FHIRFormatError {
608    Dosage.DosageDoseAndRateComponent res = new Dosage.DosageDoseAndRateComponent();
609    parseDosageDosageDoseAndRateComponentProperties(json, owner, res);
610    return res;
611  }
612
613  protected void parseDosageDosageDoseAndRateComponentProperties(JsonObject json, Dosage owner, Dosage.DosageDoseAndRateComponent res) throws IOException, FHIRFormatError {
614    parseTypeProperties(json, res);
615    if (json.has("type"))
616      res.setType(parseCodeableConcept(getJObject(json, "type")));
617    Type dose = parseType("dose", json);
618    if (dose != null)
619      res.setDose(dose);
620    Type rate = parseType("rate", json);
621    if (rate != null)
622      res.setRate(rate);
623  }
624
625  protected Money parseMoney(JsonObject json) throws IOException, FHIRFormatError {
626    Money res = new Money();
627    parseMoneyProperties(json, res);
628    return res;
629  }
630
631  protected void parseMoneyProperties(JsonObject json, Money res) throws IOException, FHIRFormatError {
632    parseTypeProperties(json, res);
633    if (json.has("value"))
634      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
635    if (json.has("_value"))
636      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
637    if (json.has("currency"))
638      res.setCurrencyElement(parseCode(json.get("currency").getAsString()));
639    if (json.has("_currency"))
640      parseElementProperties(getJObject(json, "_currency"), res.getCurrencyElement());
641  }
642
643  protected HumanName parseHumanName(JsonObject json) throws IOException, FHIRFormatError {
644    HumanName res = new HumanName();
645    parseHumanNameProperties(json, res);
646    return res;
647  }
648
649  protected void parseHumanNameProperties(JsonObject json, HumanName res) throws IOException, FHIRFormatError {
650    parseTypeProperties(json, res);
651    if (json.has("use"))
652      res.setUseElement(parseEnumeration(json.get("use").getAsString(), HumanName.NameUse.NULL, new HumanName.NameUseEnumFactory()));
653    if (json.has("_use"))
654      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
655    if (json.has("text"))
656      res.setTextElement(parseString(json.get("text").getAsString()));
657    if (json.has("_text"))
658      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
659    if (json.has("family"))
660      res.setFamilyElement(parseString(json.get("family").getAsString()));
661    if (json.has("_family"))
662      parseElementProperties(getJObject(json, "_family"), res.getFamilyElement());
663    if (json.has("given")) {
664      JsonArray array = json.getAsJsonArray("given");
665      for (int i = 0; i < array.size(); i++) {
666        res.getGiven().add(parseString(array.get(i).getAsString()));
667      }
668    };
669    if (json.has("_given")) {
670      JsonArray array = json.getAsJsonArray("_given");
671      for (int i = 0; i < array.size(); i++) {
672        if (i == res.getGiven().size())
673          res.getGiven().add(parseString(null));
674        if (array.get(i) instanceof JsonObject) 
675          parseElementProperties(array.get(i).getAsJsonObject(), res.getGiven().get(i));
676      }
677    };
678    if (json.has("prefix")) {
679      JsonArray array = json.getAsJsonArray("prefix");
680      for (int i = 0; i < array.size(); i++) {
681        res.getPrefix().add(parseString(array.get(i).getAsString()));
682      }
683    };
684    if (json.has("_prefix")) {
685      JsonArray array = json.getAsJsonArray("_prefix");
686      for (int i = 0; i < array.size(); i++) {
687        if (i == res.getPrefix().size())
688          res.getPrefix().add(parseString(null));
689        if (array.get(i) instanceof JsonObject) 
690          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrefix().get(i));
691      }
692    };
693    if (json.has("suffix")) {
694      JsonArray array = json.getAsJsonArray("suffix");
695      for (int i = 0; i < array.size(); i++) {
696        res.getSuffix().add(parseString(array.get(i).getAsString()));
697      }
698    };
699    if (json.has("_suffix")) {
700      JsonArray array = json.getAsJsonArray("_suffix");
701      for (int i = 0; i < array.size(); i++) {
702        if (i == res.getSuffix().size())
703          res.getSuffix().add(parseString(null));
704        if (array.get(i) instanceof JsonObject) 
705          parseElementProperties(array.get(i).getAsJsonObject(), res.getSuffix().get(i));
706      }
707    };
708    if (json.has("period"))
709      res.setPeriod(parsePeriod(getJObject(json, "period")));
710  }
711
712  protected ContactPoint parseContactPoint(JsonObject json) throws IOException, FHIRFormatError {
713    ContactPoint res = new ContactPoint();
714    parseContactPointProperties(json, res);
715    return res;
716  }
717
718  protected void parseContactPointProperties(JsonObject json, ContactPoint res) throws IOException, FHIRFormatError {
719    parseTypeProperties(json, res);
720    if (json.has("system"))
721      res.setSystemElement(parseEnumeration(json.get("system").getAsString(), ContactPoint.ContactPointSystem.NULL, new ContactPoint.ContactPointSystemEnumFactory()));
722    if (json.has("_system"))
723      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
724    if (json.has("value"))
725      res.setValueElement(parseString(json.get("value").getAsString()));
726    if (json.has("_value"))
727      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
728    if (json.has("use"))
729      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ContactPoint.ContactPointUse.NULL, new ContactPoint.ContactPointUseEnumFactory()));
730    if (json.has("_use"))
731      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
732    if (json.has("rank"))
733      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
734    if (json.has("_rank"))
735      parseElementProperties(getJObject(json, "_rank"), res.getRankElement());
736    if (json.has("period"))
737      res.setPeriod(parsePeriod(getJObject(json, "period")));
738  }
739
740  protected MarketingStatus parseMarketingStatus(JsonObject json) throws IOException, FHIRFormatError {
741    MarketingStatus res = new MarketingStatus();
742    parseMarketingStatusProperties(json, res);
743    return res;
744  }
745
746  protected void parseMarketingStatusProperties(JsonObject json, MarketingStatus res) throws IOException, FHIRFormatError {
747    parseBackboneElementProperties(json, res);
748    if (json.has("country"))
749      res.setCountry(parseCodeableConcept(getJObject(json, "country")));
750    if (json.has("jurisdiction"))
751      res.setJurisdiction(parseCodeableConcept(getJObject(json, "jurisdiction")));
752    if (json.has("status"))
753      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
754    if (json.has("dateRange"))
755      res.setDateRange(parsePeriod(getJObject(json, "dateRange")));
756    if (json.has("restoreDate"))
757      res.setRestoreDateElement(parseDateTime(json.get("restoreDate").getAsString()));
758    if (json.has("_restoreDate"))
759      parseElementProperties(getJObject(json, "_restoreDate"), res.getRestoreDateElement());
760  }
761
762  protected Identifier parseIdentifier(JsonObject json) throws IOException, FHIRFormatError {
763    Identifier res = new Identifier();
764    parseIdentifierProperties(json, res);
765    return res;
766  }
767
768  protected void parseIdentifierProperties(JsonObject json, Identifier res) throws IOException, FHIRFormatError {
769    parseTypeProperties(json, res);
770    if (json.has("use"))
771      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Identifier.IdentifierUse.NULL, new Identifier.IdentifierUseEnumFactory()));
772    if (json.has("_use"))
773      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
774    if (json.has("type"))
775      res.setType(parseCodeableConcept(getJObject(json, "type")));
776    if (json.has("system"))
777      res.setSystemElement(parseUri(json.get("system").getAsString()));
778    if (json.has("_system"))
779      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
780    if (json.has("value"))
781      res.setValueElement(parseString(json.get("value").getAsString()));
782    if (json.has("_value"))
783      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
784    if (json.has("period"))
785      res.setPeriod(parsePeriod(getJObject(json, "period")));
786    if (json.has("assigner"))
787      res.setAssigner(parseReference(getJObject(json, "assigner")));
788  }
789
790  protected SubstanceAmount parseSubstanceAmount(JsonObject json) throws IOException, FHIRFormatError {
791    SubstanceAmount res = new SubstanceAmount();
792    parseSubstanceAmountProperties(json, res);
793    return res;
794  }
795
796  protected void parseSubstanceAmountProperties(JsonObject json, SubstanceAmount res) throws IOException, FHIRFormatError {
797    parseBackboneElementProperties(json, res);
798    Type amount = parseType("amount", json);
799    if (amount != null)
800      res.setAmount(amount);
801    if (json.has("amountType"))
802      res.setAmountType(parseCodeableConcept(getJObject(json, "amountType")));
803    if (json.has("amountText"))
804      res.setAmountTextElement(parseString(json.get("amountText").getAsString()));
805    if (json.has("_amountText"))
806      parseElementProperties(getJObject(json, "_amountText"), res.getAmountTextElement());
807    if (json.has("referenceRange"))
808      res.setReferenceRange(parseSubstanceAmountSubstanceAmountReferenceRangeComponent(getJObject(json, "referenceRange"), res));
809  }
810
811  protected SubstanceAmount.SubstanceAmountReferenceRangeComponent parseSubstanceAmountSubstanceAmountReferenceRangeComponent(JsonObject json, SubstanceAmount owner) throws IOException, FHIRFormatError {
812    SubstanceAmount.SubstanceAmountReferenceRangeComponent res = new SubstanceAmount.SubstanceAmountReferenceRangeComponent();
813    parseSubstanceAmountSubstanceAmountReferenceRangeComponentProperties(json, owner, res);
814    return res;
815  }
816
817  protected void parseSubstanceAmountSubstanceAmountReferenceRangeComponentProperties(JsonObject json, SubstanceAmount owner, SubstanceAmount.SubstanceAmountReferenceRangeComponent res) throws IOException, FHIRFormatError {
818    parseTypeProperties(json, res);
819    if (json.has("lowLimit"))
820      res.setLowLimit(parseQuantity(getJObject(json, "lowLimit")));
821    if (json.has("highLimit"))
822      res.setHighLimit(parseQuantity(getJObject(json, "highLimit")));
823  }
824
825  protected Coding parseCoding(JsonObject json) throws IOException, FHIRFormatError {
826    Coding res = new Coding();
827    parseCodingProperties(json, res);
828    return res;
829  }
830
831  protected void parseCodingProperties(JsonObject json, Coding res) throws IOException, FHIRFormatError {
832    parseTypeProperties(json, res);
833    if (json.has("system"))
834      res.setSystemElement(parseUri(json.get("system").getAsString()));
835    if (json.has("_system"))
836      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
837    if (json.has("version"))
838      res.setVersionElement(parseString(json.get("version").getAsString()));
839    if (json.has("_version"))
840      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
841    if (json.has("code"))
842      res.setCodeElement(parseCode(json.get("code").getAsString()));
843    if (json.has("_code"))
844      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
845    if (json.has("display"))
846      res.setDisplayElement(parseString(json.get("display").getAsString()));
847    if (json.has("_display"))
848      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
849    if (json.has("userSelected"))
850      res.setUserSelectedElement(parseBoolean(json.get("userSelected").getAsBoolean()));
851    if (json.has("_userSelected"))
852      parseElementProperties(getJObject(json, "_userSelected"), res.getUserSelectedElement());
853  }
854
855  protected SampledData parseSampledData(JsonObject json) throws IOException, FHIRFormatError {
856    SampledData res = new SampledData();
857    parseSampledDataProperties(json, res);
858    return res;
859  }
860
861  protected void parseSampledDataProperties(JsonObject json, SampledData res) throws IOException, FHIRFormatError {
862    parseTypeProperties(json, res);
863    if (json.has("origin"))
864      res.setOrigin(parseQuantity(getJObject(json, "origin")));
865    if (json.has("period"))
866      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
867    if (json.has("_period"))
868      parseElementProperties(getJObject(json, "_period"), res.getPeriodElement());
869    if (json.has("factor"))
870      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
871    if (json.has("_factor"))
872      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
873    if (json.has("lowerLimit"))
874      res.setLowerLimitElement(parseDecimal(json.get("lowerLimit").getAsBigDecimal()));
875    if (json.has("_lowerLimit"))
876      parseElementProperties(getJObject(json, "_lowerLimit"), res.getLowerLimitElement());
877    if (json.has("upperLimit"))
878      res.setUpperLimitElement(parseDecimal(json.get("upperLimit").getAsBigDecimal()));
879    if (json.has("_upperLimit"))
880      parseElementProperties(getJObject(json, "_upperLimit"), res.getUpperLimitElement());
881    if (json.has("dimensions"))
882      res.setDimensionsElement(parsePositiveInt(json.get("dimensions").getAsString()));
883    if (json.has("_dimensions"))
884      parseElementProperties(getJObject(json, "_dimensions"), res.getDimensionsElement());
885    if (json.has("data"))
886      res.setDataElement(parseString(json.get("data").getAsString()));
887    if (json.has("_data"))
888      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
889  }
890
891  protected Population parsePopulation(JsonObject json) throws IOException, FHIRFormatError {
892    Population res = new Population();
893    parsePopulationProperties(json, res);
894    return res;
895  }
896
897  protected void parsePopulationProperties(JsonObject json, Population res) throws IOException, FHIRFormatError {
898    parseBackboneElementProperties(json, res);
899    Type age = parseType("age", json);
900    if (age != null)
901      res.setAge(age);
902    if (json.has("gender"))
903      res.setGender(parseCodeableConcept(getJObject(json, "gender")));
904    if (json.has("race"))
905      res.setRace(parseCodeableConcept(getJObject(json, "race")));
906    if (json.has("physiologicalCondition"))
907      res.setPhysiologicalCondition(parseCodeableConcept(getJObject(json, "physiologicalCondition")));
908  }
909
910  protected Ratio parseRatio(JsonObject json) throws IOException, FHIRFormatError {
911    Ratio res = new Ratio();
912    parseRatioProperties(json, res);
913    return res;
914  }
915
916  protected void parseRatioProperties(JsonObject json, Ratio res) throws IOException, FHIRFormatError {
917    parseTypeProperties(json, res);
918    if (json.has("numerator"))
919      res.setNumerator(parseQuantity(getJObject(json, "numerator")));
920    if (json.has("denominator"))
921      res.setDenominator(parseQuantity(getJObject(json, "denominator")));
922  }
923
924  protected Distance parseDistance(JsonObject json) throws IOException, FHIRFormatError {
925    Distance res = new Distance();
926    parseDistanceProperties(json, res);
927    return res;
928  }
929
930  protected void parseDistanceProperties(JsonObject json, Distance res) throws IOException, FHIRFormatError {
931    parseQuantityProperties(json, res);
932  }
933
934  protected Age parseAge(JsonObject json) throws IOException, FHIRFormatError {
935    Age res = new Age();
936    parseAgeProperties(json, res);
937    return res;
938  }
939
940  protected void parseAgeProperties(JsonObject json, Age res) throws IOException, FHIRFormatError {
941    parseQuantityProperties(json, res);
942  }
943
944  protected Reference parseReference(JsonObject json) throws IOException, FHIRFormatError {
945    Reference res = new Reference();
946    parseReferenceProperties(json, res);
947    return res;
948  }
949
950  protected void parseReferenceProperties(JsonObject json, Reference res) throws IOException, FHIRFormatError {
951    parseTypeProperties(json, res);
952    if (json.has("reference"))
953      res.setReferenceElement(parseString(json.get("reference").getAsString()));
954    if (json.has("_reference"))
955      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
956    if (json.has("type"))
957      res.setTypeElement(parseUri(json.get("type").getAsString()));
958    if (json.has("_type"))
959      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
960    if (json.has("identifier"))
961      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
962    if (json.has("display"))
963      res.setDisplayElement(parseString(json.get("display").getAsString()));
964    if (json.has("_display"))
965      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
966  }
967
968  protected TriggerDefinition parseTriggerDefinition(JsonObject json) throws IOException, FHIRFormatError {
969    TriggerDefinition res = new TriggerDefinition();
970    parseTriggerDefinitionProperties(json, res);
971    return res;
972  }
973
974  protected void parseTriggerDefinitionProperties(JsonObject json, TriggerDefinition res) throws IOException, FHIRFormatError {
975    parseTypeProperties(json, res);
976    if (json.has("type"))
977      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TriggerDefinition.TriggerType.NULL, new TriggerDefinition.TriggerTypeEnumFactory()));
978    if (json.has("_type"))
979      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
980    if (json.has("name"))
981      res.setNameElement(parseString(json.get("name").getAsString()));
982    if (json.has("_name"))
983      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
984    Type timing = parseType("timing", json);
985    if (timing != null)
986      res.setTiming(timing);
987    if (json.has("data")) {
988      JsonArray array = json.getAsJsonArray("data");
989      for (int i = 0; i < array.size(); i++) {
990        res.getData().add(parseDataRequirement(array.get(i).getAsJsonObject()));
991      }
992    };
993    if (json.has("condition"))
994      res.setCondition(parseExpression(getJObject(json, "condition")));
995  }
996
997  protected Quantity parseQuantity(JsonObject json) throws IOException, FHIRFormatError {
998    Quantity res = new Quantity();
999    parseQuantityProperties(json, res);
1000    return res;
1001  }
1002
1003  protected void parseQuantityProperties(JsonObject json, Quantity res) throws IOException, FHIRFormatError {
1004    parseTypeProperties(json, res);
1005    if (json.has("value"))
1006      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
1007    if (json.has("_value"))
1008      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1009    if (json.has("comparator"))
1010      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
1011    if (json.has("_comparator"))
1012      parseElementProperties(getJObject(json, "_comparator"), res.getComparatorElement());
1013    if (json.has("unit"))
1014      res.setUnitElement(parseString(json.get("unit").getAsString()));
1015    if (json.has("_unit"))
1016      parseElementProperties(getJObject(json, "_unit"), res.getUnitElement());
1017    if (json.has("system"))
1018      res.setSystemElement(parseUri(json.get("system").getAsString()));
1019    if (json.has("_system"))
1020      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
1021    if (json.has("code"))
1022      res.setCodeElement(parseCode(json.get("code").getAsString()));
1023    if (json.has("_code"))
1024      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
1025  }
1026
1027  protected Period parsePeriod(JsonObject json) throws IOException, FHIRFormatError {
1028    Period res = new Period();
1029    parsePeriodProperties(json, res);
1030    return res;
1031  }
1032
1033  protected void parsePeriodProperties(JsonObject json, Period res) throws IOException, FHIRFormatError {
1034    parseTypeProperties(json, res);
1035    if (json.has("start"))
1036      res.setStartElement(parseDateTime(json.get("start").getAsString()));
1037    if (json.has("_start"))
1038      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
1039    if (json.has("end"))
1040      res.setEndElement(parseDateTime(json.get("end").getAsString()));
1041    if (json.has("_end"))
1042      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
1043  }
1044
1045  protected Duration parseDuration(JsonObject json) throws IOException, FHIRFormatError {
1046    Duration res = new Duration();
1047    parseDurationProperties(json, res);
1048    return res;
1049  }
1050
1051  protected void parseDurationProperties(JsonObject json, Duration res) throws IOException, FHIRFormatError {
1052    parseQuantityProperties(json, res);
1053  }
1054
1055  protected Range parseRange(JsonObject json) throws IOException, FHIRFormatError {
1056    Range res = new Range();
1057    parseRangeProperties(json, res);
1058    return res;
1059  }
1060
1061  protected void parseRangeProperties(JsonObject json, Range res) throws IOException, FHIRFormatError {
1062    parseTypeProperties(json, res);
1063    if (json.has("low"))
1064      res.setLow(parseQuantity(getJObject(json, "low")));
1065    if (json.has("high"))
1066      res.setHigh(parseQuantity(getJObject(json, "high")));
1067  }
1068
1069  protected RelatedArtifact parseRelatedArtifact(JsonObject json) throws IOException, FHIRFormatError {
1070    RelatedArtifact res = new RelatedArtifact();
1071    parseRelatedArtifactProperties(json, res);
1072    return res;
1073  }
1074
1075  protected void parseRelatedArtifactProperties(JsonObject json, RelatedArtifact res) throws IOException, FHIRFormatError {
1076    parseTypeProperties(json, res);
1077    if (json.has("type"))
1078      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), RelatedArtifact.RelatedArtifactType.NULL, new RelatedArtifact.RelatedArtifactTypeEnumFactory()));
1079    if (json.has("_type"))
1080      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1081    if (json.has("label"))
1082      res.setLabelElement(parseString(json.get("label").getAsString()));
1083    if (json.has("_label"))
1084      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
1085    if (json.has("display"))
1086      res.setDisplayElement(parseString(json.get("display").getAsString()));
1087    if (json.has("_display"))
1088      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
1089    if (json.has("citation"))
1090      res.setCitationElement(parseMarkdown(json.get("citation").getAsString()));
1091    if (json.has("_citation"))
1092      parseElementProperties(getJObject(json, "_citation"), res.getCitationElement());
1093    if (json.has("url"))
1094      res.setUrlElement(parseUrl(json.get("url").getAsString()));
1095    if (json.has("_url"))
1096      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
1097    if (json.has("document"))
1098      res.setDocument(parseAttachment(getJObject(json, "document")));
1099    if (json.has("resource"))
1100      res.setResourceElement(parseCanonical(json.get("resource").getAsString()));
1101    if (json.has("_resource"))
1102      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
1103  }
1104
1105  protected Annotation parseAnnotation(JsonObject json) throws IOException, FHIRFormatError {
1106    Annotation res = new Annotation();
1107    parseAnnotationProperties(json, res);
1108    return res;
1109  }
1110
1111  protected void parseAnnotationProperties(JsonObject json, Annotation res) throws IOException, FHIRFormatError {
1112    parseTypeProperties(json, res);
1113    Type author = parseType("author", json);
1114    if (author != null)
1115      res.setAuthor(author);
1116    if (json.has("time"))
1117      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
1118    if (json.has("_time"))
1119      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
1120    if (json.has("text"))
1121      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
1122    if (json.has("_text"))
1123      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
1124  }
1125
1126  protected ProductShelfLife parseProductShelfLife(JsonObject json) throws IOException, FHIRFormatError {
1127    ProductShelfLife res = new ProductShelfLife();
1128    parseProductShelfLifeProperties(json, res);
1129    return res;
1130  }
1131
1132  protected void parseProductShelfLifeProperties(JsonObject json, ProductShelfLife res) throws IOException, FHIRFormatError {
1133    parseBackboneElementProperties(json, res);
1134    if (json.has("identifier"))
1135      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
1136    if (json.has("type"))
1137      res.setType(parseCodeableConcept(getJObject(json, "type")));
1138    if (json.has("period"))
1139      res.setPeriod(parseQuantity(getJObject(json, "period")));
1140    if (json.has("specialPrecautionsForStorage")) {
1141      JsonArray array = json.getAsJsonArray("specialPrecautionsForStorage");
1142      for (int i = 0; i < array.size(); i++) {
1143        res.getSpecialPrecautionsForStorage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1144      }
1145    };
1146  }
1147
1148  protected ContactDetail parseContactDetail(JsonObject json) throws IOException, FHIRFormatError {
1149    ContactDetail res = new ContactDetail();
1150    parseContactDetailProperties(json, res);
1151    return res;
1152  }
1153
1154  protected void parseContactDetailProperties(JsonObject json, ContactDetail res) throws IOException, FHIRFormatError {
1155    parseTypeProperties(json, res);
1156    if (json.has("name"))
1157      res.setNameElement(parseString(json.get("name").getAsString()));
1158    if (json.has("_name"))
1159      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1160    if (json.has("telecom")) {
1161      JsonArray array = json.getAsJsonArray("telecom");
1162      for (int i = 0; i < array.size(); i++) {
1163        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
1164      }
1165    };
1166  }
1167
1168  protected UsageContext parseUsageContext(JsonObject json) throws IOException, FHIRFormatError {
1169    UsageContext res = new UsageContext();
1170    parseUsageContextProperties(json, res);
1171    return res;
1172  }
1173
1174  protected void parseUsageContextProperties(JsonObject json, UsageContext res) throws IOException, FHIRFormatError {
1175    parseTypeProperties(json, res);
1176    if (json.has("code"))
1177      res.setCode(parseCoding(getJObject(json, "code")));
1178    Type value = parseType("value", json);
1179    if (value != null)
1180      res.setValue(value);
1181  }
1182
1183  protected Expression parseExpression(JsonObject json) throws IOException, FHIRFormatError {
1184    Expression res = new Expression();
1185    parseExpressionProperties(json, res);
1186    return res;
1187  }
1188
1189  protected void parseExpressionProperties(JsonObject json, Expression res) throws IOException, FHIRFormatError {
1190    parseElementProperties(json, res);
1191    if (json.has("description"))
1192      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1193    if (json.has("_description"))
1194      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1195    if (json.has("name"))
1196      res.setNameElement(parseId(json.get("name").getAsString()));
1197    if (json.has("_name"))
1198      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1199    if (json.has("language"))
1200      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1201    if (json.has("_language"))
1202      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
1203    if (json.has("expression"))
1204      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1205    if (json.has("_expression"))
1206      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
1207    if (json.has("reference"))
1208      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
1209    if (json.has("_reference"))
1210      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
1211  }
1212
1213  protected Signature parseSignature(JsonObject json) throws IOException, FHIRFormatError {
1214    Signature res = new Signature();
1215    parseSignatureProperties(json, res);
1216    return res;
1217  }
1218
1219  protected void parseSignatureProperties(JsonObject json, Signature res) throws IOException, FHIRFormatError {
1220    parseTypeProperties(json, res);
1221    if (json.has("type")) {
1222      JsonArray array = json.getAsJsonArray("type");
1223      for (int i = 0; i < array.size(); i++) {
1224        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
1225      }
1226    };
1227    if (json.has("when"))
1228      res.setWhenElement(parseInstant(json.get("when").getAsString()));
1229    if (json.has("_when"))
1230      parseElementProperties(getJObject(json, "_when"), res.getWhenElement());
1231    if (json.has("who"))
1232      res.setWho(parseReference(getJObject(json, "who")));
1233    if (json.has("onBehalfOf"))
1234      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
1235    if (json.has("targetFormat"))
1236      res.setTargetFormatElement(parseCode(json.get("targetFormat").getAsString()));
1237    if (json.has("_targetFormat"))
1238      parseElementProperties(getJObject(json, "_targetFormat"), res.getTargetFormatElement());
1239    if (json.has("sigFormat"))
1240      res.setSigFormatElement(parseCode(json.get("sigFormat").getAsString()));
1241    if (json.has("_sigFormat"))
1242      parseElementProperties(getJObject(json, "_sigFormat"), res.getSigFormatElement());
1243    if (json.has("data"))
1244      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
1245    if (json.has("_data"))
1246      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
1247  }
1248
1249  protected Timing parseTiming(JsonObject json) throws IOException, FHIRFormatError {
1250    Timing res = new Timing();
1251    parseTimingProperties(json, res);
1252    return res;
1253  }
1254
1255  protected void parseTimingProperties(JsonObject json, Timing res) throws IOException, FHIRFormatError {
1256    parseBackboneElementProperties(json, res);
1257    if (json.has("event")) {
1258      JsonArray array = json.getAsJsonArray("event");
1259      for (int i = 0; i < array.size(); i++) {
1260        res.getEvent().add(parseDateTime(array.get(i).getAsString()));
1261      }
1262    };
1263    if (json.has("_event")) {
1264      JsonArray array = json.getAsJsonArray("_event");
1265      for (int i = 0; i < array.size(); i++) {
1266        if (i == res.getEvent().size())
1267          res.getEvent().add(parseDateTime(null));
1268        if (array.get(i) instanceof JsonObject) 
1269          parseElementProperties(array.get(i).getAsJsonObject(), res.getEvent().get(i));
1270      }
1271    };
1272    if (json.has("repeat"))
1273      res.setRepeat(parseTimingTimingRepeatComponent(getJObject(json, "repeat"), res));
1274    if (json.has("code"))
1275      res.setCode(parseCodeableConcept(getJObject(json, "code")));
1276  }
1277
1278  protected Timing.TimingRepeatComponent parseTimingTimingRepeatComponent(JsonObject json, Timing owner) throws IOException, FHIRFormatError {
1279    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
1280    parseTimingTimingRepeatComponentProperties(json, owner, res);
1281    return res;
1282  }
1283
1284  protected void parseTimingTimingRepeatComponentProperties(JsonObject json, Timing owner, Timing.TimingRepeatComponent res) throws IOException, FHIRFormatError {
1285    parseTypeProperties(json, res);
1286    Type bounds = parseType("bounds", json);
1287    if (bounds != null)
1288      res.setBounds(bounds);
1289    if (json.has("count"))
1290      res.setCountElement(parsePositiveInt(json.get("count").getAsString()));
1291    if (json.has("_count"))
1292      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
1293    if (json.has("countMax"))
1294      res.setCountMaxElement(parsePositiveInt(json.get("countMax").getAsString()));
1295    if (json.has("_countMax"))
1296      parseElementProperties(getJObject(json, "_countMax"), res.getCountMaxElement());
1297    if (json.has("duration"))
1298      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
1299    if (json.has("_duration"))
1300      parseElementProperties(getJObject(json, "_duration"), res.getDurationElement());
1301    if (json.has("durationMax"))
1302      res.setDurationMaxElement(parseDecimal(json.get("durationMax").getAsBigDecimal()));
1303    if (json.has("_durationMax"))
1304      parseElementProperties(getJObject(json, "_durationMax"), res.getDurationMaxElement());
1305    if (json.has("durationUnit"))
1306      res.setDurationUnitElement(parseEnumeration(json.get("durationUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1307    if (json.has("_durationUnit"))
1308      parseElementProperties(getJObject(json, "_durationUnit"), res.getDurationUnitElement());
1309    if (json.has("frequency"))
1310      res.setFrequencyElement(parsePositiveInt(json.get("frequency").getAsString()));
1311    if (json.has("_frequency"))
1312      parseElementProperties(getJObject(json, "_frequency"), res.getFrequencyElement());
1313    if (json.has("frequencyMax"))
1314      res.setFrequencyMaxElement(parsePositiveInt(json.get("frequencyMax").getAsString()));
1315    if (json.has("_frequencyMax"))
1316      parseElementProperties(getJObject(json, "_frequencyMax"), res.getFrequencyMaxElement());
1317    if (json.has("period"))
1318      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
1319    if (json.has("_period"))
1320      parseElementProperties(getJObject(json, "_period"), res.getPeriodElement());
1321    if (json.has("periodMax"))
1322      res.setPeriodMaxElement(parseDecimal(json.get("periodMax").getAsBigDecimal()));
1323    if (json.has("_periodMax"))
1324      parseElementProperties(getJObject(json, "_periodMax"), res.getPeriodMaxElement());
1325    if (json.has("periodUnit"))
1326      res.setPeriodUnitElement(parseEnumeration(json.get("periodUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1327    if (json.has("_periodUnit"))
1328      parseElementProperties(getJObject(json, "_periodUnit"), res.getPeriodUnitElement());
1329    if (json.has("dayOfWeek")) {
1330      JsonArray array = json.getAsJsonArray("dayOfWeek");
1331      for (int i = 0; i < array.size(); i++) {
1332        res.getDayOfWeek().add(parseEnumeration(array.get(i).getAsString(), Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1333      }
1334    };
1335    if (json.has("_dayOfWeek")) {
1336      JsonArray array = json.getAsJsonArray("_dayOfWeek");
1337      for (int i = 0; i < array.size(); i++) {
1338        if (i == res.getDayOfWeek().size())
1339          res.getDayOfWeek().add(parseEnumeration(null, Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1340        if (array.get(i) instanceof JsonObject) 
1341          parseElementProperties(array.get(i).getAsJsonObject(), res.getDayOfWeek().get(i));
1342      }
1343    };
1344    if (json.has("timeOfDay")) {
1345      JsonArray array = json.getAsJsonArray("timeOfDay");
1346      for (int i = 0; i < array.size(); i++) {
1347        res.getTimeOfDay().add(parseTime(array.get(i).getAsString()));
1348      }
1349    };
1350    if (json.has("_timeOfDay")) {
1351      JsonArray array = json.getAsJsonArray("_timeOfDay");
1352      for (int i = 0; i < array.size(); i++) {
1353        if (i == res.getTimeOfDay().size())
1354          res.getTimeOfDay().add(parseTime(null));
1355        if (array.get(i) instanceof JsonObject) 
1356          parseElementProperties(array.get(i).getAsJsonObject(), res.getTimeOfDay().get(i));
1357      }
1358    };
1359    if (json.has("when")) {
1360      JsonArray array = json.getAsJsonArray("when");
1361      for (int i = 0; i < array.size(); i++) {
1362        res.getWhen().add(parseEnumeration(array.get(i).getAsString(), Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1363      }
1364    };
1365    if (json.has("_when")) {
1366      JsonArray array = json.getAsJsonArray("_when");
1367      for (int i = 0; i < array.size(); i++) {
1368        if (i == res.getWhen().size())
1369          res.getWhen().add(parseEnumeration(null, Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1370        if (array.get(i) instanceof JsonObject) 
1371          parseElementProperties(array.get(i).getAsJsonObject(), res.getWhen().get(i));
1372      }
1373    };
1374    if (json.has("offset"))
1375      res.setOffsetElement(parseUnsignedInt(json.get("offset").getAsString()));
1376    if (json.has("_offset"))
1377      parseElementProperties(getJObject(json, "_offset"), res.getOffsetElement());
1378  }
1379
1380  protected ProdCharacteristic parseProdCharacteristic(JsonObject json) throws IOException, FHIRFormatError {
1381    ProdCharacteristic res = new ProdCharacteristic();
1382    parseProdCharacteristicProperties(json, res);
1383    return res;
1384  }
1385
1386  protected void parseProdCharacteristicProperties(JsonObject json, ProdCharacteristic res) throws IOException, FHIRFormatError {
1387    parseBackboneElementProperties(json, res);
1388    if (json.has("height"))
1389      res.setHeight(parseQuantity(getJObject(json, "height")));
1390    if (json.has("width"))
1391      res.setWidth(parseQuantity(getJObject(json, "width")));
1392    if (json.has("depth"))
1393      res.setDepth(parseQuantity(getJObject(json, "depth")));
1394    if (json.has("weight"))
1395      res.setWeight(parseQuantity(getJObject(json, "weight")));
1396    if (json.has("nominalVolume"))
1397      res.setNominalVolume(parseQuantity(getJObject(json, "nominalVolume")));
1398    if (json.has("externalDiameter"))
1399      res.setExternalDiameter(parseQuantity(getJObject(json, "externalDiameter")));
1400    if (json.has("shape"))
1401      res.setShapeElement(parseString(json.get("shape").getAsString()));
1402    if (json.has("_shape"))
1403      parseElementProperties(getJObject(json, "_shape"), res.getShapeElement());
1404    if (json.has("color")) {
1405      JsonArray array = json.getAsJsonArray("color");
1406      for (int i = 0; i < array.size(); i++) {
1407        res.getColor().add(parseString(array.get(i).getAsString()));
1408      }
1409    };
1410    if (json.has("_color")) {
1411      JsonArray array = json.getAsJsonArray("_color");
1412      for (int i = 0; i < array.size(); i++) {
1413        if (i == res.getColor().size())
1414          res.getColor().add(parseString(null));
1415        if (array.get(i) instanceof JsonObject) 
1416          parseElementProperties(array.get(i).getAsJsonObject(), res.getColor().get(i));
1417      }
1418    };
1419    if (json.has("imprint")) {
1420      JsonArray array = json.getAsJsonArray("imprint");
1421      for (int i = 0; i < array.size(); i++) {
1422        res.getImprint().add(parseString(array.get(i).getAsString()));
1423      }
1424    };
1425    if (json.has("_imprint")) {
1426      JsonArray array = json.getAsJsonArray("_imprint");
1427      for (int i = 0; i < array.size(); i++) {
1428        if (i == res.getImprint().size())
1429          res.getImprint().add(parseString(null));
1430        if (array.get(i) instanceof JsonObject) 
1431          parseElementProperties(array.get(i).getAsJsonObject(), res.getImprint().get(i));
1432      }
1433    };
1434    if (json.has("image")) {
1435      JsonArray array = json.getAsJsonArray("image");
1436      for (int i = 0; i < array.size(); i++) {
1437        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
1438      }
1439    };
1440    if (json.has("scoring"))
1441      res.setScoring(parseCodeableConcept(getJObject(json, "scoring")));
1442  }
1443
1444  protected CodeableConcept parseCodeableConcept(JsonObject json) throws IOException, FHIRFormatError {
1445    CodeableConcept res = new CodeableConcept();
1446    parseCodeableConceptProperties(json, res);
1447    return res;
1448  }
1449
1450  protected void parseCodeableConceptProperties(JsonObject json, CodeableConcept res) throws IOException, FHIRFormatError {
1451    parseTypeProperties(json, res);
1452    if (json.has("coding")) {
1453      JsonArray array = json.getAsJsonArray("coding");
1454      for (int i = 0; i < array.size(); i++) {
1455        res.getCoding().add(parseCoding(array.get(i).getAsJsonObject()));
1456      }
1457    };
1458    if (json.has("text"))
1459      res.setTextElement(parseString(json.get("text").getAsString()));
1460    if (json.has("_text"))
1461      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
1462  }
1463
1464  protected ParameterDefinition parseParameterDefinition(JsonObject json) throws IOException, FHIRFormatError {
1465    ParameterDefinition res = new ParameterDefinition();
1466    parseParameterDefinitionProperties(json, res);
1467    return res;
1468  }
1469
1470  protected void parseParameterDefinitionProperties(JsonObject json, ParameterDefinition res) throws IOException, FHIRFormatError {
1471    parseTypeProperties(json, res);
1472    if (json.has("name"))
1473      res.setNameElement(parseCode(json.get("name").getAsString()));
1474    if (json.has("_name"))
1475      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1476    if (json.has("use"))
1477      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ParameterDefinition.ParameterUse.NULL, new ParameterDefinition.ParameterUseEnumFactory()));
1478    if (json.has("_use"))
1479      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
1480    if (json.has("min"))
1481      res.setMinElement(parseInteger(json.get("min").getAsLong()));
1482    if (json.has("_min"))
1483      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1484    if (json.has("max"))
1485      res.setMaxElement(parseString(json.get("max").getAsString()));
1486    if (json.has("_max"))
1487      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1488    if (json.has("documentation"))
1489      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
1490    if (json.has("_documentation"))
1491      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
1492    if (json.has("type"))
1493      res.setTypeElement(parseCode(json.get("type").getAsString()));
1494    if (json.has("_type"))
1495      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1496    if (json.has("profile"))
1497      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
1498    if (json.has("_profile"))
1499      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
1500  }
1501
1502  protected ElementDefinition parseElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
1503    ElementDefinition res = new ElementDefinition();
1504    parseElementDefinitionProperties(json, res);
1505    return res;
1506  }
1507
1508  protected void parseElementDefinitionProperties(JsonObject json, ElementDefinition res) throws IOException, FHIRFormatError {
1509    parseBackboneElementProperties(json, res);
1510    if (json.has("path"))
1511      res.setPathElement(parseString(json.get("path").getAsString()));
1512    if (json.has("_path"))
1513      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
1514    if (json.has("representation")) {
1515      JsonArray array = json.getAsJsonArray("representation");
1516      for (int i = 0; i < array.size(); i++) {
1517        res.getRepresentation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1518      }
1519    };
1520    if (json.has("_representation")) {
1521      JsonArray array = json.getAsJsonArray("_representation");
1522      for (int i = 0; i < array.size(); i++) {
1523        if (i == res.getRepresentation().size())
1524          res.getRepresentation().add(parseEnumeration(null, ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1525        if (array.get(i) instanceof JsonObject) 
1526          parseElementProperties(array.get(i).getAsJsonObject(), res.getRepresentation().get(i));
1527      }
1528    };
1529    if (json.has("sliceName"))
1530      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
1531    if (json.has("_sliceName"))
1532      parseElementProperties(getJObject(json, "_sliceName"), res.getSliceNameElement());
1533    if (json.has("sliceIsConstraining"))
1534      res.setSliceIsConstrainingElement(parseBoolean(json.get("sliceIsConstraining").getAsBoolean()));
1535    if (json.has("_sliceIsConstraining"))
1536      parseElementProperties(getJObject(json, "_sliceIsConstraining"), res.getSliceIsConstrainingElement());
1537    if (json.has("label"))
1538      res.setLabelElement(parseString(json.get("label").getAsString()));
1539    if (json.has("_label"))
1540      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
1541    if (json.has("code")) {
1542      JsonArray array = json.getAsJsonArray("code");
1543      for (int i = 0; i < array.size(); i++) {
1544        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
1545      }
1546    };
1547    if (json.has("slicing"))
1548      res.setSlicing(parseElementDefinitionElementDefinitionSlicingComponent(getJObject(json, "slicing"), res));
1549    if (json.has("short"))
1550      res.setShortElement(parseString(json.get("short").getAsString()));
1551    if (json.has("_short"))
1552      parseElementProperties(getJObject(json, "_short"), res.getShortElement());
1553    if (json.has("definition"))
1554      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
1555    if (json.has("_definition"))
1556      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
1557    if (json.has("comment"))
1558      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
1559    if (json.has("_comment"))
1560      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
1561    if (json.has("requirements"))
1562      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
1563    if (json.has("_requirements"))
1564      parseElementProperties(getJObject(json, "_requirements"), res.getRequirementsElement());
1565    if (json.has("alias")) {
1566      JsonArray array = json.getAsJsonArray("alias");
1567      for (int i = 0; i < array.size(); i++) {
1568        res.getAlias().add(parseString(array.get(i).getAsString()));
1569      }
1570    };
1571    if (json.has("_alias")) {
1572      JsonArray array = json.getAsJsonArray("_alias");
1573      for (int i = 0; i < array.size(); i++) {
1574        if (i == res.getAlias().size())
1575          res.getAlias().add(parseString(null));
1576        if (array.get(i) instanceof JsonObject) 
1577          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
1578      }
1579    };
1580    if (json.has("min"))
1581      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1582    if (json.has("_min"))
1583      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1584    if (json.has("max"))
1585      res.setMaxElement(parseString(json.get("max").getAsString()));
1586    if (json.has("_max"))
1587      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1588    if (json.has("base"))
1589      res.setBase(parseElementDefinitionElementDefinitionBaseComponent(getJObject(json, "base"), res));
1590    if (json.has("contentReference"))
1591      res.setContentReferenceElement(parseUri(json.get("contentReference").getAsString()));
1592    if (json.has("_contentReference"))
1593      parseElementProperties(getJObject(json, "_contentReference"), res.getContentReferenceElement());
1594    if (json.has("type")) {
1595      JsonArray array = json.getAsJsonArray("type");
1596      for (int i = 0; i < array.size(); i++) {
1597        res.getType().add(parseElementDefinitionTypeRefComponent(array.get(i).getAsJsonObject(), res));
1598      }
1599    };
1600    Type defaultValue = parseType("defaultValue", json);
1601    if (defaultValue != null)
1602      res.setDefaultValue(defaultValue);
1603    if (json.has("meaningWhenMissing"))
1604      res.setMeaningWhenMissingElement(parseMarkdown(json.get("meaningWhenMissing").getAsString()));
1605    if (json.has("_meaningWhenMissing"))
1606      parseElementProperties(getJObject(json, "_meaningWhenMissing"), res.getMeaningWhenMissingElement());
1607    if (json.has("orderMeaning"))
1608      res.setOrderMeaningElement(parseString(json.get("orderMeaning").getAsString()));
1609    if (json.has("_orderMeaning"))
1610      parseElementProperties(getJObject(json, "_orderMeaning"), res.getOrderMeaningElement());
1611    Type fixed = parseType("fixed", json);
1612    if (fixed != null)
1613      res.setFixed(fixed);
1614    Type pattern = parseType("pattern", json);
1615    if (pattern != null)
1616      res.setPattern(pattern);
1617    if (json.has("example")) {
1618      JsonArray array = json.getAsJsonArray("example");
1619      for (int i = 0; i < array.size(); i++) {
1620        res.getExample().add(parseElementDefinitionElementDefinitionExampleComponent(array.get(i).getAsJsonObject(), res));
1621      }
1622    };
1623    Type minValue = parseType("minValue", json);
1624    if (minValue != null)
1625      res.setMinValue(minValue);
1626    Type maxValue = parseType("maxValue", json);
1627    if (maxValue != null)
1628      res.setMaxValue(maxValue);
1629    if (json.has("maxLength"))
1630      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
1631    if (json.has("_maxLength"))
1632      parseElementProperties(getJObject(json, "_maxLength"), res.getMaxLengthElement());
1633    if (json.has("condition")) {
1634      JsonArray array = json.getAsJsonArray("condition");
1635      for (int i = 0; i < array.size(); i++) {
1636        res.getCondition().add(parseId(array.get(i).getAsString()));
1637      }
1638    };
1639    if (json.has("_condition")) {
1640      JsonArray array = json.getAsJsonArray("_condition");
1641      for (int i = 0; i < array.size(); i++) {
1642        if (i == res.getCondition().size())
1643          res.getCondition().add(parseId(null));
1644        if (array.get(i) instanceof JsonObject) 
1645          parseElementProperties(array.get(i).getAsJsonObject(), res.getCondition().get(i));
1646      }
1647    };
1648    if (json.has("constraint")) {
1649      JsonArray array = json.getAsJsonArray("constraint");
1650      for (int i = 0; i < array.size(); i++) {
1651        res.getConstraint().add(parseElementDefinitionElementDefinitionConstraintComponent(array.get(i).getAsJsonObject(), res));
1652      }
1653    };
1654    if (json.has("mustSupport"))
1655      res.setMustSupportElement(parseBoolean(json.get("mustSupport").getAsBoolean()));
1656    if (json.has("_mustSupport"))
1657      parseElementProperties(getJObject(json, "_mustSupport"), res.getMustSupportElement());
1658    if (json.has("isModifier"))
1659      res.setIsModifierElement(parseBoolean(json.get("isModifier").getAsBoolean()));
1660    if (json.has("_isModifier"))
1661      parseElementProperties(getJObject(json, "_isModifier"), res.getIsModifierElement());
1662    if (json.has("isModifierReason"))
1663      res.setIsModifierReasonElement(parseString(json.get("isModifierReason").getAsString()));
1664    if (json.has("_isModifierReason"))
1665      parseElementProperties(getJObject(json, "_isModifierReason"), res.getIsModifierReasonElement());
1666    if (json.has("isSummary"))
1667      res.setIsSummaryElement(parseBoolean(json.get("isSummary").getAsBoolean()));
1668    if (json.has("_isSummary"))
1669      parseElementProperties(getJObject(json, "_isSummary"), res.getIsSummaryElement());
1670    if (json.has("binding"))
1671      res.setBinding(parseElementDefinitionElementDefinitionBindingComponent(getJObject(json, "binding"), res));
1672    if (json.has("mapping")) {
1673      JsonArray array = json.getAsJsonArray("mapping");
1674      for (int i = 0; i < array.size(); i++) {
1675        res.getMapping().add(parseElementDefinitionElementDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
1676      }
1677    };
1678  }
1679
1680  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionElementDefinitionSlicingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1681    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
1682    parseElementDefinitionElementDefinitionSlicingComponentProperties(json, owner, res);
1683    return res;
1684  }
1685
1686  protected void parseElementDefinitionElementDefinitionSlicingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingComponent res) throws IOException, FHIRFormatError {
1687    parseTypeProperties(json, res);
1688    if (json.has("discriminator")) {
1689      JsonArray array = json.getAsJsonArray("discriminator");
1690      for (int i = 0; i < array.size(); i++) {
1691        res.getDiscriminator().add(parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(array.get(i).getAsJsonObject(), owner));
1692      }
1693    };
1694    if (json.has("description"))
1695      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1696    if (json.has("_description"))
1697      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1698    if (json.has("ordered"))
1699      res.setOrderedElement(parseBoolean(json.get("ordered").getAsBoolean()));
1700    if (json.has("_ordered"))
1701      parseElementProperties(getJObject(json, "_ordered"), res.getOrderedElement());
1702    if (json.has("rules"))
1703      res.setRulesElement(parseEnumeration(json.get("rules").getAsString(), ElementDefinition.SlicingRules.NULL, new ElementDefinition.SlicingRulesEnumFactory()));
1704    if (json.has("_rules"))
1705      parseElementProperties(getJObject(json, "_rules"), res.getRulesElement());
1706  }
1707
1708  protected ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1709    ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res = new ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent();
1710    parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(json, owner, res);
1711    return res;
1712  }
1713
1714  protected void parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res) throws IOException, FHIRFormatError {
1715    parseTypeProperties(json, res);
1716    if (json.has("type"))
1717      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ElementDefinition.DiscriminatorType.NULL, new ElementDefinition.DiscriminatorTypeEnumFactory()));
1718    if (json.has("_type"))
1719      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1720    if (json.has("path"))
1721      res.setPathElement(parseString(json.get("path").getAsString()));
1722    if (json.has("_path"))
1723      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
1724  }
1725
1726  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionElementDefinitionBaseComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1727    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
1728    parseElementDefinitionElementDefinitionBaseComponentProperties(json, owner, res);
1729    return res;
1730  }
1731
1732  protected void parseElementDefinitionElementDefinitionBaseComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBaseComponent res) throws IOException, FHIRFormatError {
1733    parseTypeProperties(json, res);
1734    if (json.has("path"))
1735      res.setPathElement(parseString(json.get("path").getAsString()));
1736    if (json.has("_path"))
1737      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
1738    if (json.has("min"))
1739      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1740    if (json.has("_min"))
1741      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1742    if (json.has("max"))
1743      res.setMaxElement(parseString(json.get("max").getAsString()));
1744    if (json.has("_max"))
1745      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1746  }
1747
1748  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1749    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
1750    parseElementDefinitionTypeRefComponentProperties(json, owner, res);
1751    return res;
1752  }
1753
1754  protected void parseElementDefinitionTypeRefComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.TypeRefComponent res) throws IOException, FHIRFormatError {
1755    parseTypeProperties(json, res);
1756    if (json.has("code"))
1757      res.setCodeElement(parseUri(json.get("code").getAsString()));
1758    if (json.has("_code"))
1759      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
1760    if (json.has("profile")) {
1761      JsonArray array = json.getAsJsonArray("profile");
1762      for (int i = 0; i < array.size(); i++) {
1763        res.getProfile().add(parseCanonical(array.get(i).getAsString()));
1764      }
1765    };
1766    if (json.has("_profile")) {
1767      JsonArray array = json.getAsJsonArray("_profile");
1768      for (int i = 0; i < array.size(); i++) {
1769        if (i == res.getProfile().size())
1770          res.getProfile().add(parseCanonical(null));
1771        if (array.get(i) instanceof JsonObject) 
1772          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
1773      }
1774    };
1775    if (json.has("targetProfile")) {
1776      JsonArray array = json.getAsJsonArray("targetProfile");
1777      for (int i = 0; i < array.size(); i++) {
1778        res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
1779      }
1780    };
1781    if (json.has("_targetProfile")) {
1782      JsonArray array = json.getAsJsonArray("_targetProfile");
1783      for (int i = 0; i < array.size(); i++) {
1784        if (i == res.getTargetProfile().size())
1785          res.getTargetProfile().add(parseCanonical(null));
1786        if (array.get(i) instanceof JsonObject) 
1787          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
1788      }
1789    };
1790    if (json.has("aggregation")) {
1791      JsonArray array = json.getAsJsonArray("aggregation");
1792      for (int i = 0; i < array.size(); i++) {
1793        res.getAggregation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1794      }
1795    };
1796    if (json.has("_aggregation")) {
1797      JsonArray array = json.getAsJsonArray("_aggregation");
1798      for (int i = 0; i < array.size(); i++) {
1799        if (i == res.getAggregation().size())
1800          res.getAggregation().add(parseEnumeration(null, ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1801        if (array.get(i) instanceof JsonObject) 
1802          parseElementProperties(array.get(i).getAsJsonObject(), res.getAggregation().get(i));
1803      }
1804    };
1805    if (json.has("versioning"))
1806      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), ElementDefinition.ReferenceVersionRules.NULL, new ElementDefinition.ReferenceVersionRulesEnumFactory()));
1807    if (json.has("_versioning"))
1808      parseElementProperties(getJObject(json, "_versioning"), res.getVersioningElement());
1809  }
1810
1811  protected ElementDefinition.ElementDefinitionExampleComponent parseElementDefinitionElementDefinitionExampleComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1812    ElementDefinition.ElementDefinitionExampleComponent res = new ElementDefinition.ElementDefinitionExampleComponent();
1813    parseElementDefinitionElementDefinitionExampleComponentProperties(json, owner, res);
1814    return res;
1815  }
1816
1817  protected void parseElementDefinitionElementDefinitionExampleComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionExampleComponent res) throws IOException, FHIRFormatError {
1818    parseTypeProperties(json, res);
1819    if (json.has("label"))
1820      res.setLabelElement(parseString(json.get("label").getAsString()));
1821    if (json.has("_label"))
1822      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
1823    Type value = parseType("value", json);
1824    if (value != null)
1825      res.setValue(value);
1826  }
1827
1828  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionElementDefinitionConstraintComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1829    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
1830    parseElementDefinitionElementDefinitionConstraintComponentProperties(json, owner, res);
1831    return res;
1832  }
1833
1834  protected void parseElementDefinitionElementDefinitionConstraintComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionConstraintComponent res) throws IOException, FHIRFormatError {
1835    parseTypeProperties(json, res);
1836    if (json.has("key"))
1837      res.setKeyElement(parseId(json.get("key").getAsString()));
1838    if (json.has("_key"))
1839      parseElementProperties(getJObject(json, "_key"), res.getKeyElement());
1840    if (json.has("requirements"))
1841      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
1842    if (json.has("_requirements"))
1843      parseElementProperties(getJObject(json, "_requirements"), res.getRequirementsElement());
1844    if (json.has("severity"))
1845      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
1846    if (json.has("_severity"))
1847      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
1848    if (json.has("human"))
1849      res.setHumanElement(parseString(json.get("human").getAsString()));
1850    if (json.has("_human"))
1851      parseElementProperties(getJObject(json, "_human"), res.getHumanElement());
1852    if (json.has("expression"))
1853      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1854    if (json.has("_expression"))
1855      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
1856    if (json.has("xpath"))
1857      res.setXpathElement(parseString(json.get("xpath").getAsString()));
1858    if (json.has("_xpath"))
1859      parseElementProperties(getJObject(json, "_xpath"), res.getXpathElement());
1860    if (json.has("source"))
1861      res.setSourceElement(parseCanonical(json.get("source").getAsString()));
1862    if (json.has("_source"))
1863      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
1864  }
1865
1866  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionElementDefinitionBindingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1867    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
1868    parseElementDefinitionElementDefinitionBindingComponentProperties(json, owner, res);
1869    return res;
1870  }
1871
1872  protected void parseElementDefinitionElementDefinitionBindingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBindingComponent res) throws IOException, FHIRFormatError {
1873    parseTypeProperties(json, res);
1874    if (json.has("strength"))
1875      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
1876    if (json.has("_strength"))
1877      parseElementProperties(getJObject(json, "_strength"), res.getStrengthElement());
1878    if (json.has("description"))
1879      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1880    if (json.has("_description"))
1881      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1882    if (json.has("valueSet"))
1883      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
1884    if (json.has("_valueSet"))
1885      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
1886  }
1887
1888  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionElementDefinitionMappingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1889    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
1890    parseElementDefinitionElementDefinitionMappingComponentProperties(json, owner, res);
1891    return res;
1892  }
1893
1894  protected void parseElementDefinitionElementDefinitionMappingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionMappingComponent res) throws IOException, FHIRFormatError {
1895    parseTypeProperties(json, res);
1896    if (json.has("identity"))
1897      res.setIdentityElement(parseId(json.get("identity").getAsString()));
1898    if (json.has("_identity"))
1899      parseElementProperties(getJObject(json, "_identity"), res.getIdentityElement());
1900    if (json.has("language"))
1901      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1902    if (json.has("_language"))
1903      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
1904    if (json.has("map"))
1905      res.setMapElement(parseString(json.get("map").getAsString()));
1906    if (json.has("_map"))
1907      parseElementProperties(getJObject(json, "_map"), res.getMapElement());
1908    if (json.has("comment"))
1909      res.setCommentElement(parseString(json.get("comment").getAsString()));
1910    if (json.has("_comment"))
1911      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
1912  }
1913
1914  protected void parseDomainResourceProperties(JsonObject json, DomainResource res) throws IOException, FHIRFormatError {
1915    parseResourceProperties(json, res);
1916    if (json.has("text"))
1917      res.setText(parseNarrative(getJObject(json, "text")));
1918    if (json.has("contained")) {
1919      JsonArray array = json.getAsJsonArray("contained");
1920      for (int i = 0; i < array.size(); i++) {
1921        res.getContained().add(parseResource(array.get(i).getAsJsonObject()));
1922      }
1923    };
1924    if (json.has("extension")) {
1925      JsonArray array = json.getAsJsonArray("extension");
1926      for (int i = 0; i < array.size(); i++) {
1927        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1928      }
1929    };
1930    if (json.has("modifierExtension")) {
1931      JsonArray array = json.getAsJsonArray("modifierExtension");
1932      for (int i = 0; i < array.size(); i++) {
1933        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1934      }
1935    };
1936  }
1937
1938  protected Parameters parseParameters(JsonObject json) throws IOException, FHIRFormatError {
1939    Parameters res = new Parameters();
1940    parseParametersProperties(json, res);
1941    return res;
1942  }
1943
1944  protected void parseParametersProperties(JsonObject json, Parameters res) throws IOException, FHIRFormatError {
1945    parseResourceProperties(json, res);
1946    if (json.has("parameter")) {
1947      JsonArray array = json.getAsJsonArray("parameter");
1948      for (int i = 0; i < array.size(); i++) {
1949        res.getParameter().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), res));
1950      }
1951    };
1952  }
1953
1954  protected Parameters.ParametersParameterComponent parseParametersParametersParameterComponent(JsonObject json, Parameters owner) throws IOException, FHIRFormatError {
1955    Parameters.ParametersParameterComponent res = new Parameters.ParametersParameterComponent();
1956    parseParametersParametersParameterComponentProperties(json, owner, res);
1957    return res;
1958  }
1959
1960  protected void parseParametersParametersParameterComponentProperties(JsonObject json, Parameters owner, Parameters.ParametersParameterComponent res) throws IOException, FHIRFormatError {
1961    parseBackboneElementProperties(json, res);
1962    if (json.has("name"))
1963      res.setNameElement(parseString(json.get("name").getAsString()));
1964    if (json.has("_name"))
1965      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1966    Type value = parseType("value", json);
1967    if (value != null)
1968      res.setValue(value);
1969    if (json.has("resource"))
1970      res.setResource(parseResource(getJObject(json, "resource")));
1971    if (json.has("part")) {
1972      JsonArray array = json.getAsJsonArray("part");
1973      for (int i = 0; i < array.size(); i++) {
1974        res.getPart().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), owner));
1975      }
1976    };
1977  }
1978
1979  protected void parseResourceProperties(JsonObject json, Resource res) throws IOException, FHIRFormatError {
1980    if (json.has("id"))
1981      res.setIdElement(parseId(json.get("id").getAsString()));
1982    if (json.has("_id"))
1983      parseElementProperties(getJObject(json, "_id"), res.getIdElement());
1984    if (json.has("meta"))
1985      res.setMeta(parseMeta(getJObject(json, "meta")));
1986    if (json.has("implicitRules"))
1987      res.setImplicitRulesElement(parseUri(json.get("implicitRules").getAsString()));
1988    if (json.has("_implicitRules"))
1989      parseElementProperties(getJObject(json, "_implicitRules"), res.getImplicitRulesElement());
1990    if (json.has("language"))
1991      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1992    if (json.has("_language"))
1993      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
1994  }
1995
1996  protected Account parseAccount(JsonObject json) throws IOException, FHIRFormatError {
1997    Account res = new Account();
1998    parseAccountProperties(json, res);
1999    return res;
2000  }
2001
2002  protected void parseAccountProperties(JsonObject json, Account res) throws IOException, FHIRFormatError {
2003    parseDomainResourceProperties(json, res);
2004    if (json.has("identifier")) {
2005      JsonArray array = json.getAsJsonArray("identifier");
2006      for (int i = 0; i < array.size(); i++) {
2007        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2008      }
2009    };
2010    if (json.has("status"))
2011      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Account.AccountStatus.NULL, new Account.AccountStatusEnumFactory()));
2012    if (json.has("_status"))
2013      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2014    if (json.has("type"))
2015      res.setType(parseCodeableConcept(getJObject(json, "type")));
2016    if (json.has("name"))
2017      res.setNameElement(parseString(json.get("name").getAsString()));
2018    if (json.has("_name"))
2019      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2020    if (json.has("subject")) {
2021      JsonArray array = json.getAsJsonArray("subject");
2022      for (int i = 0; i < array.size(); i++) {
2023        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
2024      }
2025    };
2026    if (json.has("servicePeriod"))
2027      res.setServicePeriod(parsePeriod(getJObject(json, "servicePeriod")));
2028    if (json.has("coverage")) {
2029      JsonArray array = json.getAsJsonArray("coverage");
2030      for (int i = 0; i < array.size(); i++) {
2031        res.getCoverage().add(parseAccountCoverageComponent(array.get(i).getAsJsonObject(), res));
2032      }
2033    };
2034    if (json.has("owner"))
2035      res.setOwner(parseReference(getJObject(json, "owner")));
2036    if (json.has("description"))
2037      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2038    if (json.has("_description"))
2039      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2040    if (json.has("guarantor")) {
2041      JsonArray array = json.getAsJsonArray("guarantor");
2042      for (int i = 0; i < array.size(); i++) {
2043        res.getGuarantor().add(parseAccountGuarantorComponent(array.get(i).getAsJsonObject(), res));
2044      }
2045    };
2046    if (json.has("partOf"))
2047      res.setPartOf(parseReference(getJObject(json, "partOf")));
2048  }
2049
2050  protected Account.CoverageComponent parseAccountCoverageComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
2051    Account.CoverageComponent res = new Account.CoverageComponent();
2052    parseAccountCoverageComponentProperties(json, owner, res);
2053    return res;
2054  }
2055
2056  protected void parseAccountCoverageComponentProperties(JsonObject json, Account owner, Account.CoverageComponent res) throws IOException, FHIRFormatError {
2057    parseBackboneElementProperties(json, res);
2058    if (json.has("coverage"))
2059      res.setCoverage(parseReference(getJObject(json, "coverage")));
2060    if (json.has("priority"))
2061      res.setPriorityElement(parsePositiveInt(json.get("priority").getAsString()));
2062    if (json.has("_priority"))
2063      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
2064  }
2065
2066  protected Account.GuarantorComponent parseAccountGuarantorComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
2067    Account.GuarantorComponent res = new Account.GuarantorComponent();
2068    parseAccountGuarantorComponentProperties(json, owner, res);
2069    return res;
2070  }
2071
2072  protected void parseAccountGuarantorComponentProperties(JsonObject json, Account owner, Account.GuarantorComponent res) throws IOException, FHIRFormatError {
2073    parseBackboneElementProperties(json, res);
2074    if (json.has("party"))
2075      res.setParty(parseReference(getJObject(json, "party")));
2076    if (json.has("onHold"))
2077      res.setOnHoldElement(parseBoolean(json.get("onHold").getAsBoolean()));
2078    if (json.has("_onHold"))
2079      parseElementProperties(getJObject(json, "_onHold"), res.getOnHoldElement());
2080    if (json.has("period"))
2081      res.setPeriod(parsePeriod(getJObject(json, "period")));
2082  }
2083
2084  protected ActivityDefinition parseActivityDefinition(JsonObject json) throws IOException, FHIRFormatError {
2085    ActivityDefinition res = new ActivityDefinition();
2086    parseActivityDefinitionProperties(json, res);
2087    return res;
2088  }
2089
2090  protected void parseActivityDefinitionProperties(JsonObject json, ActivityDefinition res) throws IOException, FHIRFormatError {
2091    parseDomainResourceProperties(json, res);
2092    if (json.has("url"))
2093      res.setUrlElement(parseUri(json.get("url").getAsString()));
2094    if (json.has("_url"))
2095      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
2096    if (json.has("identifier")) {
2097      JsonArray array = json.getAsJsonArray("identifier");
2098      for (int i = 0; i < array.size(); i++) {
2099        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2100      }
2101    };
2102    if (json.has("version"))
2103      res.setVersionElement(parseString(json.get("version").getAsString()));
2104    if (json.has("_version"))
2105      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
2106    if (json.has("name"))
2107      res.setNameElement(parseString(json.get("name").getAsString()));
2108    if (json.has("_name"))
2109      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2110    if (json.has("title"))
2111      res.setTitleElement(parseString(json.get("title").getAsString()));
2112    if (json.has("_title"))
2113      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
2114    if (json.has("subtitle"))
2115      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
2116    if (json.has("_subtitle"))
2117      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
2118    if (json.has("status"))
2119      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2120    if (json.has("_status"))
2121      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2122    if (json.has("experimental"))
2123      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
2124    if (json.has("_experimental"))
2125      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
2126    Type subject = parseType("subject", json);
2127    if (subject != null)
2128      res.setSubject(subject);
2129    if (json.has("date"))
2130      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2131    if (json.has("_date"))
2132      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
2133    if (json.has("publisher"))
2134      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
2135    if (json.has("_publisher"))
2136      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
2137    if (json.has("contact")) {
2138      JsonArray array = json.getAsJsonArray("contact");
2139      for (int i = 0; i < array.size(); i++) {
2140        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
2141      }
2142    };
2143    if (json.has("description"))
2144      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
2145    if (json.has("_description"))
2146      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2147    if (json.has("useContext")) {
2148      JsonArray array = json.getAsJsonArray("useContext");
2149      for (int i = 0; i < array.size(); i++) {
2150        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
2151      }
2152    };
2153    if (json.has("jurisdiction")) {
2154      JsonArray array = json.getAsJsonArray("jurisdiction");
2155      for (int i = 0; i < array.size(); i++) {
2156        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2157      }
2158    };
2159    if (json.has("purpose"))
2160      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
2161    if (json.has("_purpose"))
2162      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
2163    if (json.has("usage"))
2164      res.setUsageElement(parseString(json.get("usage").getAsString()));
2165    if (json.has("_usage"))
2166      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
2167    if (json.has("copyright"))
2168      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
2169    if (json.has("_copyright"))
2170      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
2171    if (json.has("approvalDate"))
2172      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
2173    if (json.has("_approvalDate"))
2174      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
2175    if (json.has("lastReviewDate"))
2176      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
2177    if (json.has("_lastReviewDate"))
2178      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
2179    if (json.has("effectivePeriod"))
2180      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
2181    if (json.has("topic")) {
2182      JsonArray array = json.getAsJsonArray("topic");
2183      for (int i = 0; i < array.size(); i++) {
2184        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2185      }
2186    };
2187    if (json.has("author")) {
2188      JsonArray array = json.getAsJsonArray("author");
2189      for (int i = 0; i < array.size(); i++) {
2190        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2191      }
2192    };
2193    if (json.has("editor")) {
2194      JsonArray array = json.getAsJsonArray("editor");
2195      for (int i = 0; i < array.size(); i++) {
2196        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2197      }
2198    };
2199    if (json.has("reviewer")) {
2200      JsonArray array = json.getAsJsonArray("reviewer");
2201      for (int i = 0; i < array.size(); i++) {
2202        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
2203      }
2204    };
2205    if (json.has("endorser")) {
2206      JsonArray array = json.getAsJsonArray("endorser");
2207      for (int i = 0; i < array.size(); i++) {
2208        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
2209      }
2210    };
2211    if (json.has("relatedArtifact")) {
2212      JsonArray array = json.getAsJsonArray("relatedArtifact");
2213      for (int i = 0; i < array.size(); i++) {
2214        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
2215      }
2216    };
2217    if (json.has("library")) {
2218      JsonArray array = json.getAsJsonArray("library");
2219      for (int i = 0; i < array.size(); i++) {
2220        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
2221      }
2222    };
2223    if (json.has("_library")) {
2224      JsonArray array = json.getAsJsonArray("_library");
2225      for (int i = 0; i < array.size(); i++) {
2226        if (i == res.getLibrary().size())
2227          res.getLibrary().add(parseCanonical(null));
2228        if (array.get(i) instanceof JsonObject) 
2229          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
2230      }
2231    };
2232    if (json.has("kind"))
2233      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ActivityDefinition.ActivityDefinitionKind.NULL, new ActivityDefinition.ActivityDefinitionKindEnumFactory()));
2234    if (json.has("_kind"))
2235      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
2236    if (json.has("profile"))
2237      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
2238    if (json.has("_profile"))
2239      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
2240    if (json.has("code"))
2241      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2242    if (json.has("intent"))
2243      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), ActivityDefinition.RequestIntent.NULL, new ActivityDefinition.RequestIntentEnumFactory()));
2244    if (json.has("_intent"))
2245      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
2246    if (json.has("priority"))
2247      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ActivityDefinition.RequestPriority.NULL, new ActivityDefinition.RequestPriorityEnumFactory()));
2248    if (json.has("_priority"))
2249      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
2250    if (json.has("doNotPerform"))
2251      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
2252    if (json.has("_doNotPerform"))
2253      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
2254    Type timing = parseType("timing", json);
2255    if (timing != null)
2256      res.setTiming(timing);
2257    if (json.has("location"))
2258      res.setLocation(parseReference(getJObject(json, "location")));
2259    if (json.has("participant")) {
2260      JsonArray array = json.getAsJsonArray("participant");
2261      for (int i = 0; i < array.size(); i++) {
2262        res.getParticipant().add(parseActivityDefinitionActivityDefinitionParticipantComponent(array.get(i).getAsJsonObject(), res));
2263      }
2264    };
2265    Type product = parseType("product", json);
2266    if (product != null)
2267      res.setProduct(product);
2268    if (json.has("quantity"))
2269      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
2270    if (json.has("dosage")) {
2271      JsonArray array = json.getAsJsonArray("dosage");
2272      for (int i = 0; i < array.size(); i++) {
2273        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
2274      }
2275    };
2276    if (json.has("bodySite")) {
2277      JsonArray array = json.getAsJsonArray("bodySite");
2278      for (int i = 0; i < array.size(); i++) {
2279        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2280      }
2281    };
2282    if (json.has("specimenRequirement")) {
2283      JsonArray array = json.getAsJsonArray("specimenRequirement");
2284      for (int i = 0; i < array.size(); i++) {
2285        res.getSpecimenRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2286      }
2287    };
2288    if (json.has("observationRequirement")) {
2289      JsonArray array = json.getAsJsonArray("observationRequirement");
2290      for (int i = 0; i < array.size(); i++) {
2291        res.getObservationRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2292      }
2293    };
2294    if (json.has("observationResultRequirement")) {
2295      JsonArray array = json.getAsJsonArray("observationResultRequirement");
2296      for (int i = 0; i < array.size(); i++) {
2297        res.getObservationResultRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2298      }
2299    };
2300    if (json.has("transform"))
2301      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
2302    if (json.has("_transform"))
2303      parseElementProperties(getJObject(json, "_transform"), res.getTransformElement());
2304    if (json.has("dynamicValue")) {
2305      JsonArray array = json.getAsJsonArray("dynamicValue");
2306      for (int i = 0; i < array.size(); i++) {
2307        res.getDynamicValue().add(parseActivityDefinitionActivityDefinitionDynamicValueComponent(array.get(i).getAsJsonObject(), res));
2308      }
2309    };
2310  }
2311
2312  protected ActivityDefinition.ActivityDefinitionParticipantComponent parseActivityDefinitionActivityDefinitionParticipantComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
2313    ActivityDefinition.ActivityDefinitionParticipantComponent res = new ActivityDefinition.ActivityDefinitionParticipantComponent();
2314    parseActivityDefinitionActivityDefinitionParticipantComponentProperties(json, owner, res);
2315    return res;
2316  }
2317
2318  protected void parseActivityDefinitionActivityDefinitionParticipantComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionParticipantComponent res) throws IOException, FHIRFormatError {
2319    parseBackboneElementProperties(json, res);
2320    if (json.has("type"))
2321      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ActivityDefinition.ActivityParticipantType.NULL, new ActivityDefinition.ActivityParticipantTypeEnumFactory()));
2322    if (json.has("_type"))
2323      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2324    if (json.has("role"))
2325      res.setRole(parseCodeableConcept(getJObject(json, "role")));
2326  }
2327
2328  protected ActivityDefinition.ActivityDefinitionDynamicValueComponent parseActivityDefinitionActivityDefinitionDynamicValueComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
2329    ActivityDefinition.ActivityDefinitionDynamicValueComponent res = new ActivityDefinition.ActivityDefinitionDynamicValueComponent();
2330    parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(json, owner, res);
2331    return res;
2332  }
2333
2334  protected void parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionDynamicValueComponent res) throws IOException, FHIRFormatError {
2335    parseBackboneElementProperties(json, res);
2336    if (json.has("path"))
2337      res.setPathElement(parseString(json.get("path").getAsString()));
2338    if (json.has("_path"))
2339      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
2340    if (json.has("expression"))
2341      res.setExpression(parseExpression(getJObject(json, "expression")));
2342  }
2343
2344  protected AdverseEvent parseAdverseEvent(JsonObject json) throws IOException, FHIRFormatError {
2345    AdverseEvent res = new AdverseEvent();
2346    parseAdverseEventProperties(json, res);
2347    return res;
2348  }
2349
2350  protected void parseAdverseEventProperties(JsonObject json, AdverseEvent res) throws IOException, FHIRFormatError {
2351    parseDomainResourceProperties(json, res);
2352    if (json.has("identifier"))
2353      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
2354    if (json.has("actuality"))
2355      res.setActualityElement(parseEnumeration(json.get("actuality").getAsString(), AdverseEvent.AdverseEventActuality.NULL, new AdverseEvent.AdverseEventActualityEnumFactory()));
2356    if (json.has("_actuality"))
2357      parseElementProperties(getJObject(json, "_actuality"), res.getActualityElement());
2358    if (json.has("category")) {
2359      JsonArray array = json.getAsJsonArray("category");
2360      for (int i = 0; i < array.size(); i++) {
2361        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2362      }
2363    };
2364    if (json.has("event"))
2365      res.setEvent(parseCodeableConcept(getJObject(json, "event")));
2366    if (json.has("subject"))
2367      res.setSubject(parseReference(getJObject(json, "subject")));
2368    if (json.has("encounter"))
2369      res.setEncounter(parseReference(getJObject(json, "encounter")));
2370    if (json.has("date"))
2371      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2372    if (json.has("_date"))
2373      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
2374    if (json.has("detected"))
2375      res.setDetectedElement(parseDateTime(json.get("detected").getAsString()));
2376    if (json.has("_detected"))
2377      parseElementProperties(getJObject(json, "_detected"), res.getDetectedElement());
2378    if (json.has("recordedDate"))
2379      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
2380    if (json.has("_recordedDate"))
2381      parseElementProperties(getJObject(json, "_recordedDate"), res.getRecordedDateElement());
2382    if (json.has("resultingCondition")) {
2383      JsonArray array = json.getAsJsonArray("resultingCondition");
2384      for (int i = 0; i < array.size(); i++) {
2385        res.getResultingCondition().add(parseReference(array.get(i).getAsJsonObject()));
2386      }
2387    };
2388    if (json.has("location"))
2389      res.setLocation(parseReference(getJObject(json, "location")));
2390    if (json.has("seriousness"))
2391      res.setSeriousness(parseCodeableConcept(getJObject(json, "seriousness")));
2392    if (json.has("severity"))
2393      res.setSeverity(parseCodeableConcept(getJObject(json, "severity")));
2394    if (json.has("outcome"))
2395      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
2396    if (json.has("recorder"))
2397      res.setRecorder(parseReference(getJObject(json, "recorder")));
2398    if (json.has("contributor")) {
2399      JsonArray array = json.getAsJsonArray("contributor");
2400      for (int i = 0; i < array.size(); i++) {
2401        res.getContributor().add(parseReference(array.get(i).getAsJsonObject()));
2402      }
2403    };
2404    if (json.has("suspectEntity")) {
2405      JsonArray array = json.getAsJsonArray("suspectEntity");
2406      for (int i = 0; i < array.size(); i++) {
2407        res.getSuspectEntity().add(parseAdverseEventAdverseEventSuspectEntityComponent(array.get(i).getAsJsonObject(), res));
2408      }
2409    };
2410    if (json.has("subjectMedicalHistory")) {
2411      JsonArray array = json.getAsJsonArray("subjectMedicalHistory");
2412      for (int i = 0; i < array.size(); i++) {
2413        res.getSubjectMedicalHistory().add(parseReference(array.get(i).getAsJsonObject()));
2414      }
2415    };
2416    if (json.has("referenceDocument")) {
2417      JsonArray array = json.getAsJsonArray("referenceDocument");
2418      for (int i = 0; i < array.size(); i++) {
2419        res.getReferenceDocument().add(parseReference(array.get(i).getAsJsonObject()));
2420      }
2421    };
2422    if (json.has("study")) {
2423      JsonArray array = json.getAsJsonArray("study");
2424      for (int i = 0; i < array.size(); i++) {
2425        res.getStudy().add(parseReference(array.get(i).getAsJsonObject()));
2426      }
2427    };
2428  }
2429
2430  protected AdverseEvent.AdverseEventSuspectEntityComponent parseAdverseEventAdverseEventSuspectEntityComponent(JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2431    AdverseEvent.AdverseEventSuspectEntityComponent res = new AdverseEvent.AdverseEventSuspectEntityComponent();
2432    parseAdverseEventAdverseEventSuspectEntityComponentProperties(json, owner, res);
2433    return res;
2434  }
2435
2436  protected void parseAdverseEventAdverseEventSuspectEntityComponentProperties(JsonObject json, AdverseEvent owner, AdverseEvent.AdverseEventSuspectEntityComponent res) throws IOException, FHIRFormatError {
2437    parseBackboneElementProperties(json, res);
2438    if (json.has("instance"))
2439      res.setInstance(parseReference(getJObject(json, "instance")));
2440    if (json.has("causality")) {
2441      JsonArray array = json.getAsJsonArray("causality");
2442      for (int i = 0; i < array.size(); i++) {
2443        res.getCausality().add(parseAdverseEventAdverseEventSuspectEntityCausalityComponent(array.get(i).getAsJsonObject(), owner));
2444      }
2445    };
2446  }
2447
2448  protected AdverseEvent.AdverseEventSuspectEntityCausalityComponent parseAdverseEventAdverseEventSuspectEntityCausalityComponent(JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2449    AdverseEvent.AdverseEventSuspectEntityCausalityComponent res = new AdverseEvent.AdverseEventSuspectEntityCausalityComponent();
2450    parseAdverseEventAdverseEventSuspectEntityCausalityComponentProperties(json, owner, res);
2451    return res;
2452  }
2453
2454  protected void parseAdverseEventAdverseEventSuspectEntityCausalityComponentProperties(JsonObject json, AdverseEvent owner, AdverseEvent.AdverseEventSuspectEntityCausalityComponent res) throws IOException, FHIRFormatError {
2455    parseBackboneElementProperties(json, res);
2456    if (json.has("assessment"))
2457      res.setAssessment(parseCodeableConcept(getJObject(json, "assessment")));
2458    if (json.has("productRelatedness"))
2459      res.setProductRelatednessElement(parseString(json.get("productRelatedness").getAsString()));
2460    if (json.has("_productRelatedness"))
2461      parseElementProperties(getJObject(json, "_productRelatedness"), res.getProductRelatednessElement());
2462    if (json.has("author"))
2463      res.setAuthor(parseReference(getJObject(json, "author")));
2464    if (json.has("method"))
2465      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
2466  }
2467
2468  protected AllergyIntolerance parseAllergyIntolerance(JsonObject json) throws IOException, FHIRFormatError {
2469    AllergyIntolerance res = new AllergyIntolerance();
2470    parseAllergyIntoleranceProperties(json, res);
2471    return res;
2472  }
2473
2474  protected void parseAllergyIntoleranceProperties(JsonObject json, AllergyIntolerance res) throws IOException, FHIRFormatError {
2475    parseDomainResourceProperties(json, res);
2476    if (json.has("identifier")) {
2477      JsonArray array = json.getAsJsonArray("identifier");
2478      for (int i = 0; i < array.size(); i++) {
2479        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2480      }
2481    };
2482    if (json.has("clinicalStatus"))
2483      res.setClinicalStatus(parseCodeableConcept(getJObject(json, "clinicalStatus")));
2484    if (json.has("verificationStatus"))
2485      res.setVerificationStatus(parseCodeableConcept(getJObject(json, "verificationStatus")));
2486    if (json.has("type"))
2487      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AllergyIntolerance.AllergyIntoleranceType.NULL, new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()));
2488    if (json.has("_type"))
2489      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2490    if (json.has("category")) {
2491      JsonArray array = json.getAsJsonArray("category");
2492      for (int i = 0; i < array.size(); i++) {
2493        res.getCategory().add(parseEnumeration(array.get(i).getAsString(), AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2494      }
2495    };
2496    if (json.has("_category")) {
2497      JsonArray array = json.getAsJsonArray("_category");
2498      for (int i = 0; i < array.size(); i++) {
2499        if (i == res.getCategory().size())
2500          res.getCategory().add(parseEnumeration(null, AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2501        if (array.get(i) instanceof JsonObject) 
2502          parseElementProperties(array.get(i).getAsJsonObject(), res.getCategory().get(i));
2503      }
2504    };
2505    if (json.has("criticality"))
2506      res.setCriticalityElement(parseEnumeration(json.get("criticality").getAsString(), AllergyIntolerance.AllergyIntoleranceCriticality.NULL, new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
2507    if (json.has("_criticality"))
2508      parseElementProperties(getJObject(json, "_criticality"), res.getCriticalityElement());
2509    if (json.has("code"))
2510      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2511    if (json.has("patient"))
2512      res.setPatient(parseReference(getJObject(json, "patient")));
2513    if (json.has("encounter"))
2514      res.setEncounter(parseReference(getJObject(json, "encounter")));
2515    Type onset = parseType("onset", json);
2516    if (onset != null)
2517      res.setOnset(onset);
2518    if (json.has("recordedDate"))
2519      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
2520    if (json.has("_recordedDate"))
2521      parseElementProperties(getJObject(json, "_recordedDate"), res.getRecordedDateElement());
2522    if (json.has("recorder"))
2523      res.setRecorder(parseReference(getJObject(json, "recorder")));
2524    if (json.has("asserter"))
2525      res.setAsserter(parseReference(getJObject(json, "asserter")));
2526    if (json.has("lastOccurrence"))
2527      res.setLastOccurrenceElement(parseDateTime(json.get("lastOccurrence").getAsString()));
2528    if (json.has("_lastOccurrence"))
2529      parseElementProperties(getJObject(json, "_lastOccurrence"), res.getLastOccurrenceElement());
2530    if (json.has("note")) {
2531      JsonArray array = json.getAsJsonArray("note");
2532      for (int i = 0; i < array.size(); i++) {
2533        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2534      }
2535    };
2536    if (json.has("reaction")) {
2537      JsonArray array = json.getAsJsonArray("reaction");
2538      for (int i = 0; i < array.size(); i++) {
2539        res.getReaction().add(parseAllergyIntoleranceAllergyIntoleranceReactionComponent(array.get(i).getAsJsonObject(), res));
2540      }
2541    };
2542  }
2543
2544  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceAllergyIntoleranceReactionComponent(JsonObject json, AllergyIntolerance owner) throws IOException, FHIRFormatError {
2545    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
2546    parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(json, owner, res);
2547    return res;
2548  }
2549
2550  protected void parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(JsonObject json, AllergyIntolerance owner, AllergyIntolerance.AllergyIntoleranceReactionComponent res) throws IOException, FHIRFormatError {
2551    parseBackboneElementProperties(json, res);
2552    if (json.has("substance"))
2553      res.setSubstance(parseCodeableConcept(getJObject(json, "substance")));
2554    if (json.has("manifestation")) {
2555      JsonArray array = json.getAsJsonArray("manifestation");
2556      for (int i = 0; i < array.size(); i++) {
2557        res.getManifestation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2558      }
2559    };
2560    if (json.has("description"))
2561      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2562    if (json.has("_description"))
2563      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2564    if (json.has("onset"))
2565      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
2566    if (json.has("_onset"))
2567      parseElementProperties(getJObject(json, "_onset"), res.getOnsetElement());
2568    if (json.has("severity"))
2569      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AllergyIntolerance.AllergyIntoleranceSeverity.NULL, new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
2570    if (json.has("_severity"))
2571      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
2572    if (json.has("exposureRoute"))
2573      res.setExposureRoute(parseCodeableConcept(getJObject(json, "exposureRoute")));
2574    if (json.has("note")) {
2575      JsonArray array = json.getAsJsonArray("note");
2576      for (int i = 0; i < array.size(); i++) {
2577        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2578      }
2579    };
2580  }
2581
2582  protected Appointment parseAppointment(JsonObject json) throws IOException, FHIRFormatError {
2583    Appointment res = new Appointment();
2584    parseAppointmentProperties(json, res);
2585    return res;
2586  }
2587
2588  protected void parseAppointmentProperties(JsonObject json, Appointment res) throws IOException, FHIRFormatError {
2589    parseDomainResourceProperties(json, res);
2590    if (json.has("identifier")) {
2591      JsonArray array = json.getAsJsonArray("identifier");
2592      for (int i = 0; i < array.size(); i++) {
2593        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2594      }
2595    };
2596    if (json.has("status"))
2597      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.AppointmentStatus.NULL, new Appointment.AppointmentStatusEnumFactory()));
2598    if (json.has("_status"))
2599      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2600    if (json.has("cancelationReason"))
2601      res.setCancelationReason(parseCodeableConcept(getJObject(json, "cancelationReason")));
2602    if (json.has("serviceCategory")) {
2603      JsonArray array = json.getAsJsonArray("serviceCategory");
2604      for (int i = 0; i < array.size(); i++) {
2605        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2606      }
2607    };
2608    if (json.has("serviceType")) {
2609      JsonArray array = json.getAsJsonArray("serviceType");
2610      for (int i = 0; i < array.size(); i++) {
2611        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2612      }
2613    };
2614    if (json.has("specialty")) {
2615      JsonArray array = json.getAsJsonArray("specialty");
2616      for (int i = 0; i < array.size(); i++) {
2617        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2618      }
2619    };
2620    if (json.has("appointmentType"))
2621      res.setAppointmentType(parseCodeableConcept(getJObject(json, "appointmentType")));
2622    if (json.has("reasonCode")) {
2623      JsonArray array = json.getAsJsonArray("reasonCode");
2624      for (int i = 0; i < array.size(); i++) {
2625        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2626      }
2627    };
2628    if (json.has("reasonReference")) {
2629      JsonArray array = json.getAsJsonArray("reasonReference");
2630      for (int i = 0; i < array.size(); i++) {
2631        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
2632      }
2633    };
2634    if (json.has("priority"))
2635      res.setPriorityElement(parseUnsignedInt(json.get("priority").getAsString()));
2636    if (json.has("_priority"))
2637      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
2638    if (json.has("description"))
2639      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2640    if (json.has("_description"))
2641      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2642    if (json.has("supportingInformation")) {
2643      JsonArray array = json.getAsJsonArray("supportingInformation");
2644      for (int i = 0; i < array.size(); i++) {
2645        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
2646      }
2647    };
2648    if (json.has("start"))
2649      res.setStartElement(parseInstant(json.get("start").getAsString()));
2650    if (json.has("_start"))
2651      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
2652    if (json.has("end"))
2653      res.setEndElement(parseInstant(json.get("end").getAsString()));
2654    if (json.has("_end"))
2655      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
2656    if (json.has("minutesDuration"))
2657      res.setMinutesDurationElement(parsePositiveInt(json.get("minutesDuration").getAsString()));
2658    if (json.has("_minutesDuration"))
2659      parseElementProperties(getJObject(json, "_minutesDuration"), res.getMinutesDurationElement());
2660    if (json.has("slot")) {
2661      JsonArray array = json.getAsJsonArray("slot");
2662      for (int i = 0; i < array.size(); i++) {
2663        res.getSlot().add(parseReference(array.get(i).getAsJsonObject()));
2664      }
2665    };
2666    if (json.has("created"))
2667      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
2668    if (json.has("_created"))
2669      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
2670    if (json.has("comment"))
2671      res.setCommentElement(parseString(json.get("comment").getAsString()));
2672    if (json.has("_comment"))
2673      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
2674    if (json.has("patientInstruction"))
2675      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
2676    if (json.has("_patientInstruction"))
2677      parseElementProperties(getJObject(json, "_patientInstruction"), res.getPatientInstructionElement());
2678    if (json.has("basedOn")) {
2679      JsonArray array = json.getAsJsonArray("basedOn");
2680      for (int i = 0; i < array.size(); i++) {
2681        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
2682      }
2683    };
2684    if (json.has("participant")) {
2685      JsonArray array = json.getAsJsonArray("participant");
2686      for (int i = 0; i < array.size(); i++) {
2687        res.getParticipant().add(parseAppointmentAppointmentParticipantComponent(array.get(i).getAsJsonObject(), res));
2688      }
2689    };
2690    if (json.has("requestedPeriod")) {
2691      JsonArray array = json.getAsJsonArray("requestedPeriod");
2692      for (int i = 0; i < array.size(); i++) {
2693        res.getRequestedPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
2694      }
2695    };
2696  }
2697
2698  protected Appointment.AppointmentParticipantComponent parseAppointmentAppointmentParticipantComponent(JsonObject json, Appointment owner) throws IOException, FHIRFormatError {
2699    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
2700    parseAppointmentAppointmentParticipantComponentProperties(json, owner, res);
2701    return res;
2702  }
2703
2704  protected void parseAppointmentAppointmentParticipantComponentProperties(JsonObject json, Appointment owner, Appointment.AppointmentParticipantComponent res) throws IOException, FHIRFormatError {
2705    parseBackboneElementProperties(json, res);
2706    if (json.has("type")) {
2707      JsonArray array = json.getAsJsonArray("type");
2708      for (int i = 0; i < array.size(); i++) {
2709        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2710      }
2711    };
2712    if (json.has("actor"))
2713      res.setActor(parseReference(getJObject(json, "actor")));
2714    if (json.has("required"))
2715      res.setRequiredElement(parseEnumeration(json.get("required").getAsString(), Appointment.ParticipantRequired.NULL, new Appointment.ParticipantRequiredEnumFactory()));
2716    if (json.has("_required"))
2717      parseElementProperties(getJObject(json, "_required"), res.getRequiredElement());
2718    if (json.has("status"))
2719      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.ParticipationStatus.NULL, new Appointment.ParticipationStatusEnumFactory()));
2720    if (json.has("_status"))
2721      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2722    if (json.has("period"))
2723      res.setPeriod(parsePeriod(getJObject(json, "period")));
2724  }
2725
2726  protected AppointmentResponse parseAppointmentResponse(JsonObject json) throws IOException, FHIRFormatError {
2727    AppointmentResponse res = new AppointmentResponse();
2728    parseAppointmentResponseProperties(json, res);
2729    return res;
2730  }
2731
2732  protected void parseAppointmentResponseProperties(JsonObject json, AppointmentResponse res) throws IOException, FHIRFormatError {
2733    parseDomainResourceProperties(json, res);
2734    if (json.has("identifier")) {
2735      JsonArray array = json.getAsJsonArray("identifier");
2736      for (int i = 0; i < array.size(); i++) {
2737        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2738      }
2739    };
2740    if (json.has("appointment"))
2741      res.setAppointment(parseReference(getJObject(json, "appointment")));
2742    if (json.has("start"))
2743      res.setStartElement(parseInstant(json.get("start").getAsString()));
2744    if (json.has("_start"))
2745      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
2746    if (json.has("end"))
2747      res.setEndElement(parseInstant(json.get("end").getAsString()));
2748    if (json.has("_end"))
2749      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
2750    if (json.has("participantType")) {
2751      JsonArray array = json.getAsJsonArray("participantType");
2752      for (int i = 0; i < array.size(); i++) {
2753        res.getParticipantType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2754      }
2755    };
2756    if (json.has("actor"))
2757      res.setActor(parseReference(getJObject(json, "actor")));
2758    if (json.has("participantStatus"))
2759      res.setParticipantStatusElement(parseEnumeration(json.get("participantStatus").getAsString(), AppointmentResponse.ParticipantStatus.NULL, new AppointmentResponse.ParticipantStatusEnumFactory()));
2760    if (json.has("_participantStatus"))
2761      parseElementProperties(getJObject(json, "_participantStatus"), res.getParticipantStatusElement());
2762    if (json.has("comment"))
2763      res.setCommentElement(parseString(json.get("comment").getAsString()));
2764    if (json.has("_comment"))
2765      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
2766  }
2767
2768  protected AuditEvent parseAuditEvent(JsonObject json) throws IOException, FHIRFormatError {
2769    AuditEvent res = new AuditEvent();
2770    parseAuditEventProperties(json, res);
2771    return res;
2772  }
2773
2774  protected void parseAuditEventProperties(JsonObject json, AuditEvent res) throws IOException, FHIRFormatError {
2775    parseDomainResourceProperties(json, res);
2776    if (json.has("type"))
2777      res.setType(parseCoding(getJObject(json, "type")));
2778    if (json.has("subtype")) {
2779      JsonArray array = json.getAsJsonArray("subtype");
2780      for (int i = 0; i < array.size(); i++) {
2781        res.getSubtype().add(parseCoding(array.get(i).getAsJsonObject()));
2782      }
2783    };
2784    if (json.has("action"))
2785      res.setActionElement(parseEnumeration(json.get("action").getAsString(), AuditEvent.AuditEventAction.NULL, new AuditEvent.AuditEventActionEnumFactory()));
2786    if (json.has("_action"))
2787      parseElementProperties(getJObject(json, "_action"), res.getActionElement());
2788    if (json.has("period"))
2789      res.setPeriod(parsePeriod(getJObject(json, "period")));
2790    if (json.has("recorded"))
2791      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
2792    if (json.has("_recorded"))
2793      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
2794    if (json.has("outcome"))
2795      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), AuditEvent.AuditEventOutcome.NULL, new AuditEvent.AuditEventOutcomeEnumFactory()));
2796    if (json.has("_outcome"))
2797      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
2798    if (json.has("outcomeDesc"))
2799      res.setOutcomeDescElement(parseString(json.get("outcomeDesc").getAsString()));
2800    if (json.has("_outcomeDesc"))
2801      parseElementProperties(getJObject(json, "_outcomeDesc"), res.getOutcomeDescElement());
2802    if (json.has("purposeOfEvent")) {
2803      JsonArray array = json.getAsJsonArray("purposeOfEvent");
2804      for (int i = 0; i < array.size(); i++) {
2805        res.getPurposeOfEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2806      }
2807    };
2808    if (json.has("agent")) {
2809      JsonArray array = json.getAsJsonArray("agent");
2810      for (int i = 0; i < array.size(); i++) {
2811        res.getAgent().add(parseAuditEventAuditEventAgentComponent(array.get(i).getAsJsonObject(), res));
2812      }
2813    };
2814    if (json.has("source"))
2815      res.setSource(parseAuditEventAuditEventSourceComponent(getJObject(json, "source"), res));
2816    if (json.has("entity")) {
2817      JsonArray array = json.getAsJsonArray("entity");
2818      for (int i = 0; i < array.size(); i++) {
2819        res.getEntity().add(parseAuditEventAuditEventEntityComponent(array.get(i).getAsJsonObject(), res));
2820      }
2821    };
2822  }
2823
2824  protected AuditEvent.AuditEventAgentComponent parseAuditEventAuditEventAgentComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2825    AuditEvent.AuditEventAgentComponent res = new AuditEvent.AuditEventAgentComponent();
2826    parseAuditEventAuditEventAgentComponentProperties(json, owner, res);
2827    return res;
2828  }
2829
2830  protected void parseAuditEventAuditEventAgentComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentComponent res) throws IOException, FHIRFormatError {
2831    parseBackboneElementProperties(json, res);
2832    if (json.has("type"))
2833      res.setType(parseCodeableConcept(getJObject(json, "type")));
2834    if (json.has("role")) {
2835      JsonArray array = json.getAsJsonArray("role");
2836      for (int i = 0; i < array.size(); i++) {
2837        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2838      }
2839    };
2840    if (json.has("who"))
2841      res.setWho(parseReference(getJObject(json, "who")));
2842    if (json.has("altId"))
2843      res.setAltIdElement(parseString(json.get("altId").getAsString()));
2844    if (json.has("_altId"))
2845      parseElementProperties(getJObject(json, "_altId"), res.getAltIdElement());
2846    if (json.has("name"))
2847      res.setNameElement(parseString(json.get("name").getAsString()));
2848    if (json.has("_name"))
2849      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2850    if (json.has("requestor"))
2851      res.setRequestorElement(parseBoolean(json.get("requestor").getAsBoolean()));
2852    if (json.has("_requestor"))
2853      parseElementProperties(getJObject(json, "_requestor"), res.getRequestorElement());
2854    if (json.has("location"))
2855      res.setLocation(parseReference(getJObject(json, "location")));
2856    if (json.has("policy")) {
2857      JsonArray array = json.getAsJsonArray("policy");
2858      for (int i = 0; i < array.size(); i++) {
2859        res.getPolicy().add(parseUri(array.get(i).getAsString()));
2860      }
2861    };
2862    if (json.has("_policy")) {
2863      JsonArray array = json.getAsJsonArray("_policy");
2864      for (int i = 0; i < array.size(); i++) {
2865        if (i == res.getPolicy().size())
2866          res.getPolicy().add(parseUri(null));
2867        if (array.get(i) instanceof JsonObject) 
2868          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
2869      }
2870    };
2871    if (json.has("media"))
2872      res.setMedia(parseCoding(getJObject(json, "media")));
2873    if (json.has("network"))
2874      res.setNetwork(parseAuditEventAuditEventAgentNetworkComponent(getJObject(json, "network"), owner));
2875    if (json.has("purposeOfUse")) {
2876      JsonArray array = json.getAsJsonArray("purposeOfUse");
2877      for (int i = 0; i < array.size(); i++) {
2878        res.getPurposeOfUse().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2879      }
2880    };
2881  }
2882
2883  protected AuditEvent.AuditEventAgentNetworkComponent parseAuditEventAuditEventAgentNetworkComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2884    AuditEvent.AuditEventAgentNetworkComponent res = new AuditEvent.AuditEventAgentNetworkComponent();
2885    parseAuditEventAuditEventAgentNetworkComponentProperties(json, owner, res);
2886    return res;
2887  }
2888
2889  protected void parseAuditEventAuditEventAgentNetworkComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentNetworkComponent res) throws IOException, FHIRFormatError {
2890    parseBackboneElementProperties(json, res);
2891    if (json.has("address"))
2892      res.setAddressElement(parseString(json.get("address").getAsString()));
2893    if (json.has("_address"))
2894      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
2895    if (json.has("type"))
2896      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AuditEvent.AuditEventAgentNetworkType.NULL, new AuditEvent.AuditEventAgentNetworkTypeEnumFactory()));
2897    if (json.has("_type"))
2898      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2899  }
2900
2901  protected AuditEvent.AuditEventSourceComponent parseAuditEventAuditEventSourceComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2902    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
2903    parseAuditEventAuditEventSourceComponentProperties(json, owner, res);
2904    return res;
2905  }
2906
2907  protected void parseAuditEventAuditEventSourceComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventSourceComponent res) throws IOException, FHIRFormatError {
2908    parseBackboneElementProperties(json, res);
2909    if (json.has("site"))
2910      res.setSiteElement(parseString(json.get("site").getAsString()));
2911    if (json.has("_site"))
2912      parseElementProperties(getJObject(json, "_site"), res.getSiteElement());
2913    if (json.has("observer"))
2914      res.setObserver(parseReference(getJObject(json, "observer")));
2915    if (json.has("type")) {
2916      JsonArray array = json.getAsJsonArray("type");
2917      for (int i = 0; i < array.size(); i++) {
2918        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
2919      }
2920    };
2921  }
2922
2923  protected AuditEvent.AuditEventEntityComponent parseAuditEventAuditEventEntityComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2924    AuditEvent.AuditEventEntityComponent res = new AuditEvent.AuditEventEntityComponent();
2925    parseAuditEventAuditEventEntityComponentProperties(json, owner, res);
2926    return res;
2927  }
2928
2929  protected void parseAuditEventAuditEventEntityComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityComponent res) throws IOException, FHIRFormatError {
2930    parseBackboneElementProperties(json, res);
2931    if (json.has("what"))
2932      res.setWhat(parseReference(getJObject(json, "what")));
2933    if (json.has("type"))
2934      res.setType(parseCoding(getJObject(json, "type")));
2935    if (json.has("role"))
2936      res.setRole(parseCoding(getJObject(json, "role")));
2937    if (json.has("lifecycle"))
2938      res.setLifecycle(parseCoding(getJObject(json, "lifecycle")));
2939    if (json.has("securityLabel")) {
2940      JsonArray array = json.getAsJsonArray("securityLabel");
2941      for (int i = 0; i < array.size(); i++) {
2942        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
2943      }
2944    };
2945    if (json.has("name"))
2946      res.setNameElement(parseString(json.get("name").getAsString()));
2947    if (json.has("_name"))
2948      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2949    if (json.has("description"))
2950      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2951    if (json.has("_description"))
2952      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2953    if (json.has("query"))
2954      res.setQueryElement(parseBase64Binary(json.get("query").getAsString()));
2955    if (json.has("_query"))
2956      parseElementProperties(getJObject(json, "_query"), res.getQueryElement());
2957    if (json.has("detail")) {
2958      JsonArray array = json.getAsJsonArray("detail");
2959      for (int i = 0; i < array.size(); i++) {
2960        res.getDetail().add(parseAuditEventAuditEventEntityDetailComponent(array.get(i).getAsJsonObject(), owner));
2961      }
2962    };
2963  }
2964
2965  protected AuditEvent.AuditEventEntityDetailComponent parseAuditEventAuditEventEntityDetailComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2966    AuditEvent.AuditEventEntityDetailComponent res = new AuditEvent.AuditEventEntityDetailComponent();
2967    parseAuditEventAuditEventEntityDetailComponentProperties(json, owner, res);
2968    return res;
2969  }
2970
2971  protected void parseAuditEventAuditEventEntityDetailComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityDetailComponent res) throws IOException, FHIRFormatError {
2972    parseBackboneElementProperties(json, res);
2973    if (json.has("type"))
2974      res.setTypeElement(parseString(json.get("type").getAsString()));
2975    if (json.has("_type"))
2976      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2977    Type value = parseType("value", json);
2978    if (value != null)
2979      res.setValue(value);
2980  }
2981
2982  protected Basic parseBasic(JsonObject json) throws IOException, FHIRFormatError {
2983    Basic res = new Basic();
2984    parseBasicProperties(json, res);
2985    return res;
2986  }
2987
2988  protected void parseBasicProperties(JsonObject json, Basic res) throws IOException, FHIRFormatError {
2989    parseDomainResourceProperties(json, res);
2990    if (json.has("identifier")) {
2991      JsonArray array = json.getAsJsonArray("identifier");
2992      for (int i = 0; i < array.size(); i++) {
2993        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2994      }
2995    };
2996    if (json.has("code"))
2997      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2998    if (json.has("subject"))
2999      res.setSubject(parseReference(getJObject(json, "subject")));
3000    if (json.has("created"))
3001      res.setCreatedElement(parseDate(json.get("created").getAsString()));
3002    if (json.has("_created"))
3003      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
3004    if (json.has("author"))
3005      res.setAuthor(parseReference(getJObject(json, "author")));
3006  }
3007
3008  protected Binary parseBinary(JsonObject json) throws IOException, FHIRFormatError {
3009    Binary res = new Binary();
3010    parseBinaryProperties(json, res);
3011    return res;
3012  }
3013
3014  protected void parseBinaryProperties(JsonObject json, Binary res) throws IOException, FHIRFormatError {
3015    parseResourceProperties(json, res);
3016    if (json.has("contentType"))
3017      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
3018    if (json.has("_contentType"))
3019      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
3020    if (json.has("securityContext"))
3021      res.setSecurityContext(parseReference(getJObject(json, "securityContext")));
3022    if (json.has("data"))
3023      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
3024    if (json.has("_data"))
3025      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
3026  }
3027
3028  protected BiologicallyDerivedProduct parseBiologicallyDerivedProduct(JsonObject json) throws IOException, FHIRFormatError {
3029    BiologicallyDerivedProduct res = new BiologicallyDerivedProduct();
3030    parseBiologicallyDerivedProductProperties(json, res);
3031    return res;
3032  }
3033
3034  protected void parseBiologicallyDerivedProductProperties(JsonObject json, BiologicallyDerivedProduct res) throws IOException, FHIRFormatError {
3035    parseDomainResourceProperties(json, res);
3036    if (json.has("identifier")) {
3037      JsonArray array = json.getAsJsonArray("identifier");
3038      for (int i = 0; i < array.size(); i++) {
3039        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3040      }
3041    };
3042    if (json.has("productCategory"))
3043      res.setProductCategoryElement(parseEnumeration(json.get("productCategory").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory()));
3044    if (json.has("_productCategory"))
3045      parseElementProperties(getJObject(json, "_productCategory"), res.getProductCategoryElement());
3046    if (json.has("productCode"))
3047      res.setProductCode(parseCodeableConcept(getJObject(json, "productCode")));
3048    if (json.has("status"))
3049      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductStatus.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory()));
3050    if (json.has("_status"))
3051      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3052    if (json.has("request")) {
3053      JsonArray array = json.getAsJsonArray("request");
3054      for (int i = 0; i < array.size(); i++) {
3055        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
3056      }
3057    };
3058    if (json.has("quantity"))
3059      res.setQuantityElement(parseInteger(json.get("quantity").getAsLong()));
3060    if (json.has("_quantity"))
3061      parseElementProperties(getJObject(json, "_quantity"), res.getQuantityElement());
3062    if (json.has("parent")) {
3063      JsonArray array = json.getAsJsonArray("parent");
3064      for (int i = 0; i < array.size(); i++) {
3065        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
3066      }
3067    };
3068    if (json.has("collection"))
3069      res.setCollection(parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(getJObject(json, "collection"), res));
3070    if (json.has("processing")) {
3071      JsonArray array = json.getAsJsonArray("processing");
3072      for (int i = 0; i < array.size(); i++) {
3073        res.getProcessing().add(parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(array.get(i).getAsJsonObject(), res));
3074      }
3075    };
3076    if (json.has("manipulation"))
3077      res.setManipulation(parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(getJObject(json, "manipulation"), res));
3078    if (json.has("storage")) {
3079      JsonArray array = json.getAsJsonArray("storage");
3080      for (int i = 0; i < array.size(); i++) {
3081        res.getStorage().add(parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(array.get(i).getAsJsonObject(), res));
3082      }
3083    };
3084  }
3085
3086  protected BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3087    BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent();
3088    parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentProperties(json, owner, res);
3089    return res;
3090  }
3091
3092  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res) throws IOException, FHIRFormatError {
3093    parseBackboneElementProperties(json, res);
3094    if (json.has("collector"))
3095      res.setCollector(parseReference(getJObject(json, "collector")));
3096    if (json.has("source"))
3097      res.setSource(parseReference(getJObject(json, "source")));
3098    Type collected = parseType("collected", json);
3099    if (collected != null)
3100      res.setCollected(collected);
3101  }
3102
3103  protected BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3104    BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent();
3105    parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentProperties(json, owner, res);
3106    return res;
3107  }
3108
3109  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res) throws IOException, FHIRFormatError {
3110    parseBackboneElementProperties(json, res);
3111    if (json.has("description"))
3112      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3113    if (json.has("_description"))
3114      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3115    if (json.has("procedure"))
3116      res.setProcedure(parseCodeableConcept(getJObject(json, "procedure")));
3117    if (json.has("additive"))
3118      res.setAdditive(parseReference(getJObject(json, "additive")));
3119    Type time = parseType("time", json);
3120    if (time != null)
3121      res.setTime(time);
3122  }
3123
3124  protected BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3125    BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent();
3126    parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentProperties(json, owner, res);
3127    return res;
3128  }
3129
3130  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res) throws IOException, FHIRFormatError {
3131    parseBackboneElementProperties(json, res);
3132    if (json.has("description"))
3133      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3134    if (json.has("_description"))
3135      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3136    Type time = parseType("time", json);
3137    if (time != null)
3138      res.setTime(time);
3139  }
3140
3141  protected BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3142    BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent();
3143    parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentProperties(json, owner, res);
3144    return res;
3145  }
3146
3147  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res) throws IOException, FHIRFormatError {
3148    parseBackboneElementProperties(json, res);
3149    if (json.has("description"))
3150      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3151    if (json.has("_description"))
3152      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3153    if (json.has("temperature"))
3154      res.setTemperatureElement(parseDecimal(json.get("temperature").getAsBigDecimal()));
3155    if (json.has("_temperature"))
3156      parseElementProperties(getJObject(json, "_temperature"), res.getTemperatureElement());
3157    if (json.has("scale"))
3158      res.setScaleElement(parseEnumeration(json.get("scale").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory()));
3159    if (json.has("_scale"))
3160      parseElementProperties(getJObject(json, "_scale"), res.getScaleElement());
3161    if (json.has("duration"))
3162      res.setDuration(parsePeriod(getJObject(json, "duration")));
3163  }
3164
3165  protected BodyStructure parseBodyStructure(JsonObject json) throws IOException, FHIRFormatError {
3166    BodyStructure res = new BodyStructure();
3167    parseBodyStructureProperties(json, res);
3168    return res;
3169  }
3170
3171  protected void parseBodyStructureProperties(JsonObject json, BodyStructure res) throws IOException, FHIRFormatError {
3172    parseDomainResourceProperties(json, res);
3173    if (json.has("identifier")) {
3174      JsonArray array = json.getAsJsonArray("identifier");
3175      for (int i = 0; i < array.size(); i++) {
3176        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3177      }
3178    };
3179    if (json.has("active"))
3180      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
3181    if (json.has("_active"))
3182      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
3183    if (json.has("morphology"))
3184      res.setMorphology(parseCodeableConcept(getJObject(json, "morphology")));
3185    if (json.has("location"))
3186      res.setLocation(parseCodeableConcept(getJObject(json, "location")));
3187    if (json.has("locationQualifier")) {
3188      JsonArray array = json.getAsJsonArray("locationQualifier");
3189      for (int i = 0; i < array.size(); i++) {
3190        res.getLocationQualifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3191      }
3192    };
3193    if (json.has("description"))
3194      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3195    if (json.has("_description"))
3196      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3197    if (json.has("image")) {
3198      JsonArray array = json.getAsJsonArray("image");
3199      for (int i = 0; i < array.size(); i++) {
3200        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
3201      }
3202    };
3203    if (json.has("patient"))
3204      res.setPatient(parseReference(getJObject(json, "patient")));
3205  }
3206
3207  protected Bundle parseBundle(JsonObject json) throws IOException, FHIRFormatError {
3208    Bundle res = new Bundle();
3209    parseBundleProperties(json, res);
3210    return res;
3211  }
3212
3213  protected void parseBundleProperties(JsonObject json, Bundle res) throws IOException, FHIRFormatError {
3214    parseResourceProperties(json, res);
3215    if (json.has("identifier"))
3216      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
3217    if (json.has("type"))
3218      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
3219    if (json.has("_type"))
3220      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3221    if (json.has("timestamp"))
3222      res.setTimestampElement(parseInstant(json.get("timestamp").getAsString()));
3223    if (json.has("_timestamp"))
3224      parseElementProperties(getJObject(json, "_timestamp"), res.getTimestampElement());
3225    if (json.has("total"))
3226      res.setTotalElement(parseUnsignedInt(json.get("total").getAsString()));
3227    if (json.has("_total"))
3228      parseElementProperties(getJObject(json, "_total"), res.getTotalElement());
3229    if (json.has("link")) {
3230      JsonArray array = json.getAsJsonArray("link");
3231      for (int i = 0; i < array.size(); i++) {
3232        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), res));
3233      }
3234    };
3235    if (json.has("entry")) {
3236      JsonArray array = json.getAsJsonArray("entry");
3237      for (int i = 0; i < array.size(); i++) {
3238        res.getEntry().add(parseBundleBundleEntryComponent(array.get(i).getAsJsonObject(), res));
3239      }
3240    };
3241    if (json.has("signature"))
3242      res.setSignature(parseSignature(getJObject(json, "signature")));
3243  }
3244
3245  protected Bundle.BundleLinkComponent parseBundleBundleLinkComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3246    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
3247    parseBundleBundleLinkComponentProperties(json, owner, res);
3248    return res;
3249  }
3250
3251  protected void parseBundleBundleLinkComponentProperties(JsonObject json, Bundle owner, Bundle.BundleLinkComponent res) throws IOException, FHIRFormatError {
3252    parseBackboneElementProperties(json, res);
3253    if (json.has("relation"))
3254      res.setRelationElement(parseString(json.get("relation").getAsString()));
3255    if (json.has("_relation"))
3256      parseElementProperties(getJObject(json, "_relation"), res.getRelationElement());
3257    if (json.has("url"))
3258      res.setUrlElement(parseUri(json.get("url").getAsString()));
3259    if (json.has("_url"))
3260      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
3261  }
3262
3263  protected Bundle.BundleEntryComponent parseBundleBundleEntryComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3264    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
3265    parseBundleBundleEntryComponentProperties(json, owner, res);
3266    return res;
3267  }
3268
3269  protected void parseBundleBundleEntryComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryComponent res) throws IOException, FHIRFormatError {
3270    parseBackboneElementProperties(json, res);
3271    if (json.has("link")) {
3272      JsonArray array = json.getAsJsonArray("link");
3273      for (int i = 0; i < array.size(); i++) {
3274        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), owner));
3275      }
3276    };
3277    if (json.has("fullUrl"))
3278      res.setFullUrlElement(parseUri(json.get("fullUrl").getAsString()));
3279    if (json.has("_fullUrl"))
3280      parseElementProperties(getJObject(json, "_fullUrl"), res.getFullUrlElement());
3281    if (json.has("resource"))
3282      res.setResource(parseResource(getJObject(json, "resource")));
3283    if (json.has("search"))
3284      res.setSearch(parseBundleBundleEntrySearchComponent(getJObject(json, "search"), owner));
3285    if (json.has("request"))
3286      res.setRequest(parseBundleBundleEntryRequestComponent(getJObject(json, "request"), owner));
3287    if (json.has("response"))
3288      res.setResponse(parseBundleBundleEntryResponseComponent(getJObject(json, "response"), owner));
3289  }
3290
3291  protected Bundle.BundleEntrySearchComponent parseBundleBundleEntrySearchComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3292    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
3293    parseBundleBundleEntrySearchComponentProperties(json, owner, res);
3294    return res;
3295  }
3296
3297  protected void parseBundleBundleEntrySearchComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntrySearchComponent res) throws IOException, FHIRFormatError {
3298    parseBackboneElementProperties(json, res);
3299    if (json.has("mode"))
3300      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Bundle.SearchEntryMode.NULL, new Bundle.SearchEntryModeEnumFactory()));
3301    if (json.has("_mode"))
3302      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
3303    if (json.has("score"))
3304      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
3305    if (json.has("_score"))
3306      parseElementProperties(getJObject(json, "_score"), res.getScoreElement());
3307  }
3308
3309  protected Bundle.BundleEntryRequestComponent parseBundleBundleEntryRequestComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3310    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
3311    parseBundleBundleEntryRequestComponentProperties(json, owner, res);
3312    return res;
3313  }
3314
3315  protected void parseBundleBundleEntryRequestComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryRequestComponent res) throws IOException, FHIRFormatError {
3316    parseBackboneElementProperties(json, res);
3317    if (json.has("method"))
3318      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
3319    if (json.has("_method"))
3320      parseElementProperties(getJObject(json, "_method"), res.getMethodElement());
3321    if (json.has("url"))
3322      res.setUrlElement(parseUri(json.get("url").getAsString()));
3323    if (json.has("_url"))
3324      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
3325    if (json.has("ifNoneMatch"))
3326      res.setIfNoneMatchElement(parseString(json.get("ifNoneMatch").getAsString()));
3327    if (json.has("_ifNoneMatch"))
3328      parseElementProperties(getJObject(json, "_ifNoneMatch"), res.getIfNoneMatchElement());
3329    if (json.has("ifModifiedSince"))
3330      res.setIfModifiedSinceElement(parseInstant(json.get("ifModifiedSince").getAsString()));
3331    if (json.has("_ifModifiedSince"))
3332      parseElementProperties(getJObject(json, "_ifModifiedSince"), res.getIfModifiedSinceElement());
3333    if (json.has("ifMatch"))
3334      res.setIfMatchElement(parseString(json.get("ifMatch").getAsString()));
3335    if (json.has("_ifMatch"))
3336      parseElementProperties(getJObject(json, "_ifMatch"), res.getIfMatchElement());
3337    if (json.has("ifNoneExist"))
3338      res.setIfNoneExistElement(parseString(json.get("ifNoneExist").getAsString()));
3339    if (json.has("_ifNoneExist"))
3340      parseElementProperties(getJObject(json, "_ifNoneExist"), res.getIfNoneExistElement());
3341  }
3342
3343  protected Bundle.BundleEntryResponseComponent parseBundleBundleEntryResponseComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3344    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
3345    parseBundleBundleEntryResponseComponentProperties(json, owner, res);
3346    return res;
3347  }
3348
3349  protected void parseBundleBundleEntryResponseComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryResponseComponent res) throws IOException, FHIRFormatError {
3350    parseBackboneElementProperties(json, res);
3351    if (json.has("status"))
3352      res.setStatusElement(parseString(json.get("status").getAsString()));
3353    if (json.has("_status"))
3354      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3355    if (json.has("location"))
3356      res.setLocationElement(parseUri(json.get("location").getAsString()));
3357    if (json.has("_location"))
3358      parseElementProperties(getJObject(json, "_location"), res.getLocationElement());
3359    if (json.has("etag"))
3360      res.setEtagElement(parseString(json.get("etag").getAsString()));
3361    if (json.has("_etag"))
3362      parseElementProperties(getJObject(json, "_etag"), res.getEtagElement());
3363    if (json.has("lastModified"))
3364      res.setLastModifiedElement(parseInstant(json.get("lastModified").getAsString()));
3365    if (json.has("_lastModified"))
3366      parseElementProperties(getJObject(json, "_lastModified"), res.getLastModifiedElement());
3367    if (json.has("outcome"))
3368      res.setOutcome(parseResource(getJObject(json, "outcome")));
3369  }
3370
3371  protected CapabilityStatement parseCapabilityStatement(JsonObject json) throws IOException, FHIRFormatError {
3372    CapabilityStatement res = new CapabilityStatement();
3373    parseCapabilityStatementProperties(json, res);
3374    return res;
3375  }
3376
3377  protected void parseCapabilityStatementProperties(JsonObject json, CapabilityStatement res) throws IOException, FHIRFormatError {
3378    parseDomainResourceProperties(json, res);
3379    if (json.has("url"))
3380      res.setUrlElement(parseUri(json.get("url").getAsString()));
3381    if (json.has("_url"))
3382      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
3383    if (json.has("version"))
3384      res.setVersionElement(parseString(json.get("version").getAsString()));
3385    if (json.has("_version"))
3386      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
3387    if (json.has("name"))
3388      res.setNameElement(parseString(json.get("name").getAsString()));
3389    if (json.has("_name"))
3390      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3391    if (json.has("title"))
3392      res.setTitleElement(parseString(json.get("title").getAsString()));
3393    if (json.has("_title"))
3394      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
3395    if (json.has("status"))
3396      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
3397    if (json.has("_status"))
3398      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3399    if (json.has("experimental"))
3400      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
3401    if (json.has("_experimental"))
3402      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
3403    if (json.has("date"))
3404      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3405    if (json.has("_date"))
3406      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
3407    if (json.has("publisher"))
3408      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
3409    if (json.has("_publisher"))
3410      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
3411    if (json.has("contact")) {
3412      JsonArray array = json.getAsJsonArray("contact");
3413      for (int i = 0; i < array.size(); i++) {
3414        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
3415      }
3416    };
3417    if (json.has("description"))
3418      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
3419    if (json.has("_description"))
3420      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3421    if (json.has("useContext")) {
3422      JsonArray array = json.getAsJsonArray("useContext");
3423      for (int i = 0; i < array.size(); i++) {
3424        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
3425      }
3426    };
3427    if (json.has("jurisdiction")) {
3428      JsonArray array = json.getAsJsonArray("jurisdiction");
3429      for (int i = 0; i < array.size(); i++) {
3430        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3431      }
3432    };
3433    if (json.has("purpose"))
3434      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
3435    if (json.has("_purpose"))
3436      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
3437    if (json.has("copyright"))
3438      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
3439    if (json.has("_copyright"))
3440      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
3441    if (json.has("kind"))
3442      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CapabilityStatement.CapabilityStatementKind.NULL, new CapabilityStatement.CapabilityStatementKindEnumFactory()));
3443    if (json.has("_kind"))
3444      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
3445    if (json.has("instantiates")) {
3446      JsonArray array = json.getAsJsonArray("instantiates");
3447      for (int i = 0; i < array.size(); i++) {
3448        res.getInstantiates().add(parseCanonical(array.get(i).getAsString()));
3449      }
3450    };
3451    if (json.has("_instantiates")) {
3452      JsonArray array = json.getAsJsonArray("_instantiates");
3453      for (int i = 0; i < array.size(); i++) {
3454        if (i == res.getInstantiates().size())
3455          res.getInstantiates().add(parseCanonical(null));
3456        if (array.get(i) instanceof JsonObject) 
3457          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
3458      }
3459    };
3460    if (json.has("imports")) {
3461      JsonArray array = json.getAsJsonArray("imports");
3462      for (int i = 0; i < array.size(); i++) {
3463        res.getImports().add(parseCanonical(array.get(i).getAsString()));
3464      }
3465    };
3466    if (json.has("_imports")) {
3467      JsonArray array = json.getAsJsonArray("_imports");
3468      for (int i = 0; i < array.size(); i++) {
3469        if (i == res.getImports().size())
3470          res.getImports().add(parseCanonical(null));
3471        if (array.get(i) instanceof JsonObject) 
3472          parseElementProperties(array.get(i).getAsJsonObject(), res.getImports().get(i));
3473      }
3474    };
3475    if (json.has("software"))
3476      res.setSoftware(parseCapabilityStatementCapabilityStatementSoftwareComponent(getJObject(json, "software"), res));
3477    if (json.has("implementation"))
3478      res.setImplementation(parseCapabilityStatementCapabilityStatementImplementationComponent(getJObject(json, "implementation"), res));
3479    if (json.has("fhirVersion"))
3480      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
3481    if (json.has("_fhirVersion"))
3482      parseElementProperties(getJObject(json, "_fhirVersion"), res.getFhirVersionElement());
3483    if (json.has("format")) {
3484      JsonArray array = json.getAsJsonArray("format");
3485      for (int i = 0; i < array.size(); i++) {
3486        res.getFormat().add(parseCode(array.get(i).getAsString()));
3487      }
3488    };
3489    if (json.has("_format")) {
3490      JsonArray array = json.getAsJsonArray("_format");
3491      for (int i = 0; i < array.size(); i++) {
3492        if (i == res.getFormat().size())
3493          res.getFormat().add(parseCode(null));
3494        if (array.get(i) instanceof JsonObject) 
3495          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
3496      }
3497    };
3498    if (json.has("patchFormat")) {
3499      JsonArray array = json.getAsJsonArray("patchFormat");
3500      for (int i = 0; i < array.size(); i++) {
3501        res.getPatchFormat().add(parseCode(array.get(i).getAsString()));
3502      }
3503    };
3504    if (json.has("_patchFormat")) {
3505      JsonArray array = json.getAsJsonArray("_patchFormat");
3506      for (int i = 0; i < array.size(); i++) {
3507        if (i == res.getPatchFormat().size())
3508          res.getPatchFormat().add(parseCode(null));
3509        if (array.get(i) instanceof JsonObject) 
3510          parseElementProperties(array.get(i).getAsJsonObject(), res.getPatchFormat().get(i));
3511      }
3512    };
3513    if (json.has("implementationGuide")) {
3514      JsonArray array = json.getAsJsonArray("implementationGuide");
3515      for (int i = 0; i < array.size(); i++) {
3516        res.getImplementationGuide().add(parseCanonical(array.get(i).getAsString()));
3517      }
3518    };
3519    if (json.has("_implementationGuide")) {
3520      JsonArray array = json.getAsJsonArray("_implementationGuide");
3521      for (int i = 0; i < array.size(); i++) {
3522        if (i == res.getImplementationGuide().size())
3523          res.getImplementationGuide().add(parseCanonical(null));
3524        if (array.get(i) instanceof JsonObject) 
3525          parseElementProperties(array.get(i).getAsJsonObject(), res.getImplementationGuide().get(i));
3526      }
3527    };
3528    if (json.has("rest")) {
3529      JsonArray array = json.getAsJsonArray("rest");
3530      for (int i = 0; i < array.size(); i++) {
3531        res.getRest().add(parseCapabilityStatementCapabilityStatementRestComponent(array.get(i).getAsJsonObject(), res));
3532      }
3533    };
3534    if (json.has("messaging")) {
3535      JsonArray array = json.getAsJsonArray("messaging");
3536      for (int i = 0; i < array.size(); i++) {
3537        res.getMessaging().add(parseCapabilityStatementCapabilityStatementMessagingComponent(array.get(i).getAsJsonObject(), res));
3538      }
3539    };
3540    if (json.has("document")) {
3541      JsonArray array = json.getAsJsonArray("document");
3542      for (int i = 0; i < array.size(); i++) {
3543        res.getDocument().add(parseCapabilityStatementCapabilityStatementDocumentComponent(array.get(i).getAsJsonObject(), res));
3544      }
3545    };
3546  }
3547
3548  protected CapabilityStatement.CapabilityStatementSoftwareComponent parseCapabilityStatementCapabilityStatementSoftwareComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3549    CapabilityStatement.CapabilityStatementSoftwareComponent res = new CapabilityStatement.CapabilityStatementSoftwareComponent();
3550    parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(json, owner, res);
3551    return res;
3552  }
3553
3554  protected void parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementSoftwareComponent res) throws IOException, FHIRFormatError {
3555    parseBackboneElementProperties(json, res);
3556    if (json.has("name"))
3557      res.setNameElement(parseString(json.get("name").getAsString()));
3558    if (json.has("_name"))
3559      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3560    if (json.has("version"))
3561      res.setVersionElement(parseString(json.get("version").getAsString()));
3562    if (json.has("_version"))
3563      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
3564    if (json.has("releaseDate"))
3565      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
3566    if (json.has("_releaseDate"))
3567      parseElementProperties(getJObject(json, "_releaseDate"), res.getReleaseDateElement());
3568  }
3569
3570  protected CapabilityStatement.CapabilityStatementImplementationComponent parseCapabilityStatementCapabilityStatementImplementationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3571    CapabilityStatement.CapabilityStatementImplementationComponent res = new CapabilityStatement.CapabilityStatementImplementationComponent();
3572    parseCapabilityStatementCapabilityStatementImplementationComponentProperties(json, owner, res);
3573    return res;
3574  }
3575
3576  protected void parseCapabilityStatementCapabilityStatementImplementationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementImplementationComponent res) throws IOException, FHIRFormatError {
3577    parseBackboneElementProperties(json, res);
3578    if (json.has("description"))
3579      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3580    if (json.has("_description"))
3581      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3582    if (json.has("url"))
3583      res.setUrlElement(parseUrl(json.get("url").getAsString()));
3584    if (json.has("_url"))
3585      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
3586    if (json.has("custodian"))
3587      res.setCustodian(parseReference(getJObject(json, "custodian")));
3588  }
3589
3590  protected CapabilityStatement.CapabilityStatementRestComponent parseCapabilityStatementCapabilityStatementRestComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3591    CapabilityStatement.CapabilityStatementRestComponent res = new CapabilityStatement.CapabilityStatementRestComponent();
3592    parseCapabilityStatementCapabilityStatementRestComponentProperties(json, owner, res);
3593    return res;
3594  }
3595
3596  protected void parseCapabilityStatementCapabilityStatementRestComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestComponent res) throws IOException, FHIRFormatError {
3597    parseBackboneElementProperties(json, res);
3598    if (json.has("mode"))
3599      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.RestfulCapabilityMode.NULL, new CapabilityStatement.RestfulCapabilityModeEnumFactory()));
3600    if (json.has("_mode"))
3601      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
3602    if (json.has("documentation"))
3603      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3604    if (json.has("_documentation"))
3605      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3606    if (json.has("security"))
3607      res.setSecurity(parseCapabilityStatementCapabilityStatementRestSecurityComponent(getJObject(json, "security"), owner));
3608    if (json.has("resource")) {
3609      JsonArray array = json.getAsJsonArray("resource");
3610      for (int i = 0; i < array.size(); i++) {
3611        res.getResource().add(parseCapabilityStatementCapabilityStatementRestResourceComponent(array.get(i).getAsJsonObject(), owner));
3612      }
3613    };
3614    if (json.has("interaction")) {
3615      JsonArray array = json.getAsJsonArray("interaction");
3616      for (int i = 0; i < array.size(); i++) {
3617        res.getInteraction().add(parseCapabilityStatementSystemInteractionComponent(array.get(i).getAsJsonObject(), owner));
3618      }
3619    };
3620    if (json.has("searchParam")) {
3621      JsonArray array = json.getAsJsonArray("searchParam");
3622      for (int i = 0; i < array.size(); i++) {
3623        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3624      }
3625    };
3626    if (json.has("operation")) {
3627      JsonArray array = json.getAsJsonArray("operation");
3628      for (int i = 0; i < array.size(); i++) {
3629        res.getOperation().add(parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject(), owner));
3630      }
3631    };
3632    if (json.has("compartment")) {
3633      JsonArray array = json.getAsJsonArray("compartment");
3634      for (int i = 0; i < array.size(); i++) {
3635        res.getCompartment().add(parseCanonical(array.get(i).getAsString()));
3636      }
3637    };
3638    if (json.has("_compartment")) {
3639      JsonArray array = json.getAsJsonArray("_compartment");
3640      for (int i = 0; i < array.size(); i++) {
3641        if (i == res.getCompartment().size())
3642          res.getCompartment().add(parseCanonical(null));
3643        if (array.get(i) instanceof JsonObject) 
3644          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
3645      }
3646    };
3647  }
3648
3649  protected CapabilityStatement.CapabilityStatementRestSecurityComponent parseCapabilityStatementCapabilityStatementRestSecurityComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3650    CapabilityStatement.CapabilityStatementRestSecurityComponent res = new CapabilityStatement.CapabilityStatementRestSecurityComponent();
3651    parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(json, owner, res);
3652    return res;
3653  }
3654
3655  protected void parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestSecurityComponent res) throws IOException, FHIRFormatError {
3656    parseBackboneElementProperties(json, res);
3657    if (json.has("cors"))
3658      res.setCorsElement(parseBoolean(json.get("cors").getAsBoolean()));
3659    if (json.has("_cors"))
3660      parseElementProperties(getJObject(json, "_cors"), res.getCorsElement());
3661    if (json.has("service")) {
3662      JsonArray array = json.getAsJsonArray("service");
3663      for (int i = 0; i < array.size(); i++) {
3664        res.getService().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3665      }
3666    };
3667    if (json.has("description"))
3668      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
3669    if (json.has("_description"))
3670      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3671  }
3672
3673  protected CapabilityStatement.CapabilityStatementRestResourceComponent parseCapabilityStatementCapabilityStatementRestResourceComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3674    CapabilityStatement.CapabilityStatementRestResourceComponent res = new CapabilityStatement.CapabilityStatementRestResourceComponent();
3675    parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(json, owner, res);
3676    return res;
3677  }
3678
3679  protected void parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceComponent res) throws IOException, FHIRFormatError {
3680    parseBackboneElementProperties(json, res);
3681    if (json.has("type"))
3682      res.setTypeElement(parseCode(json.get("type").getAsString()));
3683    if (json.has("_type"))
3684      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3685    if (json.has("profile"))
3686      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
3687    if (json.has("_profile"))
3688      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
3689    if (json.has("supportedProfile")) {
3690      JsonArray array = json.getAsJsonArray("supportedProfile");
3691      for (int i = 0; i < array.size(); i++) {
3692        res.getSupportedProfile().add(parseCanonical(array.get(i).getAsString()));
3693      }
3694    };
3695    if (json.has("_supportedProfile")) {
3696      JsonArray array = json.getAsJsonArray("_supportedProfile");
3697      for (int i = 0; i < array.size(); i++) {
3698        if (i == res.getSupportedProfile().size())
3699          res.getSupportedProfile().add(parseCanonical(null));
3700        if (array.get(i) instanceof JsonObject) 
3701          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportedProfile().get(i));
3702      }
3703    };
3704    if (json.has("documentation"))
3705      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3706    if (json.has("_documentation"))
3707      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3708    if (json.has("interaction")) {
3709      JsonArray array = json.getAsJsonArray("interaction");
3710      for (int i = 0; i < array.size(); i++) {
3711        res.getInteraction().add(parseCapabilityStatementResourceInteractionComponent(array.get(i).getAsJsonObject(), owner));
3712      }
3713    };
3714    if (json.has("versioning"))
3715      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), CapabilityStatement.ResourceVersionPolicy.NULL, new CapabilityStatement.ResourceVersionPolicyEnumFactory()));
3716    if (json.has("_versioning"))
3717      parseElementProperties(getJObject(json, "_versioning"), res.getVersioningElement());
3718    if (json.has("readHistory"))
3719      res.setReadHistoryElement(parseBoolean(json.get("readHistory").getAsBoolean()));
3720    if (json.has("_readHistory"))
3721      parseElementProperties(getJObject(json, "_readHistory"), res.getReadHistoryElement());
3722    if (json.has("updateCreate"))
3723      res.setUpdateCreateElement(parseBoolean(json.get("updateCreate").getAsBoolean()));
3724    if (json.has("_updateCreate"))
3725      parseElementProperties(getJObject(json, "_updateCreate"), res.getUpdateCreateElement());
3726    if (json.has("conditionalCreate"))
3727      res.setConditionalCreateElement(parseBoolean(json.get("conditionalCreate").getAsBoolean()));
3728    if (json.has("_conditionalCreate"))
3729      parseElementProperties(getJObject(json, "_conditionalCreate"), res.getConditionalCreateElement());
3730    if (json.has("conditionalRead"))
3731      res.setConditionalReadElement(parseEnumeration(json.get("conditionalRead").getAsString(), CapabilityStatement.ConditionalReadStatus.NULL, new CapabilityStatement.ConditionalReadStatusEnumFactory()));
3732    if (json.has("_conditionalRead"))
3733      parseElementProperties(getJObject(json, "_conditionalRead"), res.getConditionalReadElement());
3734    if (json.has("conditionalUpdate"))
3735      res.setConditionalUpdateElement(parseBoolean(json.get("conditionalUpdate").getAsBoolean()));
3736    if (json.has("_conditionalUpdate"))
3737      parseElementProperties(getJObject(json, "_conditionalUpdate"), res.getConditionalUpdateElement());
3738    if (json.has("conditionalDelete"))
3739      res.setConditionalDeleteElement(parseEnumeration(json.get("conditionalDelete").getAsString(), CapabilityStatement.ConditionalDeleteStatus.NULL, new CapabilityStatement.ConditionalDeleteStatusEnumFactory()));
3740    if (json.has("_conditionalDelete"))
3741      parseElementProperties(getJObject(json, "_conditionalDelete"), res.getConditionalDeleteElement());
3742    if (json.has("referencePolicy")) {
3743      JsonArray array = json.getAsJsonArray("referencePolicy");
3744      for (int i = 0; i < array.size(); i++) {
3745        res.getReferencePolicy().add(parseEnumeration(array.get(i).getAsString(), CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3746      }
3747    };
3748    if (json.has("_referencePolicy")) {
3749      JsonArray array = json.getAsJsonArray("_referencePolicy");
3750      for (int i = 0; i < array.size(); i++) {
3751        if (i == res.getReferencePolicy().size())
3752          res.getReferencePolicy().add(parseEnumeration(null, CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3753        if (array.get(i) instanceof JsonObject) 
3754          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferencePolicy().get(i));
3755      }
3756    };
3757    if (json.has("searchInclude")) {
3758      JsonArray array = json.getAsJsonArray("searchInclude");
3759      for (int i = 0; i < array.size(); i++) {
3760        res.getSearchInclude().add(parseString(array.get(i).getAsString()));
3761      }
3762    };
3763    if (json.has("_searchInclude")) {
3764      JsonArray array = json.getAsJsonArray("_searchInclude");
3765      for (int i = 0; i < array.size(); i++) {
3766        if (i == res.getSearchInclude().size())
3767          res.getSearchInclude().add(parseString(null));
3768        if (array.get(i) instanceof JsonObject) 
3769          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchInclude().get(i));
3770      }
3771    };
3772    if (json.has("searchRevInclude")) {
3773      JsonArray array = json.getAsJsonArray("searchRevInclude");
3774      for (int i = 0; i < array.size(); i++) {
3775        res.getSearchRevInclude().add(parseString(array.get(i).getAsString()));
3776      }
3777    };
3778    if (json.has("_searchRevInclude")) {
3779      JsonArray array = json.getAsJsonArray("_searchRevInclude");
3780      for (int i = 0; i < array.size(); i++) {
3781        if (i == res.getSearchRevInclude().size())
3782          res.getSearchRevInclude().add(parseString(null));
3783        if (array.get(i) instanceof JsonObject) 
3784          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchRevInclude().get(i));
3785      }
3786    };
3787    if (json.has("searchParam")) {
3788      JsonArray array = json.getAsJsonArray("searchParam");
3789      for (int i = 0; i < array.size(); i++) {
3790        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3791      }
3792    };
3793    if (json.has("operation")) {
3794      JsonArray array = json.getAsJsonArray("operation");
3795      for (int i = 0; i < array.size(); i++) {
3796        res.getOperation().add(parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject(), owner));
3797      }
3798    };
3799  }
3800
3801  protected CapabilityStatement.ResourceInteractionComponent parseCapabilityStatementResourceInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3802    CapabilityStatement.ResourceInteractionComponent res = new CapabilityStatement.ResourceInteractionComponent();
3803    parseCapabilityStatementResourceInteractionComponentProperties(json, owner, res);
3804    return res;
3805  }
3806
3807  protected void parseCapabilityStatementResourceInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.ResourceInteractionComponent res) throws IOException, FHIRFormatError {
3808    parseBackboneElementProperties(json, res);
3809    if (json.has("code"))
3810      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.TypeRestfulInteraction.NULL, new CapabilityStatement.TypeRestfulInteractionEnumFactory()));
3811    if (json.has("_code"))
3812      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
3813    if (json.has("documentation"))
3814      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3815    if (json.has("_documentation"))
3816      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3817  }
3818
3819  protected CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3820    CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
3821    parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(json, owner, res);
3822    return res;
3823  }
3824
3825  protected void parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res) throws IOException, FHIRFormatError {
3826    parseBackboneElementProperties(json, res);
3827    if (json.has("name"))
3828      res.setNameElement(parseString(json.get("name").getAsString()));
3829    if (json.has("_name"))
3830      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3831    if (json.has("definition"))
3832      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
3833    if (json.has("_definition"))
3834      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
3835    if (json.has("type"))
3836      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
3837    if (json.has("_type"))
3838      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3839    if (json.has("documentation"))
3840      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3841    if (json.has("_documentation"))
3842      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3843  }
3844
3845  protected CapabilityStatement.CapabilityStatementRestResourceOperationComponent parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3846    CapabilityStatement.CapabilityStatementRestResourceOperationComponent res = new CapabilityStatement.CapabilityStatementRestResourceOperationComponent();
3847    parseCapabilityStatementCapabilityStatementRestResourceOperationComponentProperties(json, owner, res);
3848    return res;
3849  }
3850
3851  protected void parseCapabilityStatementCapabilityStatementRestResourceOperationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceOperationComponent res) throws IOException, FHIRFormatError {
3852    parseBackboneElementProperties(json, res);
3853    if (json.has("name"))
3854      res.setNameElement(parseString(json.get("name").getAsString()));
3855    if (json.has("_name"))
3856      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3857    if (json.has("definition"))
3858      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
3859    if (json.has("_definition"))
3860      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
3861    if (json.has("documentation"))
3862      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3863    if (json.has("_documentation"))
3864      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3865  }
3866
3867  protected CapabilityStatement.SystemInteractionComponent parseCapabilityStatementSystemInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3868    CapabilityStatement.SystemInteractionComponent res = new CapabilityStatement.SystemInteractionComponent();
3869    parseCapabilityStatementSystemInteractionComponentProperties(json, owner, res);
3870    return res;
3871  }
3872
3873  protected void parseCapabilityStatementSystemInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.SystemInteractionComponent res) throws IOException, FHIRFormatError {
3874    parseBackboneElementProperties(json, res);
3875    if (json.has("code"))
3876      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.SystemRestfulInteraction.NULL, new CapabilityStatement.SystemRestfulInteractionEnumFactory()));
3877    if (json.has("_code"))
3878      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
3879    if (json.has("documentation"))
3880      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3881    if (json.has("_documentation"))
3882      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3883  }
3884
3885  protected CapabilityStatement.CapabilityStatementMessagingComponent parseCapabilityStatementCapabilityStatementMessagingComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3886    CapabilityStatement.CapabilityStatementMessagingComponent res = new CapabilityStatement.CapabilityStatementMessagingComponent();
3887    parseCapabilityStatementCapabilityStatementMessagingComponentProperties(json, owner, res);
3888    return res;
3889  }
3890
3891  protected void parseCapabilityStatementCapabilityStatementMessagingComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingComponent res) throws IOException, FHIRFormatError {
3892    parseBackboneElementProperties(json, res);
3893    if (json.has("endpoint")) {
3894      JsonArray array = json.getAsJsonArray("endpoint");
3895      for (int i = 0; i < array.size(); i++) {
3896        res.getEndpoint().add(parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(array.get(i).getAsJsonObject(), owner));
3897      }
3898    };
3899    if (json.has("reliableCache"))
3900      res.setReliableCacheElement(parseUnsignedInt(json.get("reliableCache").getAsString()));
3901    if (json.has("_reliableCache"))
3902      parseElementProperties(getJObject(json, "_reliableCache"), res.getReliableCacheElement());
3903    if (json.has("documentation"))
3904      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3905    if (json.has("_documentation"))
3906      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3907    if (json.has("supportedMessage")) {
3908      JsonArray array = json.getAsJsonArray("supportedMessage");
3909      for (int i = 0; i < array.size(); i++) {
3910        res.getSupportedMessage().add(parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(array.get(i).getAsJsonObject(), owner));
3911      }
3912    };
3913  }
3914
3915  protected CapabilityStatement.CapabilityStatementMessagingEndpointComponent parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3916    CapabilityStatement.CapabilityStatementMessagingEndpointComponent res = new CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
3917    parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(json, owner, res);
3918    return res;
3919  }
3920
3921  protected void parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingEndpointComponent res) throws IOException, FHIRFormatError {
3922    parseBackboneElementProperties(json, res);
3923    if (json.has("protocol"))
3924      res.setProtocol(parseCoding(getJObject(json, "protocol")));
3925    if (json.has("address"))
3926      res.setAddressElement(parseUrl(json.get("address").getAsString()));
3927    if (json.has("_address"))
3928      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
3929  }
3930
3931  protected CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3932    CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res = new CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
3933    parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(json, owner, res);
3934    return res;
3935  }
3936
3937  protected void parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res) throws IOException, FHIRFormatError {
3938    parseBackboneElementProperties(json, res);
3939    if (json.has("mode"))
3940      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
3941    if (json.has("_mode"))
3942      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
3943    if (json.has("definition"))
3944      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
3945    if (json.has("_definition"))
3946      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
3947  }
3948
3949  protected CapabilityStatement.CapabilityStatementDocumentComponent parseCapabilityStatementCapabilityStatementDocumentComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3950    CapabilityStatement.CapabilityStatementDocumentComponent res = new CapabilityStatement.CapabilityStatementDocumentComponent();
3951    parseCapabilityStatementCapabilityStatementDocumentComponentProperties(json, owner, res);
3952    return res;
3953  }
3954
3955  protected void parseCapabilityStatementCapabilityStatementDocumentComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementDocumentComponent res) throws IOException, FHIRFormatError {
3956    parseBackboneElementProperties(json, res);
3957    if (json.has("mode"))
3958      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.DocumentMode.NULL, new CapabilityStatement.DocumentModeEnumFactory()));
3959    if (json.has("_mode"))
3960      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
3961    if (json.has("documentation"))
3962      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3963    if (json.has("_documentation"))
3964      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3965    if (json.has("profile"))
3966      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
3967    if (json.has("_profile"))
3968      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
3969  }
3970
3971  protected CarePlan parseCarePlan(JsonObject json) throws IOException, FHIRFormatError {
3972    CarePlan res = new CarePlan();
3973    parseCarePlanProperties(json, res);
3974    return res;
3975  }
3976
3977  protected void parseCarePlanProperties(JsonObject json, CarePlan res) throws IOException, FHIRFormatError {
3978    parseDomainResourceProperties(json, res);
3979    if (json.has("identifier")) {
3980      JsonArray array = json.getAsJsonArray("identifier");
3981      for (int i = 0; i < array.size(); i++) {
3982        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3983      }
3984    };
3985    if (json.has("instantiatesCanonical")) {
3986      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
3987      for (int i = 0; i < array.size(); i++) {
3988        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
3989      }
3990    };
3991    if (json.has("_instantiatesCanonical")) {
3992      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
3993      for (int i = 0; i < array.size(); i++) {
3994        if (i == res.getInstantiatesCanonical().size())
3995          res.getInstantiatesCanonical().add(parseCanonical(null));
3996        if (array.get(i) instanceof JsonObject) 
3997          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
3998      }
3999    };
4000    if (json.has("instantiatesUri")) {
4001      JsonArray array = json.getAsJsonArray("instantiatesUri");
4002      for (int i = 0; i < array.size(); i++) {
4003        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
4004      }
4005    };
4006    if (json.has("_instantiatesUri")) {
4007      JsonArray array = json.getAsJsonArray("_instantiatesUri");
4008      for (int i = 0; i < array.size(); i++) {
4009        if (i == res.getInstantiatesUri().size())
4010          res.getInstantiatesUri().add(parseUri(null));
4011        if (array.get(i) instanceof JsonObject) 
4012          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
4013      }
4014    };
4015    if (json.has("basedOn")) {
4016      JsonArray array = json.getAsJsonArray("basedOn");
4017      for (int i = 0; i < array.size(); i++) {
4018        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
4019      }
4020    };
4021    if (json.has("replaces")) {
4022      JsonArray array = json.getAsJsonArray("replaces");
4023      for (int i = 0; i < array.size(); i++) {
4024        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
4025      }
4026    };
4027    if (json.has("partOf")) {
4028      JsonArray array = json.getAsJsonArray("partOf");
4029      for (int i = 0; i < array.size(); i++) {
4030        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
4031      }
4032    };
4033    if (json.has("status"))
4034      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanStatus.NULL, new CarePlan.CarePlanStatusEnumFactory()));
4035    if (json.has("_status"))
4036      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4037    if (json.has("intent"))
4038      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), CarePlan.CarePlanIntent.NULL, new CarePlan.CarePlanIntentEnumFactory()));
4039    if (json.has("_intent"))
4040      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
4041    if (json.has("category")) {
4042      JsonArray array = json.getAsJsonArray("category");
4043      for (int i = 0; i < array.size(); i++) {
4044        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4045      }
4046    };
4047    if (json.has("title"))
4048      res.setTitleElement(parseString(json.get("title").getAsString()));
4049    if (json.has("_title"))
4050      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
4051    if (json.has("description"))
4052      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4053    if (json.has("_description"))
4054      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4055    if (json.has("subject"))
4056      res.setSubject(parseReference(getJObject(json, "subject")));
4057    if (json.has("encounter"))
4058      res.setEncounter(parseReference(getJObject(json, "encounter")));
4059    if (json.has("period"))
4060      res.setPeriod(parsePeriod(getJObject(json, "period")));
4061    if (json.has("created"))
4062      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4063    if (json.has("_created"))
4064      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
4065    if (json.has("author"))
4066      res.setAuthor(parseReference(getJObject(json, "author")));
4067    if (json.has("contributor")) {
4068      JsonArray array = json.getAsJsonArray("contributor");
4069      for (int i = 0; i < array.size(); i++) {
4070        res.getContributor().add(parseReference(array.get(i).getAsJsonObject()));
4071      }
4072    };
4073    if (json.has("careTeam")) {
4074      JsonArray array = json.getAsJsonArray("careTeam");
4075      for (int i = 0; i < array.size(); i++) {
4076        res.getCareTeam().add(parseReference(array.get(i).getAsJsonObject()));
4077      }
4078    };
4079    if (json.has("addresses")) {
4080      JsonArray array = json.getAsJsonArray("addresses");
4081      for (int i = 0; i < array.size(); i++) {
4082        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
4083      }
4084    };
4085    if (json.has("supportingInfo")) {
4086      JsonArray array = json.getAsJsonArray("supportingInfo");
4087      for (int i = 0; i < array.size(); i++) {
4088        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
4089      }
4090    };
4091    if (json.has("goal")) {
4092      JsonArray array = json.getAsJsonArray("goal");
4093      for (int i = 0; i < array.size(); i++) {
4094        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
4095      }
4096    };
4097    if (json.has("activity")) {
4098      JsonArray array = json.getAsJsonArray("activity");
4099      for (int i = 0; i < array.size(); i++) {
4100        res.getActivity().add(parseCarePlanCarePlanActivityComponent(array.get(i).getAsJsonObject(), res));
4101      }
4102    };
4103    if (json.has("note")) {
4104      JsonArray array = json.getAsJsonArray("note");
4105      for (int i = 0; i < array.size(); i++) {
4106        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4107      }
4108    };
4109  }
4110
4111  protected CarePlan.CarePlanActivityComponent parseCarePlanCarePlanActivityComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
4112    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
4113    parseCarePlanCarePlanActivityComponentProperties(json, owner, res);
4114    return res;
4115  }
4116
4117  protected void parseCarePlanCarePlanActivityComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityComponent res) throws IOException, FHIRFormatError {
4118    parseBackboneElementProperties(json, res);
4119    if (json.has("outcomeCodeableConcept")) {
4120      JsonArray array = json.getAsJsonArray("outcomeCodeableConcept");
4121      for (int i = 0; i < array.size(); i++) {
4122        res.getOutcomeCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4123      }
4124    };
4125    if (json.has("outcomeReference")) {
4126      JsonArray array = json.getAsJsonArray("outcomeReference");
4127      for (int i = 0; i < array.size(); i++) {
4128        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
4129      }
4130    };
4131    if (json.has("progress")) {
4132      JsonArray array = json.getAsJsonArray("progress");
4133      for (int i = 0; i < array.size(); i++) {
4134        res.getProgress().add(parseAnnotation(array.get(i).getAsJsonObject()));
4135      }
4136    };
4137    if (json.has("reference"))
4138      res.setReference(parseReference(getJObject(json, "reference")));
4139    if (json.has("detail"))
4140      res.setDetail(parseCarePlanCarePlanActivityDetailComponent(getJObject(json, "detail"), owner));
4141  }
4142
4143  protected CarePlan.CarePlanActivityDetailComponent parseCarePlanCarePlanActivityDetailComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
4144    CarePlan.CarePlanActivityDetailComponent res = new CarePlan.CarePlanActivityDetailComponent();
4145    parseCarePlanCarePlanActivityDetailComponentProperties(json, owner, res);
4146    return res;
4147  }
4148
4149  protected void parseCarePlanCarePlanActivityDetailComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityDetailComponent res) throws IOException, FHIRFormatError {
4150    parseBackboneElementProperties(json, res);
4151    if (json.has("kind"))
4152      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CarePlan.CarePlanActivityKind.NULL, new CarePlan.CarePlanActivityKindEnumFactory()));
4153    if (json.has("_kind"))
4154      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
4155    if (json.has("instantiatesCanonical")) {
4156      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
4157      for (int i = 0; i < array.size(); i++) {
4158        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
4159      }
4160    };
4161    if (json.has("_instantiatesCanonical")) {
4162      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
4163      for (int i = 0; i < array.size(); i++) {
4164        if (i == res.getInstantiatesCanonical().size())
4165          res.getInstantiatesCanonical().add(parseCanonical(null));
4166        if (array.get(i) instanceof JsonObject) 
4167          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
4168      }
4169    };
4170    if (json.has("instantiatesUri")) {
4171      JsonArray array = json.getAsJsonArray("instantiatesUri");
4172      for (int i = 0; i < array.size(); i++) {
4173        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
4174      }
4175    };
4176    if (json.has("_instantiatesUri")) {
4177      JsonArray array = json.getAsJsonArray("_instantiatesUri");
4178      for (int i = 0; i < array.size(); i++) {
4179        if (i == res.getInstantiatesUri().size())
4180          res.getInstantiatesUri().add(parseUri(null));
4181        if (array.get(i) instanceof JsonObject) 
4182          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
4183      }
4184    };
4185    if (json.has("code"))
4186      res.setCode(parseCodeableConcept(getJObject(json, "code")));
4187    if (json.has("reasonCode")) {
4188      JsonArray array = json.getAsJsonArray("reasonCode");
4189      for (int i = 0; i < array.size(); i++) {
4190        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4191      }
4192    };
4193    if (json.has("reasonReference")) {
4194      JsonArray array = json.getAsJsonArray("reasonReference");
4195      for (int i = 0; i < array.size(); i++) {
4196        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
4197      }
4198    };
4199    if (json.has("goal")) {
4200      JsonArray array = json.getAsJsonArray("goal");
4201      for (int i = 0; i < array.size(); i++) {
4202        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
4203      }
4204    };
4205    if (json.has("status"))
4206      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanActivityStatus.NULL, new CarePlan.CarePlanActivityStatusEnumFactory()));
4207    if (json.has("_status"))
4208      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4209    if (json.has("statusReason"))
4210      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
4211    if (json.has("doNotPerform"))
4212      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
4213    if (json.has("_doNotPerform"))
4214      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
4215    Type scheduled = parseType("scheduled", json);
4216    if (scheduled != null)
4217      res.setScheduled(scheduled);
4218    if (json.has("location"))
4219      res.setLocation(parseReference(getJObject(json, "location")));
4220    if (json.has("performer")) {
4221      JsonArray array = json.getAsJsonArray("performer");
4222      for (int i = 0; i < array.size(); i++) {
4223        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
4224      }
4225    };
4226    Type product = parseType("product", json);
4227    if (product != null)
4228      res.setProduct(product);
4229    if (json.has("dailyAmount"))
4230      res.setDailyAmount(parseQuantity(getJObject(json, "dailyAmount")));
4231    if (json.has("quantity"))
4232      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
4233    if (json.has("description"))
4234      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4235    if (json.has("_description"))
4236      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4237  }
4238
4239  protected CareTeam parseCareTeam(JsonObject json) throws IOException, FHIRFormatError {
4240    CareTeam res = new CareTeam();
4241    parseCareTeamProperties(json, res);
4242    return res;
4243  }
4244
4245  protected void parseCareTeamProperties(JsonObject json, CareTeam res) throws IOException, FHIRFormatError {
4246    parseDomainResourceProperties(json, res);
4247    if (json.has("identifier")) {
4248      JsonArray array = json.getAsJsonArray("identifier");
4249      for (int i = 0; i < array.size(); i++) {
4250        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4251      }
4252    };
4253    if (json.has("status"))
4254      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CareTeam.CareTeamStatus.NULL, new CareTeam.CareTeamStatusEnumFactory()));
4255    if (json.has("_status"))
4256      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4257    if (json.has("category")) {
4258      JsonArray array = json.getAsJsonArray("category");
4259      for (int i = 0; i < array.size(); i++) {
4260        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4261      }
4262    };
4263    if (json.has("name"))
4264      res.setNameElement(parseString(json.get("name").getAsString()));
4265    if (json.has("_name"))
4266      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4267    if (json.has("subject"))
4268      res.setSubject(parseReference(getJObject(json, "subject")));
4269    if (json.has("encounter"))
4270      res.setEncounter(parseReference(getJObject(json, "encounter")));
4271    if (json.has("period"))
4272      res.setPeriod(parsePeriod(getJObject(json, "period")));
4273    if (json.has("participant")) {
4274      JsonArray array = json.getAsJsonArray("participant");
4275      for (int i = 0; i < array.size(); i++) {
4276        res.getParticipant().add(parseCareTeamCareTeamParticipantComponent(array.get(i).getAsJsonObject(), res));
4277      }
4278    };
4279    if (json.has("reasonCode")) {
4280      JsonArray array = json.getAsJsonArray("reasonCode");
4281      for (int i = 0; i < array.size(); i++) {
4282        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4283      }
4284    };
4285    if (json.has("reasonReference")) {
4286      JsonArray array = json.getAsJsonArray("reasonReference");
4287      for (int i = 0; i < array.size(); i++) {
4288        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
4289      }
4290    };
4291    if (json.has("managingOrganization")) {
4292      JsonArray array = json.getAsJsonArray("managingOrganization");
4293      for (int i = 0; i < array.size(); i++) {
4294        res.getManagingOrganization().add(parseReference(array.get(i).getAsJsonObject()));
4295      }
4296    };
4297    if (json.has("telecom")) {
4298      JsonArray array = json.getAsJsonArray("telecom");
4299      for (int i = 0; i < array.size(); i++) {
4300        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
4301      }
4302    };
4303    if (json.has("note")) {
4304      JsonArray array = json.getAsJsonArray("note");
4305      for (int i = 0; i < array.size(); i++) {
4306        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4307      }
4308    };
4309  }
4310
4311  protected CareTeam.CareTeamParticipantComponent parseCareTeamCareTeamParticipantComponent(JsonObject json, CareTeam owner) throws IOException, FHIRFormatError {
4312    CareTeam.CareTeamParticipantComponent res = new CareTeam.CareTeamParticipantComponent();
4313    parseCareTeamCareTeamParticipantComponentProperties(json, owner, res);
4314    return res;
4315  }
4316
4317  protected void parseCareTeamCareTeamParticipantComponentProperties(JsonObject json, CareTeam owner, CareTeam.CareTeamParticipantComponent res) throws IOException, FHIRFormatError {
4318    parseBackboneElementProperties(json, res);
4319    if (json.has("role")) {
4320      JsonArray array = json.getAsJsonArray("role");
4321      for (int i = 0; i < array.size(); i++) {
4322        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4323      }
4324    };
4325    if (json.has("member"))
4326      res.setMember(parseReference(getJObject(json, "member")));
4327    if (json.has("onBehalfOf"))
4328      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
4329    if (json.has("period"))
4330      res.setPeriod(parsePeriod(getJObject(json, "period")));
4331  }
4332
4333  protected CatalogEntry parseCatalogEntry(JsonObject json) throws IOException, FHIRFormatError {
4334    CatalogEntry res = new CatalogEntry();
4335    parseCatalogEntryProperties(json, res);
4336    return res;
4337  }
4338
4339  protected void parseCatalogEntryProperties(JsonObject json, CatalogEntry res) throws IOException, FHIRFormatError {
4340    parseDomainResourceProperties(json, res);
4341    if (json.has("identifier")) {
4342      JsonArray array = json.getAsJsonArray("identifier");
4343      for (int i = 0; i < array.size(); i++) {
4344        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4345      }
4346    };
4347    if (json.has("type"))
4348      res.setType(parseCodeableConcept(getJObject(json, "type")));
4349    if (json.has("orderable"))
4350      res.setOrderableElement(parseBoolean(json.get("orderable").getAsBoolean()));
4351    if (json.has("_orderable"))
4352      parseElementProperties(getJObject(json, "_orderable"), res.getOrderableElement());
4353    if (json.has("referencedItem"))
4354      res.setReferencedItem(parseReference(getJObject(json, "referencedItem")));
4355    if (json.has("additionalIdentifier")) {
4356      JsonArray array = json.getAsJsonArray("additionalIdentifier");
4357      for (int i = 0; i < array.size(); i++) {
4358        res.getAdditionalIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4359      }
4360    };
4361    if (json.has("classification")) {
4362      JsonArray array = json.getAsJsonArray("classification");
4363      for (int i = 0; i < array.size(); i++) {
4364        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4365      }
4366    };
4367    if (json.has("status"))
4368      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
4369    if (json.has("_status"))
4370      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4371    if (json.has("validityPeriod"))
4372      res.setValidityPeriod(parsePeriod(getJObject(json, "validityPeriod")));
4373    if (json.has("validTo"))
4374      res.setValidToElement(parseDateTime(json.get("validTo").getAsString()));
4375    if (json.has("_validTo"))
4376      parseElementProperties(getJObject(json, "_validTo"), res.getValidToElement());
4377    if (json.has("lastUpdated"))
4378      res.setLastUpdatedElement(parseDateTime(json.get("lastUpdated").getAsString()));
4379    if (json.has("_lastUpdated"))
4380      parseElementProperties(getJObject(json, "_lastUpdated"), res.getLastUpdatedElement());
4381    if (json.has("additionalCharacteristic")) {
4382      JsonArray array = json.getAsJsonArray("additionalCharacteristic");
4383      for (int i = 0; i < array.size(); i++) {
4384        res.getAdditionalCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4385      }
4386    };
4387    if (json.has("additionalClassification")) {
4388      JsonArray array = json.getAsJsonArray("additionalClassification");
4389      for (int i = 0; i < array.size(); i++) {
4390        res.getAdditionalClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4391      }
4392    };
4393    if (json.has("relatedEntry")) {
4394      JsonArray array = json.getAsJsonArray("relatedEntry");
4395      for (int i = 0; i < array.size(); i++) {
4396        res.getRelatedEntry().add(parseCatalogEntryCatalogEntryRelatedEntryComponent(array.get(i).getAsJsonObject(), res));
4397      }
4398    };
4399  }
4400
4401  protected CatalogEntry.CatalogEntryRelatedEntryComponent parseCatalogEntryCatalogEntryRelatedEntryComponent(JsonObject json, CatalogEntry owner) throws IOException, FHIRFormatError {
4402    CatalogEntry.CatalogEntryRelatedEntryComponent res = new CatalogEntry.CatalogEntryRelatedEntryComponent();
4403    parseCatalogEntryCatalogEntryRelatedEntryComponentProperties(json, owner, res);
4404    return res;
4405  }
4406
4407  protected void parseCatalogEntryCatalogEntryRelatedEntryComponentProperties(JsonObject json, CatalogEntry owner, CatalogEntry.CatalogEntryRelatedEntryComponent res) throws IOException, FHIRFormatError {
4408    parseBackboneElementProperties(json, res);
4409    if (json.has("relationtype"))
4410      res.setRelationtypeElement(parseEnumeration(json.get("relationtype").getAsString(), CatalogEntry.CatalogEntryRelationType.NULL, new CatalogEntry.CatalogEntryRelationTypeEnumFactory()));
4411    if (json.has("_relationtype"))
4412      parseElementProperties(getJObject(json, "_relationtype"), res.getRelationtypeElement());
4413    if (json.has("item"))
4414      res.setItem(parseReference(getJObject(json, "item")));
4415  }
4416
4417  protected ChargeItem parseChargeItem(JsonObject json) throws IOException, FHIRFormatError {
4418    ChargeItem res = new ChargeItem();
4419    parseChargeItemProperties(json, res);
4420    return res;
4421  }
4422
4423  protected void parseChargeItemProperties(JsonObject json, ChargeItem res) throws IOException, FHIRFormatError {
4424    parseDomainResourceProperties(json, res);
4425    if (json.has("identifier")) {
4426      JsonArray array = json.getAsJsonArray("identifier");
4427      for (int i = 0; i < array.size(); i++) {
4428        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4429      }
4430    };
4431    if (json.has("definitionUri")) {
4432      JsonArray array = json.getAsJsonArray("definitionUri");
4433      for (int i = 0; i < array.size(); i++) {
4434        res.getDefinitionUri().add(parseUri(array.get(i).getAsString()));
4435      }
4436    };
4437    if (json.has("_definitionUri")) {
4438      JsonArray array = json.getAsJsonArray("_definitionUri");
4439      for (int i = 0; i < array.size(); i++) {
4440        if (i == res.getDefinitionUri().size())
4441          res.getDefinitionUri().add(parseUri(null));
4442        if (array.get(i) instanceof JsonObject) 
4443          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionUri().get(i));
4444      }
4445    };
4446    if (json.has("definitionCanonical")) {
4447      JsonArray array = json.getAsJsonArray("definitionCanonical");
4448      for (int i = 0; i < array.size(); i++) {
4449        res.getDefinitionCanonical().add(parseCanonical(array.get(i).getAsString()));
4450      }
4451    };
4452    if (json.has("_definitionCanonical")) {
4453      JsonArray array = json.getAsJsonArray("_definitionCanonical");
4454      for (int i = 0; i < array.size(); i++) {
4455        if (i == res.getDefinitionCanonical().size())
4456          res.getDefinitionCanonical().add(parseCanonical(null));
4457        if (array.get(i) instanceof JsonObject) 
4458          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionCanonical().get(i));
4459      }
4460    };
4461    if (json.has("status"))
4462      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ChargeItem.ChargeItemStatus.NULL, new ChargeItem.ChargeItemStatusEnumFactory()));
4463    if (json.has("_status"))
4464      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4465    if (json.has("partOf")) {
4466      JsonArray array = json.getAsJsonArray("partOf");
4467      for (int i = 0; i < array.size(); i++) {
4468        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
4469      }
4470    };
4471    if (json.has("code"))
4472      res.setCode(parseCodeableConcept(getJObject(json, "code")));
4473    if (json.has("subject"))
4474      res.setSubject(parseReference(getJObject(json, "subject")));
4475    if (json.has("context"))
4476      res.setContext(parseReference(getJObject(json, "context")));
4477    Type occurrence = parseType("occurrence", json);
4478    if (occurrence != null)
4479      res.setOccurrence(occurrence);
4480    if (json.has("performer")) {
4481      JsonArray array = json.getAsJsonArray("performer");
4482      for (int i = 0; i < array.size(); i++) {
4483        res.getPerformer().add(parseChargeItemChargeItemPerformerComponent(array.get(i).getAsJsonObject(), res));
4484      }
4485    };
4486    if (json.has("performingOrganization"))
4487      res.setPerformingOrganization(parseReference(getJObject(json, "performingOrganization")));
4488    if (json.has("requestingOrganization"))
4489      res.setRequestingOrganization(parseReference(getJObject(json, "requestingOrganization")));
4490    if (json.has("costCenter"))
4491      res.setCostCenter(parseReference(getJObject(json, "costCenter")));
4492    if (json.has("quantity"))
4493      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
4494    if (json.has("bodysite")) {
4495      JsonArray array = json.getAsJsonArray("bodysite");
4496      for (int i = 0; i < array.size(); i++) {
4497        res.getBodysite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4498      }
4499    };
4500    if (json.has("factorOverride"))
4501      res.setFactorOverrideElement(parseDecimal(json.get("factorOverride").getAsBigDecimal()));
4502    if (json.has("_factorOverride"))
4503      parseElementProperties(getJObject(json, "_factorOverride"), res.getFactorOverrideElement());
4504    if (json.has("priceOverride"))
4505      res.setPriceOverride(parseMoney(getJObject(json, "priceOverride")));
4506    if (json.has("overrideReason"))
4507      res.setOverrideReasonElement(parseString(json.get("overrideReason").getAsString()));
4508    if (json.has("_overrideReason"))
4509      parseElementProperties(getJObject(json, "_overrideReason"), res.getOverrideReasonElement());
4510    if (json.has("enterer"))
4511      res.setEnterer(parseReference(getJObject(json, "enterer")));
4512    if (json.has("enteredDate"))
4513      res.setEnteredDateElement(parseDateTime(json.get("enteredDate").getAsString()));
4514    if (json.has("_enteredDate"))
4515      parseElementProperties(getJObject(json, "_enteredDate"), res.getEnteredDateElement());
4516    if (json.has("reason")) {
4517      JsonArray array = json.getAsJsonArray("reason");
4518      for (int i = 0; i < array.size(); i++) {
4519        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4520      }
4521    };
4522    if (json.has("service")) {
4523      JsonArray array = json.getAsJsonArray("service");
4524      for (int i = 0; i < array.size(); i++) {
4525        res.getService().add(parseReference(array.get(i).getAsJsonObject()));
4526      }
4527    };
4528    Type product = parseType("product", json);
4529    if (product != null)
4530      res.setProduct(product);
4531    if (json.has("account")) {
4532      JsonArray array = json.getAsJsonArray("account");
4533      for (int i = 0; i < array.size(); i++) {
4534        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
4535      }
4536    };
4537    if (json.has("note")) {
4538      JsonArray array = json.getAsJsonArray("note");
4539      for (int i = 0; i < array.size(); i++) {
4540        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4541      }
4542    };
4543    if (json.has("supportingInformation")) {
4544      JsonArray array = json.getAsJsonArray("supportingInformation");
4545      for (int i = 0; i < array.size(); i++) {
4546        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
4547      }
4548    };
4549  }
4550
4551  protected ChargeItem.ChargeItemPerformerComponent parseChargeItemChargeItemPerformerComponent(JsonObject json, ChargeItem owner) throws IOException, FHIRFormatError {
4552    ChargeItem.ChargeItemPerformerComponent res = new ChargeItem.ChargeItemPerformerComponent();
4553    parseChargeItemChargeItemPerformerComponentProperties(json, owner, res);
4554    return res;
4555  }
4556
4557  protected void parseChargeItemChargeItemPerformerComponentProperties(JsonObject json, ChargeItem owner, ChargeItem.ChargeItemPerformerComponent res) throws IOException, FHIRFormatError {
4558    parseBackboneElementProperties(json, res);
4559    if (json.has("function"))
4560      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
4561    if (json.has("actor"))
4562      res.setActor(parseReference(getJObject(json, "actor")));
4563  }
4564
4565  protected ChargeItemDefinition parseChargeItemDefinition(JsonObject json) throws IOException, FHIRFormatError {
4566    ChargeItemDefinition res = new ChargeItemDefinition();
4567    parseChargeItemDefinitionProperties(json, res);
4568    return res;
4569  }
4570
4571  protected void parseChargeItemDefinitionProperties(JsonObject json, ChargeItemDefinition res) throws IOException, FHIRFormatError {
4572    parseDomainResourceProperties(json, res);
4573    if (json.has("url"))
4574      res.setUrlElement(parseUri(json.get("url").getAsString()));
4575    if (json.has("_url"))
4576      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
4577    if (json.has("identifier")) {
4578      JsonArray array = json.getAsJsonArray("identifier");
4579      for (int i = 0; i < array.size(); i++) {
4580        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4581      }
4582    };
4583    if (json.has("version"))
4584      res.setVersionElement(parseString(json.get("version").getAsString()));
4585    if (json.has("_version"))
4586      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
4587    if (json.has("title"))
4588      res.setTitleElement(parseString(json.get("title").getAsString()));
4589    if (json.has("_title"))
4590      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
4591    if (json.has("derivedFromUri")) {
4592      JsonArray array = json.getAsJsonArray("derivedFromUri");
4593      for (int i = 0; i < array.size(); i++) {
4594        res.getDerivedFromUri().add(parseUri(array.get(i).getAsString()));
4595      }
4596    };
4597    if (json.has("_derivedFromUri")) {
4598      JsonArray array = json.getAsJsonArray("_derivedFromUri");
4599      for (int i = 0; i < array.size(); i++) {
4600        if (i == res.getDerivedFromUri().size())
4601          res.getDerivedFromUri().add(parseUri(null));
4602        if (array.get(i) instanceof JsonObject) 
4603          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromUri().get(i));
4604      }
4605    };
4606    if (json.has("partOf")) {
4607      JsonArray array = json.getAsJsonArray("partOf");
4608      for (int i = 0; i < array.size(); i++) {
4609        res.getPartOf().add(parseCanonical(array.get(i).getAsString()));
4610      }
4611    };
4612    if (json.has("_partOf")) {
4613      JsonArray array = json.getAsJsonArray("_partOf");
4614      for (int i = 0; i < array.size(); i++) {
4615        if (i == res.getPartOf().size())
4616          res.getPartOf().add(parseCanonical(null));
4617        if (array.get(i) instanceof JsonObject) 
4618          parseElementProperties(array.get(i).getAsJsonObject(), res.getPartOf().get(i));
4619      }
4620    };
4621    if (json.has("replaces")) {
4622      JsonArray array = json.getAsJsonArray("replaces");
4623      for (int i = 0; i < array.size(); i++) {
4624        res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
4625      }
4626    };
4627    if (json.has("_replaces")) {
4628      JsonArray array = json.getAsJsonArray("_replaces");
4629      for (int i = 0; i < array.size(); i++) {
4630        if (i == res.getReplaces().size())
4631          res.getReplaces().add(parseCanonical(null));
4632        if (array.get(i) instanceof JsonObject) 
4633          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
4634      }
4635    };
4636    if (json.has("status"))
4637      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
4638    if (json.has("_status"))
4639      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4640    if (json.has("experimental"))
4641      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
4642    if (json.has("_experimental"))
4643      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
4644    if (json.has("date"))
4645      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4646    if (json.has("_date"))
4647      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
4648    if (json.has("publisher"))
4649      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
4650    if (json.has("_publisher"))
4651      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
4652    if (json.has("contact")) {
4653      JsonArray array = json.getAsJsonArray("contact");
4654      for (int i = 0; i < array.size(); i++) {
4655        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
4656      }
4657    };
4658    if (json.has("description"))
4659      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
4660    if (json.has("_description"))
4661      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4662    if (json.has("useContext")) {
4663      JsonArray array = json.getAsJsonArray("useContext");
4664      for (int i = 0; i < array.size(); i++) {
4665        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
4666      }
4667    };
4668    if (json.has("jurisdiction")) {
4669      JsonArray array = json.getAsJsonArray("jurisdiction");
4670      for (int i = 0; i < array.size(); i++) {
4671        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4672      }
4673    };
4674    if (json.has("copyright"))
4675      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
4676    if (json.has("_copyright"))
4677      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
4678    if (json.has("approvalDate"))
4679      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
4680    if (json.has("_approvalDate"))
4681      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
4682    if (json.has("lastReviewDate"))
4683      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
4684    if (json.has("_lastReviewDate"))
4685      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
4686    if (json.has("effectivePeriod"))
4687      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
4688    if (json.has("code"))
4689      res.setCode(parseCodeableConcept(getJObject(json, "code")));
4690    if (json.has("instance")) {
4691      JsonArray array = json.getAsJsonArray("instance");
4692      for (int i = 0; i < array.size(); i++) {
4693        res.getInstance().add(parseReference(array.get(i).getAsJsonObject()));
4694      }
4695    };
4696    if (json.has("applicability")) {
4697      JsonArray array = json.getAsJsonArray("applicability");
4698      for (int i = 0; i < array.size(); i++) {
4699        res.getApplicability().add(parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject(), res));
4700      }
4701    };
4702    if (json.has("propertyGroup")) {
4703      JsonArray array = json.getAsJsonArray("propertyGroup");
4704      for (int i = 0; i < array.size(); i++) {
4705        res.getPropertyGroup().add(parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(array.get(i).getAsJsonObject(), res));
4706      }
4707    };
4708  }
4709
4710  protected ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(JsonObject json, ChargeItemDefinition owner) throws IOException, FHIRFormatError {
4711    ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res = new ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent();
4712    parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponentProperties(json, owner, res);
4713    return res;
4714  }
4715
4716  protected void parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponentProperties(JsonObject json, ChargeItemDefinition owner, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res) throws IOException, FHIRFormatError {
4717    parseBackboneElementProperties(json, res);
4718    if (json.has("description"))
4719      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4720    if (json.has("_description"))
4721      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4722    if (json.has("language"))
4723      res.setLanguageElement(parseString(json.get("language").getAsString()));
4724    if (json.has("_language"))
4725      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
4726    if (json.has("expression"))
4727      res.setExpressionElement(parseString(json.get("expression").getAsString()));
4728    if (json.has("_expression"))
4729      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
4730  }
4731
4732  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(JsonObject json, ChargeItemDefinition owner) throws IOException, FHIRFormatError {
4733    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent();
4734    parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentProperties(json, owner, res);
4735    return res;
4736  }
4737
4738  protected void parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentProperties(JsonObject json, ChargeItemDefinition owner, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res) throws IOException, FHIRFormatError {
4739    parseBackboneElementProperties(json, res);
4740    if (json.has("applicability")) {
4741      JsonArray array = json.getAsJsonArray("applicability");
4742      for (int i = 0; i < array.size(); i++) {
4743        res.getApplicability().add(parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject(), owner));
4744      }
4745    };
4746    if (json.has("priceComponent")) {
4747      JsonArray array = json.getAsJsonArray("priceComponent");
4748      for (int i = 0; i < array.size(); i++) {
4749        res.getPriceComponent().add(parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(array.get(i).getAsJsonObject(), owner));
4750      }
4751    };
4752  }
4753
4754  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(JsonObject json, ChargeItemDefinition owner) throws IOException, FHIRFormatError {
4755    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent();
4756    parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(json, owner, res);
4757    return res;
4758  }
4759
4760  protected void parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(JsonObject json, ChargeItemDefinition owner, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res) throws IOException, FHIRFormatError {
4761    parseBackboneElementProperties(json, res);
4762    if (json.has("type"))
4763      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.NULL, new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory()));
4764    if (json.has("_type"))
4765      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
4766    if (json.has("code"))
4767      res.setCode(parseCodeableConcept(getJObject(json, "code")));
4768    if (json.has("factor"))
4769      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4770    if (json.has("_factor"))
4771      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
4772    if (json.has("amount"))
4773      res.setAmount(parseMoney(getJObject(json, "amount")));
4774  }
4775
4776  protected Claim parseClaim(JsonObject json) throws IOException, FHIRFormatError {
4777    Claim res = new Claim();
4778    parseClaimProperties(json, res);
4779    return res;
4780  }
4781
4782  protected void parseClaimProperties(JsonObject json, Claim res) throws IOException, FHIRFormatError {
4783    parseDomainResourceProperties(json, res);
4784    if (json.has("identifier")) {
4785      JsonArray array = json.getAsJsonArray("identifier");
4786      for (int i = 0; i < array.size(); i++) {
4787        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4788      }
4789    };
4790    if (json.has("status"))
4791      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Claim.ClaimStatus.NULL, new Claim.ClaimStatusEnumFactory()));
4792    if (json.has("_status"))
4793      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4794    if (json.has("type"))
4795      res.setType(parseCodeableConcept(getJObject(json, "type")));
4796    if (json.has("subType"))
4797      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
4798    if (json.has("use"))
4799      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Claim.Use.NULL, new Claim.UseEnumFactory()));
4800    if (json.has("_use"))
4801      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
4802    if (json.has("patient"))
4803      res.setPatient(parseReference(getJObject(json, "patient")));
4804    if (json.has("billablePeriod"))
4805      res.setBillablePeriod(parsePeriod(getJObject(json, "billablePeriod")));
4806    if (json.has("created"))
4807      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4808    if (json.has("_created"))
4809      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
4810    if (json.has("enterer"))
4811      res.setEnterer(parseReference(getJObject(json, "enterer")));
4812    if (json.has("insurer"))
4813      res.setInsurer(parseReference(getJObject(json, "insurer")));
4814    if (json.has("provider"))
4815      res.setProvider(parseReference(getJObject(json, "provider")));
4816    if (json.has("priority"))
4817      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
4818    if (json.has("fundsReserve"))
4819      res.setFundsReserve(parseCodeableConcept(getJObject(json, "fundsReserve")));
4820    if (json.has("related")) {
4821      JsonArray array = json.getAsJsonArray("related");
4822      for (int i = 0; i < array.size(); i++) {
4823        res.getRelated().add(parseClaimRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
4824      }
4825    };
4826    if (json.has("prescription"))
4827      res.setPrescription(parseReference(getJObject(json, "prescription")));
4828    if (json.has("originalPrescription"))
4829      res.setOriginalPrescription(parseReference(getJObject(json, "originalPrescription")));
4830    if (json.has("payee"))
4831      res.setPayee(parseClaimPayeeComponent(getJObject(json, "payee"), res));
4832    if (json.has("referral"))
4833      res.setReferral(parseReference(getJObject(json, "referral")));
4834    if (json.has("facility"))
4835      res.setFacility(parseReference(getJObject(json, "facility")));
4836    if (json.has("careTeam")) {
4837      JsonArray array = json.getAsJsonArray("careTeam");
4838      for (int i = 0; i < array.size(); i++) {
4839        res.getCareTeam().add(parseClaimCareTeamComponent(array.get(i).getAsJsonObject(), res));
4840      }
4841    };
4842    if (json.has("supportingInfo")) {
4843      JsonArray array = json.getAsJsonArray("supportingInfo");
4844      for (int i = 0; i < array.size(); i++) {
4845        res.getSupportingInfo().add(parseClaimSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
4846      }
4847    };
4848    if (json.has("diagnosis")) {
4849      JsonArray array = json.getAsJsonArray("diagnosis");
4850      for (int i = 0; i < array.size(); i++) {
4851        res.getDiagnosis().add(parseClaimDiagnosisComponent(array.get(i).getAsJsonObject(), res));
4852      }
4853    };
4854    if (json.has("procedure")) {
4855      JsonArray array = json.getAsJsonArray("procedure");
4856      for (int i = 0; i < array.size(); i++) {
4857        res.getProcedure().add(parseClaimProcedureComponent(array.get(i).getAsJsonObject(), res));
4858      }
4859    };
4860    if (json.has("insurance")) {
4861      JsonArray array = json.getAsJsonArray("insurance");
4862      for (int i = 0; i < array.size(); i++) {
4863        res.getInsurance().add(parseClaimInsuranceComponent(array.get(i).getAsJsonObject(), res));
4864      }
4865    };
4866    if (json.has("accident"))
4867      res.setAccident(parseClaimAccidentComponent(getJObject(json, "accident"), res));
4868    if (json.has("item")) {
4869      JsonArray array = json.getAsJsonArray("item");
4870      for (int i = 0; i < array.size(); i++) {
4871        res.getItem().add(parseClaimItemComponent(array.get(i).getAsJsonObject(), res));
4872      }
4873    };
4874    if (json.has("total"))
4875      res.setTotal(parseMoney(getJObject(json, "total")));
4876  }
4877
4878  protected Claim.RelatedClaimComponent parseClaimRelatedClaimComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4879    Claim.RelatedClaimComponent res = new Claim.RelatedClaimComponent();
4880    parseClaimRelatedClaimComponentProperties(json, owner, res);
4881    return res;
4882  }
4883
4884  protected void parseClaimRelatedClaimComponentProperties(JsonObject json, Claim owner, Claim.RelatedClaimComponent res) throws IOException, FHIRFormatError {
4885    parseBackboneElementProperties(json, res);
4886    if (json.has("claim"))
4887      res.setClaim(parseReference(getJObject(json, "claim")));
4888    if (json.has("relationship"))
4889      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
4890    if (json.has("reference"))
4891      res.setReference(parseIdentifier(getJObject(json, "reference")));
4892  }
4893
4894  protected Claim.PayeeComponent parseClaimPayeeComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4895    Claim.PayeeComponent res = new Claim.PayeeComponent();
4896    parseClaimPayeeComponentProperties(json, owner, res);
4897    return res;
4898  }
4899
4900  protected void parseClaimPayeeComponentProperties(JsonObject json, Claim owner, Claim.PayeeComponent res) throws IOException, FHIRFormatError {
4901    parseBackboneElementProperties(json, res);
4902    if (json.has("type"))
4903      res.setType(parseCodeableConcept(getJObject(json, "type")));
4904    if (json.has("party"))
4905      res.setParty(parseReference(getJObject(json, "party")));
4906  }
4907
4908  protected Claim.CareTeamComponent parseClaimCareTeamComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4909    Claim.CareTeamComponent res = new Claim.CareTeamComponent();
4910    parseClaimCareTeamComponentProperties(json, owner, res);
4911    return res;
4912  }
4913
4914  protected void parseClaimCareTeamComponentProperties(JsonObject json, Claim owner, Claim.CareTeamComponent res) throws IOException, FHIRFormatError {
4915    parseBackboneElementProperties(json, res);
4916    if (json.has("sequence"))
4917      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4918    if (json.has("_sequence"))
4919      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4920    if (json.has("provider"))
4921      res.setProvider(parseReference(getJObject(json, "provider")));
4922    if (json.has("responsible"))
4923      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
4924    if (json.has("_responsible"))
4925      parseElementProperties(getJObject(json, "_responsible"), res.getResponsibleElement());
4926    if (json.has("role"))
4927      res.setRole(parseCodeableConcept(getJObject(json, "role")));
4928    if (json.has("qualification"))
4929      res.setQualification(parseCodeableConcept(getJObject(json, "qualification")));
4930  }
4931
4932  protected Claim.SupportingInformationComponent parseClaimSupportingInformationComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4933    Claim.SupportingInformationComponent res = new Claim.SupportingInformationComponent();
4934    parseClaimSupportingInformationComponentProperties(json, owner, res);
4935    return res;
4936  }
4937
4938  protected void parseClaimSupportingInformationComponentProperties(JsonObject json, Claim owner, Claim.SupportingInformationComponent res) throws IOException, FHIRFormatError {
4939    parseBackboneElementProperties(json, res);
4940    if (json.has("sequence"))
4941      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4942    if (json.has("_sequence"))
4943      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4944    if (json.has("category"))
4945      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
4946    if (json.has("code"))
4947      res.setCode(parseCodeableConcept(getJObject(json, "code")));
4948    Type timing = parseType("timing", json);
4949    if (timing != null)
4950      res.setTiming(timing);
4951    Type value = parseType("value", json);
4952    if (value != null)
4953      res.setValue(value);
4954    if (json.has("reason"))
4955      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
4956  }
4957
4958  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4959    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
4960    parseClaimDiagnosisComponentProperties(json, owner, res);
4961    return res;
4962  }
4963
4964  protected void parseClaimDiagnosisComponentProperties(JsonObject json, Claim owner, Claim.DiagnosisComponent res) throws IOException, FHIRFormatError {
4965    parseBackboneElementProperties(json, res);
4966    if (json.has("sequence"))
4967      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4968    if (json.has("_sequence"))
4969      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4970    Type diagnosis = parseType("diagnosis", json);
4971    if (diagnosis != null)
4972      res.setDiagnosis(diagnosis);
4973    if (json.has("type")) {
4974      JsonArray array = json.getAsJsonArray("type");
4975      for (int i = 0; i < array.size(); i++) {
4976        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4977      }
4978    };
4979    if (json.has("onAdmission"))
4980      res.setOnAdmission(parseCodeableConcept(getJObject(json, "onAdmission")));
4981    if (json.has("packageCode"))
4982      res.setPackageCode(parseCodeableConcept(getJObject(json, "packageCode")));
4983  }
4984
4985  protected Claim.ProcedureComponent parseClaimProcedureComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4986    Claim.ProcedureComponent res = new Claim.ProcedureComponent();
4987    parseClaimProcedureComponentProperties(json, owner, res);
4988    return res;
4989  }
4990
4991  protected void parseClaimProcedureComponentProperties(JsonObject json, Claim owner, Claim.ProcedureComponent res) throws IOException, FHIRFormatError {
4992    parseBackboneElementProperties(json, res);
4993    if (json.has("sequence"))
4994      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4995    if (json.has("_sequence"))
4996      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4997    if (json.has("type")) {
4998      JsonArray array = json.getAsJsonArray("type");
4999      for (int i = 0; i < array.size(); i++) {
5000        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5001      }
5002    };
5003    if (json.has("date"))
5004      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5005    if (json.has("_date"))
5006      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5007    Type procedure = parseType("procedure", json);
5008    if (procedure != null)
5009      res.setProcedure(procedure);
5010    if (json.has("udi")) {
5011      JsonArray array = json.getAsJsonArray("udi");
5012      for (int i = 0; i < array.size(); i++) {
5013        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5014      }
5015    };
5016  }
5017
5018  protected Claim.InsuranceComponent parseClaimInsuranceComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5019    Claim.InsuranceComponent res = new Claim.InsuranceComponent();
5020    parseClaimInsuranceComponentProperties(json, owner, res);
5021    return res;
5022  }
5023
5024  protected void parseClaimInsuranceComponentProperties(JsonObject json, Claim owner, Claim.InsuranceComponent res) throws IOException, FHIRFormatError {
5025    parseBackboneElementProperties(json, res);
5026    if (json.has("sequence"))
5027      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5028    if (json.has("_sequence"))
5029      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5030    if (json.has("focal"))
5031      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
5032    if (json.has("_focal"))
5033      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
5034    if (json.has("identifier"))
5035      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
5036    if (json.has("coverage"))
5037      res.setCoverage(parseReference(getJObject(json, "coverage")));
5038    if (json.has("businessArrangement"))
5039      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
5040    if (json.has("_businessArrangement"))
5041      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
5042    if (json.has("preAuthRef")) {
5043      JsonArray array = json.getAsJsonArray("preAuthRef");
5044      for (int i = 0; i < array.size(); i++) {
5045        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
5046      }
5047    };
5048    if (json.has("_preAuthRef")) {
5049      JsonArray array = json.getAsJsonArray("_preAuthRef");
5050      for (int i = 0; i < array.size(); i++) {
5051        if (i == res.getPreAuthRef().size())
5052          res.getPreAuthRef().add(parseString(null));
5053        if (array.get(i) instanceof JsonObject) 
5054          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
5055      }
5056    };
5057    if (json.has("claimResponse"))
5058      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
5059  }
5060
5061  protected Claim.AccidentComponent parseClaimAccidentComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5062    Claim.AccidentComponent res = new Claim.AccidentComponent();
5063    parseClaimAccidentComponentProperties(json, owner, res);
5064    return res;
5065  }
5066
5067  protected void parseClaimAccidentComponentProperties(JsonObject json, Claim owner, Claim.AccidentComponent res) throws IOException, FHIRFormatError {
5068    parseBackboneElementProperties(json, res);
5069    if (json.has("date"))
5070      res.setDateElement(parseDate(json.get("date").getAsString()));
5071    if (json.has("_date"))
5072      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5073    if (json.has("type"))
5074      res.setType(parseCodeableConcept(getJObject(json, "type")));
5075    Type location = parseType("location", json);
5076    if (location != null)
5077      res.setLocation(location);
5078  }
5079
5080  protected Claim.ItemComponent parseClaimItemComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5081    Claim.ItemComponent res = new Claim.ItemComponent();
5082    parseClaimItemComponentProperties(json, owner, res);
5083    return res;
5084  }
5085
5086  protected void parseClaimItemComponentProperties(JsonObject json, Claim owner, Claim.ItemComponent res) throws IOException, FHIRFormatError {
5087    parseBackboneElementProperties(json, res);
5088    if (json.has("sequence"))
5089      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5090    if (json.has("_sequence"))
5091      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5092    if (json.has("careTeamSequence")) {
5093      JsonArray array = json.getAsJsonArray("careTeamSequence");
5094      for (int i = 0; i < array.size(); i++) {
5095        res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
5096      }
5097    };
5098    if (json.has("_careTeamSequence")) {
5099      JsonArray array = json.getAsJsonArray("_careTeamSequence");
5100      for (int i = 0; i < array.size(); i++) {
5101        if (i == res.getCareTeamSequence().size())
5102          res.getCareTeamSequence().add(parsePositiveInt(null));
5103        if (array.get(i) instanceof JsonObject) 
5104          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
5105      }
5106    };
5107    if (json.has("diagnosisSequence")) {
5108      JsonArray array = json.getAsJsonArray("diagnosisSequence");
5109      for (int i = 0; i < array.size(); i++) {
5110        res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
5111      }
5112    };
5113    if (json.has("_diagnosisSequence")) {
5114      JsonArray array = json.getAsJsonArray("_diagnosisSequence");
5115      for (int i = 0; i < array.size(); i++) {
5116        if (i == res.getDiagnosisSequence().size())
5117          res.getDiagnosisSequence().add(parsePositiveInt(null));
5118        if (array.get(i) instanceof JsonObject) 
5119          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
5120      }
5121    };
5122    if (json.has("procedureSequence")) {
5123      JsonArray array = json.getAsJsonArray("procedureSequence");
5124      for (int i = 0; i < array.size(); i++) {
5125        res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
5126      }
5127    };
5128    if (json.has("_procedureSequence")) {
5129      JsonArray array = json.getAsJsonArray("_procedureSequence");
5130      for (int i = 0; i < array.size(); i++) {
5131        if (i == res.getProcedureSequence().size())
5132          res.getProcedureSequence().add(parsePositiveInt(null));
5133        if (array.get(i) instanceof JsonObject) 
5134          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
5135      }
5136    };
5137    if (json.has("informationSequence")) {
5138      JsonArray array = json.getAsJsonArray("informationSequence");
5139      for (int i = 0; i < array.size(); i++) {
5140        res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
5141      }
5142    };
5143    if (json.has("_informationSequence")) {
5144      JsonArray array = json.getAsJsonArray("_informationSequence");
5145      for (int i = 0; i < array.size(); i++) {
5146        if (i == res.getInformationSequence().size())
5147          res.getInformationSequence().add(parsePositiveInt(null));
5148        if (array.get(i) instanceof JsonObject) 
5149          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
5150      }
5151    };
5152    if (json.has("revenue"))
5153      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
5154    if (json.has("category"))
5155      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
5156    if (json.has("productOrService"))
5157      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
5158    if (json.has("modifier")) {
5159      JsonArray array = json.getAsJsonArray("modifier");
5160      for (int i = 0; i < array.size(); i++) {
5161        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5162      }
5163    };
5164    if (json.has("programCode")) {
5165      JsonArray array = json.getAsJsonArray("programCode");
5166      for (int i = 0; i < array.size(); i++) {
5167        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5168      }
5169    };
5170    Type serviced = parseType("serviced", json);
5171    if (serviced != null)
5172      res.setServiced(serviced);
5173    Type location = parseType("location", json);
5174    if (location != null)
5175      res.setLocation(location);
5176    if (json.has("quantity"))
5177      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
5178    if (json.has("unitPrice"))
5179      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
5180    if (json.has("factor"))
5181      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5182    if (json.has("_factor"))
5183      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
5184    if (json.has("net"))
5185      res.setNet(parseMoney(getJObject(json, "net")));
5186    if (json.has("udi")) {
5187      JsonArray array = json.getAsJsonArray("udi");
5188      for (int i = 0; i < array.size(); i++) {
5189        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5190      }
5191    };
5192    if (json.has("bodySite"))
5193      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
5194    if (json.has("subSite")) {
5195      JsonArray array = json.getAsJsonArray("subSite");
5196      for (int i = 0; i < array.size(); i++) {
5197        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5198      }
5199    };
5200    if (json.has("encounter")) {
5201      JsonArray array = json.getAsJsonArray("encounter");
5202      for (int i = 0; i < array.size(); i++) {
5203        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
5204      }
5205    };
5206    if (json.has("detail")) {
5207      JsonArray array = json.getAsJsonArray("detail");
5208      for (int i = 0; i < array.size(); i++) {
5209        res.getDetail().add(parseClaimDetailComponent(array.get(i).getAsJsonObject(), owner));
5210      }
5211    };
5212  }
5213
5214  protected Claim.DetailComponent parseClaimDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5215    Claim.DetailComponent res = new Claim.DetailComponent();
5216    parseClaimDetailComponentProperties(json, owner, res);
5217    return res;
5218  }
5219
5220  protected void parseClaimDetailComponentProperties(JsonObject json, Claim owner, Claim.DetailComponent res) throws IOException, FHIRFormatError {
5221    parseBackboneElementProperties(json, res);
5222    if (json.has("sequence"))
5223      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5224    if (json.has("_sequence"))
5225      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5226    if (json.has("revenue"))
5227      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
5228    if (json.has("category"))
5229      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
5230    if (json.has("productOrService"))
5231      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
5232    if (json.has("modifier")) {
5233      JsonArray array = json.getAsJsonArray("modifier");
5234      for (int i = 0; i < array.size(); i++) {
5235        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5236      }
5237    };
5238    if (json.has("programCode")) {
5239      JsonArray array = json.getAsJsonArray("programCode");
5240      for (int i = 0; i < array.size(); i++) {
5241        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5242      }
5243    };
5244    if (json.has("quantity"))
5245      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
5246    if (json.has("unitPrice"))
5247      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
5248    if (json.has("factor"))
5249      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5250    if (json.has("_factor"))
5251      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
5252    if (json.has("net"))
5253      res.setNet(parseMoney(getJObject(json, "net")));
5254    if (json.has("udi")) {
5255      JsonArray array = json.getAsJsonArray("udi");
5256      for (int i = 0; i < array.size(); i++) {
5257        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5258      }
5259    };
5260    if (json.has("subDetail")) {
5261      JsonArray array = json.getAsJsonArray("subDetail");
5262      for (int i = 0; i < array.size(); i++) {
5263        res.getSubDetail().add(parseClaimSubDetailComponent(array.get(i).getAsJsonObject(), owner));
5264      }
5265    };
5266  }
5267
5268  protected Claim.SubDetailComponent parseClaimSubDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5269    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
5270    parseClaimSubDetailComponentProperties(json, owner, res);
5271    return res;
5272  }
5273
5274  protected void parseClaimSubDetailComponentProperties(JsonObject json, Claim owner, Claim.SubDetailComponent res) throws IOException, FHIRFormatError {
5275    parseBackboneElementProperties(json, res);
5276    if (json.has("sequence"))
5277      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5278    if (json.has("_sequence"))
5279      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5280    if (json.has("revenue"))
5281      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
5282    if (json.has("category"))
5283      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
5284    if (json.has("productOrService"))
5285      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
5286    if (json.has("modifier")) {
5287      JsonArray array = json.getAsJsonArray("modifier");
5288      for (int i = 0; i < array.size(); i++) {
5289        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5290      }
5291    };
5292    if (json.has("programCode")) {
5293      JsonArray array = json.getAsJsonArray("programCode");
5294      for (int i = 0; i < array.size(); i++) {
5295        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5296      }
5297    };
5298    if (json.has("quantity"))
5299      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
5300    if (json.has("unitPrice"))
5301      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
5302    if (json.has("factor"))
5303      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5304    if (json.has("_factor"))
5305      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
5306    if (json.has("net"))
5307      res.setNet(parseMoney(getJObject(json, "net")));
5308    if (json.has("udi")) {
5309      JsonArray array = json.getAsJsonArray("udi");
5310      for (int i = 0; i < array.size(); i++) {
5311        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5312      }
5313    };
5314  }
5315
5316  protected ClaimResponse parseClaimResponse(JsonObject json) throws IOException, FHIRFormatError {
5317    ClaimResponse res = new ClaimResponse();
5318    parseClaimResponseProperties(json, res);
5319    return res;
5320  }
5321
5322  protected void parseClaimResponseProperties(JsonObject json, ClaimResponse res) throws IOException, FHIRFormatError {
5323    parseDomainResourceProperties(json, res);
5324    if (json.has("identifier")) {
5325      JsonArray array = json.getAsJsonArray("identifier");
5326      for (int i = 0; i < array.size(); i++) {
5327        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5328      }
5329    };
5330    if (json.has("status"))
5331      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClaimResponse.ClaimResponseStatus.NULL, new ClaimResponse.ClaimResponseStatusEnumFactory()));
5332    if (json.has("_status"))
5333      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5334    if (json.has("type"))
5335      res.setType(parseCodeableConcept(getJObject(json, "type")));
5336    if (json.has("subType"))
5337      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
5338    if (json.has("use"))
5339      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ClaimResponse.Use.NULL, new ClaimResponse.UseEnumFactory()));
5340    if (json.has("_use"))
5341      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
5342    if (json.has("patient"))
5343      res.setPatient(parseReference(getJObject(json, "patient")));
5344    if (json.has("created"))
5345      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5346    if (json.has("_created"))
5347      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
5348    if (json.has("insurer"))
5349      res.setInsurer(parseReference(getJObject(json, "insurer")));
5350    if (json.has("requestor"))
5351      res.setRequestor(parseReference(getJObject(json, "requestor")));
5352    if (json.has("request"))
5353      res.setRequest(parseReference(getJObject(json, "request")));
5354    if (json.has("outcome"))
5355      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), ClaimResponse.RemittanceOutcome.NULL, new ClaimResponse.RemittanceOutcomeEnumFactory()));
5356    if (json.has("_outcome"))
5357      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
5358    if (json.has("disposition"))
5359      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
5360    if (json.has("_disposition"))
5361      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
5362    if (json.has("preAuthRef"))
5363      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
5364    if (json.has("_preAuthRef"))
5365      parseElementProperties(getJObject(json, "_preAuthRef"), res.getPreAuthRefElement());
5366    if (json.has("preAuthPeriod"))
5367      res.setPreAuthPeriod(parsePeriod(getJObject(json, "preAuthPeriod")));
5368    if (json.has("payeeType"))
5369      res.setPayeeType(parseCodeableConcept(getJObject(json, "payeeType")));
5370    if (json.has("item")) {
5371      JsonArray array = json.getAsJsonArray("item");
5372      for (int i = 0; i < array.size(); i++) {
5373        res.getItem().add(parseClaimResponseItemComponent(array.get(i).getAsJsonObject(), res));
5374      }
5375    };
5376    if (json.has("addItem")) {
5377      JsonArray array = json.getAsJsonArray("addItem");
5378      for (int i = 0; i < array.size(); i++) {
5379        res.getAddItem().add(parseClaimResponseAddedItemComponent(array.get(i).getAsJsonObject(), res));
5380      }
5381    };
5382    if (json.has("adjudication")) {
5383      JsonArray array = json.getAsJsonArray("adjudication");
5384      for (int i = 0; i < array.size(); i++) {
5385        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), res));
5386      }
5387    };
5388    if (json.has("total")) {
5389      JsonArray array = json.getAsJsonArray("total");
5390      for (int i = 0; i < array.size(); i++) {
5391        res.getTotal().add(parseClaimResponseTotalComponent(array.get(i).getAsJsonObject(), res));
5392      }
5393    };
5394    if (json.has("payment"))
5395      res.setPayment(parseClaimResponsePaymentComponent(getJObject(json, "payment"), res));
5396    if (json.has("fundsReserve"))
5397      res.setFundsReserve(parseCodeableConcept(getJObject(json, "fundsReserve")));
5398    if (json.has("formCode"))
5399      res.setFormCode(parseCodeableConcept(getJObject(json, "formCode")));
5400    if (json.has("form"))
5401      res.setForm(parseAttachment(getJObject(json, "form")));
5402    if (json.has("processNote")) {
5403      JsonArray array = json.getAsJsonArray("processNote");
5404      for (int i = 0; i < array.size(); i++) {
5405        res.getProcessNote().add(parseClaimResponseNoteComponent(array.get(i).getAsJsonObject(), res));
5406      }
5407    };
5408    if (json.has("communicationRequest")) {
5409      JsonArray array = json.getAsJsonArray("communicationRequest");
5410      for (int i = 0; i < array.size(); i++) {
5411        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
5412      }
5413    };
5414    if (json.has("insurance")) {
5415      JsonArray array = json.getAsJsonArray("insurance");
5416      for (int i = 0; i < array.size(); i++) {
5417        res.getInsurance().add(parseClaimResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
5418      }
5419    };
5420    if (json.has("error")) {
5421      JsonArray array = json.getAsJsonArray("error");
5422      for (int i = 0; i < array.size(); i++) {
5423        res.getError().add(parseClaimResponseErrorComponent(array.get(i).getAsJsonObject(), res));
5424      }
5425    };
5426  }
5427
5428  protected ClaimResponse.ItemComponent parseClaimResponseItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5429    ClaimResponse.ItemComponent res = new ClaimResponse.ItemComponent();
5430    parseClaimResponseItemComponentProperties(json, owner, res);
5431    return res;
5432  }
5433
5434  protected void parseClaimResponseItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemComponent res) throws IOException, FHIRFormatError {
5435    parseBackboneElementProperties(json, res);
5436    if (json.has("itemSequence"))
5437      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
5438    if (json.has("_itemSequence"))
5439      parseElementProperties(getJObject(json, "_itemSequence"), res.getItemSequenceElement());
5440    if (json.has("noteNumber")) {
5441      JsonArray array = json.getAsJsonArray("noteNumber");
5442      for (int i = 0; i < array.size(); i++) {
5443        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5444      }
5445    };
5446    if (json.has("_noteNumber")) {
5447      JsonArray array = json.getAsJsonArray("_noteNumber");
5448      for (int i = 0; i < array.size(); i++) {
5449        if (i == res.getNoteNumber().size())
5450          res.getNoteNumber().add(parsePositiveInt(null));
5451        if (array.get(i) instanceof JsonObject) 
5452          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5453      }
5454    };
5455    if (json.has("adjudication")) {
5456      JsonArray array = json.getAsJsonArray("adjudication");
5457      for (int i = 0; i < array.size(); i++) {
5458        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5459      }
5460    };
5461    if (json.has("detail")) {
5462      JsonArray array = json.getAsJsonArray("detail");
5463      for (int i = 0; i < array.size(); i++) {
5464        res.getDetail().add(parseClaimResponseItemDetailComponent(array.get(i).getAsJsonObject(), owner));
5465      }
5466    };
5467  }
5468
5469  protected ClaimResponse.AdjudicationComponent parseClaimResponseAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5470    ClaimResponse.AdjudicationComponent res = new ClaimResponse.AdjudicationComponent();
5471    parseClaimResponseAdjudicationComponentProperties(json, owner, res);
5472    return res;
5473  }
5474
5475  protected void parseClaimResponseAdjudicationComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AdjudicationComponent res) throws IOException, FHIRFormatError {
5476    parseBackboneElementProperties(json, res);
5477    if (json.has("category"))
5478      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
5479    if (json.has("reason"))
5480      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
5481    if (json.has("amount"))
5482      res.setAmount(parseMoney(getJObject(json, "amount")));
5483    if (json.has("value"))
5484      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
5485    if (json.has("_value"))
5486      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
5487  }
5488
5489  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5490    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
5491    parseClaimResponseItemDetailComponentProperties(json, owner, res);
5492    return res;
5493  }
5494
5495  protected void parseClaimResponseItemDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemDetailComponent res) throws IOException, FHIRFormatError {
5496    parseBackboneElementProperties(json, res);
5497    if (json.has("detailSequence"))
5498      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
5499    if (json.has("_detailSequence"))
5500      parseElementProperties(getJObject(json, "_detailSequence"), res.getDetailSequenceElement());
5501    if (json.has("noteNumber")) {
5502      JsonArray array = json.getAsJsonArray("noteNumber");
5503      for (int i = 0; i < array.size(); i++) {
5504        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5505      }
5506    };
5507    if (json.has("_noteNumber")) {
5508      JsonArray array = json.getAsJsonArray("_noteNumber");
5509      for (int i = 0; i < array.size(); i++) {
5510        if (i == res.getNoteNumber().size())
5511          res.getNoteNumber().add(parsePositiveInt(null));
5512        if (array.get(i) instanceof JsonObject) 
5513          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5514      }
5515    };
5516    if (json.has("adjudication")) {
5517      JsonArray array = json.getAsJsonArray("adjudication");
5518      for (int i = 0; i < array.size(); i++) {
5519        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5520      }
5521    };
5522    if (json.has("subDetail")) {
5523      JsonArray array = json.getAsJsonArray("subDetail");
5524      for (int i = 0; i < array.size(); i++) {
5525        res.getSubDetail().add(parseClaimResponseSubDetailComponent(array.get(i).getAsJsonObject(), owner));
5526      }
5527    };
5528  }
5529
5530  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5531    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
5532    parseClaimResponseSubDetailComponentProperties(json, owner, res);
5533    return res;
5534  }
5535
5536  protected void parseClaimResponseSubDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.SubDetailComponent res) throws IOException, FHIRFormatError {
5537    parseBackboneElementProperties(json, res);
5538    if (json.has("subDetailSequence"))
5539      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
5540    if (json.has("_subDetailSequence"))
5541      parseElementProperties(getJObject(json, "_subDetailSequence"), res.getSubDetailSequenceElement());
5542    if (json.has("noteNumber")) {
5543      JsonArray array = json.getAsJsonArray("noteNumber");
5544      for (int i = 0; i < array.size(); i++) {
5545        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5546      }
5547    };
5548    if (json.has("_noteNumber")) {
5549      JsonArray array = json.getAsJsonArray("_noteNumber");
5550      for (int i = 0; i < array.size(); i++) {
5551        if (i == res.getNoteNumber().size())
5552          res.getNoteNumber().add(parsePositiveInt(null));
5553        if (array.get(i) instanceof JsonObject) 
5554          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5555      }
5556    };
5557    if (json.has("adjudication")) {
5558      JsonArray array = json.getAsJsonArray("adjudication");
5559      for (int i = 0; i < array.size(); i++) {
5560        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5561      }
5562    };
5563  }
5564
5565  protected ClaimResponse.AddedItemComponent parseClaimResponseAddedItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5566    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
5567    parseClaimResponseAddedItemComponentProperties(json, owner, res);
5568    return res;
5569  }
5570
5571  protected void parseClaimResponseAddedItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemComponent res) throws IOException, FHIRFormatError {
5572    parseBackboneElementProperties(json, res);
5573    if (json.has("itemSequence")) {
5574      JsonArray array = json.getAsJsonArray("itemSequence");
5575      for (int i = 0; i < array.size(); i++) {
5576        res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
5577      }
5578    };
5579    if (json.has("_itemSequence")) {
5580      JsonArray array = json.getAsJsonArray("_itemSequence");
5581      for (int i = 0; i < array.size(); i++) {
5582        if (i == res.getItemSequence().size())
5583          res.getItemSequence().add(parsePositiveInt(null));
5584        if (array.get(i) instanceof JsonObject) 
5585          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
5586      }
5587    };
5588    if (json.has("detailSequence")) {
5589      JsonArray array = json.getAsJsonArray("detailSequence");
5590      for (int i = 0; i < array.size(); i++) {
5591        res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
5592      }
5593    };
5594    if (json.has("_detailSequence")) {
5595      JsonArray array = json.getAsJsonArray("_detailSequence");
5596      for (int i = 0; i < array.size(); i++) {
5597        if (i == res.getDetailSequence().size())
5598          res.getDetailSequence().add(parsePositiveInt(null));
5599        if (array.get(i) instanceof JsonObject) 
5600          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
5601      }
5602    };
5603    if (json.has("subdetailSequence")) {
5604      JsonArray array = json.getAsJsonArray("subdetailSequence");
5605      for (int i = 0; i < array.size(); i++) {
5606        res.getSubdetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
5607      }
5608    };
5609    if (json.has("_subdetailSequence")) {
5610      JsonArray array = json.getAsJsonArray("_subdetailSequence");
5611      for (int i = 0; i < array.size(); i++) {
5612        if (i == res.getSubdetailSequence().size())
5613          res.getSubdetailSequence().add(parsePositiveInt(null));
5614        if (array.get(i) instanceof JsonObject) 
5615          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubdetailSequence().get(i));
5616      }
5617    };
5618    if (json.has("provider")) {
5619      JsonArray array = json.getAsJsonArray("provider");
5620      for (int i = 0; i < array.size(); i++) {
5621        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
5622      }
5623    };
5624    if (json.has("productOrService"))
5625      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
5626    if (json.has("modifier")) {
5627      JsonArray array = json.getAsJsonArray("modifier");
5628      for (int i = 0; i < array.size(); i++) {
5629        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5630      }
5631    };
5632    if (json.has("programCode")) {
5633      JsonArray array = json.getAsJsonArray("programCode");
5634      for (int i = 0; i < array.size(); i++) {
5635        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5636      }
5637    };
5638    Type serviced = parseType("serviced", json);
5639    if (serviced != null)
5640      res.setServiced(serviced);
5641    Type location = parseType("location", json);
5642    if (location != null)
5643      res.setLocation(location);
5644    if (json.has("quantity"))
5645      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
5646    if (json.has("unitPrice"))
5647      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
5648    if (json.has("factor"))
5649      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5650    if (json.has("_factor"))
5651      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
5652    if (json.has("net"))
5653      res.setNet(parseMoney(getJObject(json, "net")));
5654    if (json.has("bodySite"))
5655      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
5656    if (json.has("subSite")) {
5657      JsonArray array = json.getAsJsonArray("subSite");
5658      for (int i = 0; i < array.size(); i++) {
5659        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5660      }
5661    };
5662    if (json.has("noteNumber")) {
5663      JsonArray array = json.getAsJsonArray("noteNumber");
5664      for (int i = 0; i < array.size(); i++) {
5665        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5666      }
5667    };
5668    if (json.has("_noteNumber")) {
5669      JsonArray array = json.getAsJsonArray("_noteNumber");
5670      for (int i = 0; i < array.size(); i++) {
5671        if (i == res.getNoteNumber().size())
5672          res.getNoteNumber().add(parsePositiveInt(null));
5673        if (array.get(i) instanceof JsonObject) 
5674          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5675      }
5676    };
5677    if (json.has("adjudication")) {
5678      JsonArray array = json.getAsJsonArray("adjudication");
5679      for (int i = 0; i < array.size(); i++) {
5680        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5681      }
5682    };
5683    if (json.has("detail")) {
5684      JsonArray array = json.getAsJsonArray("detail");
5685      for (int i = 0; i < array.size(); i++) {
5686        res.getDetail().add(parseClaimResponseAddedItemDetailComponent(array.get(i).getAsJsonObject(), owner));
5687      }
5688    };
5689  }
5690
5691  protected ClaimResponse.AddedItemDetailComponent parseClaimResponseAddedItemDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5692    ClaimResponse.AddedItemDetailComponent res = new ClaimResponse.AddedItemDetailComponent();
5693    parseClaimResponseAddedItemDetailComponentProperties(json, owner, res);
5694    return res;
5695  }
5696
5697  protected void parseClaimResponseAddedItemDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemDetailComponent res) throws IOException, FHIRFormatError {
5698    parseBackboneElementProperties(json, res);
5699    if (json.has("productOrService"))
5700      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
5701    if (json.has("modifier")) {
5702      JsonArray array = json.getAsJsonArray("modifier");
5703      for (int i = 0; i < array.size(); i++) {
5704        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5705      }
5706    };
5707    if (json.has("quantity"))
5708      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
5709    if (json.has("unitPrice"))
5710      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
5711    if (json.has("factor"))
5712      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5713    if (json.has("_factor"))
5714      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
5715    if (json.has("net"))
5716      res.setNet(parseMoney(getJObject(json, "net")));
5717    if (json.has("noteNumber")) {
5718      JsonArray array = json.getAsJsonArray("noteNumber");
5719      for (int i = 0; i < array.size(); i++) {
5720        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5721      }
5722    };
5723    if (json.has("_noteNumber")) {
5724      JsonArray array = json.getAsJsonArray("_noteNumber");
5725      for (int i = 0; i < array.size(); i++) {
5726        if (i == res.getNoteNumber().size())
5727          res.getNoteNumber().add(parsePositiveInt(null));
5728        if (array.get(i) instanceof JsonObject) 
5729          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5730      }
5731    };
5732    if (json.has("adjudication")) {
5733      JsonArray array = json.getAsJsonArray("adjudication");
5734      for (int i = 0; i < array.size(); i++) {
5735        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5736      }
5737    };
5738    if (json.has("subDetail")) {
5739      JsonArray array = json.getAsJsonArray("subDetail");
5740      for (int i = 0; i < array.size(); i++) {
5741        res.getSubDetail().add(parseClaimResponseAddedItemSubDetailComponent(array.get(i).getAsJsonObject(), owner));
5742      }
5743    };
5744  }
5745
5746  protected ClaimResponse.AddedItemSubDetailComponent parseClaimResponseAddedItemSubDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5747    ClaimResponse.AddedItemSubDetailComponent res = new ClaimResponse.AddedItemSubDetailComponent();
5748    parseClaimResponseAddedItemSubDetailComponentProperties(json, owner, res);
5749    return res;
5750  }
5751
5752  protected void parseClaimResponseAddedItemSubDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemSubDetailComponent res) throws IOException, FHIRFormatError {
5753    parseBackboneElementProperties(json, res);
5754    if (json.has("productOrService"))
5755      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
5756    if (json.has("modifier")) {
5757      JsonArray array = json.getAsJsonArray("modifier");
5758      for (int i = 0; i < array.size(); i++) {
5759        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5760      }
5761    };
5762    if (json.has("quantity"))
5763      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
5764    if (json.has("unitPrice"))
5765      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
5766    if (json.has("factor"))
5767      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5768    if (json.has("_factor"))
5769      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
5770    if (json.has("net"))
5771      res.setNet(parseMoney(getJObject(json, "net")));
5772    if (json.has("noteNumber")) {
5773      JsonArray array = json.getAsJsonArray("noteNumber");
5774      for (int i = 0; i < array.size(); i++) {
5775        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5776      }
5777    };
5778    if (json.has("_noteNumber")) {
5779      JsonArray array = json.getAsJsonArray("_noteNumber");
5780      for (int i = 0; i < array.size(); i++) {
5781        if (i == res.getNoteNumber().size())
5782          res.getNoteNumber().add(parsePositiveInt(null));
5783        if (array.get(i) instanceof JsonObject) 
5784          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5785      }
5786    };
5787    if (json.has("adjudication")) {
5788      JsonArray array = json.getAsJsonArray("adjudication");
5789      for (int i = 0; i < array.size(); i++) {
5790        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5791      }
5792    };
5793  }
5794
5795  protected ClaimResponse.TotalComponent parseClaimResponseTotalComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5796    ClaimResponse.TotalComponent res = new ClaimResponse.TotalComponent();
5797    parseClaimResponseTotalComponentProperties(json, owner, res);
5798    return res;
5799  }
5800
5801  protected void parseClaimResponseTotalComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.TotalComponent res) throws IOException, FHIRFormatError {
5802    parseBackboneElementProperties(json, res);
5803    if (json.has("category"))
5804      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
5805    if (json.has("amount"))
5806      res.setAmount(parseMoney(getJObject(json, "amount")));
5807  }
5808
5809  protected ClaimResponse.PaymentComponent parseClaimResponsePaymentComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5810    ClaimResponse.PaymentComponent res = new ClaimResponse.PaymentComponent();
5811    parseClaimResponsePaymentComponentProperties(json, owner, res);
5812    return res;
5813  }
5814
5815  protected void parseClaimResponsePaymentComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.PaymentComponent res) throws IOException, FHIRFormatError {
5816    parseBackboneElementProperties(json, res);
5817    if (json.has("type"))
5818      res.setType(parseCodeableConcept(getJObject(json, "type")));
5819    if (json.has("adjustment"))
5820      res.setAdjustment(parseMoney(getJObject(json, "adjustment")));
5821    if (json.has("adjustmentReason"))
5822      res.setAdjustmentReason(parseCodeableConcept(getJObject(json, "adjustmentReason")));
5823    if (json.has("date"))
5824      res.setDateElement(parseDate(json.get("date").getAsString()));
5825    if (json.has("_date"))
5826      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5827    if (json.has("amount"))
5828      res.setAmount(parseMoney(getJObject(json, "amount")));
5829    if (json.has("identifier"))
5830      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
5831  }
5832
5833  protected ClaimResponse.NoteComponent parseClaimResponseNoteComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5834    ClaimResponse.NoteComponent res = new ClaimResponse.NoteComponent();
5835    parseClaimResponseNoteComponentProperties(json, owner, res);
5836    return res;
5837  }
5838
5839  protected void parseClaimResponseNoteComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.NoteComponent res) throws IOException, FHIRFormatError {
5840    parseBackboneElementProperties(json, res);
5841    if (json.has("number"))
5842      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
5843    if (json.has("_number"))
5844      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
5845    if (json.has("type"))
5846      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
5847    if (json.has("_type"))
5848      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
5849    if (json.has("text"))
5850      res.setTextElement(parseString(json.get("text").getAsString()));
5851    if (json.has("_text"))
5852      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
5853    if (json.has("language"))
5854      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
5855  }
5856
5857  protected ClaimResponse.InsuranceComponent parseClaimResponseInsuranceComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5858    ClaimResponse.InsuranceComponent res = new ClaimResponse.InsuranceComponent();
5859    parseClaimResponseInsuranceComponentProperties(json, owner, res);
5860    return res;
5861  }
5862
5863  protected void parseClaimResponseInsuranceComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
5864    parseBackboneElementProperties(json, res);
5865    if (json.has("sequence"))
5866      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5867    if (json.has("_sequence"))
5868      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5869    if (json.has("focal"))
5870      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
5871    if (json.has("_focal"))
5872      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
5873    if (json.has("coverage"))
5874      res.setCoverage(parseReference(getJObject(json, "coverage")));
5875    if (json.has("businessArrangement"))
5876      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
5877    if (json.has("_businessArrangement"))
5878      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
5879    if (json.has("claimResponse"))
5880      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
5881  }
5882
5883  protected ClaimResponse.ErrorComponent parseClaimResponseErrorComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5884    ClaimResponse.ErrorComponent res = new ClaimResponse.ErrorComponent();
5885    parseClaimResponseErrorComponentProperties(json, owner, res);
5886    return res;
5887  }
5888
5889  protected void parseClaimResponseErrorComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ErrorComponent res) throws IOException, FHIRFormatError {
5890    parseBackboneElementProperties(json, res);
5891    if (json.has("itemSequence"))
5892      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
5893    if (json.has("_itemSequence"))
5894      parseElementProperties(getJObject(json, "_itemSequence"), res.getItemSequenceElement());
5895    if (json.has("detailSequence"))
5896      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
5897    if (json.has("_detailSequence"))
5898      parseElementProperties(getJObject(json, "_detailSequence"), res.getDetailSequenceElement());
5899    if (json.has("subDetailSequence"))
5900      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
5901    if (json.has("_subDetailSequence"))
5902      parseElementProperties(getJObject(json, "_subDetailSequence"), res.getSubDetailSequenceElement());
5903    if (json.has("code"))
5904      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5905  }
5906
5907  protected ClinicalImpression parseClinicalImpression(JsonObject json) throws IOException, FHIRFormatError {
5908    ClinicalImpression res = new ClinicalImpression();
5909    parseClinicalImpressionProperties(json, res);
5910    return res;
5911  }
5912
5913  protected void parseClinicalImpressionProperties(JsonObject json, ClinicalImpression res) throws IOException, FHIRFormatError {
5914    parseDomainResourceProperties(json, res);
5915    if (json.has("identifier")) {
5916      JsonArray array = json.getAsJsonArray("identifier");
5917      for (int i = 0; i < array.size(); i++) {
5918        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5919      }
5920    };
5921    if (json.has("status"))
5922      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClinicalImpression.ClinicalImpressionStatus.NULL, new ClinicalImpression.ClinicalImpressionStatusEnumFactory()));
5923    if (json.has("_status"))
5924      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5925    if (json.has("statusReason"))
5926      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
5927    if (json.has("code"))
5928      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5929    if (json.has("description"))
5930      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5931    if (json.has("_description"))
5932      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5933    if (json.has("subject"))
5934      res.setSubject(parseReference(getJObject(json, "subject")));
5935    if (json.has("encounter"))
5936      res.setEncounter(parseReference(getJObject(json, "encounter")));
5937    Type effective = parseType("effective", json);
5938    if (effective != null)
5939      res.setEffective(effective);
5940    if (json.has("date"))
5941      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5942    if (json.has("_date"))
5943      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5944    if (json.has("assessor"))
5945      res.setAssessor(parseReference(getJObject(json, "assessor")));
5946    if (json.has("previous"))
5947      res.setPrevious(parseReference(getJObject(json, "previous")));
5948    if (json.has("problem")) {
5949      JsonArray array = json.getAsJsonArray("problem");
5950      for (int i = 0; i < array.size(); i++) {
5951        res.getProblem().add(parseReference(array.get(i).getAsJsonObject()));
5952      }
5953    };
5954    if (json.has("investigation")) {
5955      JsonArray array = json.getAsJsonArray("investigation");
5956      for (int i = 0; i < array.size(); i++) {
5957        res.getInvestigation().add(parseClinicalImpressionClinicalImpressionInvestigationComponent(array.get(i).getAsJsonObject(), res));
5958      }
5959    };
5960    if (json.has("protocol")) {
5961      JsonArray array = json.getAsJsonArray("protocol");
5962      for (int i = 0; i < array.size(); i++) {
5963        res.getProtocol().add(parseUri(array.get(i).getAsString()));
5964      }
5965    };
5966    if (json.has("_protocol")) {
5967      JsonArray array = json.getAsJsonArray("_protocol");
5968      for (int i = 0; i < array.size(); i++) {
5969        if (i == res.getProtocol().size())
5970          res.getProtocol().add(parseUri(null));
5971        if (array.get(i) instanceof JsonObject) 
5972          parseElementProperties(array.get(i).getAsJsonObject(), res.getProtocol().get(i));
5973      }
5974    };
5975    if (json.has("summary"))
5976      res.setSummaryElement(parseString(json.get("summary").getAsString()));
5977    if (json.has("_summary"))
5978      parseElementProperties(getJObject(json, "_summary"), res.getSummaryElement());
5979    if (json.has("finding")) {
5980      JsonArray array = json.getAsJsonArray("finding");
5981      for (int i = 0; i < array.size(); i++) {
5982        res.getFinding().add(parseClinicalImpressionClinicalImpressionFindingComponent(array.get(i).getAsJsonObject(), res));
5983      }
5984    };
5985    if (json.has("prognosisCodeableConcept")) {
5986      JsonArray array = json.getAsJsonArray("prognosisCodeableConcept");
5987      for (int i = 0; i < array.size(); i++) {
5988        res.getPrognosisCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5989      }
5990    };
5991    if (json.has("prognosisReference")) {
5992      JsonArray array = json.getAsJsonArray("prognosisReference");
5993      for (int i = 0; i < array.size(); i++) {
5994        res.getPrognosisReference().add(parseReference(array.get(i).getAsJsonObject()));
5995      }
5996    };
5997    if (json.has("supportingInfo")) {
5998      JsonArray array = json.getAsJsonArray("supportingInfo");
5999      for (int i = 0; i < array.size(); i++) {
6000        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
6001      }
6002    };
6003    if (json.has("note")) {
6004      JsonArray array = json.getAsJsonArray("note");
6005      for (int i = 0; i < array.size(); i++) {
6006        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6007      }
6008    };
6009  }
6010
6011  protected ClinicalImpression.ClinicalImpressionInvestigationComponent parseClinicalImpressionClinicalImpressionInvestigationComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
6012    ClinicalImpression.ClinicalImpressionInvestigationComponent res = new ClinicalImpression.ClinicalImpressionInvestigationComponent();
6013    parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(json, owner, res);
6014    return res;
6015  }
6016
6017  protected void parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(JsonObject json, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionInvestigationComponent res) throws IOException, FHIRFormatError {
6018    parseBackboneElementProperties(json, res);
6019    if (json.has("code"))
6020      res.setCode(parseCodeableConcept(getJObject(json, "code")));
6021    if (json.has("item")) {
6022      JsonArray array = json.getAsJsonArray("item");
6023      for (int i = 0; i < array.size(); i++) {
6024        res.getItem().add(parseReference(array.get(i).getAsJsonObject()));
6025      }
6026    };
6027  }
6028
6029  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionClinicalImpressionFindingComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
6030    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
6031    parseClinicalImpressionClinicalImpressionFindingComponentProperties(json, owner, res);
6032    return res;
6033  }
6034
6035  protected void parseClinicalImpressionClinicalImpressionFindingComponentProperties(JsonObject json, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionFindingComponent res) throws IOException, FHIRFormatError {
6036    parseBackboneElementProperties(json, res);
6037    if (json.has("itemCodeableConcept"))
6038      res.setItemCodeableConcept(parseCodeableConcept(getJObject(json, "itemCodeableConcept")));
6039    if (json.has("itemReference"))
6040      res.setItemReference(parseReference(getJObject(json, "itemReference")));
6041    if (json.has("basis"))
6042      res.setBasisElement(parseString(json.get("basis").getAsString()));
6043    if (json.has("_basis"))
6044      parseElementProperties(getJObject(json, "_basis"), res.getBasisElement());
6045  }
6046
6047  protected CodeSystem parseCodeSystem(JsonObject json) throws IOException, FHIRFormatError {
6048    CodeSystem res = new CodeSystem();
6049    parseCodeSystemProperties(json, res);
6050    return res;
6051  }
6052
6053  protected void parseCodeSystemProperties(JsonObject json, CodeSystem res) throws IOException, FHIRFormatError {
6054    parseDomainResourceProperties(json, res);
6055    if (json.has("url"))
6056      res.setUrlElement(parseUri(json.get("url").getAsString()));
6057    if (json.has("_url"))
6058      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
6059    if (json.has("identifier")) {
6060      JsonArray array = json.getAsJsonArray("identifier");
6061      for (int i = 0; i < array.size(); i++) {
6062        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6063      }
6064    };
6065    if (json.has("version"))
6066      res.setVersionElement(parseString(json.get("version").getAsString()));
6067    if (json.has("_version"))
6068      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
6069    if (json.has("name"))
6070      res.setNameElement(parseString(json.get("name").getAsString()));
6071    if (json.has("_name"))
6072      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
6073    if (json.has("title"))
6074      res.setTitleElement(parseString(json.get("title").getAsString()));
6075    if (json.has("_title"))
6076      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
6077    if (json.has("status"))
6078      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
6079    if (json.has("_status"))
6080      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6081    if (json.has("experimental"))
6082      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6083    if (json.has("_experimental"))
6084      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
6085    if (json.has("date"))
6086      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6087    if (json.has("_date"))
6088      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6089    if (json.has("publisher"))
6090      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6091    if (json.has("_publisher"))
6092      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
6093    if (json.has("contact")) {
6094      JsonArray array = json.getAsJsonArray("contact");
6095      for (int i = 0; i < array.size(); i++) {
6096        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
6097      }
6098    };
6099    if (json.has("description"))
6100      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
6101    if (json.has("_description"))
6102      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
6103    if (json.has("useContext")) {
6104      JsonArray array = json.getAsJsonArray("useContext");
6105      for (int i = 0; i < array.size(); i++) {
6106        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
6107      }
6108    };
6109    if (json.has("jurisdiction")) {
6110      JsonArray array = json.getAsJsonArray("jurisdiction");
6111      for (int i = 0; i < array.size(); i++) {
6112        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6113      }
6114    };
6115    if (json.has("purpose"))
6116      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
6117    if (json.has("_purpose"))
6118      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
6119    if (json.has("copyright"))
6120      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
6121    if (json.has("_copyright"))
6122      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
6123    if (json.has("caseSensitive"))
6124      res.setCaseSensitiveElement(parseBoolean(json.get("caseSensitive").getAsBoolean()));
6125    if (json.has("_caseSensitive"))
6126      parseElementProperties(getJObject(json, "_caseSensitive"), res.getCaseSensitiveElement());
6127    if (json.has("valueSet"))
6128      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
6129    if (json.has("_valueSet"))
6130      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
6131    if (json.has("hierarchyMeaning"))
6132      res.setHierarchyMeaningElement(parseEnumeration(json.get("hierarchyMeaning").getAsString(), CodeSystem.CodeSystemHierarchyMeaning.NULL, new CodeSystem.CodeSystemHierarchyMeaningEnumFactory()));
6133    if (json.has("_hierarchyMeaning"))
6134      parseElementProperties(getJObject(json, "_hierarchyMeaning"), res.getHierarchyMeaningElement());
6135    if (json.has("compositional"))
6136      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
6137    if (json.has("_compositional"))
6138      parseElementProperties(getJObject(json, "_compositional"), res.getCompositionalElement());
6139    if (json.has("versionNeeded"))
6140      res.setVersionNeededElement(parseBoolean(json.get("versionNeeded").getAsBoolean()));
6141    if (json.has("_versionNeeded"))
6142      parseElementProperties(getJObject(json, "_versionNeeded"), res.getVersionNeededElement());
6143    if (json.has("content"))
6144      res.setContentElement(parseEnumeration(json.get("content").getAsString(), CodeSystem.CodeSystemContentMode.NULL, new CodeSystem.CodeSystemContentModeEnumFactory()));
6145    if (json.has("_content"))
6146      parseElementProperties(getJObject(json, "_content"), res.getContentElement());
6147    if (json.has("supplements"))
6148      res.setSupplementsElement(parseCanonical(json.get("supplements").getAsString()));
6149    if (json.has("_supplements"))
6150      parseElementProperties(getJObject(json, "_supplements"), res.getSupplementsElement());
6151    if (json.has("count"))
6152      res.setCountElement(parseUnsignedInt(json.get("count").getAsString()));
6153    if (json.has("_count"))
6154      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
6155    if (json.has("filter")) {
6156      JsonArray array = json.getAsJsonArray("filter");
6157      for (int i = 0; i < array.size(); i++) {
6158        res.getFilter().add(parseCodeSystemCodeSystemFilterComponent(array.get(i).getAsJsonObject(), res));
6159      }
6160    };
6161    if (json.has("property")) {
6162      JsonArray array = json.getAsJsonArray("property");
6163      for (int i = 0; i < array.size(); i++) {
6164        res.getProperty().add(parseCodeSystemPropertyComponent(array.get(i).getAsJsonObject(), res));
6165      }
6166    };
6167    if (json.has("concept")) {
6168      JsonArray array = json.getAsJsonArray("concept");
6169      for (int i = 0; i < array.size(); i++) {
6170        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), res));
6171      }
6172    };
6173  }
6174
6175  protected CodeSystem.CodeSystemFilterComponent parseCodeSystemCodeSystemFilterComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6176    CodeSystem.CodeSystemFilterComponent res = new CodeSystem.CodeSystemFilterComponent();
6177    parseCodeSystemCodeSystemFilterComponentProperties(json, owner, res);
6178    return res;
6179  }
6180
6181  protected void parseCodeSystemCodeSystemFilterComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.CodeSystemFilterComponent res) throws IOException, FHIRFormatError {
6182    parseBackboneElementProperties(json, res);
6183    if (json.has("code"))
6184      res.setCodeElement(parseCode(json.get("code").getAsString()));
6185    if (json.has("_code"))
6186      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
6187    if (json.has("description"))
6188      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6189    if (json.has("_description"))
6190      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
6191    if (json.has("operator")) {
6192      JsonArray array = json.getAsJsonArray("operator");
6193      for (int i = 0; i < array.size(); i++) {
6194        res.getOperator().add(parseEnumeration(array.get(i).getAsString(), CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
6195      }
6196    };
6197    if (json.has("_operator")) {
6198      JsonArray array = json.getAsJsonArray("_operator");
6199      for (int i = 0; i < array.size(); i++) {
6200        if (i == res.getOperator().size())
6201          res.getOperator().add(parseEnumeration(null, CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
6202        if (array.get(i) instanceof JsonObject) 
6203          parseElementProperties(array.get(i).getAsJsonObject(), res.getOperator().get(i));
6204      }
6205    };
6206    if (json.has("value"))
6207      res.setValueElement(parseString(json.get("value").getAsString()));
6208    if (json.has("_value"))
6209      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
6210  }
6211
6212  protected CodeSystem.PropertyComponent parseCodeSystemPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6213    CodeSystem.PropertyComponent res = new CodeSystem.PropertyComponent();
6214    parseCodeSystemPropertyComponentProperties(json, owner, res);
6215    return res;
6216  }
6217
6218  protected void parseCodeSystemPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.PropertyComponent res) throws IOException, FHIRFormatError {
6219    parseBackboneElementProperties(json, res);
6220    if (json.has("code"))
6221      res.setCodeElement(parseCode(json.get("code").getAsString()));
6222    if (json.has("_code"))
6223      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
6224    if (json.has("uri"))
6225      res.setUriElement(parseUri(json.get("uri").getAsString()));
6226    if (json.has("_uri"))
6227      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
6228    if (json.has("description"))
6229      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6230    if (json.has("_description"))
6231      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
6232    if (json.has("type"))
6233      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CodeSystem.PropertyType.NULL, new CodeSystem.PropertyTypeEnumFactory()));
6234    if (json.has("_type"))
6235      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
6236  }
6237
6238  protected CodeSystem.ConceptDefinitionComponent parseCodeSystemConceptDefinitionComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6239    CodeSystem.ConceptDefinitionComponent res = new CodeSystem.ConceptDefinitionComponent();
6240    parseCodeSystemConceptDefinitionComponentProperties(json, owner, res);
6241    return res;
6242  }
6243
6244  protected void parseCodeSystemConceptDefinitionComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionComponent res) throws IOException, FHIRFormatError {
6245    parseBackboneElementProperties(json, res);
6246    if (json.has("code"))
6247      res.setCodeElement(parseCode(json.get("code").getAsString()));
6248    if (json.has("_code"))
6249      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
6250    if (json.has("display"))
6251      res.setDisplayElement(parseString(json.get("display").getAsString()));
6252    if (json.has("_display"))
6253      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
6254    if (json.has("definition"))
6255      res.setDefinitionElement(parseString(json.get("definition").getAsString()));
6256    if (json.has("_definition"))
6257      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
6258    if (json.has("designation")) {
6259      JsonArray array = json.getAsJsonArray("designation");
6260      for (int i = 0; i < array.size(); i++) {
6261        res.getDesignation().add(parseCodeSystemConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject(), owner));
6262      }
6263    };
6264    if (json.has("property")) {
6265      JsonArray array = json.getAsJsonArray("property");
6266      for (int i = 0; i < array.size(); i++) {
6267        res.getProperty().add(parseCodeSystemConceptPropertyComponent(array.get(i).getAsJsonObject(), owner));
6268      }
6269    };
6270    if (json.has("concept")) {
6271      JsonArray array = json.getAsJsonArray("concept");
6272      for (int i = 0; i < array.size(); i++) {
6273        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), owner));
6274      }
6275    };
6276  }
6277
6278  protected CodeSystem.ConceptDefinitionDesignationComponent parseCodeSystemConceptDefinitionDesignationComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6279    CodeSystem.ConceptDefinitionDesignationComponent res = new CodeSystem.ConceptDefinitionDesignationComponent();
6280    parseCodeSystemConceptDefinitionDesignationComponentProperties(json, owner, res);
6281    return res;
6282  }
6283
6284  protected void parseCodeSystemConceptDefinitionDesignationComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionDesignationComponent res) throws IOException, FHIRFormatError {
6285    parseBackboneElementProperties(json, res);
6286    if (json.has("language"))
6287      res.setLanguageElement(parseCode(json.get("language").getAsString()));
6288    if (json.has("_language"))
6289      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
6290    if (json.has("use"))
6291      res.setUse(parseCoding(getJObject(json, "use")));
6292    if (json.has("value"))
6293      res.setValueElement(parseString(json.get("value").getAsString()));
6294    if (json.has("_value"))
6295      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
6296  }
6297
6298  protected CodeSystem.ConceptPropertyComponent parseCodeSystemConceptPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6299    CodeSystem.ConceptPropertyComponent res = new CodeSystem.ConceptPropertyComponent();
6300    parseCodeSystemConceptPropertyComponentProperties(json, owner, res);
6301    return res;
6302  }
6303
6304  protected void parseCodeSystemConceptPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptPropertyComponent res) throws IOException, FHIRFormatError {
6305    parseBackboneElementProperties(json, res);
6306    if (json.has("code"))
6307      res.setCodeElement(parseCode(json.get("code").getAsString()));
6308    if (json.has("_code"))
6309      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
6310    Type value = parseType("value", json);
6311    if (value != null)
6312      res.setValue(value);
6313  }
6314
6315  protected Communication parseCommunication(JsonObject json) throws IOException, FHIRFormatError {
6316    Communication res = new Communication();
6317    parseCommunicationProperties(json, res);
6318    return res;
6319  }
6320
6321  protected void parseCommunicationProperties(JsonObject json, Communication res) throws IOException, FHIRFormatError {
6322    parseDomainResourceProperties(json, res);
6323    if (json.has("identifier")) {
6324      JsonArray array = json.getAsJsonArray("identifier");
6325      for (int i = 0; i < array.size(); i++) {
6326        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6327      }
6328    };
6329    if (json.has("instantiatesCanonical")) {
6330      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
6331      for (int i = 0; i < array.size(); i++) {
6332        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
6333      }
6334    };
6335    if (json.has("_instantiatesCanonical")) {
6336      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
6337      for (int i = 0; i < array.size(); i++) {
6338        if (i == res.getInstantiatesCanonical().size())
6339          res.getInstantiatesCanonical().add(parseCanonical(null));
6340        if (array.get(i) instanceof JsonObject) 
6341          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
6342      }
6343    };
6344    if (json.has("instantiatesUri")) {
6345      JsonArray array = json.getAsJsonArray("instantiatesUri");
6346      for (int i = 0; i < array.size(); i++) {
6347        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
6348      }
6349    };
6350    if (json.has("_instantiatesUri")) {
6351      JsonArray array = json.getAsJsonArray("_instantiatesUri");
6352      for (int i = 0; i < array.size(); i++) {
6353        if (i == res.getInstantiatesUri().size())
6354          res.getInstantiatesUri().add(parseUri(null));
6355        if (array.get(i) instanceof JsonObject) 
6356          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
6357      }
6358    };
6359    if (json.has("basedOn")) {
6360      JsonArray array = json.getAsJsonArray("basedOn");
6361      for (int i = 0; i < array.size(); i++) {
6362        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
6363      }
6364    };
6365    if (json.has("partOf")) {
6366      JsonArray array = json.getAsJsonArray("partOf");
6367      for (int i = 0; i < array.size(); i++) {
6368        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
6369      }
6370    };
6371    if (json.has("inResponseTo")) {
6372      JsonArray array = json.getAsJsonArray("inResponseTo");
6373      for (int i = 0; i < array.size(); i++) {
6374        res.getInResponseTo().add(parseReference(array.get(i).getAsJsonObject()));
6375      }
6376    };
6377    if (json.has("status"))
6378      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Communication.CommunicationStatus.NULL, new Communication.CommunicationStatusEnumFactory()));
6379    if (json.has("_status"))
6380      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6381    if (json.has("statusReason"))
6382      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
6383    if (json.has("category")) {
6384      JsonArray array = json.getAsJsonArray("category");
6385      for (int i = 0; i < array.size(); i++) {
6386        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6387      }
6388    };
6389    if (json.has("priority"))
6390      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Communication.CommunicationPriority.NULL, new Communication.CommunicationPriorityEnumFactory()));
6391    if (json.has("_priority"))
6392      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
6393    if (json.has("medium")) {
6394      JsonArray array = json.getAsJsonArray("medium");
6395      for (int i = 0; i < array.size(); i++) {
6396        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6397      }
6398    };
6399    if (json.has("subject"))
6400      res.setSubject(parseReference(getJObject(json, "subject")));
6401    if (json.has("topic"))
6402      res.setTopic(parseCodeableConcept(getJObject(json, "topic")));
6403    if (json.has("about")) {
6404      JsonArray array = json.getAsJsonArray("about");
6405      for (int i = 0; i < array.size(); i++) {
6406        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
6407      }
6408    };
6409    if (json.has("encounter"))
6410      res.setEncounter(parseReference(getJObject(json, "encounter")));
6411    if (json.has("sent"))
6412      res.setSentElement(parseDateTime(json.get("sent").getAsString()));
6413    if (json.has("_sent"))
6414      parseElementProperties(getJObject(json, "_sent"), res.getSentElement());
6415    if (json.has("received"))
6416      res.setReceivedElement(parseDateTime(json.get("received").getAsString()));
6417    if (json.has("_received"))
6418      parseElementProperties(getJObject(json, "_received"), res.getReceivedElement());
6419    if (json.has("recipient")) {
6420      JsonArray array = json.getAsJsonArray("recipient");
6421      for (int i = 0; i < array.size(); i++) {
6422        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
6423      }
6424    };
6425    if (json.has("sender"))
6426      res.setSender(parseReference(getJObject(json, "sender")));
6427    if (json.has("reasonCode")) {
6428      JsonArray array = json.getAsJsonArray("reasonCode");
6429      for (int i = 0; i < array.size(); i++) {
6430        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6431      }
6432    };
6433    if (json.has("reasonReference")) {
6434      JsonArray array = json.getAsJsonArray("reasonReference");
6435      for (int i = 0; i < array.size(); i++) {
6436        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
6437      }
6438    };
6439    if (json.has("payload")) {
6440      JsonArray array = json.getAsJsonArray("payload");
6441      for (int i = 0; i < array.size(); i++) {
6442        res.getPayload().add(parseCommunicationCommunicationPayloadComponent(array.get(i).getAsJsonObject(), res));
6443      }
6444    };
6445    if (json.has("note")) {
6446      JsonArray array = json.getAsJsonArray("note");
6447      for (int i = 0; i < array.size(); i++) {
6448        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6449      }
6450    };
6451  }
6452
6453  protected Communication.CommunicationPayloadComponent parseCommunicationCommunicationPayloadComponent(JsonObject json, Communication owner) throws IOException, FHIRFormatError {
6454    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
6455    parseCommunicationCommunicationPayloadComponentProperties(json, owner, res);
6456    return res;
6457  }
6458
6459  protected void parseCommunicationCommunicationPayloadComponentProperties(JsonObject json, Communication owner, Communication.CommunicationPayloadComponent res) throws IOException, FHIRFormatError {
6460    parseBackboneElementProperties(json, res);
6461    Type content = parseType("content", json);
6462    if (content != null)
6463      res.setContent(content);
6464  }
6465
6466  protected CommunicationRequest parseCommunicationRequest(JsonObject json) throws IOException, FHIRFormatError {
6467    CommunicationRequest res = new CommunicationRequest();
6468    parseCommunicationRequestProperties(json, res);
6469    return res;
6470  }
6471
6472  protected void parseCommunicationRequestProperties(JsonObject json, CommunicationRequest res) throws IOException, FHIRFormatError {
6473    parseDomainResourceProperties(json, res);
6474    if (json.has("identifier")) {
6475      JsonArray array = json.getAsJsonArray("identifier");
6476      for (int i = 0; i < array.size(); i++) {
6477        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6478      }
6479    };
6480    if (json.has("basedOn")) {
6481      JsonArray array = json.getAsJsonArray("basedOn");
6482      for (int i = 0; i < array.size(); i++) {
6483        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
6484      }
6485    };
6486    if (json.has("replaces")) {
6487      JsonArray array = json.getAsJsonArray("replaces");
6488      for (int i = 0; i < array.size(); i++) {
6489        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
6490      }
6491    };
6492    if (json.has("groupIdentifier"))
6493      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
6494    if (json.has("status"))
6495      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CommunicationRequest.CommunicationRequestStatus.NULL, new CommunicationRequest.CommunicationRequestStatusEnumFactory()));
6496    if (json.has("_status"))
6497      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6498    if (json.has("statusReason"))
6499      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
6500    if (json.has("category")) {
6501      JsonArray array = json.getAsJsonArray("category");
6502      for (int i = 0; i < array.size(); i++) {
6503        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6504      }
6505    };
6506    if (json.has("priority"))
6507      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), CommunicationRequest.CommunicationPriority.NULL, new CommunicationRequest.CommunicationPriorityEnumFactory()));
6508    if (json.has("_priority"))
6509      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
6510    if (json.has("doNotPerform"))
6511      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
6512    if (json.has("_doNotPerform"))
6513      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
6514    if (json.has("medium")) {
6515      JsonArray array = json.getAsJsonArray("medium");
6516      for (int i = 0; i < array.size(); i++) {
6517        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6518      }
6519    };
6520    if (json.has("subject"))
6521      res.setSubject(parseReference(getJObject(json, "subject")));
6522    if (json.has("about")) {
6523      JsonArray array = json.getAsJsonArray("about");
6524      for (int i = 0; i < array.size(); i++) {
6525        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
6526      }
6527    };
6528    if (json.has("encounter"))
6529      res.setEncounter(parseReference(getJObject(json, "encounter")));
6530    if (json.has("payload")) {
6531      JsonArray array = json.getAsJsonArray("payload");
6532      for (int i = 0; i < array.size(); i++) {
6533        res.getPayload().add(parseCommunicationRequestCommunicationRequestPayloadComponent(array.get(i).getAsJsonObject(), res));
6534      }
6535    };
6536    Type occurrence = parseType("occurrence", json);
6537    if (occurrence != null)
6538      res.setOccurrence(occurrence);
6539    if (json.has("authoredOn"))
6540      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
6541    if (json.has("_authoredOn"))
6542      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
6543    if (json.has("requester"))
6544      res.setRequester(parseReference(getJObject(json, "requester")));
6545    if (json.has("recipient")) {
6546      JsonArray array = json.getAsJsonArray("recipient");
6547      for (int i = 0; i < array.size(); i++) {
6548        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
6549      }
6550    };
6551    if (json.has("sender"))
6552      res.setSender(parseReference(getJObject(json, "sender")));
6553    if (json.has("reasonCode")) {
6554      JsonArray array = json.getAsJsonArray("reasonCode");
6555      for (int i = 0; i < array.size(); i++) {
6556        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6557      }
6558    };
6559    if (json.has("reasonReference")) {
6560      JsonArray array = json.getAsJsonArray("reasonReference");
6561      for (int i = 0; i < array.size(); i++) {
6562        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
6563      }
6564    };
6565    if (json.has("note")) {
6566      JsonArray array = json.getAsJsonArray("note");
6567      for (int i = 0; i < array.size(); i++) {
6568        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6569      }
6570    };
6571  }
6572
6573  protected CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestCommunicationRequestPayloadComponent(JsonObject json, CommunicationRequest owner) throws IOException, FHIRFormatError {
6574    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
6575    parseCommunicationRequestCommunicationRequestPayloadComponentProperties(json, owner, res);
6576    return res;
6577  }
6578
6579  protected void parseCommunicationRequestCommunicationRequestPayloadComponentProperties(JsonObject json, CommunicationRequest owner, CommunicationRequest.CommunicationRequestPayloadComponent res) throws IOException, FHIRFormatError {
6580    parseBackboneElementProperties(json, res);
6581    Type content = parseType("content", json);
6582    if (content != null)
6583      res.setContent(content);
6584  }
6585
6586  protected CompartmentDefinition parseCompartmentDefinition(JsonObject json) throws IOException, FHIRFormatError {
6587    CompartmentDefinition res = new CompartmentDefinition();
6588    parseCompartmentDefinitionProperties(json, res);
6589    return res;
6590  }
6591
6592  protected void parseCompartmentDefinitionProperties(JsonObject json, CompartmentDefinition res) throws IOException, FHIRFormatError {
6593    parseDomainResourceProperties(json, res);
6594    if (json.has("url"))
6595      res.setUrlElement(parseUri(json.get("url").getAsString()));
6596    if (json.has("_url"))
6597      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
6598    if (json.has("version"))
6599      res.setVersionElement(parseString(json.get("version").getAsString()));
6600    if (json.has("_version"))
6601      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
6602    if (json.has("name"))
6603      res.setNameElement(parseString(json.get("name").getAsString()));
6604    if (json.has("_name"))
6605      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
6606    if (json.has("status"))
6607      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
6608    if (json.has("_status"))
6609      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6610    if (json.has("experimental"))
6611      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6612    if (json.has("_experimental"))
6613      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
6614    if (json.has("date"))
6615      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6616    if (json.has("_date"))
6617      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6618    if (json.has("publisher"))
6619      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6620    if (json.has("_publisher"))
6621      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
6622    if (json.has("contact")) {
6623      JsonArray array = json.getAsJsonArray("contact");
6624      for (int i = 0; i < array.size(); i++) {
6625        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
6626      }
6627    };
6628    if (json.has("description"))
6629      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
6630    if (json.has("_description"))
6631      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
6632    if (json.has("useContext")) {
6633      JsonArray array = json.getAsJsonArray("useContext");
6634      for (int i = 0; i < array.size(); i++) {
6635        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
6636      }
6637    };
6638    if (json.has("purpose"))
6639      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
6640    if (json.has("_purpose"))
6641      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
6642    if (json.has("code"))
6643      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CompartmentDefinition.CompartmentType.NULL, new CompartmentDefinition.CompartmentTypeEnumFactory()));
6644    if (json.has("_code"))
6645      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
6646    if (json.has("search"))
6647      res.setSearchElement(parseBoolean(json.get("search").getAsBoolean()));
6648    if (json.has("_search"))
6649      parseElementProperties(getJObject(json, "_search"), res.getSearchElement());
6650    if (json.has("resource")) {
6651      JsonArray array = json.getAsJsonArray("resource");
6652      for (int i = 0; i < array.size(); i++) {
6653        res.getResource().add(parseCompartmentDefinitionCompartmentDefinitionResourceComponent(array.get(i).getAsJsonObject(), res));
6654      }
6655    };
6656  }
6657
6658  protected CompartmentDefinition.CompartmentDefinitionResourceComponent parseCompartmentDefinitionCompartmentDefinitionResourceComponent(JsonObject json, CompartmentDefinition owner) throws IOException, FHIRFormatError {
6659    CompartmentDefinition.CompartmentDefinitionResourceComponent res = new CompartmentDefinition.CompartmentDefinitionResourceComponent();
6660    parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(json, owner, res);
6661    return res;
6662  }
6663
6664  protected void parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(JsonObject json, CompartmentDefinition owner, CompartmentDefinition.CompartmentDefinitionResourceComponent res) throws IOException, FHIRFormatError {
6665    parseBackboneElementProperties(json, res);
6666    if (json.has("code"))
6667      res.setCodeElement(parseCode(json.get("code").getAsString()));
6668    if (json.has("_code"))
6669      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
6670    if (json.has("param")) {
6671      JsonArray array = json.getAsJsonArray("param");
6672      for (int i = 0; i < array.size(); i++) {
6673        res.getParam().add(parseString(array.get(i).getAsString()));
6674      }
6675    };
6676    if (json.has("_param")) {
6677      JsonArray array = json.getAsJsonArray("_param");
6678      for (int i = 0; i < array.size(); i++) {
6679        if (i == res.getParam().size())
6680          res.getParam().add(parseString(null));
6681        if (array.get(i) instanceof JsonObject) 
6682          parseElementProperties(array.get(i).getAsJsonObject(), res.getParam().get(i));
6683      }
6684    };
6685    if (json.has("documentation"))
6686      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
6687    if (json.has("_documentation"))
6688      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
6689  }
6690
6691  protected Composition parseComposition(JsonObject json) throws IOException, FHIRFormatError {
6692    Composition res = new Composition();
6693    parseCompositionProperties(json, res);
6694    return res;
6695  }
6696
6697  protected void parseCompositionProperties(JsonObject json, Composition res) throws IOException, FHIRFormatError {
6698    parseDomainResourceProperties(json, res);
6699    if (json.has("identifier"))
6700      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
6701    if (json.has("status"))
6702      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Composition.CompositionStatus.NULL, new Composition.CompositionStatusEnumFactory()));
6703    if (json.has("_status"))
6704      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6705    if (json.has("type"))
6706      res.setType(parseCodeableConcept(getJObject(json, "type")));
6707    if (json.has("category")) {
6708      JsonArray array = json.getAsJsonArray("category");
6709      for (int i = 0; i < array.size(); i++) {
6710        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6711      }
6712    };
6713    if (json.has("subject"))
6714      res.setSubject(parseReference(getJObject(json, "subject")));
6715    if (json.has("encounter"))
6716      res.setEncounter(parseReference(getJObject(json, "encounter")));
6717    if (json.has("date"))
6718      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6719    if (json.has("_date"))
6720      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6721    if (json.has("author")) {
6722      JsonArray array = json.getAsJsonArray("author");
6723      for (int i = 0; i < array.size(); i++) {
6724        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
6725      }
6726    };
6727    if (json.has("title"))
6728      res.setTitleElement(parseString(json.get("title").getAsString()));
6729    if (json.has("_title"))
6730      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
6731    if (json.has("confidentiality"))
6732      res.setConfidentialityElement(parseEnumeration(json.get("confidentiality").getAsString(), Composition.DocumentConfidentiality.NULL, new Composition.DocumentConfidentialityEnumFactory()));
6733    if (json.has("_confidentiality"))
6734      parseElementProperties(getJObject(json, "_confidentiality"), res.getConfidentialityElement());
6735    if (json.has("attester")) {
6736      JsonArray array = json.getAsJsonArray("attester");
6737      for (int i = 0; i < array.size(); i++) {
6738        res.getAttester().add(parseCompositionCompositionAttesterComponent(array.get(i).getAsJsonObject(), res));
6739      }
6740    };
6741    if (json.has("custodian"))
6742      res.setCustodian(parseReference(getJObject(json, "custodian")));
6743    if (json.has("relatesTo")) {
6744      JsonArray array = json.getAsJsonArray("relatesTo");
6745      for (int i = 0; i < array.size(); i++) {
6746        res.getRelatesTo().add(parseCompositionCompositionRelatesToComponent(array.get(i).getAsJsonObject(), res));
6747      }
6748    };
6749    if (json.has("event")) {
6750      JsonArray array = json.getAsJsonArray("event");
6751      for (int i = 0; i < array.size(); i++) {
6752        res.getEvent().add(parseCompositionCompositionEventComponent(array.get(i).getAsJsonObject(), res));
6753      }
6754    };
6755    if (json.has("section")) {
6756      JsonArray array = json.getAsJsonArray("section");
6757      for (int i = 0; i < array.size(); i++) {
6758        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), res));
6759      }
6760    };
6761  }
6762
6763  protected Composition.CompositionAttesterComponent parseCompositionCompositionAttesterComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
6764    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
6765    parseCompositionCompositionAttesterComponentProperties(json, owner, res);
6766    return res;
6767  }
6768
6769  protected void parseCompositionCompositionAttesterComponentProperties(JsonObject json, Composition owner, Composition.CompositionAttesterComponent res) throws IOException, FHIRFormatError {
6770    parseBackboneElementProperties(json, res);
6771    if (json.has("mode"))
6772      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
6773    if (json.has("_mode"))
6774      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
6775    if (json.has("time"))
6776      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
6777    if (json.has("_time"))
6778      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
6779    if (json.has("party"))
6780      res.setParty(parseReference(getJObject(json, "party")));
6781  }
6782
6783  protected Composition.CompositionRelatesToComponent parseCompositionCompositionRelatesToComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
6784    Composition.CompositionRelatesToComponent res = new Composition.CompositionRelatesToComponent();
6785    parseCompositionCompositionRelatesToComponentProperties(json, owner, res);
6786    return res;
6787  }
6788
6789  protected void parseCompositionCompositionRelatesToComponentProperties(JsonObject json, Composition owner, Composition.CompositionRelatesToComponent res) throws IOException, FHIRFormatError {
6790    parseBackboneElementProperties(json, res);
6791    if (json.has("code"))
6792      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Composition.DocumentRelationshipType.NULL, new Composition.DocumentRelationshipTypeEnumFactory()));
6793    if (json.has("_code"))
6794      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
6795    Type target = parseType("target", json);
6796    if (target != null)
6797      res.setTarget(target);
6798  }
6799
6800  protected Composition.CompositionEventComponent parseCompositionCompositionEventComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
6801    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
6802    parseCompositionCompositionEventComponentProperties(json, owner, res);
6803    return res;
6804  }
6805
6806  protected void parseCompositionCompositionEventComponentProperties(JsonObject json, Composition owner, Composition.CompositionEventComponent res) throws IOException, FHIRFormatError {
6807    parseBackboneElementProperties(json, res);
6808    if (json.has("code")) {
6809      JsonArray array = json.getAsJsonArray("code");
6810      for (int i = 0; i < array.size(); i++) {
6811        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6812      }
6813    };
6814    if (json.has("period"))
6815      res.setPeriod(parsePeriod(getJObject(json, "period")));
6816    if (json.has("detail")) {
6817      JsonArray array = json.getAsJsonArray("detail");
6818      for (int i = 0; i < array.size(); i++) {
6819        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
6820      }
6821    };
6822  }
6823
6824  protected Composition.SectionComponent parseCompositionSectionComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
6825    Composition.SectionComponent res = new Composition.SectionComponent();
6826    parseCompositionSectionComponentProperties(json, owner, res);
6827    return res;
6828  }
6829
6830  protected void parseCompositionSectionComponentProperties(JsonObject json, Composition owner, Composition.SectionComponent res) throws IOException, FHIRFormatError {
6831    parseBackboneElementProperties(json, res);
6832    if (json.has("title"))
6833      res.setTitleElement(parseString(json.get("title").getAsString()));
6834    if (json.has("_title"))
6835      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
6836    if (json.has("code"))
6837      res.setCode(parseCodeableConcept(getJObject(json, "code")));
6838    if (json.has("author")) {
6839      JsonArray array = json.getAsJsonArray("author");
6840      for (int i = 0; i < array.size(); i++) {
6841        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
6842      }
6843    };
6844    if (json.has("focus"))
6845      res.setFocus(parseReference(getJObject(json, "focus")));
6846    if (json.has("text"))
6847      res.setText(parseNarrative(getJObject(json, "text")));
6848    if (json.has("mode"))
6849      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.SectionMode.NULL, new Composition.SectionModeEnumFactory()));
6850    if (json.has("_mode"))
6851      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
6852    if (json.has("orderedBy"))
6853      res.setOrderedBy(parseCodeableConcept(getJObject(json, "orderedBy")));
6854    if (json.has("entry")) {
6855      JsonArray array = json.getAsJsonArray("entry");
6856      for (int i = 0; i < array.size(); i++) {
6857        res.getEntry().add(parseReference(array.get(i).getAsJsonObject()));
6858      }
6859    };
6860    if (json.has("emptyReason"))
6861      res.setEmptyReason(parseCodeableConcept(getJObject(json, "emptyReason")));
6862    if (json.has("section")) {
6863      JsonArray array = json.getAsJsonArray("section");
6864      for (int i = 0; i < array.size(); i++) {
6865        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), owner));
6866      }
6867    };
6868  }
6869
6870  protected ConceptMap parseConceptMap(JsonObject json) throws IOException, FHIRFormatError {
6871    ConceptMap res = new ConceptMap();
6872    parseConceptMapProperties(json, res);
6873    return res;
6874  }
6875
6876  protected void parseConceptMapProperties(JsonObject json, ConceptMap res) throws IOException, FHIRFormatError {
6877    parseDomainResourceProperties(json, res);
6878    if (json.has("url"))
6879      res.setUrlElement(parseUri(json.get("url").getAsString()));
6880    if (json.has("_url"))
6881      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
6882    if (json.has("identifier"))
6883      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
6884    if (json.has("version"))
6885      res.setVersionElement(parseString(json.get("version").getAsString()));
6886    if (json.has("_version"))
6887      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
6888    if (json.has("name"))
6889      res.setNameElement(parseString(json.get("name").getAsString()));
6890    if (json.has("_name"))
6891      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
6892    if (json.has("title"))
6893      res.setTitleElement(parseString(json.get("title").getAsString()));
6894    if (json.has("_title"))
6895      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
6896    if (json.has("status"))
6897      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
6898    if (json.has("_status"))
6899      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6900    if (json.has("experimental"))
6901      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6902    if (json.has("_experimental"))
6903      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
6904    if (json.has("date"))
6905      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6906    if (json.has("_date"))
6907      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6908    if (json.has("publisher"))
6909      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6910    if (json.has("_publisher"))
6911      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
6912    if (json.has("contact")) {
6913      JsonArray array = json.getAsJsonArray("contact");
6914      for (int i = 0; i < array.size(); i++) {
6915        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
6916      }
6917    };
6918    if (json.has("description"))
6919      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
6920    if (json.has("_description"))
6921      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
6922    if (json.has("useContext")) {
6923      JsonArray array = json.getAsJsonArray("useContext");
6924      for (int i = 0; i < array.size(); i++) {
6925        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
6926      }
6927    };
6928    if (json.has("jurisdiction")) {
6929      JsonArray array = json.getAsJsonArray("jurisdiction");
6930      for (int i = 0; i < array.size(); i++) {
6931        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6932      }
6933    };
6934    if (json.has("purpose"))
6935      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
6936    if (json.has("_purpose"))
6937      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
6938    if (json.has("copyright"))
6939      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
6940    if (json.has("_copyright"))
6941      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
6942    Type source = parseType("source", json);
6943    if (source != null)
6944      res.setSource(source);
6945    Type target = parseType("target", json);
6946    if (target != null)
6947      res.setTarget(target);
6948    if (json.has("group")) {
6949      JsonArray array = json.getAsJsonArray("group");
6950      for (int i = 0; i < array.size(); i++) {
6951        res.getGroup().add(parseConceptMapConceptMapGroupComponent(array.get(i).getAsJsonObject(), res));
6952      }
6953    };
6954  }
6955
6956  protected ConceptMap.ConceptMapGroupComponent parseConceptMapConceptMapGroupComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6957    ConceptMap.ConceptMapGroupComponent res = new ConceptMap.ConceptMapGroupComponent();
6958    parseConceptMapConceptMapGroupComponentProperties(json, owner, res);
6959    return res;
6960  }
6961
6962  protected void parseConceptMapConceptMapGroupComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupComponent res) throws IOException, FHIRFormatError {
6963    parseBackboneElementProperties(json, res);
6964    if (json.has("source"))
6965      res.setSourceElement(parseUri(json.get("source").getAsString()));
6966    if (json.has("_source"))
6967      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
6968    if (json.has("sourceVersion"))
6969      res.setSourceVersionElement(parseString(json.get("sourceVersion").getAsString()));
6970    if (json.has("_sourceVersion"))
6971      parseElementProperties(getJObject(json, "_sourceVersion"), res.getSourceVersionElement());
6972    if (json.has("target"))
6973      res.setTargetElement(parseUri(json.get("target").getAsString()));
6974    if (json.has("_target"))
6975      parseElementProperties(getJObject(json, "_target"), res.getTargetElement());
6976    if (json.has("targetVersion"))
6977      res.setTargetVersionElement(parseString(json.get("targetVersion").getAsString()));
6978    if (json.has("_targetVersion"))
6979      parseElementProperties(getJObject(json, "_targetVersion"), res.getTargetVersionElement());
6980    if (json.has("element")) {
6981      JsonArray array = json.getAsJsonArray("element");
6982      for (int i = 0; i < array.size(); i++) {
6983        res.getElement().add(parseConceptMapSourceElementComponent(array.get(i).getAsJsonObject(), owner));
6984      }
6985    };
6986    if (json.has("unmapped"))
6987      res.setUnmapped(parseConceptMapConceptMapGroupUnmappedComponent(getJObject(json, "unmapped"), owner));
6988  }
6989
6990  protected ConceptMap.SourceElementComponent parseConceptMapSourceElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6991    ConceptMap.SourceElementComponent res = new ConceptMap.SourceElementComponent();
6992    parseConceptMapSourceElementComponentProperties(json, owner, res);
6993    return res;
6994  }
6995
6996  protected void parseConceptMapSourceElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.SourceElementComponent res) throws IOException, FHIRFormatError {
6997    parseBackboneElementProperties(json, res);
6998    if (json.has("code"))
6999      res.setCodeElement(parseCode(json.get("code").getAsString()));
7000    if (json.has("_code"))
7001      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
7002    if (json.has("display"))
7003      res.setDisplayElement(parseString(json.get("display").getAsString()));
7004    if (json.has("_display"))
7005      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
7006    if (json.has("target")) {
7007      JsonArray array = json.getAsJsonArray("target");
7008      for (int i = 0; i < array.size(); i++) {
7009        res.getTarget().add(parseConceptMapTargetElementComponent(array.get(i).getAsJsonObject(), owner));
7010      }
7011    };
7012  }
7013
7014  protected ConceptMap.TargetElementComponent parseConceptMapTargetElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
7015    ConceptMap.TargetElementComponent res = new ConceptMap.TargetElementComponent();
7016    parseConceptMapTargetElementComponentProperties(json, owner, res);
7017    return res;
7018  }
7019
7020  protected void parseConceptMapTargetElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.TargetElementComponent res) throws IOException, FHIRFormatError {
7021    parseBackboneElementProperties(json, res);
7022    if (json.has("code"))
7023      res.setCodeElement(parseCode(json.get("code").getAsString()));
7024    if (json.has("_code"))
7025      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
7026    if (json.has("display"))
7027      res.setDisplayElement(parseString(json.get("display").getAsString()));
7028    if (json.has("_display"))
7029      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
7030    if (json.has("equivalence"))
7031      res.setEquivalenceElement(parseEnumeration(json.get("equivalence").getAsString(), Enumerations.ConceptMapEquivalence.NULL, new Enumerations.ConceptMapEquivalenceEnumFactory()));
7032    if (json.has("_equivalence"))
7033      parseElementProperties(getJObject(json, "_equivalence"), res.getEquivalenceElement());
7034    if (json.has("comment"))
7035      res.setCommentElement(parseString(json.get("comment").getAsString()));
7036    if (json.has("_comment"))
7037      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
7038    if (json.has("dependsOn")) {
7039      JsonArray array = json.getAsJsonArray("dependsOn");
7040      for (int i = 0; i < array.size(); i++) {
7041        res.getDependsOn().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
7042      }
7043    };
7044    if (json.has("product")) {
7045      JsonArray array = json.getAsJsonArray("product");
7046      for (int i = 0; i < array.size(); i++) {
7047        res.getProduct().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
7048      }
7049    };
7050  }
7051
7052  protected ConceptMap.OtherElementComponent parseConceptMapOtherElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
7053    ConceptMap.OtherElementComponent res = new ConceptMap.OtherElementComponent();
7054    parseConceptMapOtherElementComponentProperties(json, owner, res);
7055    return res;
7056  }
7057
7058  protected void parseConceptMapOtherElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.OtherElementComponent res) throws IOException, FHIRFormatError {
7059    parseBackboneElementProperties(json, res);
7060    if (json.has("property"))
7061      res.setPropertyElement(parseUri(json.get("property").getAsString()));
7062    if (json.has("_property"))
7063      parseElementProperties(getJObject(json, "_property"), res.getPropertyElement());
7064    if (json.has("system"))
7065      res.setSystemElement(parseCanonical(json.get("system").getAsString()));
7066    if (json.has("_system"))
7067      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
7068    if (json.has("value"))
7069      res.setValueElement(parseString(json.get("value").getAsString()));
7070    if (json.has("_value"))
7071      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
7072    if (json.has("display"))
7073      res.setDisplayElement(parseString(json.get("display").getAsString()));
7074    if (json.has("_display"))
7075      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
7076  }
7077
7078  protected ConceptMap.ConceptMapGroupUnmappedComponent parseConceptMapConceptMapGroupUnmappedComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
7079    ConceptMap.ConceptMapGroupUnmappedComponent res = new ConceptMap.ConceptMapGroupUnmappedComponent();
7080    parseConceptMapConceptMapGroupUnmappedComponentProperties(json, owner, res);
7081    return res;
7082  }
7083
7084  protected void parseConceptMapConceptMapGroupUnmappedComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupUnmappedComponent res) throws IOException, FHIRFormatError {
7085    parseBackboneElementProperties(json, res);
7086    if (json.has("mode"))
7087      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ConceptMap.ConceptMapGroupUnmappedMode.NULL, new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory()));
7088    if (json.has("_mode"))
7089      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
7090    if (json.has("code"))
7091      res.setCodeElement(parseCode(json.get("code").getAsString()));
7092    if (json.has("_code"))
7093      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
7094    if (json.has("display"))
7095      res.setDisplayElement(parseString(json.get("display").getAsString()));
7096    if (json.has("_display"))
7097      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
7098    if (json.has("url"))
7099      res.setUrlElement(parseCanonical(json.get("url").getAsString()));
7100    if (json.has("_url"))
7101      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
7102  }
7103
7104  protected Condition parseCondition(JsonObject json) throws IOException, FHIRFormatError {
7105    Condition res = new Condition();
7106    parseConditionProperties(json, res);
7107    return res;
7108  }
7109
7110  protected void parseConditionProperties(JsonObject json, Condition res) throws IOException, FHIRFormatError {
7111    parseDomainResourceProperties(json, res);
7112    if (json.has("identifier")) {
7113      JsonArray array = json.getAsJsonArray("identifier");
7114      for (int i = 0; i < array.size(); i++) {
7115        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7116      }
7117    };
7118    if (json.has("clinicalStatus"))
7119      res.setClinicalStatus(parseCodeableConcept(getJObject(json, "clinicalStatus")));
7120    if (json.has("verificationStatus"))
7121      res.setVerificationStatus(parseCodeableConcept(getJObject(json, "verificationStatus")));
7122    if (json.has("category")) {
7123      JsonArray array = json.getAsJsonArray("category");
7124      for (int i = 0; i < array.size(); i++) {
7125        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7126      }
7127    };
7128    if (json.has("severity"))
7129      res.setSeverity(parseCodeableConcept(getJObject(json, "severity")));
7130    if (json.has("code"))
7131      res.setCode(parseCodeableConcept(getJObject(json, "code")));
7132    if (json.has("bodySite")) {
7133      JsonArray array = json.getAsJsonArray("bodySite");
7134      for (int i = 0; i < array.size(); i++) {
7135        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7136      }
7137    };
7138    if (json.has("subject"))
7139      res.setSubject(parseReference(getJObject(json, "subject")));
7140    if (json.has("encounter"))
7141      res.setEncounter(parseReference(getJObject(json, "encounter")));
7142    Type onset = parseType("onset", json);
7143    if (onset != null)
7144      res.setOnset(onset);
7145    Type abatement = parseType("abatement", json);
7146    if (abatement != null)
7147      res.setAbatement(abatement);
7148    if (json.has("recordedDate"))
7149      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
7150    if (json.has("_recordedDate"))
7151      parseElementProperties(getJObject(json, "_recordedDate"), res.getRecordedDateElement());
7152    if (json.has("recorder"))
7153      res.setRecorder(parseReference(getJObject(json, "recorder")));
7154    if (json.has("asserter"))
7155      res.setAsserter(parseReference(getJObject(json, "asserter")));
7156    if (json.has("stage")) {
7157      JsonArray array = json.getAsJsonArray("stage");
7158      for (int i = 0; i < array.size(); i++) {
7159        res.getStage().add(parseConditionConditionStageComponent(array.get(i).getAsJsonObject(), res));
7160      }
7161    };
7162    if (json.has("evidence")) {
7163      JsonArray array = json.getAsJsonArray("evidence");
7164      for (int i = 0; i < array.size(); i++) {
7165        res.getEvidence().add(parseConditionConditionEvidenceComponent(array.get(i).getAsJsonObject(), res));
7166      }
7167    };
7168    if (json.has("note")) {
7169      JsonArray array = json.getAsJsonArray("note");
7170      for (int i = 0; i < array.size(); i++) {
7171        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7172      }
7173    };
7174  }
7175
7176  protected Condition.ConditionStageComponent parseConditionConditionStageComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
7177    Condition.ConditionStageComponent res = new Condition.ConditionStageComponent();
7178    parseConditionConditionStageComponentProperties(json, owner, res);
7179    return res;
7180  }
7181
7182  protected void parseConditionConditionStageComponentProperties(JsonObject json, Condition owner, Condition.ConditionStageComponent res) throws IOException, FHIRFormatError {
7183    parseBackboneElementProperties(json, res);
7184    if (json.has("summary"))
7185      res.setSummary(parseCodeableConcept(getJObject(json, "summary")));
7186    if (json.has("assessment")) {
7187      JsonArray array = json.getAsJsonArray("assessment");
7188      for (int i = 0; i < array.size(); i++) {
7189        res.getAssessment().add(parseReference(array.get(i).getAsJsonObject()));
7190      }
7191    };
7192    if (json.has("type"))
7193      res.setType(parseCodeableConcept(getJObject(json, "type")));
7194  }
7195
7196  protected Condition.ConditionEvidenceComponent parseConditionConditionEvidenceComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
7197    Condition.ConditionEvidenceComponent res = new Condition.ConditionEvidenceComponent();
7198    parseConditionConditionEvidenceComponentProperties(json, owner, res);
7199    return res;
7200  }
7201
7202  protected void parseConditionConditionEvidenceComponentProperties(JsonObject json, Condition owner, Condition.ConditionEvidenceComponent res) throws IOException, FHIRFormatError {
7203    parseBackboneElementProperties(json, res);
7204    if (json.has("code")) {
7205      JsonArray array = json.getAsJsonArray("code");
7206      for (int i = 0; i < array.size(); i++) {
7207        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7208      }
7209    };
7210    if (json.has("detail")) {
7211      JsonArray array = json.getAsJsonArray("detail");
7212      for (int i = 0; i < array.size(); i++) {
7213        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
7214      }
7215    };
7216  }
7217
7218  protected Consent parseConsent(JsonObject json) throws IOException, FHIRFormatError {
7219    Consent res = new Consent();
7220    parseConsentProperties(json, res);
7221    return res;
7222  }
7223
7224  protected void parseConsentProperties(JsonObject json, Consent res) throws IOException, FHIRFormatError {
7225    parseDomainResourceProperties(json, res);
7226    if (json.has("identifier")) {
7227      JsonArray array = json.getAsJsonArray("identifier");
7228      for (int i = 0; i < array.size(); i++) {
7229        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7230      }
7231    };
7232    if (json.has("status"))
7233      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Consent.ConsentState.NULL, new Consent.ConsentStateEnumFactory()));
7234    if (json.has("_status"))
7235      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7236    if (json.has("scope"))
7237      res.setScope(parseCodeableConcept(getJObject(json, "scope")));
7238    if (json.has("category")) {
7239      JsonArray array = json.getAsJsonArray("category");
7240      for (int i = 0; i < array.size(); i++) {
7241        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7242      }
7243    };
7244    if (json.has("patient"))
7245      res.setPatient(parseReference(getJObject(json, "patient")));
7246    if (json.has("dateTime"))
7247      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
7248    if (json.has("_dateTime"))
7249      parseElementProperties(getJObject(json, "_dateTime"), res.getDateTimeElement());
7250    if (json.has("performer")) {
7251      JsonArray array = json.getAsJsonArray("performer");
7252      for (int i = 0; i < array.size(); i++) {
7253        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
7254      }
7255    };
7256    if (json.has("organization")) {
7257      JsonArray array = json.getAsJsonArray("organization");
7258      for (int i = 0; i < array.size(); i++) {
7259        res.getOrganization().add(parseReference(array.get(i).getAsJsonObject()));
7260      }
7261    };
7262    Type source = parseType("source", json);
7263    if (source != null)
7264      res.setSource(source);
7265    if (json.has("policy")) {
7266      JsonArray array = json.getAsJsonArray("policy");
7267      for (int i = 0; i < array.size(); i++) {
7268        res.getPolicy().add(parseConsentConsentPolicyComponent(array.get(i).getAsJsonObject(), res));
7269      }
7270    };
7271    if (json.has("policyRule"))
7272      res.setPolicyRule(parseCodeableConcept(getJObject(json, "policyRule")));
7273    if (json.has("verification")) {
7274      JsonArray array = json.getAsJsonArray("verification");
7275      for (int i = 0; i < array.size(); i++) {
7276        res.getVerification().add(parseConsentConsentVerificationComponent(array.get(i).getAsJsonObject(), res));
7277      }
7278    };
7279    if (json.has("provision"))
7280      res.setProvision(parseConsentprovisionComponent(getJObject(json, "provision"), res));
7281  }
7282
7283  protected Consent.ConsentPolicyComponent parseConsentConsentPolicyComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7284    Consent.ConsentPolicyComponent res = new Consent.ConsentPolicyComponent();
7285    parseConsentConsentPolicyComponentProperties(json, owner, res);
7286    return res;
7287  }
7288
7289  protected void parseConsentConsentPolicyComponentProperties(JsonObject json, Consent owner, Consent.ConsentPolicyComponent res) throws IOException, FHIRFormatError {
7290    parseBackboneElementProperties(json, res);
7291    if (json.has("authority"))
7292      res.setAuthorityElement(parseUri(json.get("authority").getAsString()));
7293    if (json.has("_authority"))
7294      parseElementProperties(getJObject(json, "_authority"), res.getAuthorityElement());
7295    if (json.has("uri"))
7296      res.setUriElement(parseUri(json.get("uri").getAsString()));
7297    if (json.has("_uri"))
7298      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
7299  }
7300
7301  protected Consent.ConsentVerificationComponent parseConsentConsentVerificationComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7302    Consent.ConsentVerificationComponent res = new Consent.ConsentVerificationComponent();
7303    parseConsentConsentVerificationComponentProperties(json, owner, res);
7304    return res;
7305  }
7306
7307  protected void parseConsentConsentVerificationComponentProperties(JsonObject json, Consent owner, Consent.ConsentVerificationComponent res) throws IOException, FHIRFormatError {
7308    parseBackboneElementProperties(json, res);
7309    if (json.has("verified"))
7310      res.setVerifiedElement(parseBoolean(json.get("verified").getAsBoolean()));
7311    if (json.has("_verified"))
7312      parseElementProperties(getJObject(json, "_verified"), res.getVerifiedElement());
7313    if (json.has("verifiedWith"))
7314      res.setVerifiedWith(parseReference(getJObject(json, "verifiedWith")));
7315    if (json.has("verificationDate"))
7316      res.setVerificationDateElement(parseDateTime(json.get("verificationDate").getAsString()));
7317    if (json.has("_verificationDate"))
7318      parseElementProperties(getJObject(json, "_verificationDate"), res.getVerificationDateElement());
7319  }
7320
7321  protected Consent.provisionComponent parseConsentprovisionComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7322    Consent.provisionComponent res = new Consent.provisionComponent();
7323    parseConsentprovisionComponentProperties(json, owner, res);
7324    return res;
7325  }
7326
7327  protected void parseConsentprovisionComponentProperties(JsonObject json, Consent owner, Consent.provisionComponent res) throws IOException, FHIRFormatError {
7328    parseBackboneElementProperties(json, res);
7329    if (json.has("type"))
7330      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Consent.ConsentProvisionType.NULL, new Consent.ConsentProvisionTypeEnumFactory()));
7331    if (json.has("_type"))
7332      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
7333    if (json.has("period"))
7334      res.setPeriod(parsePeriod(getJObject(json, "period")));
7335    if (json.has("actor")) {
7336      JsonArray array = json.getAsJsonArray("actor");
7337      for (int i = 0; i < array.size(); i++) {
7338        res.getActor().add(parseConsentprovisionActorComponent(array.get(i).getAsJsonObject(), owner));
7339      }
7340    };
7341    if (json.has("action")) {
7342      JsonArray array = json.getAsJsonArray("action");
7343      for (int i = 0; i < array.size(); i++) {
7344        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7345      }
7346    };
7347    if (json.has("securityLabel")) {
7348      JsonArray array = json.getAsJsonArray("securityLabel");
7349      for (int i = 0; i < array.size(); i++) {
7350        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
7351      }
7352    };
7353    if (json.has("purpose")) {
7354      JsonArray array = json.getAsJsonArray("purpose");
7355      for (int i = 0; i < array.size(); i++) {
7356        res.getPurpose().add(parseCoding(array.get(i).getAsJsonObject()));
7357      }
7358    };
7359    if (json.has("class")) {
7360      JsonArray array = json.getAsJsonArray("class");
7361      for (int i = 0; i < array.size(); i++) {
7362        res.getClass_().add(parseCoding(array.get(i).getAsJsonObject()));
7363      }
7364    };
7365    if (json.has("code")) {
7366      JsonArray array = json.getAsJsonArray("code");
7367      for (int i = 0; i < array.size(); i++) {
7368        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7369      }
7370    };
7371    if (json.has("dataPeriod"))
7372      res.setDataPeriod(parsePeriod(getJObject(json, "dataPeriod")));
7373    if (json.has("data")) {
7374      JsonArray array = json.getAsJsonArray("data");
7375      for (int i = 0; i < array.size(); i++) {
7376        res.getData().add(parseConsentprovisionDataComponent(array.get(i).getAsJsonObject(), owner));
7377      }
7378    };
7379    if (json.has("provision")) {
7380      JsonArray array = json.getAsJsonArray("provision");
7381      for (int i = 0; i < array.size(); i++) {
7382        res.getProvision().add(parseConsentprovisionComponent(array.get(i).getAsJsonObject(), owner));
7383      }
7384    };
7385  }
7386
7387  protected Consent.provisionActorComponent parseConsentprovisionActorComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7388    Consent.provisionActorComponent res = new Consent.provisionActorComponent();
7389    parseConsentprovisionActorComponentProperties(json, owner, res);
7390    return res;
7391  }
7392
7393  protected void parseConsentprovisionActorComponentProperties(JsonObject json, Consent owner, Consent.provisionActorComponent res) throws IOException, FHIRFormatError {
7394    parseBackboneElementProperties(json, res);
7395    if (json.has("role"))
7396      res.setRole(parseCodeableConcept(getJObject(json, "role")));
7397    if (json.has("reference"))
7398      res.setReference(parseReference(getJObject(json, "reference")));
7399  }
7400
7401  protected Consent.provisionDataComponent parseConsentprovisionDataComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7402    Consent.provisionDataComponent res = new Consent.provisionDataComponent();
7403    parseConsentprovisionDataComponentProperties(json, owner, res);
7404    return res;
7405  }
7406
7407  protected void parseConsentprovisionDataComponentProperties(JsonObject json, Consent owner, Consent.provisionDataComponent res) throws IOException, FHIRFormatError {
7408    parseBackboneElementProperties(json, res);
7409    if (json.has("meaning"))
7410      res.setMeaningElement(parseEnumeration(json.get("meaning").getAsString(), Consent.ConsentDataMeaning.NULL, new Consent.ConsentDataMeaningEnumFactory()));
7411    if (json.has("_meaning"))
7412      parseElementProperties(getJObject(json, "_meaning"), res.getMeaningElement());
7413    if (json.has("reference"))
7414      res.setReference(parseReference(getJObject(json, "reference")));
7415  }
7416
7417  protected Contract parseContract(JsonObject json) throws IOException, FHIRFormatError {
7418    Contract res = new Contract();
7419    parseContractProperties(json, res);
7420    return res;
7421  }
7422
7423  protected void parseContractProperties(JsonObject json, Contract res) throws IOException, FHIRFormatError {
7424    parseDomainResourceProperties(json, res);
7425    if (json.has("identifier")) {
7426      JsonArray array = json.getAsJsonArray("identifier");
7427      for (int i = 0; i < array.size(); i++) {
7428        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7429      }
7430    };
7431    if (json.has("url"))
7432      res.setUrlElement(parseUri(json.get("url").getAsString()));
7433    if (json.has("_url"))
7434      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
7435    if (json.has("version"))
7436      res.setVersionElement(parseString(json.get("version").getAsString()));
7437    if (json.has("_version"))
7438      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
7439    if (json.has("status"))
7440      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Contract.ContractStatus.NULL, new Contract.ContractStatusEnumFactory()));
7441    if (json.has("_status"))
7442      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7443    if (json.has("legalState"))
7444      res.setLegalState(parseCodeableConcept(getJObject(json, "legalState")));
7445    if (json.has("instantiatesCanonical"))
7446      res.setInstantiatesCanonical(parseReference(getJObject(json, "instantiatesCanonical")));
7447    if (json.has("instantiatesUri"))
7448      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
7449    if (json.has("_instantiatesUri"))
7450      parseElementProperties(getJObject(json, "_instantiatesUri"), res.getInstantiatesUriElement());
7451    if (json.has("contentDerivative"))
7452      res.setContentDerivative(parseCodeableConcept(getJObject(json, "contentDerivative")));
7453    if (json.has("issued"))
7454      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
7455    if (json.has("_issued"))
7456      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
7457    if (json.has("applies"))
7458      res.setApplies(parsePeriod(getJObject(json, "applies")));
7459    if (json.has("expirationType"))
7460      res.setExpirationType(parseCodeableConcept(getJObject(json, "expirationType")));
7461    if (json.has("subject")) {
7462      JsonArray array = json.getAsJsonArray("subject");
7463      for (int i = 0; i < array.size(); i++) {
7464        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
7465      }
7466    };
7467    if (json.has("authority")) {
7468      JsonArray array = json.getAsJsonArray("authority");
7469      for (int i = 0; i < array.size(); i++) {
7470        res.getAuthority().add(parseReference(array.get(i).getAsJsonObject()));
7471      }
7472    };
7473    if (json.has("domain")) {
7474      JsonArray array = json.getAsJsonArray("domain");
7475      for (int i = 0; i < array.size(); i++) {
7476        res.getDomain().add(parseReference(array.get(i).getAsJsonObject()));
7477      }
7478    };
7479    if (json.has("site")) {
7480      JsonArray array = json.getAsJsonArray("site");
7481      for (int i = 0; i < array.size(); i++) {
7482        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
7483      }
7484    };
7485    if (json.has("name"))
7486      res.setNameElement(parseString(json.get("name").getAsString()));
7487    if (json.has("_name"))
7488      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
7489    if (json.has("title"))
7490      res.setTitleElement(parseString(json.get("title").getAsString()));
7491    if (json.has("_title"))
7492      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
7493    if (json.has("subtitle"))
7494      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
7495    if (json.has("_subtitle"))
7496      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
7497    if (json.has("alias")) {
7498      JsonArray array = json.getAsJsonArray("alias");
7499      for (int i = 0; i < array.size(); i++) {
7500        res.getAlias().add(parseString(array.get(i).getAsString()));
7501      }
7502    };
7503    if (json.has("_alias")) {
7504      JsonArray array = json.getAsJsonArray("_alias");
7505      for (int i = 0; i < array.size(); i++) {
7506        if (i == res.getAlias().size())
7507          res.getAlias().add(parseString(null));
7508        if (array.get(i) instanceof JsonObject) 
7509          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
7510      }
7511    };
7512    if (json.has("author"))
7513      res.setAuthor(parseReference(getJObject(json, "author")));
7514    if (json.has("scope"))
7515      res.setScope(parseCodeableConcept(getJObject(json, "scope")));
7516    Type topic = parseType("topic", json);
7517    if (topic != null)
7518      res.setTopic(topic);
7519    if (json.has("type"))
7520      res.setType(parseCodeableConcept(getJObject(json, "type")));
7521    if (json.has("subType")) {
7522      JsonArray array = json.getAsJsonArray("subType");
7523      for (int i = 0; i < array.size(); i++) {
7524        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7525      }
7526    };
7527    if (json.has("contentDefinition"))
7528      res.setContentDefinition(parseContractContentDefinitionComponent(getJObject(json, "contentDefinition"), res));
7529    if (json.has("term")) {
7530      JsonArray array = json.getAsJsonArray("term");
7531      for (int i = 0; i < array.size(); i++) {
7532        res.getTerm().add(parseContractTermComponent(array.get(i).getAsJsonObject(), res));
7533      }
7534    };
7535    if (json.has("supportingInfo")) {
7536      JsonArray array = json.getAsJsonArray("supportingInfo");
7537      for (int i = 0; i < array.size(); i++) {
7538        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
7539      }
7540    };
7541    if (json.has("relevantHistory")) {
7542      JsonArray array = json.getAsJsonArray("relevantHistory");
7543      for (int i = 0; i < array.size(); i++) {
7544        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
7545      }
7546    };
7547    if (json.has("signer")) {
7548      JsonArray array = json.getAsJsonArray("signer");
7549      for (int i = 0; i < array.size(); i++) {
7550        res.getSigner().add(parseContractSignatoryComponent(array.get(i).getAsJsonObject(), res));
7551      }
7552    };
7553    if (json.has("friendly")) {
7554      JsonArray array = json.getAsJsonArray("friendly");
7555      for (int i = 0; i < array.size(); i++) {
7556        res.getFriendly().add(parseContractFriendlyLanguageComponent(array.get(i).getAsJsonObject(), res));
7557      }
7558    };
7559    if (json.has("legal")) {
7560      JsonArray array = json.getAsJsonArray("legal");
7561      for (int i = 0; i < array.size(); i++) {
7562        res.getLegal().add(parseContractLegalLanguageComponent(array.get(i).getAsJsonObject(), res));
7563      }
7564    };
7565    if (json.has("rule")) {
7566      JsonArray array = json.getAsJsonArray("rule");
7567      for (int i = 0; i < array.size(); i++) {
7568        res.getRule().add(parseContractComputableLanguageComponent(array.get(i).getAsJsonObject(), res));
7569      }
7570    };
7571    Type legallyBinding = parseType("legallyBinding", json);
7572    if (legallyBinding != null)
7573      res.setLegallyBinding(legallyBinding);
7574  }
7575
7576  protected Contract.ContentDefinitionComponent parseContractContentDefinitionComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7577    Contract.ContentDefinitionComponent res = new Contract.ContentDefinitionComponent();
7578    parseContractContentDefinitionComponentProperties(json, owner, res);
7579    return res;
7580  }
7581
7582  protected void parseContractContentDefinitionComponentProperties(JsonObject json, Contract owner, Contract.ContentDefinitionComponent res) throws IOException, FHIRFormatError {
7583    parseBackboneElementProperties(json, res);
7584    if (json.has("type"))
7585      res.setType(parseCodeableConcept(getJObject(json, "type")));
7586    if (json.has("subType"))
7587      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
7588    if (json.has("publisher"))
7589      res.setPublisher(parseReference(getJObject(json, "publisher")));
7590    if (json.has("publicationDate"))
7591      res.setPublicationDateElement(parseDateTime(json.get("publicationDate").getAsString()));
7592    if (json.has("_publicationDate"))
7593      parseElementProperties(getJObject(json, "_publicationDate"), res.getPublicationDateElement());
7594    if (json.has("publicationStatus"))
7595      res.setPublicationStatusElement(parseEnumeration(json.get("publicationStatus").getAsString(), Contract.ContractPublicationStatus.NULL, new Contract.ContractPublicationStatusEnumFactory()));
7596    if (json.has("_publicationStatus"))
7597      parseElementProperties(getJObject(json, "_publicationStatus"), res.getPublicationStatusElement());
7598    if (json.has("copyright"))
7599      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
7600    if (json.has("_copyright"))
7601      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
7602  }
7603
7604  protected Contract.TermComponent parseContractTermComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7605    Contract.TermComponent res = new Contract.TermComponent();
7606    parseContractTermComponentProperties(json, owner, res);
7607    return res;
7608  }
7609
7610  protected void parseContractTermComponentProperties(JsonObject json, Contract owner, Contract.TermComponent res) throws IOException, FHIRFormatError {
7611    parseBackboneElementProperties(json, res);
7612    if (json.has("identifier"))
7613      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
7614    if (json.has("issued"))
7615      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
7616    if (json.has("_issued"))
7617      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
7618    if (json.has("applies"))
7619      res.setApplies(parsePeriod(getJObject(json, "applies")));
7620    Type topic = parseType("topic", json);
7621    if (topic != null)
7622      res.setTopic(topic);
7623    if (json.has("type"))
7624      res.setType(parseCodeableConcept(getJObject(json, "type")));
7625    if (json.has("subType"))
7626      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
7627    if (json.has("text"))
7628      res.setTextElement(parseString(json.get("text").getAsString()));
7629    if (json.has("_text"))
7630      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
7631    if (json.has("securityLabel")) {
7632      JsonArray array = json.getAsJsonArray("securityLabel");
7633      for (int i = 0; i < array.size(); i++) {
7634        res.getSecurityLabel().add(parseContractSecurityLabelComponent(array.get(i).getAsJsonObject(), owner));
7635      }
7636    };
7637    if (json.has("offer"))
7638      res.setOffer(parseContractContractOfferComponent(getJObject(json, "offer"), owner));
7639    if (json.has("asset")) {
7640      JsonArray array = json.getAsJsonArray("asset");
7641      for (int i = 0; i < array.size(); i++) {
7642        res.getAsset().add(parseContractContractAssetComponent(array.get(i).getAsJsonObject(), owner));
7643      }
7644    };
7645    if (json.has("action")) {
7646      JsonArray array = json.getAsJsonArray("action");
7647      for (int i = 0; i < array.size(); i++) {
7648        res.getAction().add(parseContractActionComponent(array.get(i).getAsJsonObject(), owner));
7649      }
7650    };
7651    if (json.has("group")) {
7652      JsonArray array = json.getAsJsonArray("group");
7653      for (int i = 0; i < array.size(); i++) {
7654        res.getGroup().add(parseContractTermComponent(array.get(i).getAsJsonObject(), owner));
7655      }
7656    };
7657  }
7658
7659  protected Contract.SecurityLabelComponent parseContractSecurityLabelComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7660    Contract.SecurityLabelComponent res = new Contract.SecurityLabelComponent();
7661    parseContractSecurityLabelComponentProperties(json, owner, res);
7662    return res;
7663  }
7664
7665  protected void parseContractSecurityLabelComponentProperties(JsonObject json, Contract owner, Contract.SecurityLabelComponent res) throws IOException, FHIRFormatError {
7666    parseBackboneElementProperties(json, res);
7667    if (json.has("number")) {
7668      JsonArray array = json.getAsJsonArray("number");
7669      for (int i = 0; i < array.size(); i++) {
7670        res.getNumber().add(parseUnsignedInt(array.get(i).getAsString()));
7671      }
7672    };
7673    if (json.has("_number")) {
7674      JsonArray array = json.getAsJsonArray("_number");
7675      for (int i = 0; i < array.size(); i++) {
7676        if (i == res.getNumber().size())
7677          res.getNumber().add(parseUnsignedInt(null));
7678        if (array.get(i) instanceof JsonObject) 
7679          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumber().get(i));
7680      }
7681    };
7682    if (json.has("classification"))
7683      res.setClassification(parseCoding(getJObject(json, "classification")));
7684    if (json.has("category")) {
7685      JsonArray array = json.getAsJsonArray("category");
7686      for (int i = 0; i < array.size(); i++) {
7687        res.getCategory().add(parseCoding(array.get(i).getAsJsonObject()));
7688      }
7689    };
7690    if (json.has("control")) {
7691      JsonArray array = json.getAsJsonArray("control");
7692      for (int i = 0; i < array.size(); i++) {
7693        res.getControl().add(parseCoding(array.get(i).getAsJsonObject()));
7694      }
7695    };
7696  }
7697
7698  protected Contract.ContractOfferComponent parseContractContractOfferComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7699    Contract.ContractOfferComponent res = new Contract.ContractOfferComponent();
7700    parseContractContractOfferComponentProperties(json, owner, res);
7701    return res;
7702  }
7703
7704  protected void parseContractContractOfferComponentProperties(JsonObject json, Contract owner, Contract.ContractOfferComponent res) throws IOException, FHIRFormatError {
7705    parseBackboneElementProperties(json, res);
7706    if (json.has("identifier")) {
7707      JsonArray array = json.getAsJsonArray("identifier");
7708      for (int i = 0; i < array.size(); i++) {
7709        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7710      }
7711    };
7712    if (json.has("party")) {
7713      JsonArray array = json.getAsJsonArray("party");
7714      for (int i = 0; i < array.size(); i++) {
7715        res.getParty().add(parseContractContractPartyComponent(array.get(i).getAsJsonObject(), owner));
7716      }
7717    };
7718    if (json.has("topic"))
7719      res.setTopic(parseReference(getJObject(json, "topic")));
7720    if (json.has("type"))
7721      res.setType(parseCodeableConcept(getJObject(json, "type")));
7722    if (json.has("decision"))
7723      res.setDecision(parseCodeableConcept(getJObject(json, "decision")));
7724    if (json.has("decisionMode")) {
7725      JsonArray array = json.getAsJsonArray("decisionMode");
7726      for (int i = 0; i < array.size(); i++) {
7727        res.getDecisionMode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7728      }
7729    };
7730    if (json.has("answer")) {
7731      JsonArray array = json.getAsJsonArray("answer");
7732      for (int i = 0; i < array.size(); i++) {
7733        res.getAnswer().add(parseContractAnswerComponent(array.get(i).getAsJsonObject(), owner));
7734      }
7735    };
7736    if (json.has("text"))
7737      res.setTextElement(parseString(json.get("text").getAsString()));
7738    if (json.has("_text"))
7739      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
7740    if (json.has("linkId")) {
7741      JsonArray array = json.getAsJsonArray("linkId");
7742      for (int i = 0; i < array.size(); i++) {
7743        res.getLinkId().add(parseString(array.get(i).getAsString()));
7744      }
7745    };
7746    if (json.has("_linkId")) {
7747      JsonArray array = json.getAsJsonArray("_linkId");
7748      for (int i = 0; i < array.size(); i++) {
7749        if (i == res.getLinkId().size())
7750          res.getLinkId().add(parseString(null));
7751        if (array.get(i) instanceof JsonObject) 
7752          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
7753      }
7754    };
7755    if (json.has("securityLabelNumber")) {
7756      JsonArray array = json.getAsJsonArray("securityLabelNumber");
7757      for (int i = 0; i < array.size(); i++) {
7758        res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
7759      }
7760    };
7761    if (json.has("_securityLabelNumber")) {
7762      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
7763      for (int i = 0; i < array.size(); i++) {
7764        if (i == res.getSecurityLabelNumber().size())
7765          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
7766        if (array.get(i) instanceof JsonObject) 
7767          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
7768      }
7769    };
7770  }
7771
7772  protected Contract.ContractPartyComponent parseContractContractPartyComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7773    Contract.ContractPartyComponent res = new Contract.ContractPartyComponent();
7774    parseContractContractPartyComponentProperties(json, owner, res);
7775    return res;
7776  }
7777
7778  protected void parseContractContractPartyComponentProperties(JsonObject json, Contract owner, Contract.ContractPartyComponent res) throws IOException, FHIRFormatError {
7779    parseBackboneElementProperties(json, res);
7780    if (json.has("reference")) {
7781      JsonArray array = json.getAsJsonArray("reference");
7782      for (int i = 0; i < array.size(); i++) {
7783        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
7784      }
7785    };
7786    if (json.has("role"))
7787      res.setRole(parseCodeableConcept(getJObject(json, "role")));
7788  }
7789
7790  protected Contract.AnswerComponent parseContractAnswerComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7791    Contract.AnswerComponent res = new Contract.AnswerComponent();
7792    parseContractAnswerComponentProperties(json, owner, res);
7793    return res;
7794  }
7795
7796  protected void parseContractAnswerComponentProperties(JsonObject json, Contract owner, Contract.AnswerComponent res) throws IOException, FHIRFormatError {
7797    parseBackboneElementProperties(json, res);
7798    Type value = parseType("value", json);
7799    if (value != null)
7800      res.setValue(value);
7801  }
7802
7803  protected Contract.ContractAssetComponent parseContractContractAssetComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7804    Contract.ContractAssetComponent res = new Contract.ContractAssetComponent();
7805    parseContractContractAssetComponentProperties(json, owner, res);
7806    return res;
7807  }
7808
7809  protected void parseContractContractAssetComponentProperties(JsonObject json, Contract owner, Contract.ContractAssetComponent res) throws IOException, FHIRFormatError {
7810    parseBackboneElementProperties(json, res);
7811    if (json.has("scope"))
7812      res.setScope(parseCodeableConcept(getJObject(json, "scope")));
7813    if (json.has("type")) {
7814      JsonArray array = json.getAsJsonArray("type");
7815      for (int i = 0; i < array.size(); i++) {
7816        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7817      }
7818    };
7819    if (json.has("typeReference")) {
7820      JsonArray array = json.getAsJsonArray("typeReference");
7821      for (int i = 0; i < array.size(); i++) {
7822        res.getTypeReference().add(parseReference(array.get(i).getAsJsonObject()));
7823      }
7824    };
7825    if (json.has("subtype")) {
7826      JsonArray array = json.getAsJsonArray("subtype");
7827      for (int i = 0; i < array.size(); i++) {
7828        res.getSubtype().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7829      }
7830    };
7831    if (json.has("relationship"))
7832      res.setRelationship(parseCoding(getJObject(json, "relationship")));
7833    if (json.has("context")) {
7834      JsonArray array = json.getAsJsonArray("context");
7835      for (int i = 0; i < array.size(); i++) {
7836        res.getContext().add(parseContractAssetContextComponent(array.get(i).getAsJsonObject(), owner));
7837      }
7838    };
7839    if (json.has("condition"))
7840      res.setConditionElement(parseString(json.get("condition").getAsString()));
7841    if (json.has("_condition"))
7842      parseElementProperties(getJObject(json, "_condition"), res.getConditionElement());
7843    if (json.has("periodType")) {
7844      JsonArray array = json.getAsJsonArray("periodType");
7845      for (int i = 0; i < array.size(); i++) {
7846        res.getPeriodType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7847      }
7848    };
7849    if (json.has("period")) {
7850      JsonArray array = json.getAsJsonArray("period");
7851      for (int i = 0; i < array.size(); i++) {
7852        res.getPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
7853      }
7854    };
7855    if (json.has("usePeriod")) {
7856      JsonArray array = json.getAsJsonArray("usePeriod");
7857      for (int i = 0; i < array.size(); i++) {
7858        res.getUsePeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
7859      }
7860    };
7861    if (json.has("text"))
7862      res.setTextElement(parseString(json.get("text").getAsString()));
7863    if (json.has("_text"))
7864      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
7865    if (json.has("linkId")) {
7866      JsonArray array = json.getAsJsonArray("linkId");
7867      for (int i = 0; i < array.size(); i++) {
7868        res.getLinkId().add(parseString(array.get(i).getAsString()));
7869      }
7870    };
7871    if (json.has("_linkId")) {
7872      JsonArray array = json.getAsJsonArray("_linkId");
7873      for (int i = 0; i < array.size(); i++) {
7874        if (i == res.getLinkId().size())
7875          res.getLinkId().add(parseString(null));
7876        if (array.get(i) instanceof JsonObject) 
7877          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
7878      }
7879    };
7880    if (json.has("answer")) {
7881      JsonArray array = json.getAsJsonArray("answer");
7882      for (int i = 0; i < array.size(); i++) {
7883        res.getAnswer().add(parseContractAnswerComponent(array.get(i).getAsJsonObject(), owner));
7884      }
7885    };
7886    if (json.has("securityLabelNumber")) {
7887      JsonArray array = json.getAsJsonArray("securityLabelNumber");
7888      for (int i = 0; i < array.size(); i++) {
7889        res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
7890      }
7891    };
7892    if (json.has("_securityLabelNumber")) {
7893      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
7894      for (int i = 0; i < array.size(); i++) {
7895        if (i == res.getSecurityLabelNumber().size())
7896          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
7897        if (array.get(i) instanceof JsonObject) 
7898          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
7899      }
7900    };
7901    if (json.has("valuedItem")) {
7902      JsonArray array = json.getAsJsonArray("valuedItem");
7903      for (int i = 0; i < array.size(); i++) {
7904        res.getValuedItem().add(parseContractValuedItemComponent(array.get(i).getAsJsonObject(), owner));
7905      }
7906    };
7907  }
7908
7909  protected Contract.AssetContextComponent parseContractAssetContextComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7910    Contract.AssetContextComponent res = new Contract.AssetContextComponent();
7911    parseContractAssetContextComponentProperties(json, owner, res);
7912    return res;
7913  }
7914
7915  protected void parseContractAssetContextComponentProperties(JsonObject json, Contract owner, Contract.AssetContextComponent res) throws IOException, FHIRFormatError {
7916    parseBackboneElementProperties(json, res);
7917    if (json.has("reference"))
7918      res.setReference(parseReference(getJObject(json, "reference")));
7919    if (json.has("code")) {
7920      JsonArray array = json.getAsJsonArray("code");
7921      for (int i = 0; i < array.size(); i++) {
7922        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7923      }
7924    };
7925    if (json.has("text"))
7926      res.setTextElement(parseString(json.get("text").getAsString()));
7927    if (json.has("_text"))
7928      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
7929  }
7930
7931  protected Contract.ValuedItemComponent parseContractValuedItemComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7932    Contract.ValuedItemComponent res = new Contract.ValuedItemComponent();
7933    parseContractValuedItemComponentProperties(json, owner, res);
7934    return res;
7935  }
7936
7937  protected void parseContractValuedItemComponentProperties(JsonObject json, Contract owner, Contract.ValuedItemComponent res) throws IOException, FHIRFormatError {
7938    parseBackboneElementProperties(json, res);
7939    Type entity = parseType("entity", json);
7940    if (entity != null)
7941      res.setEntity(entity);
7942    if (json.has("identifier"))
7943      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
7944    if (json.has("effectiveTime"))
7945      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
7946    if (json.has("_effectiveTime"))
7947      parseElementProperties(getJObject(json, "_effectiveTime"), res.getEffectiveTimeElement());
7948    if (json.has("quantity"))
7949      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
7950    if (json.has("unitPrice"))
7951      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
7952    if (json.has("factor"))
7953      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7954    if (json.has("_factor"))
7955      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
7956    if (json.has("points"))
7957      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
7958    if (json.has("_points"))
7959      parseElementProperties(getJObject(json, "_points"), res.getPointsElement());
7960    if (json.has("net"))
7961      res.setNet(parseMoney(getJObject(json, "net")));
7962    if (json.has("payment"))
7963      res.setPaymentElement(parseString(json.get("payment").getAsString()));
7964    if (json.has("_payment"))
7965      parseElementProperties(getJObject(json, "_payment"), res.getPaymentElement());
7966    if (json.has("paymentDate"))
7967      res.setPaymentDateElement(parseDateTime(json.get("paymentDate").getAsString()));
7968    if (json.has("_paymentDate"))
7969      parseElementProperties(getJObject(json, "_paymentDate"), res.getPaymentDateElement());
7970    if (json.has("responsible"))
7971      res.setResponsible(parseReference(getJObject(json, "responsible")));
7972    if (json.has("recipient"))
7973      res.setRecipient(parseReference(getJObject(json, "recipient")));
7974    if (json.has("linkId")) {
7975      JsonArray array = json.getAsJsonArray("linkId");
7976      for (int i = 0; i < array.size(); i++) {
7977        res.getLinkId().add(parseString(array.get(i).getAsString()));
7978      }
7979    };
7980    if (json.has("_linkId")) {
7981      JsonArray array = json.getAsJsonArray("_linkId");
7982      for (int i = 0; i < array.size(); i++) {
7983        if (i == res.getLinkId().size())
7984          res.getLinkId().add(parseString(null));
7985        if (array.get(i) instanceof JsonObject) 
7986          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
7987      }
7988    };
7989    if (json.has("securityLabelNumber")) {
7990      JsonArray array = json.getAsJsonArray("securityLabelNumber");
7991      for (int i = 0; i < array.size(); i++) {
7992        res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
7993      }
7994    };
7995    if (json.has("_securityLabelNumber")) {
7996      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
7997      for (int i = 0; i < array.size(); i++) {
7998        if (i == res.getSecurityLabelNumber().size())
7999          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
8000        if (array.get(i) instanceof JsonObject) 
8001          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
8002      }
8003    };
8004  }
8005
8006  protected Contract.ActionComponent parseContractActionComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8007    Contract.ActionComponent res = new Contract.ActionComponent();
8008    parseContractActionComponentProperties(json, owner, res);
8009    return res;
8010  }
8011
8012  protected void parseContractActionComponentProperties(JsonObject json, Contract owner, Contract.ActionComponent res) throws IOException, FHIRFormatError {
8013    parseBackboneElementProperties(json, res);
8014    if (json.has("doNotPerform"))
8015      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
8016    if (json.has("_doNotPerform"))
8017      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
8018    if (json.has("type"))
8019      res.setType(parseCodeableConcept(getJObject(json, "type")));
8020    if (json.has("subject")) {
8021      JsonArray array = json.getAsJsonArray("subject");
8022      for (int i = 0; i < array.size(); i++) {
8023        res.getSubject().add(parseContractActionSubjectComponent(array.get(i).getAsJsonObject(), owner));
8024      }
8025    };
8026    if (json.has("intent"))
8027      res.setIntent(parseCodeableConcept(getJObject(json, "intent")));
8028    if (json.has("linkId")) {
8029      JsonArray array = json.getAsJsonArray("linkId");
8030      for (int i = 0; i < array.size(); i++) {
8031        res.getLinkId().add(parseString(array.get(i).getAsString()));
8032      }
8033    };
8034    if (json.has("_linkId")) {
8035      JsonArray array = json.getAsJsonArray("_linkId");
8036      for (int i = 0; i < array.size(); i++) {
8037        if (i == res.getLinkId().size())
8038          res.getLinkId().add(parseString(null));
8039        if (array.get(i) instanceof JsonObject) 
8040          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
8041      }
8042    };
8043    if (json.has("status"))
8044      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
8045    if (json.has("context"))
8046      res.setContext(parseReference(getJObject(json, "context")));
8047    if (json.has("contextLinkId")) {
8048      JsonArray array = json.getAsJsonArray("contextLinkId");
8049      for (int i = 0; i < array.size(); i++) {
8050        res.getContextLinkId().add(parseString(array.get(i).getAsString()));
8051      }
8052    };
8053    if (json.has("_contextLinkId")) {
8054      JsonArray array = json.getAsJsonArray("_contextLinkId");
8055      for (int i = 0; i < array.size(); i++) {
8056        if (i == res.getContextLinkId().size())
8057          res.getContextLinkId().add(parseString(null));
8058        if (array.get(i) instanceof JsonObject) 
8059          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextLinkId().get(i));
8060      }
8061    };
8062    Type occurrence = parseType("occurrence", json);
8063    if (occurrence != null)
8064      res.setOccurrence(occurrence);
8065    if (json.has("requester")) {
8066      JsonArray array = json.getAsJsonArray("requester");
8067      for (int i = 0; i < array.size(); i++) {
8068        res.getRequester().add(parseReference(array.get(i).getAsJsonObject()));
8069      }
8070    };
8071    if (json.has("requesterLinkId")) {
8072      JsonArray array = json.getAsJsonArray("requesterLinkId");
8073      for (int i = 0; i < array.size(); i++) {
8074        res.getRequesterLinkId().add(parseString(array.get(i).getAsString()));
8075      }
8076    };
8077    if (json.has("_requesterLinkId")) {
8078      JsonArray array = json.getAsJsonArray("_requesterLinkId");
8079      for (int i = 0; i < array.size(); i++) {
8080        if (i == res.getRequesterLinkId().size())
8081          res.getRequesterLinkId().add(parseString(null));
8082        if (array.get(i) instanceof JsonObject) 
8083          parseElementProperties(array.get(i).getAsJsonObject(), res.getRequesterLinkId().get(i));
8084      }
8085    };
8086    if (json.has("performerType")) {
8087      JsonArray array = json.getAsJsonArray("performerType");
8088      for (int i = 0; i < array.size(); i++) {
8089        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8090      }
8091    };
8092    if (json.has("performerRole"))
8093      res.setPerformerRole(parseCodeableConcept(getJObject(json, "performerRole")));
8094    if (json.has("performer"))
8095      res.setPerformer(parseReference(getJObject(json, "performer")));
8096    if (json.has("performerLinkId")) {
8097      JsonArray array = json.getAsJsonArray("performerLinkId");
8098      for (int i = 0; i < array.size(); i++) {
8099        res.getPerformerLinkId().add(parseString(array.get(i).getAsString()));
8100      }
8101    };
8102    if (json.has("_performerLinkId")) {
8103      JsonArray array = json.getAsJsonArray("_performerLinkId");
8104      for (int i = 0; i < array.size(); i++) {
8105        if (i == res.getPerformerLinkId().size())
8106          res.getPerformerLinkId().add(parseString(null));
8107        if (array.get(i) instanceof JsonObject) 
8108          parseElementProperties(array.get(i).getAsJsonObject(), res.getPerformerLinkId().get(i));
8109      }
8110    };
8111    if (json.has("reasonCode")) {
8112      JsonArray array = json.getAsJsonArray("reasonCode");
8113      for (int i = 0; i < array.size(); i++) {
8114        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8115      }
8116    };
8117    if (json.has("reasonReference")) {
8118      JsonArray array = json.getAsJsonArray("reasonReference");
8119      for (int i = 0; i < array.size(); i++) {
8120        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
8121      }
8122    };
8123    if (json.has("reason")) {
8124      JsonArray array = json.getAsJsonArray("reason");
8125      for (int i = 0; i < array.size(); i++) {
8126        res.getReason().add(parseString(array.get(i).getAsString()));
8127      }
8128    };
8129    if (json.has("_reason")) {
8130      JsonArray array = json.getAsJsonArray("_reason");
8131      for (int i = 0; i < array.size(); i++) {
8132        if (i == res.getReason().size())
8133          res.getReason().add(parseString(null));
8134        if (array.get(i) instanceof JsonObject) 
8135          parseElementProperties(array.get(i).getAsJsonObject(), res.getReason().get(i));
8136      }
8137    };
8138    if (json.has("reasonLinkId")) {
8139      JsonArray array = json.getAsJsonArray("reasonLinkId");
8140      for (int i = 0; i < array.size(); i++) {
8141        res.getReasonLinkId().add(parseString(array.get(i).getAsString()));
8142      }
8143    };
8144    if (json.has("_reasonLinkId")) {
8145      JsonArray array = json.getAsJsonArray("_reasonLinkId");
8146      for (int i = 0; i < array.size(); i++) {
8147        if (i == res.getReasonLinkId().size())
8148          res.getReasonLinkId().add(parseString(null));
8149        if (array.get(i) instanceof JsonObject) 
8150          parseElementProperties(array.get(i).getAsJsonObject(), res.getReasonLinkId().get(i));
8151      }
8152    };
8153    if (json.has("note")) {
8154      JsonArray array = json.getAsJsonArray("note");
8155      for (int i = 0; i < array.size(); i++) {
8156        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8157      }
8158    };
8159    if (json.has("securityLabelNumber")) {
8160      JsonArray array = json.getAsJsonArray("securityLabelNumber");
8161      for (int i = 0; i < array.size(); i++) {
8162        res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
8163      }
8164    };
8165    if (json.has("_securityLabelNumber")) {
8166      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
8167      for (int i = 0; i < array.size(); i++) {
8168        if (i == res.getSecurityLabelNumber().size())
8169          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
8170        if (array.get(i) instanceof JsonObject) 
8171          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
8172      }
8173    };
8174  }
8175
8176  protected Contract.ActionSubjectComponent parseContractActionSubjectComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8177    Contract.ActionSubjectComponent res = new Contract.ActionSubjectComponent();
8178    parseContractActionSubjectComponentProperties(json, owner, res);
8179    return res;
8180  }
8181
8182  protected void parseContractActionSubjectComponentProperties(JsonObject json, Contract owner, Contract.ActionSubjectComponent res) throws IOException, FHIRFormatError {
8183    parseBackboneElementProperties(json, res);
8184    if (json.has("reference")) {
8185      JsonArray array = json.getAsJsonArray("reference");
8186      for (int i = 0; i < array.size(); i++) {
8187        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
8188      }
8189    };
8190    if (json.has("role"))
8191      res.setRole(parseCodeableConcept(getJObject(json, "role")));
8192  }
8193
8194  protected Contract.SignatoryComponent parseContractSignatoryComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8195    Contract.SignatoryComponent res = new Contract.SignatoryComponent();
8196    parseContractSignatoryComponentProperties(json, owner, res);
8197    return res;
8198  }
8199
8200  protected void parseContractSignatoryComponentProperties(JsonObject json, Contract owner, Contract.SignatoryComponent res) throws IOException, FHIRFormatError {
8201    parseBackboneElementProperties(json, res);
8202    if (json.has("type"))
8203      res.setType(parseCoding(getJObject(json, "type")));
8204    if (json.has("party"))
8205      res.setParty(parseReference(getJObject(json, "party")));
8206    if (json.has("signature")) {
8207      JsonArray array = json.getAsJsonArray("signature");
8208      for (int i = 0; i < array.size(); i++) {
8209        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
8210      }
8211    };
8212  }
8213
8214  protected Contract.FriendlyLanguageComponent parseContractFriendlyLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8215    Contract.FriendlyLanguageComponent res = new Contract.FriendlyLanguageComponent();
8216    parseContractFriendlyLanguageComponentProperties(json, owner, res);
8217    return res;
8218  }
8219
8220  protected void parseContractFriendlyLanguageComponentProperties(JsonObject json, Contract owner, Contract.FriendlyLanguageComponent res) throws IOException, FHIRFormatError {
8221    parseBackboneElementProperties(json, res);
8222    Type content = parseType("content", json);
8223    if (content != null)
8224      res.setContent(content);
8225  }
8226
8227  protected Contract.LegalLanguageComponent parseContractLegalLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8228    Contract.LegalLanguageComponent res = new Contract.LegalLanguageComponent();
8229    parseContractLegalLanguageComponentProperties(json, owner, res);
8230    return res;
8231  }
8232
8233  protected void parseContractLegalLanguageComponentProperties(JsonObject json, Contract owner, Contract.LegalLanguageComponent res) throws IOException, FHIRFormatError {
8234    parseBackboneElementProperties(json, res);
8235    Type content = parseType("content", json);
8236    if (content != null)
8237      res.setContent(content);
8238  }
8239
8240  protected Contract.ComputableLanguageComponent parseContractComputableLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8241    Contract.ComputableLanguageComponent res = new Contract.ComputableLanguageComponent();
8242    parseContractComputableLanguageComponentProperties(json, owner, res);
8243    return res;
8244  }
8245
8246  protected void parseContractComputableLanguageComponentProperties(JsonObject json, Contract owner, Contract.ComputableLanguageComponent res) throws IOException, FHIRFormatError {
8247    parseBackboneElementProperties(json, res);
8248    Type content = parseType("content", json);
8249    if (content != null)
8250      res.setContent(content);
8251  }
8252
8253  protected Coverage parseCoverage(JsonObject json) throws IOException, FHIRFormatError {
8254    Coverage res = new Coverage();
8255    parseCoverageProperties(json, res);
8256    return res;
8257  }
8258
8259  protected void parseCoverageProperties(JsonObject json, Coverage res) throws IOException, FHIRFormatError {
8260    parseDomainResourceProperties(json, res);
8261    if (json.has("identifier")) {
8262      JsonArray array = json.getAsJsonArray("identifier");
8263      for (int i = 0; i < array.size(); i++) {
8264        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8265      }
8266    };
8267    if (json.has("status"))
8268      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Coverage.CoverageStatus.NULL, new Coverage.CoverageStatusEnumFactory()));
8269    if (json.has("_status"))
8270      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8271    if (json.has("type"))
8272      res.setType(parseCodeableConcept(getJObject(json, "type")));
8273    if (json.has("policyHolder"))
8274      res.setPolicyHolder(parseReference(getJObject(json, "policyHolder")));
8275    if (json.has("subscriber"))
8276      res.setSubscriber(parseReference(getJObject(json, "subscriber")));
8277    if (json.has("subscriberId"))
8278      res.setSubscriberIdElement(parseString(json.get("subscriberId").getAsString()));
8279    if (json.has("_subscriberId"))
8280      parseElementProperties(getJObject(json, "_subscriberId"), res.getSubscriberIdElement());
8281    if (json.has("beneficiary"))
8282      res.setBeneficiary(parseReference(getJObject(json, "beneficiary")));
8283    if (json.has("dependent"))
8284      res.setDependentElement(parseString(json.get("dependent").getAsString()));
8285    if (json.has("_dependent"))
8286      parseElementProperties(getJObject(json, "_dependent"), res.getDependentElement());
8287    if (json.has("relationship"))
8288      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
8289    if (json.has("period"))
8290      res.setPeriod(parsePeriod(getJObject(json, "period")));
8291    if (json.has("payor")) {
8292      JsonArray array = json.getAsJsonArray("payor");
8293      for (int i = 0; i < array.size(); i++) {
8294        res.getPayor().add(parseReference(array.get(i).getAsJsonObject()));
8295      }
8296    };
8297    if (json.has("class")) {
8298      JsonArray array = json.getAsJsonArray("class");
8299      for (int i = 0; i < array.size(); i++) {
8300        res.getClass_().add(parseCoverageClassComponent(array.get(i).getAsJsonObject(), res));
8301      }
8302    };
8303    if (json.has("order"))
8304      res.setOrderElement(parsePositiveInt(json.get("order").getAsString()));
8305    if (json.has("_order"))
8306      parseElementProperties(getJObject(json, "_order"), res.getOrderElement());
8307    if (json.has("network"))
8308      res.setNetworkElement(parseString(json.get("network").getAsString()));
8309    if (json.has("_network"))
8310      parseElementProperties(getJObject(json, "_network"), res.getNetworkElement());
8311    if (json.has("costToBeneficiary")) {
8312      JsonArray array = json.getAsJsonArray("costToBeneficiary");
8313      for (int i = 0; i < array.size(); i++) {
8314        res.getCostToBeneficiary().add(parseCoverageCostToBeneficiaryComponent(array.get(i).getAsJsonObject(), res));
8315      }
8316    };
8317    if (json.has("subrogation"))
8318      res.setSubrogationElement(parseBoolean(json.get("subrogation").getAsBoolean()));
8319    if (json.has("_subrogation"))
8320      parseElementProperties(getJObject(json, "_subrogation"), res.getSubrogationElement());
8321    if (json.has("contract")) {
8322      JsonArray array = json.getAsJsonArray("contract");
8323      for (int i = 0; i < array.size(); i++) {
8324        res.getContract().add(parseReference(array.get(i).getAsJsonObject()));
8325      }
8326    };
8327  }
8328
8329  protected Coverage.ClassComponent parseCoverageClassComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
8330    Coverage.ClassComponent res = new Coverage.ClassComponent();
8331    parseCoverageClassComponentProperties(json, owner, res);
8332    return res;
8333  }
8334
8335  protected void parseCoverageClassComponentProperties(JsonObject json, Coverage owner, Coverage.ClassComponent res) throws IOException, FHIRFormatError {
8336    parseBackboneElementProperties(json, res);
8337    if (json.has("type"))
8338      res.setType(parseCodeableConcept(getJObject(json, "type")));
8339    if (json.has("value"))
8340      res.setValueElement(parseString(json.get("value").getAsString()));
8341    if (json.has("_value"))
8342      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
8343    if (json.has("name"))
8344      res.setNameElement(parseString(json.get("name").getAsString()));
8345    if (json.has("_name"))
8346      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
8347  }
8348
8349  protected Coverage.CostToBeneficiaryComponent parseCoverageCostToBeneficiaryComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
8350    Coverage.CostToBeneficiaryComponent res = new Coverage.CostToBeneficiaryComponent();
8351    parseCoverageCostToBeneficiaryComponentProperties(json, owner, res);
8352    return res;
8353  }
8354
8355  protected void parseCoverageCostToBeneficiaryComponentProperties(JsonObject json, Coverage owner, Coverage.CostToBeneficiaryComponent res) throws IOException, FHIRFormatError {
8356    parseBackboneElementProperties(json, res);
8357    if (json.has("type"))
8358      res.setType(parseCodeableConcept(getJObject(json, "type")));
8359    Type value = parseType("value", json);
8360    if (value != null)
8361      res.setValue(value);
8362    if (json.has("exception")) {
8363      JsonArray array = json.getAsJsonArray("exception");
8364      for (int i = 0; i < array.size(); i++) {
8365        res.getException().add(parseCoverageExemptionComponent(array.get(i).getAsJsonObject(), owner));
8366      }
8367    };
8368  }
8369
8370  protected Coverage.ExemptionComponent parseCoverageExemptionComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
8371    Coverage.ExemptionComponent res = new Coverage.ExemptionComponent();
8372    parseCoverageExemptionComponentProperties(json, owner, res);
8373    return res;
8374  }
8375
8376  protected void parseCoverageExemptionComponentProperties(JsonObject json, Coverage owner, Coverage.ExemptionComponent res) throws IOException, FHIRFormatError {
8377    parseBackboneElementProperties(json, res);
8378    if (json.has("type"))
8379      res.setType(parseCodeableConcept(getJObject(json, "type")));
8380    if (json.has("period"))
8381      res.setPeriod(parsePeriod(getJObject(json, "period")));
8382  }
8383
8384  protected CoverageEligibilityRequest parseCoverageEligibilityRequest(JsonObject json) throws IOException, FHIRFormatError {
8385    CoverageEligibilityRequest res = new CoverageEligibilityRequest();
8386    parseCoverageEligibilityRequestProperties(json, res);
8387    return res;
8388  }
8389
8390  protected void parseCoverageEligibilityRequestProperties(JsonObject json, CoverageEligibilityRequest res) throws IOException, FHIRFormatError {
8391    parseDomainResourceProperties(json, res);
8392    if (json.has("identifier")) {
8393      JsonArray array = json.getAsJsonArray("identifier");
8394      for (int i = 0; i < array.size(); i++) {
8395        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8396      }
8397    };
8398    if (json.has("status"))
8399      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CoverageEligibilityRequest.EligibilityRequestStatus.NULL, new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory()));
8400    if (json.has("_status"))
8401      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8402    if (json.has("priority"))
8403      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
8404    if (json.has("purpose")) {
8405      JsonArray array = json.getAsJsonArray("purpose");
8406      for (int i = 0; i < array.size(); i++) {
8407        res.getPurpose().add(parseEnumeration(array.get(i).getAsString(), CoverageEligibilityRequest.EligibilityRequestPurpose.NULL, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory()));
8408      }
8409    };
8410    if (json.has("_purpose")) {
8411      JsonArray array = json.getAsJsonArray("_purpose");
8412      for (int i = 0; i < array.size(); i++) {
8413        if (i == res.getPurpose().size())
8414          res.getPurpose().add(parseEnumeration(null, CoverageEligibilityRequest.EligibilityRequestPurpose.NULL, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory()));
8415        if (array.get(i) instanceof JsonObject) 
8416          parseElementProperties(array.get(i).getAsJsonObject(), res.getPurpose().get(i));
8417      }
8418    };
8419    if (json.has("patient"))
8420      res.setPatient(parseReference(getJObject(json, "patient")));
8421    Type serviced = parseType("serviced", json);
8422    if (serviced != null)
8423      res.setServiced(serviced);
8424    if (json.has("created"))
8425      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8426    if (json.has("_created"))
8427      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
8428    if (json.has("enterer"))
8429      res.setEnterer(parseReference(getJObject(json, "enterer")));
8430    if (json.has("provider"))
8431      res.setProvider(parseReference(getJObject(json, "provider")));
8432    if (json.has("insurer"))
8433      res.setInsurer(parseReference(getJObject(json, "insurer")));
8434    if (json.has("facility"))
8435      res.setFacility(parseReference(getJObject(json, "facility")));
8436    if (json.has("supportingInfo")) {
8437      JsonArray array = json.getAsJsonArray("supportingInfo");
8438      for (int i = 0; i < array.size(); i++) {
8439        res.getSupportingInfo().add(parseCoverageEligibilityRequestSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
8440      }
8441    };
8442    if (json.has("insurance")) {
8443      JsonArray array = json.getAsJsonArray("insurance");
8444      for (int i = 0; i < array.size(); i++) {
8445        res.getInsurance().add(parseCoverageEligibilityRequestInsuranceComponent(array.get(i).getAsJsonObject(), res));
8446      }
8447    };
8448    if (json.has("item")) {
8449      JsonArray array = json.getAsJsonArray("item");
8450      for (int i = 0; i < array.size(); i++) {
8451        res.getItem().add(parseCoverageEligibilityRequestDetailsComponent(array.get(i).getAsJsonObject(), res));
8452      }
8453    };
8454  }
8455
8456  protected CoverageEligibilityRequest.SupportingInformationComponent parseCoverageEligibilityRequestSupportingInformationComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
8457    CoverageEligibilityRequest.SupportingInformationComponent res = new CoverageEligibilityRequest.SupportingInformationComponent();
8458    parseCoverageEligibilityRequestSupportingInformationComponentProperties(json, owner, res);
8459    return res;
8460  }
8461
8462  protected void parseCoverageEligibilityRequestSupportingInformationComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.SupportingInformationComponent res) throws IOException, FHIRFormatError {
8463    parseBackboneElementProperties(json, res);
8464    if (json.has("sequence"))
8465      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
8466    if (json.has("_sequence"))
8467      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
8468    if (json.has("information"))
8469      res.setInformation(parseReference(getJObject(json, "information")));
8470    if (json.has("appliesToAll"))
8471      res.setAppliesToAllElement(parseBoolean(json.get("appliesToAll").getAsBoolean()));
8472    if (json.has("_appliesToAll"))
8473      parseElementProperties(getJObject(json, "_appliesToAll"), res.getAppliesToAllElement());
8474  }
8475
8476  protected CoverageEligibilityRequest.InsuranceComponent parseCoverageEligibilityRequestInsuranceComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
8477    CoverageEligibilityRequest.InsuranceComponent res = new CoverageEligibilityRequest.InsuranceComponent();
8478    parseCoverageEligibilityRequestInsuranceComponentProperties(json, owner, res);
8479    return res;
8480  }
8481
8482  protected void parseCoverageEligibilityRequestInsuranceComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.InsuranceComponent res) throws IOException, FHIRFormatError {
8483    parseBackboneElementProperties(json, res);
8484    if (json.has("focal"))
8485      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
8486    if (json.has("_focal"))
8487      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
8488    if (json.has("coverage"))
8489      res.setCoverage(parseReference(getJObject(json, "coverage")));
8490    if (json.has("businessArrangement"))
8491      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
8492    if (json.has("_businessArrangement"))
8493      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
8494  }
8495
8496  protected CoverageEligibilityRequest.DetailsComponent parseCoverageEligibilityRequestDetailsComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
8497    CoverageEligibilityRequest.DetailsComponent res = new CoverageEligibilityRequest.DetailsComponent();
8498    parseCoverageEligibilityRequestDetailsComponentProperties(json, owner, res);
8499    return res;
8500  }
8501
8502  protected void parseCoverageEligibilityRequestDetailsComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.DetailsComponent res) throws IOException, FHIRFormatError {
8503    parseBackboneElementProperties(json, res);
8504    if (json.has("supportingInfoSequence")) {
8505      JsonArray array = json.getAsJsonArray("supportingInfoSequence");
8506      for (int i = 0; i < array.size(); i++) {
8507        res.getSupportingInfoSequence().add(parsePositiveInt(array.get(i).getAsString()));
8508      }
8509    };
8510    if (json.has("_supportingInfoSequence")) {
8511      JsonArray array = json.getAsJsonArray("_supportingInfoSequence");
8512      for (int i = 0; i < array.size(); i++) {
8513        if (i == res.getSupportingInfoSequence().size())
8514          res.getSupportingInfoSequence().add(parsePositiveInt(null));
8515        if (array.get(i) instanceof JsonObject) 
8516          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportingInfoSequence().get(i));
8517      }
8518    };
8519    if (json.has("category"))
8520      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
8521    if (json.has("productOrService"))
8522      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
8523    if (json.has("modifier")) {
8524      JsonArray array = json.getAsJsonArray("modifier");
8525      for (int i = 0; i < array.size(); i++) {
8526        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8527      }
8528    };
8529    if (json.has("provider"))
8530      res.setProvider(parseReference(getJObject(json, "provider")));
8531    if (json.has("quantity"))
8532      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
8533    if (json.has("unitPrice"))
8534      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
8535    if (json.has("facility"))
8536      res.setFacility(parseReference(getJObject(json, "facility")));
8537    if (json.has("diagnosis")) {
8538      JsonArray array = json.getAsJsonArray("diagnosis");
8539      for (int i = 0; i < array.size(); i++) {
8540        res.getDiagnosis().add(parseCoverageEligibilityRequestDiagnosisComponent(array.get(i).getAsJsonObject(), owner));
8541      }
8542    };
8543    if (json.has("detail")) {
8544      JsonArray array = json.getAsJsonArray("detail");
8545      for (int i = 0; i < array.size(); i++) {
8546        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
8547      }
8548    };
8549  }
8550
8551  protected CoverageEligibilityRequest.DiagnosisComponent parseCoverageEligibilityRequestDiagnosisComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
8552    CoverageEligibilityRequest.DiagnosisComponent res = new CoverageEligibilityRequest.DiagnosisComponent();
8553    parseCoverageEligibilityRequestDiagnosisComponentProperties(json, owner, res);
8554    return res;
8555  }
8556
8557  protected void parseCoverageEligibilityRequestDiagnosisComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.DiagnosisComponent res) throws IOException, FHIRFormatError {
8558    parseBackboneElementProperties(json, res);
8559    Type diagnosis = parseType("diagnosis", json);
8560    if (diagnosis != null)
8561      res.setDiagnosis(diagnosis);
8562  }
8563
8564  protected CoverageEligibilityResponse parseCoverageEligibilityResponse(JsonObject json) throws IOException, FHIRFormatError {
8565    CoverageEligibilityResponse res = new CoverageEligibilityResponse();
8566    parseCoverageEligibilityResponseProperties(json, res);
8567    return res;
8568  }
8569
8570  protected void parseCoverageEligibilityResponseProperties(JsonObject json, CoverageEligibilityResponse res) throws IOException, FHIRFormatError {
8571    parseDomainResourceProperties(json, res);
8572    if (json.has("identifier")) {
8573      JsonArray array = json.getAsJsonArray("identifier");
8574      for (int i = 0; i < array.size(); i++) {
8575        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8576      }
8577    };
8578    if (json.has("status"))
8579      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CoverageEligibilityResponse.EligibilityResponseStatus.NULL, new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory()));
8580    if (json.has("_status"))
8581      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8582    if (json.has("purpose")) {
8583      JsonArray array = json.getAsJsonArray("purpose");
8584      for (int i = 0; i < array.size(); i++) {
8585        res.getPurpose().add(parseEnumeration(array.get(i).getAsString(), CoverageEligibilityResponse.EligibilityResponsePurpose.NULL, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory()));
8586      }
8587    };
8588    if (json.has("_purpose")) {
8589      JsonArray array = json.getAsJsonArray("_purpose");
8590      for (int i = 0; i < array.size(); i++) {
8591        if (i == res.getPurpose().size())
8592          res.getPurpose().add(parseEnumeration(null, CoverageEligibilityResponse.EligibilityResponsePurpose.NULL, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory()));
8593        if (array.get(i) instanceof JsonObject) 
8594          parseElementProperties(array.get(i).getAsJsonObject(), res.getPurpose().get(i));
8595      }
8596    };
8597    if (json.has("patient"))
8598      res.setPatient(parseReference(getJObject(json, "patient")));
8599    Type serviced = parseType("serviced", json);
8600    if (serviced != null)
8601      res.setServiced(serviced);
8602    if (json.has("created"))
8603      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8604    if (json.has("_created"))
8605      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
8606    if (json.has("requestor"))
8607      res.setRequestor(parseReference(getJObject(json, "requestor")));
8608    if (json.has("request"))
8609      res.setRequest(parseReference(getJObject(json, "request")));
8610    if (json.has("outcome"))
8611      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
8612    if (json.has("_outcome"))
8613      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
8614    if (json.has("disposition"))
8615      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
8616    if (json.has("_disposition"))
8617      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
8618    if (json.has("insurer"))
8619      res.setInsurer(parseReference(getJObject(json, "insurer")));
8620    if (json.has("insurance")) {
8621      JsonArray array = json.getAsJsonArray("insurance");
8622      for (int i = 0; i < array.size(); i++) {
8623        res.getInsurance().add(parseCoverageEligibilityResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
8624      }
8625    };
8626    if (json.has("preAuthRef"))
8627      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
8628    if (json.has("_preAuthRef"))
8629      parseElementProperties(getJObject(json, "_preAuthRef"), res.getPreAuthRefElement());
8630    if (json.has("form"))
8631      res.setForm(parseCodeableConcept(getJObject(json, "form")));
8632    if (json.has("error")) {
8633      JsonArray array = json.getAsJsonArray("error");
8634      for (int i = 0; i < array.size(); i++) {
8635        res.getError().add(parseCoverageEligibilityResponseErrorsComponent(array.get(i).getAsJsonObject(), res));
8636      }
8637    };
8638  }
8639
8640  protected CoverageEligibilityResponse.InsuranceComponent parseCoverageEligibilityResponseInsuranceComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
8641    CoverageEligibilityResponse.InsuranceComponent res = new CoverageEligibilityResponse.InsuranceComponent();
8642    parseCoverageEligibilityResponseInsuranceComponentProperties(json, owner, res);
8643    return res;
8644  }
8645
8646  protected void parseCoverageEligibilityResponseInsuranceComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
8647    parseBackboneElementProperties(json, res);
8648    if (json.has("coverage"))
8649      res.setCoverage(parseReference(getJObject(json, "coverage")));
8650    if (json.has("inforce"))
8651      res.setInforceElement(parseBoolean(json.get("inforce").getAsBoolean()));
8652    if (json.has("_inforce"))
8653      parseElementProperties(getJObject(json, "_inforce"), res.getInforceElement());
8654    if (json.has("benefitPeriod"))
8655      res.setBenefitPeriod(parsePeriod(getJObject(json, "benefitPeriod")));
8656    if (json.has("item")) {
8657      JsonArray array = json.getAsJsonArray("item");
8658      for (int i = 0; i < array.size(); i++) {
8659        res.getItem().add(parseCoverageEligibilityResponseItemsComponent(array.get(i).getAsJsonObject(), owner));
8660      }
8661    };
8662  }
8663
8664  protected CoverageEligibilityResponse.ItemsComponent parseCoverageEligibilityResponseItemsComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
8665    CoverageEligibilityResponse.ItemsComponent res = new CoverageEligibilityResponse.ItemsComponent();
8666    parseCoverageEligibilityResponseItemsComponentProperties(json, owner, res);
8667    return res;
8668  }
8669
8670  protected void parseCoverageEligibilityResponseItemsComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.ItemsComponent res) throws IOException, FHIRFormatError {
8671    parseBackboneElementProperties(json, res);
8672    if (json.has("category"))
8673      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
8674    if (json.has("productOrService"))
8675      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
8676    if (json.has("modifier")) {
8677      JsonArray array = json.getAsJsonArray("modifier");
8678      for (int i = 0; i < array.size(); i++) {
8679        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8680      }
8681    };
8682    if (json.has("provider"))
8683      res.setProvider(parseReference(getJObject(json, "provider")));
8684    if (json.has("excluded"))
8685      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
8686    if (json.has("_excluded"))
8687      parseElementProperties(getJObject(json, "_excluded"), res.getExcludedElement());
8688    if (json.has("name"))
8689      res.setNameElement(parseString(json.get("name").getAsString()));
8690    if (json.has("_name"))
8691      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
8692    if (json.has("description"))
8693      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8694    if (json.has("_description"))
8695      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
8696    if (json.has("network"))
8697      res.setNetwork(parseCodeableConcept(getJObject(json, "network")));
8698    if (json.has("unit"))
8699      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
8700    if (json.has("term"))
8701      res.setTerm(parseCodeableConcept(getJObject(json, "term")));
8702    if (json.has("benefit")) {
8703      JsonArray array = json.getAsJsonArray("benefit");
8704      for (int i = 0; i < array.size(); i++) {
8705        res.getBenefit().add(parseCoverageEligibilityResponseBenefitComponent(array.get(i).getAsJsonObject(), owner));
8706      }
8707    };
8708    if (json.has("authorizationRequired"))
8709      res.setAuthorizationRequiredElement(parseBoolean(json.get("authorizationRequired").getAsBoolean()));
8710    if (json.has("_authorizationRequired"))
8711      parseElementProperties(getJObject(json, "_authorizationRequired"), res.getAuthorizationRequiredElement());
8712    if (json.has("authorizationSupporting")) {
8713      JsonArray array = json.getAsJsonArray("authorizationSupporting");
8714      for (int i = 0; i < array.size(); i++) {
8715        res.getAuthorizationSupporting().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8716      }
8717    };
8718    if (json.has("authorizationUrl"))
8719      res.setAuthorizationUrlElement(parseUri(json.get("authorizationUrl").getAsString()));
8720    if (json.has("_authorizationUrl"))
8721      parseElementProperties(getJObject(json, "_authorizationUrl"), res.getAuthorizationUrlElement());
8722  }
8723
8724  protected CoverageEligibilityResponse.BenefitComponent parseCoverageEligibilityResponseBenefitComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
8725    CoverageEligibilityResponse.BenefitComponent res = new CoverageEligibilityResponse.BenefitComponent();
8726    parseCoverageEligibilityResponseBenefitComponentProperties(json, owner, res);
8727    return res;
8728  }
8729
8730  protected void parseCoverageEligibilityResponseBenefitComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.BenefitComponent res) throws IOException, FHIRFormatError {
8731    parseBackboneElementProperties(json, res);
8732    if (json.has("type"))
8733      res.setType(parseCodeableConcept(getJObject(json, "type")));
8734    Type allowed = parseType("allowed", json);
8735    if (allowed != null)
8736      res.setAllowed(allowed);
8737    Type used = parseType("used", json);
8738    if (used != null)
8739      res.setUsed(used);
8740  }
8741
8742  protected CoverageEligibilityResponse.ErrorsComponent parseCoverageEligibilityResponseErrorsComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
8743    CoverageEligibilityResponse.ErrorsComponent res = new CoverageEligibilityResponse.ErrorsComponent();
8744    parseCoverageEligibilityResponseErrorsComponentProperties(json, owner, res);
8745    return res;
8746  }
8747
8748  protected void parseCoverageEligibilityResponseErrorsComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.ErrorsComponent res) throws IOException, FHIRFormatError {
8749    parseBackboneElementProperties(json, res);
8750    if (json.has("code"))
8751      res.setCode(parseCodeableConcept(getJObject(json, "code")));
8752  }
8753
8754  protected DetectedIssue parseDetectedIssue(JsonObject json) throws IOException, FHIRFormatError {
8755    DetectedIssue res = new DetectedIssue();
8756    parseDetectedIssueProperties(json, res);
8757    return res;
8758  }
8759
8760  protected void parseDetectedIssueProperties(JsonObject json, DetectedIssue res) throws IOException, FHIRFormatError {
8761    parseDomainResourceProperties(json, res);
8762    if (json.has("identifier")) {
8763      JsonArray array = json.getAsJsonArray("identifier");
8764      for (int i = 0; i < array.size(); i++) {
8765        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8766      }
8767    };
8768    if (json.has("status"))
8769      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DetectedIssue.DetectedIssueStatus.NULL, new DetectedIssue.DetectedIssueStatusEnumFactory()));
8770    if (json.has("_status"))
8771      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8772    if (json.has("code"))
8773      res.setCode(parseCodeableConcept(getJObject(json, "code")));
8774    if (json.has("severity"))
8775      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), DetectedIssue.DetectedIssueSeverity.NULL, new DetectedIssue.DetectedIssueSeverityEnumFactory()));
8776    if (json.has("_severity"))
8777      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
8778    if (json.has("patient"))
8779      res.setPatient(parseReference(getJObject(json, "patient")));
8780    Type identified = parseType("identified", json);
8781    if (identified != null)
8782      res.setIdentified(identified);
8783    if (json.has("author"))
8784      res.setAuthor(parseReference(getJObject(json, "author")));
8785    if (json.has("implicated")) {
8786      JsonArray array = json.getAsJsonArray("implicated");
8787      for (int i = 0; i < array.size(); i++) {
8788        res.getImplicated().add(parseReference(array.get(i).getAsJsonObject()));
8789      }
8790    };
8791    if (json.has("evidence")) {
8792      JsonArray array = json.getAsJsonArray("evidence");
8793      for (int i = 0; i < array.size(); i++) {
8794        res.getEvidence().add(parseDetectedIssueDetectedIssueEvidenceComponent(array.get(i).getAsJsonObject(), res));
8795      }
8796    };
8797    if (json.has("detail"))
8798      res.setDetailElement(parseString(json.get("detail").getAsString()));
8799    if (json.has("_detail"))
8800      parseElementProperties(getJObject(json, "_detail"), res.getDetailElement());
8801    if (json.has("reference"))
8802      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
8803    if (json.has("_reference"))
8804      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
8805    if (json.has("mitigation")) {
8806      JsonArray array = json.getAsJsonArray("mitigation");
8807      for (int i = 0; i < array.size(); i++) {
8808        res.getMitigation().add(parseDetectedIssueDetectedIssueMitigationComponent(array.get(i).getAsJsonObject(), res));
8809      }
8810    };
8811  }
8812
8813  protected DetectedIssue.DetectedIssueEvidenceComponent parseDetectedIssueDetectedIssueEvidenceComponent(JsonObject json, DetectedIssue owner) throws IOException, FHIRFormatError {
8814    DetectedIssue.DetectedIssueEvidenceComponent res = new DetectedIssue.DetectedIssueEvidenceComponent();
8815    parseDetectedIssueDetectedIssueEvidenceComponentProperties(json, owner, res);
8816    return res;
8817  }
8818
8819  protected void parseDetectedIssueDetectedIssueEvidenceComponentProperties(JsonObject json, DetectedIssue owner, DetectedIssue.DetectedIssueEvidenceComponent res) throws IOException, FHIRFormatError {
8820    parseBackboneElementProperties(json, res);
8821    if (json.has("code")) {
8822      JsonArray array = json.getAsJsonArray("code");
8823      for (int i = 0; i < array.size(); i++) {
8824        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8825      }
8826    };
8827    if (json.has("detail")) {
8828      JsonArray array = json.getAsJsonArray("detail");
8829      for (int i = 0; i < array.size(); i++) {
8830        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
8831      }
8832    };
8833  }
8834
8835  protected DetectedIssue.DetectedIssueMitigationComponent parseDetectedIssueDetectedIssueMitigationComponent(JsonObject json, DetectedIssue owner) throws IOException, FHIRFormatError {
8836    DetectedIssue.DetectedIssueMitigationComponent res = new DetectedIssue.DetectedIssueMitigationComponent();
8837    parseDetectedIssueDetectedIssueMitigationComponentProperties(json, owner, res);
8838    return res;
8839  }
8840
8841  protected void parseDetectedIssueDetectedIssueMitigationComponentProperties(JsonObject json, DetectedIssue owner, DetectedIssue.DetectedIssueMitigationComponent res) throws IOException, FHIRFormatError {
8842    parseBackboneElementProperties(json, res);
8843    if (json.has("action"))
8844      res.setAction(parseCodeableConcept(getJObject(json, "action")));
8845    if (json.has("date"))
8846      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8847    if (json.has("_date"))
8848      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
8849    if (json.has("author"))
8850      res.setAuthor(parseReference(getJObject(json, "author")));
8851  }
8852
8853  protected Device parseDevice(JsonObject json) throws IOException, FHIRFormatError {
8854    Device res = new Device();
8855    parseDeviceProperties(json, res);
8856    return res;
8857  }
8858
8859  protected void parseDeviceProperties(JsonObject json, Device res) throws IOException, FHIRFormatError {
8860    parseDomainResourceProperties(json, res);
8861    if (json.has("identifier")) {
8862      JsonArray array = json.getAsJsonArray("identifier");
8863      for (int i = 0; i < array.size(); i++) {
8864        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8865      }
8866    };
8867    if (json.has("definition"))
8868      res.setDefinition(parseReference(getJObject(json, "definition")));
8869    if (json.has("udiCarrier")) {
8870      JsonArray array = json.getAsJsonArray("udiCarrier");
8871      for (int i = 0; i < array.size(); i++) {
8872        res.getUdiCarrier().add(parseDeviceDeviceUdiCarrierComponent(array.get(i).getAsJsonObject(), res));
8873      }
8874    };
8875    if (json.has("status"))
8876      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Device.FHIRDeviceStatus.NULL, new Device.FHIRDeviceStatusEnumFactory()));
8877    if (json.has("_status"))
8878      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8879    if (json.has("statusReason")) {
8880      JsonArray array = json.getAsJsonArray("statusReason");
8881      for (int i = 0; i < array.size(); i++) {
8882        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8883      }
8884    };
8885    if (json.has("distinctIdentifier"))
8886      res.setDistinctIdentifierElement(parseString(json.get("distinctIdentifier").getAsString()));
8887    if (json.has("_distinctIdentifier"))
8888      parseElementProperties(getJObject(json, "_distinctIdentifier"), res.getDistinctIdentifierElement());
8889    if (json.has("manufacturer"))
8890      res.setManufacturerElement(parseString(json.get("manufacturer").getAsString()));
8891    if (json.has("_manufacturer"))
8892      parseElementProperties(getJObject(json, "_manufacturer"), res.getManufacturerElement());
8893    if (json.has("manufactureDate"))
8894      res.setManufactureDateElement(parseDateTime(json.get("manufactureDate").getAsString()));
8895    if (json.has("_manufactureDate"))
8896      parseElementProperties(getJObject(json, "_manufactureDate"), res.getManufactureDateElement());
8897    if (json.has("expirationDate"))
8898      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
8899    if (json.has("_expirationDate"))
8900      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
8901    if (json.has("lotNumber"))
8902      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
8903    if (json.has("_lotNumber"))
8904      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
8905    if (json.has("serialNumber"))
8906      res.setSerialNumberElement(parseString(json.get("serialNumber").getAsString()));
8907    if (json.has("_serialNumber"))
8908      parseElementProperties(getJObject(json, "_serialNumber"), res.getSerialNumberElement());
8909    if (json.has("deviceName")) {
8910      JsonArray array = json.getAsJsonArray("deviceName");
8911      for (int i = 0; i < array.size(); i++) {
8912        res.getDeviceName().add(parseDeviceDeviceDeviceNameComponent(array.get(i).getAsJsonObject(), res));
8913      }
8914    };
8915    if (json.has("modelNumber"))
8916      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
8917    if (json.has("_modelNumber"))
8918      parseElementProperties(getJObject(json, "_modelNumber"), res.getModelNumberElement());
8919    if (json.has("partNumber"))
8920      res.setPartNumberElement(parseString(json.get("partNumber").getAsString()));
8921    if (json.has("_partNumber"))
8922      parseElementProperties(getJObject(json, "_partNumber"), res.getPartNumberElement());
8923    if (json.has("type"))
8924      res.setType(parseCodeableConcept(getJObject(json, "type")));
8925    if (json.has("specialization")) {
8926      JsonArray array = json.getAsJsonArray("specialization");
8927      for (int i = 0; i < array.size(); i++) {
8928        res.getSpecialization().add(parseDeviceDeviceSpecializationComponent(array.get(i).getAsJsonObject(), res));
8929      }
8930    };
8931    if (json.has("version")) {
8932      JsonArray array = json.getAsJsonArray("version");
8933      for (int i = 0; i < array.size(); i++) {
8934        res.getVersion().add(parseDeviceDeviceVersionComponent(array.get(i).getAsJsonObject(), res));
8935      }
8936    };
8937    if (json.has("property")) {
8938      JsonArray array = json.getAsJsonArray("property");
8939      for (int i = 0; i < array.size(); i++) {
8940        res.getProperty().add(parseDeviceDevicePropertyComponent(array.get(i).getAsJsonObject(), res));
8941      }
8942    };
8943    if (json.has("patient"))
8944      res.setPatient(parseReference(getJObject(json, "patient")));
8945    if (json.has("owner"))
8946      res.setOwner(parseReference(getJObject(json, "owner")));
8947    if (json.has("contact")) {
8948      JsonArray array = json.getAsJsonArray("contact");
8949      for (int i = 0; i < array.size(); i++) {
8950        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
8951      }
8952    };
8953    if (json.has("location"))
8954      res.setLocation(parseReference(getJObject(json, "location")));
8955    if (json.has("url"))
8956      res.setUrlElement(parseUri(json.get("url").getAsString()));
8957    if (json.has("_url"))
8958      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
8959    if (json.has("note")) {
8960      JsonArray array = json.getAsJsonArray("note");
8961      for (int i = 0; i < array.size(); i++) {
8962        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8963      }
8964    };
8965    if (json.has("safety")) {
8966      JsonArray array = json.getAsJsonArray("safety");
8967      for (int i = 0; i < array.size(); i++) {
8968        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8969      }
8970    };
8971    if (json.has("parent"))
8972      res.setParent(parseReference(getJObject(json, "parent")));
8973  }
8974
8975  protected Device.DeviceUdiCarrierComponent parseDeviceDeviceUdiCarrierComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
8976    Device.DeviceUdiCarrierComponent res = new Device.DeviceUdiCarrierComponent();
8977    parseDeviceDeviceUdiCarrierComponentProperties(json, owner, res);
8978    return res;
8979  }
8980
8981  protected void parseDeviceDeviceUdiCarrierComponentProperties(JsonObject json, Device owner, Device.DeviceUdiCarrierComponent res) throws IOException, FHIRFormatError {
8982    parseBackboneElementProperties(json, res);
8983    if (json.has("deviceIdentifier"))
8984      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
8985    if (json.has("_deviceIdentifier"))
8986      parseElementProperties(getJObject(json, "_deviceIdentifier"), res.getDeviceIdentifierElement());
8987    if (json.has("issuer"))
8988      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
8989    if (json.has("_issuer"))
8990      parseElementProperties(getJObject(json, "_issuer"), res.getIssuerElement());
8991    if (json.has("jurisdiction"))
8992      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
8993    if (json.has("_jurisdiction"))
8994      parseElementProperties(getJObject(json, "_jurisdiction"), res.getJurisdictionElement());
8995    if (json.has("carrierAIDC"))
8996      res.setCarrierAIDCElement(parseBase64Binary(json.get("carrierAIDC").getAsString()));
8997    if (json.has("_carrierAIDC"))
8998      parseElementProperties(getJObject(json, "_carrierAIDC"), res.getCarrierAIDCElement());
8999    if (json.has("carrierHRF"))
9000      res.setCarrierHRFElement(parseString(json.get("carrierHRF").getAsString()));
9001    if (json.has("_carrierHRF"))
9002      parseElementProperties(getJObject(json, "_carrierHRF"), res.getCarrierHRFElement());
9003    if (json.has("entryType"))
9004      res.setEntryTypeElement(parseEnumeration(json.get("entryType").getAsString(), Device.UDIEntryType.NULL, new Device.UDIEntryTypeEnumFactory()));
9005    if (json.has("_entryType"))
9006      parseElementProperties(getJObject(json, "_entryType"), res.getEntryTypeElement());
9007  }
9008
9009  protected Device.DeviceDeviceNameComponent parseDeviceDeviceDeviceNameComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
9010    Device.DeviceDeviceNameComponent res = new Device.DeviceDeviceNameComponent();
9011    parseDeviceDeviceDeviceNameComponentProperties(json, owner, res);
9012    return res;
9013  }
9014
9015  protected void parseDeviceDeviceDeviceNameComponentProperties(JsonObject json, Device owner, Device.DeviceDeviceNameComponent res) throws IOException, FHIRFormatError {
9016    parseBackboneElementProperties(json, res);
9017    if (json.has("name"))
9018      res.setNameElement(parseString(json.get("name").getAsString()));
9019    if (json.has("_name"))
9020      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
9021    if (json.has("type"))
9022      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Device.DeviceNameType.NULL, new Device.DeviceNameTypeEnumFactory()));
9023    if (json.has("_type"))
9024      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
9025  }
9026
9027  protected Device.DeviceSpecializationComponent parseDeviceDeviceSpecializationComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
9028    Device.DeviceSpecializationComponent res = new Device.DeviceSpecializationComponent();
9029    parseDeviceDeviceSpecializationComponentProperties(json, owner, res);
9030    return res;
9031  }
9032
9033  protected void parseDeviceDeviceSpecializationComponentProperties(JsonObject json, Device owner, Device.DeviceSpecializationComponent res) throws IOException, FHIRFormatError {
9034    parseBackboneElementProperties(json, res);
9035    if (json.has("systemType"))
9036      res.setSystemType(parseCodeableConcept(getJObject(json, "systemType")));
9037    if (json.has("version"))
9038      res.setVersionElement(parseString(json.get("version").getAsString()));
9039    if (json.has("_version"))
9040      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
9041  }
9042
9043  protected Device.DeviceVersionComponent parseDeviceDeviceVersionComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
9044    Device.DeviceVersionComponent res = new Device.DeviceVersionComponent();
9045    parseDeviceDeviceVersionComponentProperties(json, owner, res);
9046    return res;
9047  }
9048
9049  protected void parseDeviceDeviceVersionComponentProperties(JsonObject json, Device owner, Device.DeviceVersionComponent res) throws IOException, FHIRFormatError {
9050    parseBackboneElementProperties(json, res);
9051    if (json.has("type"))
9052      res.setType(parseCodeableConcept(getJObject(json, "type")));
9053    if (json.has("component"))
9054      res.setComponent(parseIdentifier(getJObject(json, "component")));
9055    if (json.has("value"))
9056      res.setValueElement(parseString(json.get("value").getAsString()));
9057    if (json.has("_value"))
9058      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
9059  }
9060
9061  protected Device.DevicePropertyComponent parseDeviceDevicePropertyComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
9062    Device.DevicePropertyComponent res = new Device.DevicePropertyComponent();
9063    parseDeviceDevicePropertyComponentProperties(json, owner, res);
9064    return res;
9065  }
9066
9067  protected void parseDeviceDevicePropertyComponentProperties(JsonObject json, Device owner, Device.DevicePropertyComponent res) throws IOException, FHIRFormatError {
9068    parseBackboneElementProperties(json, res);
9069    if (json.has("type"))
9070      res.setType(parseCodeableConcept(getJObject(json, "type")));
9071    if (json.has("valueQuantity")) {
9072      JsonArray array = json.getAsJsonArray("valueQuantity");
9073      for (int i = 0; i < array.size(); i++) {
9074        res.getValueQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
9075      }
9076    };
9077    if (json.has("valueCode")) {
9078      JsonArray array = json.getAsJsonArray("valueCode");
9079      for (int i = 0; i < array.size(); i++) {
9080        res.getValueCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9081      }
9082    };
9083  }
9084
9085  protected DeviceDefinition parseDeviceDefinition(JsonObject json) throws IOException, FHIRFormatError {
9086    DeviceDefinition res = new DeviceDefinition();
9087    parseDeviceDefinitionProperties(json, res);
9088    return res;
9089  }
9090
9091  protected void parseDeviceDefinitionProperties(JsonObject json, DeviceDefinition res) throws IOException, FHIRFormatError {
9092    parseDomainResourceProperties(json, res);
9093    if (json.has("identifier")) {
9094      JsonArray array = json.getAsJsonArray("identifier");
9095      for (int i = 0; i < array.size(); i++) {
9096        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9097      }
9098    };
9099    if (json.has("udiDeviceIdentifier")) {
9100      JsonArray array = json.getAsJsonArray("udiDeviceIdentifier");
9101      for (int i = 0; i < array.size(); i++) {
9102        res.getUdiDeviceIdentifier().add(parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(array.get(i).getAsJsonObject(), res));
9103      }
9104    };
9105    Type manufacturer = parseType("manufacturer", json);
9106    if (manufacturer != null)
9107      res.setManufacturer(manufacturer);
9108    if (json.has("deviceName")) {
9109      JsonArray array = json.getAsJsonArray("deviceName");
9110      for (int i = 0; i < array.size(); i++) {
9111        res.getDeviceName().add(parseDeviceDefinitionDeviceDefinitionDeviceNameComponent(array.get(i).getAsJsonObject(), res));
9112      }
9113    };
9114    if (json.has("modelNumber"))
9115      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
9116    if (json.has("_modelNumber"))
9117      parseElementProperties(getJObject(json, "_modelNumber"), res.getModelNumberElement());
9118    if (json.has("type"))
9119      res.setType(parseCodeableConcept(getJObject(json, "type")));
9120    if (json.has("specialization")) {
9121      JsonArray array = json.getAsJsonArray("specialization");
9122      for (int i = 0; i < array.size(); i++) {
9123        res.getSpecialization().add(parseDeviceDefinitionDeviceDefinitionSpecializationComponent(array.get(i).getAsJsonObject(), res));
9124      }
9125    };
9126    if (json.has("version")) {
9127      JsonArray array = json.getAsJsonArray("version");
9128      for (int i = 0; i < array.size(); i++) {
9129        res.getVersion().add(parseString(array.get(i).getAsString()));
9130      }
9131    };
9132    if (json.has("_version")) {
9133      JsonArray array = json.getAsJsonArray("_version");
9134      for (int i = 0; i < array.size(); i++) {
9135        if (i == res.getVersion().size())
9136          res.getVersion().add(parseString(null));
9137        if (array.get(i) instanceof JsonObject) 
9138          parseElementProperties(array.get(i).getAsJsonObject(), res.getVersion().get(i));
9139      }
9140    };
9141    if (json.has("safety")) {
9142      JsonArray array = json.getAsJsonArray("safety");
9143      for (int i = 0; i < array.size(); i++) {
9144        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9145      }
9146    };
9147    if (json.has("shelfLifeStorage")) {
9148      JsonArray array = json.getAsJsonArray("shelfLifeStorage");
9149      for (int i = 0; i < array.size(); i++) {
9150        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
9151      }
9152    };
9153    if (json.has("physicalCharacteristics"))
9154      res.setPhysicalCharacteristics(parseProdCharacteristic(getJObject(json, "physicalCharacteristics")));
9155    if (json.has("languageCode")) {
9156      JsonArray array = json.getAsJsonArray("languageCode");
9157      for (int i = 0; i < array.size(); i++) {
9158        res.getLanguageCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9159      }
9160    };
9161    if (json.has("capability")) {
9162      JsonArray array = json.getAsJsonArray("capability");
9163      for (int i = 0; i < array.size(); i++) {
9164        res.getCapability().add(parseDeviceDefinitionDeviceDefinitionCapabilityComponent(array.get(i).getAsJsonObject(), res));
9165      }
9166    };
9167    if (json.has("property")) {
9168      JsonArray array = json.getAsJsonArray("property");
9169      for (int i = 0; i < array.size(); i++) {
9170        res.getProperty().add(parseDeviceDefinitionDeviceDefinitionPropertyComponent(array.get(i).getAsJsonObject(), res));
9171      }
9172    };
9173    if (json.has("owner"))
9174      res.setOwner(parseReference(getJObject(json, "owner")));
9175    if (json.has("contact")) {
9176      JsonArray array = json.getAsJsonArray("contact");
9177      for (int i = 0; i < array.size(); i++) {
9178        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
9179      }
9180    };
9181    if (json.has("url"))
9182      res.setUrlElement(parseUri(json.get("url").getAsString()));
9183    if (json.has("_url"))
9184      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
9185    if (json.has("onlineInformation"))
9186      res.setOnlineInformationElement(parseUri(json.get("onlineInformation").getAsString()));
9187    if (json.has("_onlineInformation"))
9188      parseElementProperties(getJObject(json, "_onlineInformation"), res.getOnlineInformationElement());
9189    if (json.has("note")) {
9190      JsonArray array = json.getAsJsonArray("note");
9191      for (int i = 0; i < array.size(); i++) {
9192        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9193      }
9194    };
9195    if (json.has("quantity"))
9196      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
9197    if (json.has("parentDevice"))
9198      res.setParentDevice(parseReference(getJObject(json, "parentDevice")));
9199    if (json.has("material")) {
9200      JsonArray array = json.getAsJsonArray("material");
9201      for (int i = 0; i < array.size(); i++) {
9202        res.getMaterial().add(parseDeviceDefinitionDeviceDefinitionMaterialComponent(array.get(i).getAsJsonObject(), res));
9203      }
9204    };
9205  }
9206
9207  protected DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9208    DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent res = new DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent();
9209    parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentProperties(json, owner, res);
9210    return res;
9211  }
9212
9213  protected void parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent res) throws IOException, FHIRFormatError {
9214    parseBackboneElementProperties(json, res);
9215    if (json.has("deviceIdentifier"))
9216      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
9217    if (json.has("_deviceIdentifier"))
9218      parseElementProperties(getJObject(json, "_deviceIdentifier"), res.getDeviceIdentifierElement());
9219    if (json.has("issuer"))
9220      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
9221    if (json.has("_issuer"))
9222      parseElementProperties(getJObject(json, "_issuer"), res.getIssuerElement());
9223    if (json.has("jurisdiction"))
9224      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
9225    if (json.has("_jurisdiction"))
9226      parseElementProperties(getJObject(json, "_jurisdiction"), res.getJurisdictionElement());
9227  }
9228
9229  protected DeviceDefinition.DeviceDefinitionDeviceNameComponent parseDeviceDefinitionDeviceDefinitionDeviceNameComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9230    DeviceDefinition.DeviceDefinitionDeviceNameComponent res = new DeviceDefinition.DeviceDefinitionDeviceNameComponent();
9231    parseDeviceDefinitionDeviceDefinitionDeviceNameComponentProperties(json, owner, res);
9232    return res;
9233  }
9234
9235  protected void parseDeviceDefinitionDeviceDefinitionDeviceNameComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionDeviceNameComponent res) throws IOException, FHIRFormatError {
9236    parseBackboneElementProperties(json, res);
9237    if (json.has("name"))
9238      res.setNameElement(parseString(json.get("name").getAsString()));
9239    if (json.has("_name"))
9240      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
9241    if (json.has("type"))
9242      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceDefinition.DeviceNameType.NULL, new DeviceDefinition.DeviceNameTypeEnumFactory()));
9243    if (json.has("_type"))
9244      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
9245  }
9246
9247  protected DeviceDefinition.DeviceDefinitionSpecializationComponent parseDeviceDefinitionDeviceDefinitionSpecializationComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9248    DeviceDefinition.DeviceDefinitionSpecializationComponent res = new DeviceDefinition.DeviceDefinitionSpecializationComponent();
9249    parseDeviceDefinitionDeviceDefinitionSpecializationComponentProperties(json, owner, res);
9250    return res;
9251  }
9252
9253  protected void parseDeviceDefinitionDeviceDefinitionSpecializationComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionSpecializationComponent res) throws IOException, FHIRFormatError {
9254    parseBackboneElementProperties(json, res);
9255    if (json.has("systemType"))
9256      res.setSystemTypeElement(parseString(json.get("systemType").getAsString()));
9257    if (json.has("_systemType"))
9258      parseElementProperties(getJObject(json, "_systemType"), res.getSystemTypeElement());
9259    if (json.has("version"))
9260      res.setVersionElement(parseString(json.get("version").getAsString()));
9261    if (json.has("_version"))
9262      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
9263  }
9264
9265  protected DeviceDefinition.DeviceDefinitionCapabilityComponent parseDeviceDefinitionDeviceDefinitionCapabilityComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9266    DeviceDefinition.DeviceDefinitionCapabilityComponent res = new DeviceDefinition.DeviceDefinitionCapabilityComponent();
9267    parseDeviceDefinitionDeviceDefinitionCapabilityComponentProperties(json, owner, res);
9268    return res;
9269  }
9270
9271  protected void parseDeviceDefinitionDeviceDefinitionCapabilityComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionCapabilityComponent res) throws IOException, FHIRFormatError {
9272    parseBackboneElementProperties(json, res);
9273    if (json.has("type"))
9274      res.setType(parseCodeableConcept(getJObject(json, "type")));
9275    if (json.has("description")) {
9276      JsonArray array = json.getAsJsonArray("description");
9277      for (int i = 0; i < array.size(); i++) {
9278        res.getDescription().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9279      }
9280    };
9281  }
9282
9283  protected DeviceDefinition.DeviceDefinitionPropertyComponent parseDeviceDefinitionDeviceDefinitionPropertyComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9284    DeviceDefinition.DeviceDefinitionPropertyComponent res = new DeviceDefinition.DeviceDefinitionPropertyComponent();
9285    parseDeviceDefinitionDeviceDefinitionPropertyComponentProperties(json, owner, res);
9286    return res;
9287  }
9288
9289  protected void parseDeviceDefinitionDeviceDefinitionPropertyComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionPropertyComponent res) throws IOException, FHIRFormatError {
9290    parseBackboneElementProperties(json, res);
9291    if (json.has("type"))
9292      res.setType(parseCodeableConcept(getJObject(json, "type")));
9293    if (json.has("valueQuantity")) {
9294      JsonArray array = json.getAsJsonArray("valueQuantity");
9295      for (int i = 0; i < array.size(); i++) {
9296        res.getValueQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
9297      }
9298    };
9299    if (json.has("valueCode")) {
9300      JsonArray array = json.getAsJsonArray("valueCode");
9301      for (int i = 0; i < array.size(); i++) {
9302        res.getValueCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9303      }
9304    };
9305  }
9306
9307  protected DeviceDefinition.DeviceDefinitionMaterialComponent parseDeviceDefinitionDeviceDefinitionMaterialComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9308    DeviceDefinition.DeviceDefinitionMaterialComponent res = new DeviceDefinition.DeviceDefinitionMaterialComponent();
9309    parseDeviceDefinitionDeviceDefinitionMaterialComponentProperties(json, owner, res);
9310    return res;
9311  }
9312
9313  protected void parseDeviceDefinitionDeviceDefinitionMaterialComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionMaterialComponent res) throws IOException, FHIRFormatError {
9314    parseBackboneElementProperties(json, res);
9315    if (json.has("substance"))
9316      res.setSubstance(parseCodeableConcept(getJObject(json, "substance")));
9317    if (json.has("alternate"))
9318      res.setAlternateElement(parseBoolean(json.get("alternate").getAsBoolean()));
9319    if (json.has("_alternate"))
9320      parseElementProperties(getJObject(json, "_alternate"), res.getAlternateElement());
9321    if (json.has("allergenicIndicator"))
9322      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
9323    if (json.has("_allergenicIndicator"))
9324      parseElementProperties(getJObject(json, "_allergenicIndicator"), res.getAllergenicIndicatorElement());
9325  }
9326
9327  protected DeviceMetric parseDeviceMetric(JsonObject json) throws IOException, FHIRFormatError {
9328    DeviceMetric res = new DeviceMetric();
9329    parseDeviceMetricProperties(json, res);
9330    return res;
9331  }
9332
9333  protected void parseDeviceMetricProperties(JsonObject json, DeviceMetric res) throws IOException, FHIRFormatError {
9334    parseDomainResourceProperties(json, res);
9335    if (json.has("identifier")) {
9336      JsonArray array = json.getAsJsonArray("identifier");
9337      for (int i = 0; i < array.size(); i++) {
9338        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9339      }
9340    };
9341    if (json.has("type"))
9342      res.setType(parseCodeableConcept(getJObject(json, "type")));
9343    if (json.has("unit"))
9344      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
9345    if (json.has("source"))
9346      res.setSource(parseReference(getJObject(json, "source")));
9347    if (json.has("parent"))
9348      res.setParent(parseReference(getJObject(json, "parent")));
9349    if (json.has("operationalStatus"))
9350      res.setOperationalStatusElement(parseEnumeration(json.get("operationalStatus").getAsString(), DeviceMetric.DeviceMetricOperationalStatus.NULL, new DeviceMetric.DeviceMetricOperationalStatusEnumFactory()));
9351    if (json.has("_operationalStatus"))
9352      parseElementProperties(getJObject(json, "_operationalStatus"), res.getOperationalStatusElement());
9353    if (json.has("color"))
9354      res.setColorElement(parseEnumeration(json.get("color").getAsString(), DeviceMetric.DeviceMetricColor.NULL, new DeviceMetric.DeviceMetricColorEnumFactory()));
9355    if (json.has("_color"))
9356      parseElementProperties(getJObject(json, "_color"), res.getColorElement());
9357    if (json.has("category"))
9358      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), DeviceMetric.DeviceMetricCategory.NULL, new DeviceMetric.DeviceMetricCategoryEnumFactory()));
9359    if (json.has("_category"))
9360      parseElementProperties(getJObject(json, "_category"), res.getCategoryElement());
9361    if (json.has("measurementPeriod"))
9362      res.setMeasurementPeriod(parseTiming(getJObject(json, "measurementPeriod")));
9363    if (json.has("calibration")) {
9364      JsonArray array = json.getAsJsonArray("calibration");
9365      for (int i = 0; i < array.size(); i++) {
9366        res.getCalibration().add(parseDeviceMetricDeviceMetricCalibrationComponent(array.get(i).getAsJsonObject(), res));
9367      }
9368    };
9369  }
9370
9371  protected DeviceMetric.DeviceMetricCalibrationComponent parseDeviceMetricDeviceMetricCalibrationComponent(JsonObject json, DeviceMetric owner) throws IOException, FHIRFormatError {
9372    DeviceMetric.DeviceMetricCalibrationComponent res = new DeviceMetric.DeviceMetricCalibrationComponent();
9373    parseDeviceMetricDeviceMetricCalibrationComponentProperties(json, owner, res);
9374    return res;
9375  }
9376
9377  protected void parseDeviceMetricDeviceMetricCalibrationComponentProperties(JsonObject json, DeviceMetric owner, DeviceMetric.DeviceMetricCalibrationComponent res) throws IOException, FHIRFormatError {
9378    parseBackboneElementProperties(json, res);
9379    if (json.has("type"))
9380      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceMetric.DeviceMetricCalibrationType.NULL, new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory()));
9381    if (json.has("_type"))
9382      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
9383    if (json.has("state"))
9384      res.setStateElement(parseEnumeration(json.get("state").getAsString(), DeviceMetric.DeviceMetricCalibrationState.NULL, new DeviceMetric.DeviceMetricCalibrationStateEnumFactory()));
9385    if (json.has("_state"))
9386      parseElementProperties(getJObject(json, "_state"), res.getStateElement());
9387    if (json.has("time"))
9388      res.setTimeElement(parseInstant(json.get("time").getAsString()));
9389    if (json.has("_time"))
9390      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
9391  }
9392
9393  protected DeviceRequest parseDeviceRequest(JsonObject json) throws IOException, FHIRFormatError {
9394    DeviceRequest res = new DeviceRequest();
9395    parseDeviceRequestProperties(json, res);
9396    return res;
9397  }
9398
9399  protected void parseDeviceRequestProperties(JsonObject json, DeviceRequest res) throws IOException, FHIRFormatError {
9400    parseDomainResourceProperties(json, res);
9401    if (json.has("identifier")) {
9402      JsonArray array = json.getAsJsonArray("identifier");
9403      for (int i = 0; i < array.size(); i++) {
9404        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9405      }
9406    };
9407    if (json.has("instantiatesCanonical")) {
9408      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
9409      for (int i = 0; i < array.size(); i++) {
9410        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
9411      }
9412    };
9413    if (json.has("_instantiatesCanonical")) {
9414      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
9415      for (int i = 0; i < array.size(); i++) {
9416        if (i == res.getInstantiatesCanonical().size())
9417          res.getInstantiatesCanonical().add(parseCanonical(null));
9418        if (array.get(i) instanceof JsonObject) 
9419          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
9420      }
9421    };
9422    if (json.has("instantiatesUri")) {
9423      JsonArray array = json.getAsJsonArray("instantiatesUri");
9424      for (int i = 0; i < array.size(); i++) {
9425        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
9426      }
9427    };
9428    if (json.has("_instantiatesUri")) {
9429      JsonArray array = json.getAsJsonArray("_instantiatesUri");
9430      for (int i = 0; i < array.size(); i++) {
9431        if (i == res.getInstantiatesUri().size())
9432          res.getInstantiatesUri().add(parseUri(null));
9433        if (array.get(i) instanceof JsonObject) 
9434          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
9435      }
9436    };
9437    if (json.has("basedOn")) {
9438      JsonArray array = json.getAsJsonArray("basedOn");
9439      for (int i = 0; i < array.size(); i++) {
9440        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
9441      }
9442    };
9443    if (json.has("priorRequest")) {
9444      JsonArray array = json.getAsJsonArray("priorRequest");
9445      for (int i = 0; i < array.size(); i++) {
9446        res.getPriorRequest().add(parseReference(array.get(i).getAsJsonObject()));
9447      }
9448    };
9449    if (json.has("groupIdentifier"))
9450      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
9451    if (json.has("status"))
9452      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceRequest.DeviceRequestStatus.NULL, new DeviceRequest.DeviceRequestStatusEnumFactory()));
9453    if (json.has("_status"))
9454      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9455    if (json.has("intent"))
9456      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), DeviceRequest.RequestIntent.NULL, new DeviceRequest.RequestIntentEnumFactory()));
9457    if (json.has("_intent"))
9458      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
9459    if (json.has("priority"))
9460      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), DeviceRequest.RequestPriority.NULL, new DeviceRequest.RequestPriorityEnumFactory()));
9461    if (json.has("_priority"))
9462      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
9463    Type code = parseType("code", json);
9464    if (code != null)
9465      res.setCode(code);
9466    if (json.has("parameter")) {
9467      JsonArray array = json.getAsJsonArray("parameter");
9468      for (int i = 0; i < array.size(); i++) {
9469        res.getParameter().add(parseDeviceRequestDeviceRequestParameterComponent(array.get(i).getAsJsonObject(), res));
9470      }
9471    };
9472    if (json.has("subject"))
9473      res.setSubject(parseReference(getJObject(json, "subject")));
9474    if (json.has("encounter"))
9475      res.setEncounter(parseReference(getJObject(json, "encounter")));
9476    Type occurrence = parseType("occurrence", json);
9477    if (occurrence != null)
9478      res.setOccurrence(occurrence);
9479    if (json.has("authoredOn"))
9480      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
9481    if (json.has("_authoredOn"))
9482      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
9483    if (json.has("requester"))
9484      res.setRequester(parseReference(getJObject(json, "requester")));
9485    if (json.has("performerType"))
9486      res.setPerformerType(parseCodeableConcept(getJObject(json, "performerType")));
9487    if (json.has("performer"))
9488      res.setPerformer(parseReference(getJObject(json, "performer")));
9489    if (json.has("reasonCode")) {
9490      JsonArray array = json.getAsJsonArray("reasonCode");
9491      for (int i = 0; i < array.size(); i++) {
9492        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9493      }
9494    };
9495    if (json.has("reasonReference")) {
9496      JsonArray array = json.getAsJsonArray("reasonReference");
9497      for (int i = 0; i < array.size(); i++) {
9498        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
9499      }
9500    };
9501    if (json.has("insurance")) {
9502      JsonArray array = json.getAsJsonArray("insurance");
9503      for (int i = 0; i < array.size(); i++) {
9504        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
9505      }
9506    };
9507    if (json.has("supportingInfo")) {
9508      JsonArray array = json.getAsJsonArray("supportingInfo");
9509      for (int i = 0; i < array.size(); i++) {
9510        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
9511      }
9512    };
9513    if (json.has("note")) {
9514      JsonArray array = json.getAsJsonArray("note");
9515      for (int i = 0; i < array.size(); i++) {
9516        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9517      }
9518    };
9519    if (json.has("relevantHistory")) {
9520      JsonArray array = json.getAsJsonArray("relevantHistory");
9521      for (int i = 0; i < array.size(); i++) {
9522        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
9523      }
9524    };
9525  }
9526
9527  protected DeviceRequest.DeviceRequestParameterComponent parseDeviceRequestDeviceRequestParameterComponent(JsonObject json, DeviceRequest owner) throws IOException, FHIRFormatError {
9528    DeviceRequest.DeviceRequestParameterComponent res = new DeviceRequest.DeviceRequestParameterComponent();
9529    parseDeviceRequestDeviceRequestParameterComponentProperties(json, owner, res);
9530    return res;
9531  }
9532
9533  protected void parseDeviceRequestDeviceRequestParameterComponentProperties(JsonObject json, DeviceRequest owner, DeviceRequest.DeviceRequestParameterComponent res) throws IOException, FHIRFormatError {
9534    parseBackboneElementProperties(json, res);
9535    if (json.has("code"))
9536      res.setCode(parseCodeableConcept(getJObject(json, "code")));
9537    Type value = parseType("value", json);
9538    if (value != null)
9539      res.setValue(value);
9540  }
9541
9542  protected DeviceUseStatement parseDeviceUseStatement(JsonObject json) throws IOException, FHIRFormatError {
9543    DeviceUseStatement res = new DeviceUseStatement();
9544    parseDeviceUseStatementProperties(json, res);
9545    return res;
9546  }
9547
9548  protected void parseDeviceUseStatementProperties(JsonObject json, DeviceUseStatement res) throws IOException, FHIRFormatError {
9549    parseDomainResourceProperties(json, res);
9550    if (json.has("identifier")) {
9551      JsonArray array = json.getAsJsonArray("identifier");
9552      for (int i = 0; i < array.size(); i++) {
9553        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9554      }
9555    };
9556    if (json.has("basedOn")) {
9557      JsonArray array = json.getAsJsonArray("basedOn");
9558      for (int i = 0; i < array.size(); i++) {
9559        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
9560      }
9561    };
9562    if (json.has("status"))
9563      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceUseStatement.DeviceUseStatementStatus.NULL, new DeviceUseStatement.DeviceUseStatementStatusEnumFactory()));
9564    if (json.has("_status"))
9565      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9566    if (json.has("subject"))
9567      res.setSubject(parseReference(getJObject(json, "subject")));
9568    if (json.has("derivedFrom")) {
9569      JsonArray array = json.getAsJsonArray("derivedFrom");
9570      for (int i = 0; i < array.size(); i++) {
9571        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
9572      }
9573    };
9574    Type timing = parseType("timing", json);
9575    if (timing != null)
9576      res.setTiming(timing);
9577    if (json.has("recordedOn"))
9578      res.setRecordedOnElement(parseDateTime(json.get("recordedOn").getAsString()));
9579    if (json.has("_recordedOn"))
9580      parseElementProperties(getJObject(json, "_recordedOn"), res.getRecordedOnElement());
9581    if (json.has("source"))
9582      res.setSource(parseReference(getJObject(json, "source")));
9583    if (json.has("device"))
9584      res.setDevice(parseReference(getJObject(json, "device")));
9585    if (json.has("reasonCode")) {
9586      JsonArray array = json.getAsJsonArray("reasonCode");
9587      for (int i = 0; i < array.size(); i++) {
9588        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9589      }
9590    };
9591    if (json.has("reasonReference")) {
9592      JsonArray array = json.getAsJsonArray("reasonReference");
9593      for (int i = 0; i < array.size(); i++) {
9594        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
9595      }
9596    };
9597    if (json.has("bodySite"))
9598      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
9599    if (json.has("note")) {
9600      JsonArray array = json.getAsJsonArray("note");
9601      for (int i = 0; i < array.size(); i++) {
9602        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9603      }
9604    };
9605  }
9606
9607  protected DiagnosticReport parseDiagnosticReport(JsonObject json) throws IOException, FHIRFormatError {
9608    DiagnosticReport res = new DiagnosticReport();
9609    parseDiagnosticReportProperties(json, res);
9610    return res;
9611  }
9612
9613  protected void parseDiagnosticReportProperties(JsonObject json, DiagnosticReport res) throws IOException, FHIRFormatError {
9614    parseDomainResourceProperties(json, res);
9615    if (json.has("identifier")) {
9616      JsonArray array = json.getAsJsonArray("identifier");
9617      for (int i = 0; i < array.size(); i++) {
9618        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9619      }
9620    };
9621    if (json.has("basedOn")) {
9622      JsonArray array = json.getAsJsonArray("basedOn");
9623      for (int i = 0; i < array.size(); i++) {
9624        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
9625      }
9626    };
9627    if (json.has("status"))
9628      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticReport.DiagnosticReportStatus.NULL, new DiagnosticReport.DiagnosticReportStatusEnumFactory()));
9629    if (json.has("_status"))
9630      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9631    if (json.has("category")) {
9632      JsonArray array = json.getAsJsonArray("category");
9633      for (int i = 0; i < array.size(); i++) {
9634        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9635      }
9636    };
9637    if (json.has("code"))
9638      res.setCode(parseCodeableConcept(getJObject(json, "code")));
9639    if (json.has("subject"))
9640      res.setSubject(parseReference(getJObject(json, "subject")));
9641    if (json.has("encounter"))
9642      res.setEncounter(parseReference(getJObject(json, "encounter")));
9643    Type effective = parseType("effective", json);
9644    if (effective != null)
9645      res.setEffective(effective);
9646    if (json.has("issued"))
9647      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
9648    if (json.has("_issued"))
9649      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
9650    if (json.has("performer")) {
9651      JsonArray array = json.getAsJsonArray("performer");
9652      for (int i = 0; i < array.size(); i++) {
9653        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
9654      }
9655    };
9656    if (json.has("resultsInterpreter")) {
9657      JsonArray array = json.getAsJsonArray("resultsInterpreter");
9658      for (int i = 0; i < array.size(); i++) {
9659        res.getResultsInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
9660      }
9661    };
9662    if (json.has("specimen")) {
9663      JsonArray array = json.getAsJsonArray("specimen");
9664      for (int i = 0; i < array.size(); i++) {
9665        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
9666      }
9667    };
9668    if (json.has("result")) {
9669      JsonArray array = json.getAsJsonArray("result");
9670      for (int i = 0; i < array.size(); i++) {
9671        res.getResult().add(parseReference(array.get(i).getAsJsonObject()));
9672      }
9673    };
9674    if (json.has("imagingStudy")) {
9675      JsonArray array = json.getAsJsonArray("imagingStudy");
9676      for (int i = 0; i < array.size(); i++) {
9677        res.getImagingStudy().add(parseReference(array.get(i).getAsJsonObject()));
9678      }
9679    };
9680    if (json.has("media")) {
9681      JsonArray array = json.getAsJsonArray("media");
9682      for (int i = 0; i < array.size(); i++) {
9683        res.getMedia().add(parseDiagnosticReportDiagnosticReportMediaComponent(array.get(i).getAsJsonObject(), res));
9684      }
9685    };
9686    if (json.has("conclusion"))
9687      res.setConclusionElement(parseString(json.get("conclusion").getAsString()));
9688    if (json.has("_conclusion"))
9689      parseElementProperties(getJObject(json, "_conclusion"), res.getConclusionElement());
9690    if (json.has("conclusionCode")) {
9691      JsonArray array = json.getAsJsonArray("conclusionCode");
9692      for (int i = 0; i < array.size(); i++) {
9693        res.getConclusionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9694      }
9695    };
9696    if (json.has("presentedForm")) {
9697      JsonArray array = json.getAsJsonArray("presentedForm");
9698      for (int i = 0; i < array.size(); i++) {
9699        res.getPresentedForm().add(parseAttachment(array.get(i).getAsJsonObject()));
9700      }
9701    };
9702  }
9703
9704  protected DiagnosticReport.DiagnosticReportMediaComponent parseDiagnosticReportDiagnosticReportMediaComponent(JsonObject json, DiagnosticReport owner) throws IOException, FHIRFormatError {
9705    DiagnosticReport.DiagnosticReportMediaComponent res = new DiagnosticReport.DiagnosticReportMediaComponent();
9706    parseDiagnosticReportDiagnosticReportMediaComponentProperties(json, owner, res);
9707    return res;
9708  }
9709
9710  protected void parseDiagnosticReportDiagnosticReportMediaComponentProperties(JsonObject json, DiagnosticReport owner, DiagnosticReport.DiagnosticReportMediaComponent res) throws IOException, FHIRFormatError {
9711    parseBackboneElementProperties(json, res);
9712    if (json.has("comment"))
9713      res.setCommentElement(parseString(json.get("comment").getAsString()));
9714    if (json.has("_comment"))
9715      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
9716    if (json.has("link"))
9717      res.setLink(parseReference(getJObject(json, "link")));
9718  }
9719
9720  protected DocumentManifest parseDocumentManifest(JsonObject json) throws IOException, FHIRFormatError {
9721    DocumentManifest res = new DocumentManifest();
9722    parseDocumentManifestProperties(json, res);
9723    return res;
9724  }
9725
9726  protected void parseDocumentManifestProperties(JsonObject json, DocumentManifest res) throws IOException, FHIRFormatError {
9727    parseDomainResourceProperties(json, res);
9728    if (json.has("masterIdentifier"))
9729      res.setMasterIdentifier(parseIdentifier(getJObject(json, "masterIdentifier")));
9730    if (json.has("identifier")) {
9731      JsonArray array = json.getAsJsonArray("identifier");
9732      for (int i = 0; i < array.size(); i++) {
9733        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9734      }
9735    };
9736    if (json.has("status"))
9737      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
9738    if (json.has("_status"))
9739      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9740    if (json.has("type"))
9741      res.setType(parseCodeableConcept(getJObject(json, "type")));
9742    if (json.has("subject"))
9743      res.setSubject(parseReference(getJObject(json, "subject")));
9744    if (json.has("created"))
9745      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
9746    if (json.has("_created"))
9747      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
9748    if (json.has("author")) {
9749      JsonArray array = json.getAsJsonArray("author");
9750      for (int i = 0; i < array.size(); i++) {
9751        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
9752      }
9753    };
9754    if (json.has("recipient")) {
9755      JsonArray array = json.getAsJsonArray("recipient");
9756      for (int i = 0; i < array.size(); i++) {
9757        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
9758      }
9759    };
9760    if (json.has("source"))
9761      res.setSourceElement(parseUri(json.get("source").getAsString()));
9762    if (json.has("_source"))
9763      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
9764    if (json.has("description"))
9765      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9766    if (json.has("_description"))
9767      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
9768    if (json.has("content")) {
9769      JsonArray array = json.getAsJsonArray("content");
9770      for (int i = 0; i < array.size(); i++) {
9771        res.getContent().add(parseReference(array.get(i).getAsJsonObject()));
9772      }
9773    };
9774    if (json.has("related")) {
9775      JsonArray array = json.getAsJsonArray("related");
9776      for (int i = 0; i < array.size(); i++) {
9777        res.getRelated().add(parseDocumentManifestDocumentManifestRelatedComponent(array.get(i).getAsJsonObject(), res));
9778      }
9779    };
9780  }
9781
9782  protected DocumentManifest.DocumentManifestRelatedComponent parseDocumentManifestDocumentManifestRelatedComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
9783    DocumentManifest.DocumentManifestRelatedComponent res = new DocumentManifest.DocumentManifestRelatedComponent();
9784    parseDocumentManifestDocumentManifestRelatedComponentProperties(json, owner, res);
9785    return res;
9786  }
9787
9788  protected void parseDocumentManifestDocumentManifestRelatedComponentProperties(JsonObject json, DocumentManifest owner, DocumentManifest.DocumentManifestRelatedComponent res) throws IOException, FHIRFormatError {
9789    parseBackboneElementProperties(json, res);
9790    if (json.has("identifier"))
9791      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
9792    if (json.has("ref"))
9793      res.setRef(parseReference(getJObject(json, "ref")));
9794  }
9795
9796  protected DocumentReference parseDocumentReference(JsonObject json) throws IOException, FHIRFormatError {
9797    DocumentReference res = new DocumentReference();
9798    parseDocumentReferenceProperties(json, res);
9799    return res;
9800  }
9801
9802  protected void parseDocumentReferenceProperties(JsonObject json, DocumentReference res) throws IOException, FHIRFormatError {
9803    parseDomainResourceProperties(json, res);
9804    if (json.has("masterIdentifier"))
9805      res.setMasterIdentifier(parseIdentifier(getJObject(json, "masterIdentifier")));
9806    if (json.has("identifier")) {
9807      JsonArray array = json.getAsJsonArray("identifier");
9808      for (int i = 0; i < array.size(); i++) {
9809        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9810      }
9811    };
9812    if (json.has("status"))
9813      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
9814    if (json.has("_status"))
9815      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9816    if (json.has("docStatus"))
9817      res.setDocStatusElement(parseEnumeration(json.get("docStatus").getAsString(), DocumentReference.ReferredDocumentStatus.NULL, new DocumentReference.ReferredDocumentStatusEnumFactory()));
9818    if (json.has("_docStatus"))
9819      parseElementProperties(getJObject(json, "_docStatus"), res.getDocStatusElement());
9820    if (json.has("type"))
9821      res.setType(parseCodeableConcept(getJObject(json, "type")));
9822    if (json.has("category")) {
9823      JsonArray array = json.getAsJsonArray("category");
9824      for (int i = 0; i < array.size(); i++) {
9825        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9826      }
9827    };
9828    if (json.has("subject"))
9829      res.setSubject(parseReference(getJObject(json, "subject")));
9830    if (json.has("date"))
9831      res.setDateElement(parseInstant(json.get("date").getAsString()));
9832    if (json.has("_date"))
9833      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
9834    if (json.has("author")) {
9835      JsonArray array = json.getAsJsonArray("author");
9836      for (int i = 0; i < array.size(); i++) {
9837        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
9838      }
9839    };
9840    if (json.has("authenticator"))
9841      res.setAuthenticator(parseReference(getJObject(json, "authenticator")));
9842    if (json.has("custodian"))
9843      res.setCustodian(parseReference(getJObject(json, "custodian")));
9844    if (json.has("relatesTo")) {
9845      JsonArray array = json.getAsJsonArray("relatesTo");
9846      for (int i = 0; i < array.size(); i++) {
9847        res.getRelatesTo().add(parseDocumentReferenceDocumentReferenceRelatesToComponent(array.get(i).getAsJsonObject(), res));
9848      }
9849    };
9850    if (json.has("description"))
9851      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9852    if (json.has("_description"))
9853      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
9854    if (json.has("securityLabel")) {
9855      JsonArray array = json.getAsJsonArray("securityLabel");
9856      for (int i = 0; i < array.size(); i++) {
9857        res.getSecurityLabel().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9858      }
9859    };
9860    if (json.has("content")) {
9861      JsonArray array = json.getAsJsonArray("content");
9862      for (int i = 0; i < array.size(); i++) {
9863        res.getContent().add(parseDocumentReferenceDocumentReferenceContentComponent(array.get(i).getAsJsonObject(), res));
9864      }
9865    };
9866    if (json.has("context"))
9867      res.setContext(parseDocumentReferenceDocumentReferenceContextComponent(getJObject(json, "context"), res));
9868  }
9869
9870  protected DocumentReference.DocumentReferenceRelatesToComponent parseDocumentReferenceDocumentReferenceRelatesToComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
9871    DocumentReference.DocumentReferenceRelatesToComponent res = new DocumentReference.DocumentReferenceRelatesToComponent();
9872    parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(json, owner, res);
9873    return res;
9874  }
9875
9876  protected void parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceRelatesToComponent res) throws IOException, FHIRFormatError {
9877    parseBackboneElementProperties(json, res);
9878    if (json.has("code"))
9879      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), DocumentReference.DocumentRelationshipType.NULL, new DocumentReference.DocumentRelationshipTypeEnumFactory()));
9880    if (json.has("_code"))
9881      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
9882    if (json.has("target"))
9883      res.setTarget(parseReference(getJObject(json, "target")));
9884  }
9885
9886  protected DocumentReference.DocumentReferenceContentComponent parseDocumentReferenceDocumentReferenceContentComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
9887    DocumentReference.DocumentReferenceContentComponent res = new DocumentReference.DocumentReferenceContentComponent();
9888    parseDocumentReferenceDocumentReferenceContentComponentProperties(json, owner, res);
9889    return res;
9890  }
9891
9892  protected void parseDocumentReferenceDocumentReferenceContentComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContentComponent res) throws IOException, FHIRFormatError {
9893    parseBackboneElementProperties(json, res);
9894    if (json.has("attachment"))
9895      res.setAttachment(parseAttachment(getJObject(json, "attachment")));
9896    if (json.has("format"))
9897      res.setFormat(parseCoding(getJObject(json, "format")));
9898  }
9899
9900  protected DocumentReference.DocumentReferenceContextComponent parseDocumentReferenceDocumentReferenceContextComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
9901    DocumentReference.DocumentReferenceContextComponent res = new DocumentReference.DocumentReferenceContextComponent();
9902    parseDocumentReferenceDocumentReferenceContextComponentProperties(json, owner, res);
9903    return res;
9904  }
9905
9906  protected void parseDocumentReferenceDocumentReferenceContextComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContextComponent res) throws IOException, FHIRFormatError {
9907    parseBackboneElementProperties(json, res);
9908    if (json.has("encounter")) {
9909      JsonArray array = json.getAsJsonArray("encounter");
9910      for (int i = 0; i < array.size(); i++) {
9911        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
9912      }
9913    };
9914    if (json.has("event")) {
9915      JsonArray array = json.getAsJsonArray("event");
9916      for (int i = 0; i < array.size(); i++) {
9917        res.getEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9918      }
9919    };
9920    if (json.has("period"))
9921      res.setPeriod(parsePeriod(getJObject(json, "period")));
9922    if (json.has("facilityType"))
9923      res.setFacilityType(parseCodeableConcept(getJObject(json, "facilityType")));
9924    if (json.has("practiceSetting"))
9925      res.setPracticeSetting(parseCodeableConcept(getJObject(json, "practiceSetting")));
9926    if (json.has("sourcePatientInfo"))
9927      res.setSourcePatientInfo(parseReference(getJObject(json, "sourcePatientInfo")));
9928    if (json.has("related")) {
9929      JsonArray array = json.getAsJsonArray("related");
9930      for (int i = 0; i < array.size(); i++) {
9931        res.getRelated().add(parseReference(array.get(i).getAsJsonObject()));
9932      }
9933    };
9934  }
9935
9936  protected EffectEvidenceSynthesis parseEffectEvidenceSynthesis(JsonObject json) throws IOException, FHIRFormatError {
9937    EffectEvidenceSynthesis res = new EffectEvidenceSynthesis();
9938    parseEffectEvidenceSynthesisProperties(json, res);
9939    return res;
9940  }
9941
9942  protected void parseEffectEvidenceSynthesisProperties(JsonObject json, EffectEvidenceSynthesis res) throws IOException, FHIRFormatError {
9943    parseDomainResourceProperties(json, res);
9944    if (json.has("url"))
9945      res.setUrlElement(parseUri(json.get("url").getAsString()));
9946    if (json.has("_url"))
9947      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
9948    if (json.has("identifier")) {
9949      JsonArray array = json.getAsJsonArray("identifier");
9950      for (int i = 0; i < array.size(); i++) {
9951        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9952      }
9953    };
9954    if (json.has("version"))
9955      res.setVersionElement(parseString(json.get("version").getAsString()));
9956    if (json.has("_version"))
9957      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
9958    if (json.has("name"))
9959      res.setNameElement(parseString(json.get("name").getAsString()));
9960    if (json.has("_name"))
9961      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
9962    if (json.has("title"))
9963      res.setTitleElement(parseString(json.get("title").getAsString()));
9964    if (json.has("_title"))
9965      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
9966    if (json.has("status"))
9967      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
9968    if (json.has("_status"))
9969      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9970    if (json.has("date"))
9971      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9972    if (json.has("_date"))
9973      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
9974    if (json.has("publisher"))
9975      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
9976    if (json.has("_publisher"))
9977      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
9978    if (json.has("contact")) {
9979      JsonArray array = json.getAsJsonArray("contact");
9980      for (int i = 0; i < array.size(); i++) {
9981        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
9982      }
9983    };
9984    if (json.has("description"))
9985      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
9986    if (json.has("_description"))
9987      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
9988    if (json.has("note")) {
9989      JsonArray array = json.getAsJsonArray("note");
9990      for (int i = 0; i < array.size(); i++) {
9991        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9992      }
9993    };
9994    if (json.has("useContext")) {
9995      JsonArray array = json.getAsJsonArray("useContext");
9996      for (int i = 0; i < array.size(); i++) {
9997        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
9998      }
9999    };
10000    if (json.has("jurisdiction")) {
10001      JsonArray array = json.getAsJsonArray("jurisdiction");
10002      for (int i = 0; i < array.size(); i++) {
10003        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10004      }
10005    };
10006    if (json.has("copyright"))
10007      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
10008    if (json.has("_copyright"))
10009      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
10010    if (json.has("approvalDate"))
10011      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
10012    if (json.has("_approvalDate"))
10013      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
10014    if (json.has("lastReviewDate"))
10015      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
10016    if (json.has("_lastReviewDate"))
10017      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
10018    if (json.has("effectivePeriod"))
10019      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
10020    if (json.has("topic")) {
10021      JsonArray array = json.getAsJsonArray("topic");
10022      for (int i = 0; i < array.size(); i++) {
10023        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10024      }
10025    };
10026    if (json.has("author")) {
10027      JsonArray array = json.getAsJsonArray("author");
10028      for (int i = 0; i < array.size(); i++) {
10029        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10030      }
10031    };
10032    if (json.has("editor")) {
10033      JsonArray array = json.getAsJsonArray("editor");
10034      for (int i = 0; i < array.size(); i++) {
10035        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10036      }
10037    };
10038    if (json.has("reviewer")) {
10039      JsonArray array = json.getAsJsonArray("reviewer");
10040      for (int i = 0; i < array.size(); i++) {
10041        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
10042      }
10043    };
10044    if (json.has("endorser")) {
10045      JsonArray array = json.getAsJsonArray("endorser");
10046      for (int i = 0; i < array.size(); i++) {
10047        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
10048      }
10049    };
10050    if (json.has("relatedArtifact")) {
10051      JsonArray array = json.getAsJsonArray("relatedArtifact");
10052      for (int i = 0; i < array.size(); i++) {
10053        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
10054      }
10055    };
10056    if (json.has("synthesisType"))
10057      res.setSynthesisType(parseCodeableConcept(getJObject(json, "synthesisType")));
10058    if (json.has("studyType"))
10059      res.setStudyType(parseCodeableConcept(getJObject(json, "studyType")));
10060    if (json.has("population"))
10061      res.setPopulation(parseReference(getJObject(json, "population")));
10062    if (json.has("exposure"))
10063      res.setExposure(parseReference(getJObject(json, "exposure")));
10064    if (json.has("exposureAlternative"))
10065      res.setExposureAlternative(parseReference(getJObject(json, "exposureAlternative")));
10066    if (json.has("outcome"))
10067      res.setOutcome(parseReference(getJObject(json, "outcome")));
10068    if (json.has("sampleSize"))
10069      res.setSampleSize(parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent(getJObject(json, "sampleSize"), res));
10070    if (json.has("resultsByExposure")) {
10071      JsonArray array = json.getAsJsonArray("resultsByExposure");
10072      for (int i = 0; i < array.size(); i++) {
10073        res.getResultsByExposure().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(array.get(i).getAsJsonObject(), res));
10074      }
10075    };
10076    if (json.has("effectEstimate")) {
10077      JsonArray array = json.getAsJsonArray("effectEstimate");
10078      for (int i = 0; i < array.size(); i++) {
10079        res.getEffectEstimate().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(array.get(i).getAsJsonObject(), res));
10080      }
10081    };
10082    if (json.has("certainty")) {
10083      JsonArray array = json.getAsJsonArray("certainty");
10084      for (int i = 0; i < array.size(); i++) {
10085        res.getCertainty().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(array.get(i).getAsJsonObject(), res));
10086      }
10087    };
10088  }
10089
10090  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10091    EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent();
10092    parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentProperties(json, owner, res);
10093    return res;
10094  }
10095
10096  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent res) throws IOException, FHIRFormatError {
10097    parseBackboneElementProperties(json, res);
10098    if (json.has("description"))
10099      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10100    if (json.has("_description"))
10101      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
10102    if (json.has("numberOfStudies"))
10103      res.setNumberOfStudiesElement(parseInteger(json.get("numberOfStudies").getAsLong()));
10104    if (json.has("_numberOfStudies"))
10105      parseElementProperties(getJObject(json, "_numberOfStudies"), res.getNumberOfStudiesElement());
10106    if (json.has("numberOfParticipants"))
10107      res.setNumberOfParticipantsElement(parseInteger(json.get("numberOfParticipants").getAsLong()));
10108    if (json.has("_numberOfParticipants"))
10109      parseElementProperties(getJObject(json, "_numberOfParticipants"), res.getNumberOfParticipantsElement());
10110  }
10111
10112  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10113    EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent();
10114    parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentProperties(json, owner, res);
10115    return res;
10116  }
10117
10118  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent res) throws IOException, FHIRFormatError {
10119    parseBackboneElementProperties(json, res);
10120    if (json.has("description"))
10121      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10122    if (json.has("_description"))
10123      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
10124    if (json.has("exposureState"))
10125      res.setExposureStateElement(parseEnumeration(json.get("exposureState").getAsString(), EffectEvidenceSynthesis.ExposureState.NULL, new EffectEvidenceSynthesis.ExposureStateEnumFactory()));
10126    if (json.has("_exposureState"))
10127      parseElementProperties(getJObject(json, "_exposureState"), res.getExposureStateElement());
10128    if (json.has("variantState"))
10129      res.setVariantState(parseCodeableConcept(getJObject(json, "variantState")));
10130    if (json.has("riskEvidenceSynthesis"))
10131      res.setRiskEvidenceSynthesis(parseReference(getJObject(json, "riskEvidenceSynthesis")));
10132  }
10133
10134  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10135    EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent();
10136    parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentProperties(json, owner, res);
10137    return res;
10138  }
10139
10140  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent res) throws IOException, FHIRFormatError {
10141    parseBackboneElementProperties(json, res);
10142    if (json.has("description"))
10143      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10144    if (json.has("_description"))
10145      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
10146    if (json.has("type"))
10147      res.setType(parseCodeableConcept(getJObject(json, "type")));
10148    if (json.has("variantState"))
10149      res.setVariantState(parseCodeableConcept(getJObject(json, "variantState")));
10150    if (json.has("value"))
10151      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
10152    if (json.has("_value"))
10153      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
10154    if (json.has("unitOfMeasure"))
10155      res.setUnitOfMeasure(parseCodeableConcept(getJObject(json, "unitOfMeasure")));
10156    if (json.has("precisionEstimate")) {
10157      JsonArray array = json.getAsJsonArray("precisionEstimate");
10158      for (int i = 0; i < array.size(); i++) {
10159        res.getPrecisionEstimate().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(array.get(i).getAsJsonObject(), owner));
10160      }
10161    };
10162  }
10163
10164  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10165    EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent();
10166    parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentProperties(json, owner, res);
10167    return res;
10168  }
10169
10170  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent res) throws IOException, FHIRFormatError {
10171    parseBackboneElementProperties(json, res);
10172    if (json.has("type"))
10173      res.setType(parseCodeableConcept(getJObject(json, "type")));
10174    if (json.has("level"))
10175      res.setLevelElement(parseDecimal(json.get("level").getAsBigDecimal()));
10176    if (json.has("_level"))
10177      parseElementProperties(getJObject(json, "_level"), res.getLevelElement());
10178    if (json.has("from"))
10179      res.setFromElement(parseDecimal(json.get("from").getAsBigDecimal()));
10180    if (json.has("_from"))
10181      parseElementProperties(getJObject(json, "_from"), res.getFromElement());
10182    if (json.has("to"))
10183      res.setToElement(parseDecimal(json.get("to").getAsBigDecimal()));
10184    if (json.has("_to"))
10185      parseElementProperties(getJObject(json, "_to"), res.getToElement());
10186  }
10187
10188  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10189    EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent();
10190    parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentProperties(json, owner, res);
10191    return res;
10192  }
10193
10194  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent res) throws IOException, FHIRFormatError {
10195    parseBackboneElementProperties(json, res);
10196    if (json.has("rating")) {
10197      JsonArray array = json.getAsJsonArray("rating");
10198      for (int i = 0; i < array.size(); i++) {
10199        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10200      }
10201    };
10202    if (json.has("note")) {
10203      JsonArray array = json.getAsJsonArray("note");
10204      for (int i = 0; i < array.size(); i++) {
10205        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10206      }
10207    };
10208    if (json.has("certaintySubcomponent")) {
10209      JsonArray array = json.getAsJsonArray("certaintySubcomponent");
10210      for (int i = 0; i < array.size(); i++) {
10211        res.getCertaintySubcomponent().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(array.get(i).getAsJsonObject(), owner));
10212      }
10213    };
10214  }
10215
10216  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10217    EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent();
10218    parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentProperties(json, owner, res);
10219    return res;
10220  }
10221
10222  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent res) throws IOException, FHIRFormatError {
10223    parseBackboneElementProperties(json, res);
10224    if (json.has("type"))
10225      res.setType(parseCodeableConcept(getJObject(json, "type")));
10226    if (json.has("rating")) {
10227      JsonArray array = json.getAsJsonArray("rating");
10228      for (int i = 0; i < array.size(); i++) {
10229        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10230      }
10231    };
10232    if (json.has("note")) {
10233      JsonArray array = json.getAsJsonArray("note");
10234      for (int i = 0; i < array.size(); i++) {
10235        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10236      }
10237    };
10238  }
10239
10240  protected Encounter parseEncounter(JsonObject json) throws IOException, FHIRFormatError {
10241    Encounter res = new Encounter();
10242    parseEncounterProperties(json, res);
10243    return res;
10244  }
10245
10246  protected void parseEncounterProperties(JsonObject json, Encounter res) throws IOException, FHIRFormatError {
10247    parseDomainResourceProperties(json, res);
10248    if (json.has("identifier")) {
10249      JsonArray array = json.getAsJsonArray("identifier");
10250      for (int i = 0; i < array.size(); i++) {
10251        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10252      }
10253    };
10254    if (json.has("status"))
10255      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
10256    if (json.has("_status"))
10257      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10258    if (json.has("statusHistory")) {
10259      JsonArray array = json.getAsJsonArray("statusHistory");
10260      for (int i = 0; i < array.size(); i++) {
10261        res.getStatusHistory().add(parseEncounterStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
10262      }
10263    };
10264    if (json.has("class"))
10265      res.setClass_(parseCoding(getJObject(json, "class")));
10266    if (json.has("classHistory")) {
10267      JsonArray array = json.getAsJsonArray("classHistory");
10268      for (int i = 0; i < array.size(); i++) {
10269        res.getClassHistory().add(parseEncounterClassHistoryComponent(array.get(i).getAsJsonObject(), res));
10270      }
10271    };
10272    if (json.has("type")) {
10273      JsonArray array = json.getAsJsonArray("type");
10274      for (int i = 0; i < array.size(); i++) {
10275        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10276      }
10277    };
10278    if (json.has("serviceType"))
10279      res.setServiceType(parseCodeableConcept(getJObject(json, "serviceType")));
10280    if (json.has("priority"))
10281      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
10282    if (json.has("subject"))
10283      res.setSubject(parseReference(getJObject(json, "subject")));
10284    if (json.has("episodeOfCare")) {
10285      JsonArray array = json.getAsJsonArray("episodeOfCare");
10286      for (int i = 0; i < array.size(); i++) {
10287        res.getEpisodeOfCare().add(parseReference(array.get(i).getAsJsonObject()));
10288      }
10289    };
10290    if (json.has("basedOn")) {
10291      JsonArray array = json.getAsJsonArray("basedOn");
10292      for (int i = 0; i < array.size(); i++) {
10293        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
10294      }
10295    };
10296    if (json.has("participant")) {
10297      JsonArray array = json.getAsJsonArray("participant");
10298      for (int i = 0; i < array.size(); i++) {
10299        res.getParticipant().add(parseEncounterEncounterParticipantComponent(array.get(i).getAsJsonObject(), res));
10300      }
10301    };
10302    if (json.has("appointment")) {
10303      JsonArray array = json.getAsJsonArray("appointment");
10304      for (int i = 0; i < array.size(); i++) {
10305        res.getAppointment().add(parseReference(array.get(i).getAsJsonObject()));
10306      }
10307    };
10308    if (json.has("period"))
10309      res.setPeriod(parsePeriod(getJObject(json, "period")));
10310    if (json.has("length"))
10311      res.setLength(parseDuration(getJObject(json, "length")));
10312    if (json.has("reasonCode")) {
10313      JsonArray array = json.getAsJsonArray("reasonCode");
10314      for (int i = 0; i < array.size(); i++) {
10315        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10316      }
10317    };
10318    if (json.has("reasonReference")) {
10319      JsonArray array = json.getAsJsonArray("reasonReference");
10320      for (int i = 0; i < array.size(); i++) {
10321        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
10322      }
10323    };
10324    if (json.has("diagnosis")) {
10325      JsonArray array = json.getAsJsonArray("diagnosis");
10326      for (int i = 0; i < array.size(); i++) {
10327        res.getDiagnosis().add(parseEncounterDiagnosisComponent(array.get(i).getAsJsonObject(), res));
10328      }
10329    };
10330    if (json.has("account")) {
10331      JsonArray array = json.getAsJsonArray("account");
10332      for (int i = 0; i < array.size(); i++) {
10333        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
10334      }
10335    };
10336    if (json.has("hospitalization"))
10337      res.setHospitalization(parseEncounterEncounterHospitalizationComponent(getJObject(json, "hospitalization"), res));
10338    if (json.has("location")) {
10339      JsonArray array = json.getAsJsonArray("location");
10340      for (int i = 0; i < array.size(); i++) {
10341        res.getLocation().add(parseEncounterEncounterLocationComponent(array.get(i).getAsJsonObject(), res));
10342      }
10343    };
10344    if (json.has("serviceProvider"))
10345      res.setServiceProvider(parseReference(getJObject(json, "serviceProvider")));
10346    if (json.has("partOf"))
10347      res.setPartOf(parseReference(getJObject(json, "partOf")));
10348  }
10349
10350  protected Encounter.StatusHistoryComponent parseEncounterStatusHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10351    Encounter.StatusHistoryComponent res = new Encounter.StatusHistoryComponent();
10352    parseEncounterStatusHistoryComponentProperties(json, owner, res);
10353    return res;
10354  }
10355
10356  protected void parseEncounterStatusHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.StatusHistoryComponent res) throws IOException, FHIRFormatError {
10357    parseBackboneElementProperties(json, res);
10358    if (json.has("status"))
10359      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
10360    if (json.has("_status"))
10361      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10362    if (json.has("period"))
10363      res.setPeriod(parsePeriod(getJObject(json, "period")));
10364  }
10365
10366  protected Encounter.ClassHistoryComponent parseEncounterClassHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10367    Encounter.ClassHistoryComponent res = new Encounter.ClassHistoryComponent();
10368    parseEncounterClassHistoryComponentProperties(json, owner, res);
10369    return res;
10370  }
10371
10372  protected void parseEncounterClassHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.ClassHistoryComponent res) throws IOException, FHIRFormatError {
10373    parseBackboneElementProperties(json, res);
10374    if (json.has("class"))
10375      res.setClass_(parseCoding(getJObject(json, "class")));
10376    if (json.has("period"))
10377      res.setPeriod(parsePeriod(getJObject(json, "period")));
10378  }
10379
10380  protected Encounter.EncounterParticipantComponent parseEncounterEncounterParticipantComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10381    Encounter.EncounterParticipantComponent res = new Encounter.EncounterParticipantComponent();
10382    parseEncounterEncounterParticipantComponentProperties(json, owner, res);
10383    return res;
10384  }
10385
10386  protected void parseEncounterEncounterParticipantComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterParticipantComponent res) throws IOException, FHIRFormatError {
10387    parseBackboneElementProperties(json, res);
10388    if (json.has("type")) {
10389      JsonArray array = json.getAsJsonArray("type");
10390      for (int i = 0; i < array.size(); i++) {
10391        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10392      }
10393    };
10394    if (json.has("period"))
10395      res.setPeriod(parsePeriod(getJObject(json, "period")));
10396    if (json.has("individual"))
10397      res.setIndividual(parseReference(getJObject(json, "individual")));
10398  }
10399
10400  protected Encounter.DiagnosisComponent parseEncounterDiagnosisComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10401    Encounter.DiagnosisComponent res = new Encounter.DiagnosisComponent();
10402    parseEncounterDiagnosisComponentProperties(json, owner, res);
10403    return res;
10404  }
10405
10406  protected void parseEncounterDiagnosisComponentProperties(JsonObject json, Encounter owner, Encounter.DiagnosisComponent res) throws IOException, FHIRFormatError {
10407    parseBackboneElementProperties(json, res);
10408    if (json.has("condition"))
10409      res.setCondition(parseReference(getJObject(json, "condition")));
10410    if (json.has("use"))
10411      res.setUse(parseCodeableConcept(getJObject(json, "use")));
10412    if (json.has("rank"))
10413      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
10414    if (json.has("_rank"))
10415      parseElementProperties(getJObject(json, "_rank"), res.getRankElement());
10416  }
10417
10418  protected Encounter.EncounterHospitalizationComponent parseEncounterEncounterHospitalizationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10419    Encounter.EncounterHospitalizationComponent res = new Encounter.EncounterHospitalizationComponent();
10420    parseEncounterEncounterHospitalizationComponentProperties(json, owner, res);
10421    return res;
10422  }
10423
10424  protected void parseEncounterEncounterHospitalizationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterHospitalizationComponent res) throws IOException, FHIRFormatError {
10425    parseBackboneElementProperties(json, res);
10426    if (json.has("preAdmissionIdentifier"))
10427      res.setPreAdmissionIdentifier(parseIdentifier(getJObject(json, "preAdmissionIdentifier")));
10428    if (json.has("origin"))
10429      res.setOrigin(parseReference(getJObject(json, "origin")));
10430    if (json.has("admitSource"))
10431      res.setAdmitSource(parseCodeableConcept(getJObject(json, "admitSource")));
10432    if (json.has("reAdmission"))
10433      res.setReAdmission(parseCodeableConcept(getJObject(json, "reAdmission")));
10434    if (json.has("dietPreference")) {
10435      JsonArray array = json.getAsJsonArray("dietPreference");
10436      for (int i = 0; i < array.size(); i++) {
10437        res.getDietPreference().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10438      }
10439    };
10440    if (json.has("specialCourtesy")) {
10441      JsonArray array = json.getAsJsonArray("specialCourtesy");
10442      for (int i = 0; i < array.size(); i++) {
10443        res.getSpecialCourtesy().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10444      }
10445    };
10446    if (json.has("specialArrangement")) {
10447      JsonArray array = json.getAsJsonArray("specialArrangement");
10448      for (int i = 0; i < array.size(); i++) {
10449        res.getSpecialArrangement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10450      }
10451    };
10452    if (json.has("destination"))
10453      res.setDestination(parseReference(getJObject(json, "destination")));
10454    if (json.has("dischargeDisposition"))
10455      res.setDischargeDisposition(parseCodeableConcept(getJObject(json, "dischargeDisposition")));
10456  }
10457
10458  protected Encounter.EncounterLocationComponent parseEncounterEncounterLocationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10459    Encounter.EncounterLocationComponent res = new Encounter.EncounterLocationComponent();
10460    parseEncounterEncounterLocationComponentProperties(json, owner, res);
10461    return res;
10462  }
10463
10464  protected void parseEncounterEncounterLocationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterLocationComponent res) throws IOException, FHIRFormatError {
10465    parseBackboneElementProperties(json, res);
10466    if (json.has("location"))
10467      res.setLocation(parseReference(getJObject(json, "location")));
10468    if (json.has("status"))
10469      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterLocationStatus.NULL, new Encounter.EncounterLocationStatusEnumFactory()));
10470    if (json.has("_status"))
10471      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10472    if (json.has("physicalType"))
10473      res.setPhysicalType(parseCodeableConcept(getJObject(json, "physicalType")));
10474    if (json.has("period"))
10475      res.setPeriod(parsePeriod(getJObject(json, "period")));
10476  }
10477
10478  protected Endpoint parseEndpoint(JsonObject json) throws IOException, FHIRFormatError {
10479    Endpoint res = new Endpoint();
10480    parseEndpointProperties(json, res);
10481    return res;
10482  }
10483
10484  protected void parseEndpointProperties(JsonObject json, Endpoint res) throws IOException, FHIRFormatError {
10485    parseDomainResourceProperties(json, res);
10486    if (json.has("identifier")) {
10487      JsonArray array = json.getAsJsonArray("identifier");
10488      for (int i = 0; i < array.size(); i++) {
10489        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10490      }
10491    };
10492    if (json.has("status"))
10493      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Endpoint.EndpointStatus.NULL, new Endpoint.EndpointStatusEnumFactory()));
10494    if (json.has("_status"))
10495      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10496    if (json.has("connectionType"))
10497      res.setConnectionType(parseCoding(getJObject(json, "connectionType")));
10498    if (json.has("name"))
10499      res.setNameElement(parseString(json.get("name").getAsString()));
10500    if (json.has("_name"))
10501      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
10502    if (json.has("managingOrganization"))
10503      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
10504    if (json.has("contact")) {
10505      JsonArray array = json.getAsJsonArray("contact");
10506      for (int i = 0; i < array.size(); i++) {
10507        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
10508      }
10509    };
10510    if (json.has("period"))
10511      res.setPeriod(parsePeriod(getJObject(json, "period")));
10512    if (json.has("payloadType")) {
10513      JsonArray array = json.getAsJsonArray("payloadType");
10514      for (int i = 0; i < array.size(); i++) {
10515        res.getPayloadType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10516      }
10517    };
10518    if (json.has("payloadMimeType")) {
10519      JsonArray array = json.getAsJsonArray("payloadMimeType");
10520      for (int i = 0; i < array.size(); i++) {
10521        res.getPayloadMimeType().add(parseCode(array.get(i).getAsString()));
10522      }
10523    };
10524    if (json.has("_payloadMimeType")) {
10525      JsonArray array = json.getAsJsonArray("_payloadMimeType");
10526      for (int i = 0; i < array.size(); i++) {
10527        if (i == res.getPayloadMimeType().size())
10528          res.getPayloadMimeType().add(parseCode(null));
10529        if (array.get(i) instanceof JsonObject) 
10530          parseElementProperties(array.get(i).getAsJsonObject(), res.getPayloadMimeType().get(i));
10531      }
10532    };
10533    if (json.has("address"))
10534      res.setAddressElement(parseUrl(json.get("address").getAsString()));
10535    if (json.has("_address"))
10536      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
10537    if (json.has("header")) {
10538      JsonArray array = json.getAsJsonArray("header");
10539      for (int i = 0; i < array.size(); i++) {
10540        res.getHeader().add(parseString(array.get(i).getAsString()));
10541      }
10542    };
10543    if (json.has("_header")) {
10544      JsonArray array = json.getAsJsonArray("_header");
10545      for (int i = 0; i < array.size(); i++) {
10546        if (i == res.getHeader().size())
10547          res.getHeader().add(parseString(null));
10548        if (array.get(i) instanceof JsonObject) 
10549          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
10550      }
10551    };
10552  }
10553
10554  protected EnrollmentRequest parseEnrollmentRequest(JsonObject json) throws IOException, FHIRFormatError {
10555    EnrollmentRequest res = new EnrollmentRequest();
10556    parseEnrollmentRequestProperties(json, res);
10557    return res;
10558  }
10559
10560  protected void parseEnrollmentRequestProperties(JsonObject json, EnrollmentRequest res) throws IOException, FHIRFormatError {
10561    parseDomainResourceProperties(json, res);
10562    if (json.has("identifier")) {
10563      JsonArray array = json.getAsJsonArray("identifier");
10564      for (int i = 0; i < array.size(); i++) {
10565        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10566      }
10567    };
10568    if (json.has("status"))
10569      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentRequest.EnrollmentRequestStatus.NULL, new EnrollmentRequest.EnrollmentRequestStatusEnumFactory()));
10570    if (json.has("_status"))
10571      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10572    if (json.has("created"))
10573      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
10574    if (json.has("_created"))
10575      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
10576    if (json.has("insurer"))
10577      res.setInsurer(parseReference(getJObject(json, "insurer")));
10578    if (json.has("provider"))
10579      res.setProvider(parseReference(getJObject(json, "provider")));
10580    if (json.has("candidate"))
10581      res.setCandidate(parseReference(getJObject(json, "candidate")));
10582    if (json.has("coverage"))
10583      res.setCoverage(parseReference(getJObject(json, "coverage")));
10584  }
10585
10586  protected EnrollmentResponse parseEnrollmentResponse(JsonObject json) throws IOException, FHIRFormatError {
10587    EnrollmentResponse res = new EnrollmentResponse();
10588    parseEnrollmentResponseProperties(json, res);
10589    return res;
10590  }
10591
10592  protected void parseEnrollmentResponseProperties(JsonObject json, EnrollmentResponse res) throws IOException, FHIRFormatError {
10593    parseDomainResourceProperties(json, res);
10594    if (json.has("identifier")) {
10595      JsonArray array = json.getAsJsonArray("identifier");
10596      for (int i = 0; i < array.size(); i++) {
10597        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10598      }
10599    };
10600    if (json.has("status"))
10601      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentResponse.EnrollmentResponseStatus.NULL, new EnrollmentResponse.EnrollmentResponseStatusEnumFactory()));
10602    if (json.has("_status"))
10603      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10604    if (json.has("request"))
10605      res.setRequest(parseReference(getJObject(json, "request")));
10606    if (json.has("outcome"))
10607      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
10608    if (json.has("_outcome"))
10609      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
10610    if (json.has("disposition"))
10611      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
10612    if (json.has("_disposition"))
10613      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
10614    if (json.has("created"))
10615      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
10616    if (json.has("_created"))
10617      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
10618    if (json.has("organization"))
10619      res.setOrganization(parseReference(getJObject(json, "organization")));
10620    if (json.has("requestProvider"))
10621      res.setRequestProvider(parseReference(getJObject(json, "requestProvider")));
10622  }
10623
10624  protected EpisodeOfCare parseEpisodeOfCare(JsonObject json) throws IOException, FHIRFormatError {
10625    EpisodeOfCare res = new EpisodeOfCare();
10626    parseEpisodeOfCareProperties(json, res);
10627    return res;
10628  }
10629
10630  protected void parseEpisodeOfCareProperties(JsonObject json, EpisodeOfCare res) throws IOException, FHIRFormatError {
10631    parseDomainResourceProperties(json, res);
10632    if (json.has("identifier")) {
10633      JsonArray array = json.getAsJsonArray("identifier");
10634      for (int i = 0; i < array.size(); i++) {
10635        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10636      }
10637    };
10638    if (json.has("status"))
10639      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
10640    if (json.has("_status"))
10641      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10642    if (json.has("statusHistory")) {
10643      JsonArray array = json.getAsJsonArray("statusHistory");
10644      for (int i = 0; i < array.size(); i++) {
10645        res.getStatusHistory().add(parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
10646      }
10647    };
10648    if (json.has("type")) {
10649      JsonArray array = json.getAsJsonArray("type");
10650      for (int i = 0; i < array.size(); i++) {
10651        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10652      }
10653    };
10654    if (json.has("diagnosis")) {
10655      JsonArray array = json.getAsJsonArray("diagnosis");
10656      for (int i = 0; i < array.size(); i++) {
10657        res.getDiagnosis().add(parseEpisodeOfCareDiagnosisComponent(array.get(i).getAsJsonObject(), res));
10658      }
10659    };
10660    if (json.has("patient"))
10661      res.setPatient(parseReference(getJObject(json, "patient")));
10662    if (json.has("managingOrganization"))
10663      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
10664    if (json.has("period"))
10665      res.setPeriod(parsePeriod(getJObject(json, "period")));
10666    if (json.has("referralRequest")) {
10667      JsonArray array = json.getAsJsonArray("referralRequest");
10668      for (int i = 0; i < array.size(); i++) {
10669        res.getReferralRequest().add(parseReference(array.get(i).getAsJsonObject()));
10670      }
10671    };
10672    if (json.has("careManager"))
10673      res.setCareManager(parseReference(getJObject(json, "careManager")));
10674    if (json.has("team")) {
10675      JsonArray array = json.getAsJsonArray("team");
10676      for (int i = 0; i < array.size(); i++) {
10677        res.getTeam().add(parseReference(array.get(i).getAsJsonObject()));
10678      }
10679    };
10680    if (json.has("account")) {
10681      JsonArray array = json.getAsJsonArray("account");
10682      for (int i = 0; i < array.size(); i++) {
10683        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
10684      }
10685    };
10686  }
10687
10688  protected EpisodeOfCare.EpisodeOfCareStatusHistoryComponent parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
10689    EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res = new EpisodeOfCare.EpisodeOfCareStatusHistoryComponent();
10690    parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(json, owner, res);
10691    return res;
10692  }
10693
10694  protected void parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res) throws IOException, FHIRFormatError {
10695    parseBackboneElementProperties(json, res);
10696    if (json.has("status"))
10697      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
10698    if (json.has("_status"))
10699      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10700    if (json.has("period"))
10701      res.setPeriod(parsePeriod(getJObject(json, "period")));
10702  }
10703
10704  protected EpisodeOfCare.DiagnosisComponent parseEpisodeOfCareDiagnosisComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
10705    EpisodeOfCare.DiagnosisComponent res = new EpisodeOfCare.DiagnosisComponent();
10706    parseEpisodeOfCareDiagnosisComponentProperties(json, owner, res);
10707    return res;
10708  }
10709
10710  protected void parseEpisodeOfCareDiagnosisComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.DiagnosisComponent res) throws IOException, FHIRFormatError {
10711    parseBackboneElementProperties(json, res);
10712    if (json.has("condition"))
10713      res.setCondition(parseReference(getJObject(json, "condition")));
10714    if (json.has("role"))
10715      res.setRole(parseCodeableConcept(getJObject(json, "role")));
10716    if (json.has("rank"))
10717      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
10718    if (json.has("_rank"))
10719      parseElementProperties(getJObject(json, "_rank"), res.getRankElement());
10720  }
10721
10722  protected EventDefinition parseEventDefinition(JsonObject json) throws IOException, FHIRFormatError {
10723    EventDefinition res = new EventDefinition();
10724    parseEventDefinitionProperties(json, res);
10725    return res;
10726  }
10727
10728  protected void parseEventDefinitionProperties(JsonObject json, EventDefinition res) throws IOException, FHIRFormatError {
10729    parseDomainResourceProperties(json, res);
10730    if (json.has("url"))
10731      res.setUrlElement(parseUri(json.get("url").getAsString()));
10732    if (json.has("_url"))
10733      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
10734    if (json.has("identifier")) {
10735      JsonArray array = json.getAsJsonArray("identifier");
10736      for (int i = 0; i < array.size(); i++) {
10737        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10738      }
10739    };
10740    if (json.has("version"))
10741      res.setVersionElement(parseString(json.get("version").getAsString()));
10742    if (json.has("_version"))
10743      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
10744    if (json.has("name"))
10745      res.setNameElement(parseString(json.get("name").getAsString()));
10746    if (json.has("_name"))
10747      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
10748    if (json.has("title"))
10749      res.setTitleElement(parseString(json.get("title").getAsString()));
10750    if (json.has("_title"))
10751      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
10752    if (json.has("subtitle"))
10753      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
10754    if (json.has("_subtitle"))
10755      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
10756    if (json.has("status"))
10757      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
10758    if (json.has("_status"))
10759      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10760    if (json.has("experimental"))
10761      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
10762    if (json.has("_experimental"))
10763      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
10764    Type subject = parseType("subject", json);
10765    if (subject != null)
10766      res.setSubject(subject);
10767    if (json.has("date"))
10768      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10769    if (json.has("_date"))
10770      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
10771    if (json.has("publisher"))
10772      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
10773    if (json.has("_publisher"))
10774      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
10775    if (json.has("contact")) {
10776      JsonArray array = json.getAsJsonArray("contact");
10777      for (int i = 0; i < array.size(); i++) {
10778        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
10779      }
10780    };
10781    if (json.has("description"))
10782      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
10783    if (json.has("_description"))
10784      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
10785    if (json.has("useContext")) {
10786      JsonArray array = json.getAsJsonArray("useContext");
10787      for (int i = 0; i < array.size(); i++) {
10788        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
10789      }
10790    };
10791    if (json.has("jurisdiction")) {
10792      JsonArray array = json.getAsJsonArray("jurisdiction");
10793      for (int i = 0; i < array.size(); i++) {
10794        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10795      }
10796    };
10797    if (json.has("purpose"))
10798      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
10799    if (json.has("_purpose"))
10800      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
10801    if (json.has("usage"))
10802      res.setUsageElement(parseString(json.get("usage").getAsString()));
10803    if (json.has("_usage"))
10804      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
10805    if (json.has("copyright"))
10806      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
10807    if (json.has("_copyright"))
10808      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
10809    if (json.has("approvalDate"))
10810      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
10811    if (json.has("_approvalDate"))
10812      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
10813    if (json.has("lastReviewDate"))
10814      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
10815    if (json.has("_lastReviewDate"))
10816      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
10817    if (json.has("effectivePeriod"))
10818      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
10819    if (json.has("topic")) {
10820      JsonArray array = json.getAsJsonArray("topic");
10821      for (int i = 0; i < array.size(); i++) {
10822        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10823      }
10824    };
10825    if (json.has("author")) {
10826      JsonArray array = json.getAsJsonArray("author");
10827      for (int i = 0; i < array.size(); i++) {
10828        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10829      }
10830    };
10831    if (json.has("editor")) {
10832      JsonArray array = json.getAsJsonArray("editor");
10833      for (int i = 0; i < array.size(); i++) {
10834        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10835      }
10836    };
10837    if (json.has("reviewer")) {
10838      JsonArray array = json.getAsJsonArray("reviewer");
10839      for (int i = 0; i < array.size(); i++) {
10840        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
10841      }
10842    };
10843    if (json.has("endorser")) {
10844      JsonArray array = json.getAsJsonArray("endorser");
10845      for (int i = 0; i < array.size(); i++) {
10846        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
10847      }
10848    };
10849    if (json.has("relatedArtifact")) {
10850      JsonArray array = json.getAsJsonArray("relatedArtifact");
10851      for (int i = 0; i < array.size(); i++) {
10852        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
10853      }
10854    };
10855    if (json.has("trigger")) {
10856      JsonArray array = json.getAsJsonArray("trigger");
10857      for (int i = 0; i < array.size(); i++) {
10858        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
10859      }
10860    };
10861  }
10862
10863  protected Evidence parseEvidence(JsonObject json) throws IOException, FHIRFormatError {
10864    Evidence res = new Evidence();
10865    parseEvidenceProperties(json, res);
10866    return res;
10867  }
10868
10869  protected void parseEvidenceProperties(JsonObject json, Evidence res) throws IOException, FHIRFormatError {
10870    parseDomainResourceProperties(json, res);
10871    if (json.has("url"))
10872      res.setUrlElement(parseUri(json.get("url").getAsString()));
10873    if (json.has("_url"))
10874      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
10875    if (json.has("identifier")) {
10876      JsonArray array = json.getAsJsonArray("identifier");
10877      for (int i = 0; i < array.size(); i++) {
10878        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10879      }
10880    };
10881    if (json.has("version"))
10882      res.setVersionElement(parseString(json.get("version").getAsString()));
10883    if (json.has("_version"))
10884      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
10885    if (json.has("name"))
10886      res.setNameElement(parseString(json.get("name").getAsString()));
10887    if (json.has("_name"))
10888      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
10889    if (json.has("title"))
10890      res.setTitleElement(parseString(json.get("title").getAsString()));
10891    if (json.has("_title"))
10892      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
10893    if (json.has("shortTitle"))
10894      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
10895    if (json.has("_shortTitle"))
10896      parseElementProperties(getJObject(json, "_shortTitle"), res.getShortTitleElement());
10897    if (json.has("subtitle"))
10898      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
10899    if (json.has("_subtitle"))
10900      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
10901    if (json.has("status"))
10902      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
10903    if (json.has("_status"))
10904      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10905    if (json.has("date"))
10906      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10907    if (json.has("_date"))
10908      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
10909    if (json.has("publisher"))
10910      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
10911    if (json.has("_publisher"))
10912      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
10913    if (json.has("contact")) {
10914      JsonArray array = json.getAsJsonArray("contact");
10915      for (int i = 0; i < array.size(); i++) {
10916        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
10917      }
10918    };
10919    if (json.has("description"))
10920      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
10921    if (json.has("_description"))
10922      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
10923    if (json.has("note")) {
10924      JsonArray array = json.getAsJsonArray("note");
10925      for (int i = 0; i < array.size(); i++) {
10926        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10927      }
10928    };
10929    if (json.has("useContext")) {
10930      JsonArray array = json.getAsJsonArray("useContext");
10931      for (int i = 0; i < array.size(); i++) {
10932        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
10933      }
10934    };
10935    if (json.has("jurisdiction")) {
10936      JsonArray array = json.getAsJsonArray("jurisdiction");
10937      for (int i = 0; i < array.size(); i++) {
10938        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10939      }
10940    };
10941    if (json.has("copyright"))
10942      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
10943    if (json.has("_copyright"))
10944      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
10945    if (json.has("approvalDate"))
10946      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
10947    if (json.has("_approvalDate"))
10948      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
10949    if (json.has("lastReviewDate"))
10950      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
10951    if (json.has("_lastReviewDate"))
10952      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
10953    if (json.has("effectivePeriod"))
10954      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
10955    if (json.has("topic")) {
10956      JsonArray array = json.getAsJsonArray("topic");
10957      for (int i = 0; i < array.size(); i++) {
10958        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10959      }
10960    };
10961    if (json.has("author")) {
10962      JsonArray array = json.getAsJsonArray("author");
10963      for (int i = 0; i < array.size(); i++) {
10964        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10965      }
10966    };
10967    if (json.has("editor")) {
10968      JsonArray array = json.getAsJsonArray("editor");
10969      for (int i = 0; i < array.size(); i++) {
10970        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10971      }
10972    };
10973    if (json.has("reviewer")) {
10974      JsonArray array = json.getAsJsonArray("reviewer");
10975      for (int i = 0; i < array.size(); i++) {
10976        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
10977      }
10978    };
10979    if (json.has("endorser")) {
10980      JsonArray array = json.getAsJsonArray("endorser");
10981      for (int i = 0; i < array.size(); i++) {
10982        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
10983      }
10984    };
10985    if (json.has("relatedArtifact")) {
10986      JsonArray array = json.getAsJsonArray("relatedArtifact");
10987      for (int i = 0; i < array.size(); i++) {
10988        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
10989      }
10990    };
10991    if (json.has("exposureBackground"))
10992      res.setExposureBackground(parseReference(getJObject(json, "exposureBackground")));
10993    if (json.has("exposureVariant")) {
10994      JsonArray array = json.getAsJsonArray("exposureVariant");
10995      for (int i = 0; i < array.size(); i++) {
10996        res.getExposureVariant().add(parseReference(array.get(i).getAsJsonObject()));
10997      }
10998    };
10999    if (json.has("outcome")) {
11000      JsonArray array = json.getAsJsonArray("outcome");
11001      for (int i = 0; i < array.size(); i++) {
11002        res.getOutcome().add(parseReference(array.get(i).getAsJsonObject()));
11003      }
11004    };
11005  }
11006
11007  protected EvidenceVariable parseEvidenceVariable(JsonObject json) throws IOException, FHIRFormatError {
11008    EvidenceVariable res = new EvidenceVariable();
11009    parseEvidenceVariableProperties(json, res);
11010    return res;
11011  }
11012
11013  protected void parseEvidenceVariableProperties(JsonObject json, EvidenceVariable res) throws IOException, FHIRFormatError {
11014    parseDomainResourceProperties(json, res);
11015    if (json.has("url"))
11016      res.setUrlElement(parseUri(json.get("url").getAsString()));
11017    if (json.has("_url"))
11018      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
11019    if (json.has("identifier")) {
11020      JsonArray array = json.getAsJsonArray("identifier");
11021      for (int i = 0; i < array.size(); i++) {
11022        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11023      }
11024    };
11025    if (json.has("version"))
11026      res.setVersionElement(parseString(json.get("version").getAsString()));
11027    if (json.has("_version"))
11028      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
11029    if (json.has("name"))
11030      res.setNameElement(parseString(json.get("name").getAsString()));
11031    if (json.has("_name"))
11032      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11033    if (json.has("title"))
11034      res.setTitleElement(parseString(json.get("title").getAsString()));
11035    if (json.has("_title"))
11036      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
11037    if (json.has("shortTitle"))
11038      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
11039    if (json.has("_shortTitle"))
11040      parseElementProperties(getJObject(json, "_shortTitle"), res.getShortTitleElement());
11041    if (json.has("subtitle"))
11042      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
11043    if (json.has("_subtitle"))
11044      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
11045    if (json.has("status"))
11046      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11047    if (json.has("_status"))
11048      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11049    if (json.has("date"))
11050      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11051    if (json.has("_date"))
11052      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
11053    if (json.has("publisher"))
11054      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11055    if (json.has("_publisher"))
11056      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
11057    if (json.has("contact")) {
11058      JsonArray array = json.getAsJsonArray("contact");
11059      for (int i = 0; i < array.size(); i++) {
11060        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
11061      }
11062    };
11063    if (json.has("description"))
11064      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11065    if (json.has("_description"))
11066      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11067    if (json.has("note")) {
11068      JsonArray array = json.getAsJsonArray("note");
11069      for (int i = 0; i < array.size(); i++) {
11070        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11071      }
11072    };
11073    if (json.has("useContext")) {
11074      JsonArray array = json.getAsJsonArray("useContext");
11075      for (int i = 0; i < array.size(); i++) {
11076        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11077      }
11078    };
11079    if (json.has("jurisdiction")) {
11080      JsonArray array = json.getAsJsonArray("jurisdiction");
11081      for (int i = 0; i < array.size(); i++) {
11082        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11083      }
11084    };
11085    if (json.has("copyright"))
11086      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
11087    if (json.has("_copyright"))
11088      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
11089    if (json.has("approvalDate"))
11090      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
11091    if (json.has("_approvalDate"))
11092      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
11093    if (json.has("lastReviewDate"))
11094      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
11095    if (json.has("_lastReviewDate"))
11096      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
11097    if (json.has("effectivePeriod"))
11098      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
11099    if (json.has("topic")) {
11100      JsonArray array = json.getAsJsonArray("topic");
11101      for (int i = 0; i < array.size(); i++) {
11102        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11103      }
11104    };
11105    if (json.has("author")) {
11106      JsonArray array = json.getAsJsonArray("author");
11107      for (int i = 0; i < array.size(); i++) {
11108        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
11109      }
11110    };
11111    if (json.has("editor")) {
11112      JsonArray array = json.getAsJsonArray("editor");
11113      for (int i = 0; i < array.size(); i++) {
11114        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
11115      }
11116    };
11117    if (json.has("reviewer")) {
11118      JsonArray array = json.getAsJsonArray("reviewer");
11119      for (int i = 0; i < array.size(); i++) {
11120        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
11121      }
11122    };
11123    if (json.has("endorser")) {
11124      JsonArray array = json.getAsJsonArray("endorser");
11125      for (int i = 0; i < array.size(); i++) {
11126        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
11127      }
11128    };
11129    if (json.has("relatedArtifact")) {
11130      JsonArray array = json.getAsJsonArray("relatedArtifact");
11131      for (int i = 0; i < array.size(); i++) {
11132        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
11133      }
11134    };
11135    if (json.has("type"))
11136      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), EvidenceVariable.EvidenceVariableType.NULL, new EvidenceVariable.EvidenceVariableTypeEnumFactory()));
11137    if (json.has("_type"))
11138      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
11139    if (json.has("characteristic")) {
11140      JsonArray array = json.getAsJsonArray("characteristic");
11141      for (int i = 0; i < array.size(); i++) {
11142        res.getCharacteristic().add(parseEvidenceVariableEvidenceVariableCharacteristicComponent(array.get(i).getAsJsonObject(), res));
11143      }
11144    };
11145  }
11146
11147  protected EvidenceVariable.EvidenceVariableCharacteristicComponent parseEvidenceVariableEvidenceVariableCharacteristicComponent(JsonObject json, EvidenceVariable owner) throws IOException, FHIRFormatError {
11148    EvidenceVariable.EvidenceVariableCharacteristicComponent res = new EvidenceVariable.EvidenceVariableCharacteristicComponent();
11149    parseEvidenceVariableEvidenceVariableCharacteristicComponentProperties(json, owner, res);
11150    return res;
11151  }
11152
11153  protected void parseEvidenceVariableEvidenceVariableCharacteristicComponentProperties(JsonObject json, EvidenceVariable owner, EvidenceVariable.EvidenceVariableCharacteristicComponent res) throws IOException, FHIRFormatError {
11154    parseBackboneElementProperties(json, res);
11155    if (json.has("description"))
11156      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11157    if (json.has("_description"))
11158      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11159    Type definition = parseType("definition", json);
11160    if (definition != null)
11161      res.setDefinition(definition);
11162    if (json.has("usageContext")) {
11163      JsonArray array = json.getAsJsonArray("usageContext");
11164      for (int i = 0; i < array.size(); i++) {
11165        res.getUsageContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11166      }
11167    };
11168    if (json.has("exclude"))
11169      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
11170    if (json.has("_exclude"))
11171      parseElementProperties(getJObject(json, "_exclude"), res.getExcludeElement());
11172    Type participantEffective = parseType("participantEffective", json);
11173    if (participantEffective != null)
11174      res.setParticipantEffective(participantEffective);
11175    if (json.has("timeFromStart"))
11176      res.setTimeFromStart(parseDuration(getJObject(json, "timeFromStart")));
11177    if (json.has("groupMeasure"))
11178      res.setGroupMeasureElement(parseEnumeration(json.get("groupMeasure").getAsString(), EvidenceVariable.GroupMeasure.NULL, new EvidenceVariable.GroupMeasureEnumFactory()));
11179    if (json.has("_groupMeasure"))
11180      parseElementProperties(getJObject(json, "_groupMeasure"), res.getGroupMeasureElement());
11181  }
11182
11183  protected ExampleScenario parseExampleScenario(JsonObject json) throws IOException, FHIRFormatError {
11184    ExampleScenario res = new ExampleScenario();
11185    parseExampleScenarioProperties(json, res);
11186    return res;
11187  }
11188
11189  protected void parseExampleScenarioProperties(JsonObject json, ExampleScenario res) throws IOException, FHIRFormatError {
11190    parseDomainResourceProperties(json, res);
11191    if (json.has("url"))
11192      res.setUrlElement(parseUri(json.get("url").getAsString()));
11193    if (json.has("_url"))
11194      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
11195    if (json.has("identifier")) {
11196      JsonArray array = json.getAsJsonArray("identifier");
11197      for (int i = 0; i < array.size(); i++) {
11198        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11199      }
11200    };
11201    if (json.has("version"))
11202      res.setVersionElement(parseString(json.get("version").getAsString()));
11203    if (json.has("_version"))
11204      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
11205    if (json.has("name"))
11206      res.setNameElement(parseString(json.get("name").getAsString()));
11207    if (json.has("_name"))
11208      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11209    if (json.has("status"))
11210      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11211    if (json.has("_status"))
11212      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11213    if (json.has("experimental"))
11214      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
11215    if (json.has("_experimental"))
11216      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
11217    if (json.has("date"))
11218      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11219    if (json.has("_date"))
11220      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
11221    if (json.has("publisher"))
11222      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11223    if (json.has("_publisher"))
11224      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
11225    if (json.has("contact")) {
11226      JsonArray array = json.getAsJsonArray("contact");
11227      for (int i = 0; i < array.size(); i++) {
11228        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
11229      }
11230    };
11231    if (json.has("useContext")) {
11232      JsonArray array = json.getAsJsonArray("useContext");
11233      for (int i = 0; i < array.size(); i++) {
11234        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11235      }
11236    };
11237    if (json.has("jurisdiction")) {
11238      JsonArray array = json.getAsJsonArray("jurisdiction");
11239      for (int i = 0; i < array.size(); i++) {
11240        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11241      }
11242    };
11243    if (json.has("copyright"))
11244      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
11245    if (json.has("_copyright"))
11246      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
11247    if (json.has("purpose"))
11248      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
11249    if (json.has("_purpose"))
11250      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
11251    if (json.has("actor")) {
11252      JsonArray array = json.getAsJsonArray("actor");
11253      for (int i = 0; i < array.size(); i++) {
11254        res.getActor().add(parseExampleScenarioExampleScenarioActorComponent(array.get(i).getAsJsonObject(), res));
11255      }
11256    };
11257    if (json.has("instance")) {
11258      JsonArray array = json.getAsJsonArray("instance");
11259      for (int i = 0; i < array.size(); i++) {
11260        res.getInstance().add(parseExampleScenarioExampleScenarioInstanceComponent(array.get(i).getAsJsonObject(), res));
11261      }
11262    };
11263    if (json.has("process")) {
11264      JsonArray array = json.getAsJsonArray("process");
11265      for (int i = 0; i < array.size(); i++) {
11266        res.getProcess().add(parseExampleScenarioExampleScenarioProcessComponent(array.get(i).getAsJsonObject(), res));
11267      }
11268    };
11269    if (json.has("workflow")) {
11270      JsonArray array = json.getAsJsonArray("workflow");
11271      for (int i = 0; i < array.size(); i++) {
11272        res.getWorkflow().add(parseCanonical(array.get(i).getAsString()));
11273      }
11274    };
11275    if (json.has("_workflow")) {
11276      JsonArray array = json.getAsJsonArray("_workflow");
11277      for (int i = 0; i < array.size(); i++) {
11278        if (i == res.getWorkflow().size())
11279          res.getWorkflow().add(parseCanonical(null));
11280        if (array.get(i) instanceof JsonObject) 
11281          parseElementProperties(array.get(i).getAsJsonObject(), res.getWorkflow().get(i));
11282      }
11283    };
11284  }
11285
11286  protected ExampleScenario.ExampleScenarioActorComponent parseExampleScenarioExampleScenarioActorComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11287    ExampleScenario.ExampleScenarioActorComponent res = new ExampleScenario.ExampleScenarioActorComponent();
11288    parseExampleScenarioExampleScenarioActorComponentProperties(json, owner, res);
11289    return res;
11290  }
11291
11292  protected void parseExampleScenarioExampleScenarioActorComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioActorComponent res) throws IOException, FHIRFormatError {
11293    parseBackboneElementProperties(json, res);
11294    if (json.has("actorId"))
11295      res.setActorIdElement(parseString(json.get("actorId").getAsString()));
11296    if (json.has("_actorId"))
11297      parseElementProperties(getJObject(json, "_actorId"), res.getActorIdElement());
11298    if (json.has("type"))
11299      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ExampleScenario.ExampleScenarioActorType.NULL, new ExampleScenario.ExampleScenarioActorTypeEnumFactory()));
11300    if (json.has("_type"))
11301      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
11302    if (json.has("name"))
11303      res.setNameElement(parseString(json.get("name").getAsString()));
11304    if (json.has("_name"))
11305      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11306    if (json.has("description"))
11307      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11308    if (json.has("_description"))
11309      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11310  }
11311
11312  protected ExampleScenario.ExampleScenarioInstanceComponent parseExampleScenarioExampleScenarioInstanceComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11313    ExampleScenario.ExampleScenarioInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceComponent();
11314    parseExampleScenarioExampleScenarioInstanceComponentProperties(json, owner, res);
11315    return res;
11316  }
11317
11318  protected void parseExampleScenarioExampleScenarioInstanceComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceComponent res) throws IOException, FHIRFormatError {
11319    parseBackboneElementProperties(json, res);
11320    if (json.has("resourceId"))
11321      res.setResourceIdElement(parseString(json.get("resourceId").getAsString()));
11322    if (json.has("_resourceId"))
11323      parseElementProperties(getJObject(json, "_resourceId"), res.getResourceIdElement());
11324    if (json.has("resourceType"))
11325      res.setResourceTypeElement(parseEnumeration(json.get("resourceType").getAsString(), ExampleScenario.FHIRResourceType.NULL, new ExampleScenario.FHIRResourceTypeEnumFactory()));
11326    if (json.has("_resourceType"))
11327      parseElementProperties(getJObject(json, "_resourceType"), res.getResourceTypeElement());
11328    if (json.has("name"))
11329      res.setNameElement(parseString(json.get("name").getAsString()));
11330    if (json.has("_name"))
11331      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11332    if (json.has("description"))
11333      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11334    if (json.has("_description"))
11335      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11336    if (json.has("version")) {
11337      JsonArray array = json.getAsJsonArray("version");
11338      for (int i = 0; i < array.size(); i++) {
11339        res.getVersion().add(parseExampleScenarioExampleScenarioInstanceVersionComponent(array.get(i).getAsJsonObject(), owner));
11340      }
11341    };
11342    if (json.has("containedInstance")) {
11343      JsonArray array = json.getAsJsonArray("containedInstance");
11344      for (int i = 0; i < array.size(); i++) {
11345        res.getContainedInstance().add(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(array.get(i).getAsJsonObject(), owner));
11346      }
11347    };
11348  }
11349
11350  protected ExampleScenario.ExampleScenarioInstanceVersionComponent parseExampleScenarioExampleScenarioInstanceVersionComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11351    ExampleScenario.ExampleScenarioInstanceVersionComponent res = new ExampleScenario.ExampleScenarioInstanceVersionComponent();
11352    parseExampleScenarioExampleScenarioInstanceVersionComponentProperties(json, owner, res);
11353    return res;
11354  }
11355
11356  protected void parseExampleScenarioExampleScenarioInstanceVersionComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceVersionComponent res) throws IOException, FHIRFormatError {
11357    parseBackboneElementProperties(json, res);
11358    if (json.has("versionId"))
11359      res.setVersionIdElement(parseString(json.get("versionId").getAsString()));
11360    if (json.has("_versionId"))
11361      parseElementProperties(getJObject(json, "_versionId"), res.getVersionIdElement());
11362    if (json.has("description"))
11363      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11364    if (json.has("_description"))
11365      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11366  }
11367
11368  protected ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11369    ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent();
11370    parseExampleScenarioExampleScenarioInstanceContainedInstanceComponentProperties(json, owner, res);
11371    return res;
11372  }
11373
11374  protected void parseExampleScenarioExampleScenarioInstanceContainedInstanceComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res) throws IOException, FHIRFormatError {
11375    parseBackboneElementProperties(json, res);
11376    if (json.has("resourceId"))
11377      res.setResourceIdElement(parseString(json.get("resourceId").getAsString()));
11378    if (json.has("_resourceId"))
11379      parseElementProperties(getJObject(json, "_resourceId"), res.getResourceIdElement());
11380    if (json.has("versionId"))
11381      res.setVersionIdElement(parseString(json.get("versionId").getAsString()));
11382    if (json.has("_versionId"))
11383      parseElementProperties(getJObject(json, "_versionId"), res.getVersionIdElement());
11384  }
11385
11386  protected ExampleScenario.ExampleScenarioProcessComponent parseExampleScenarioExampleScenarioProcessComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11387    ExampleScenario.ExampleScenarioProcessComponent res = new ExampleScenario.ExampleScenarioProcessComponent();
11388    parseExampleScenarioExampleScenarioProcessComponentProperties(json, owner, res);
11389    return res;
11390  }
11391
11392  protected void parseExampleScenarioExampleScenarioProcessComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessComponent res) throws IOException, FHIRFormatError {
11393    parseBackboneElementProperties(json, res);
11394    if (json.has("title"))
11395      res.setTitleElement(parseString(json.get("title").getAsString()));
11396    if (json.has("_title"))
11397      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
11398    if (json.has("description"))
11399      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11400    if (json.has("_description"))
11401      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11402    if (json.has("preConditions"))
11403      res.setPreConditionsElement(parseMarkdown(json.get("preConditions").getAsString()));
11404    if (json.has("_preConditions"))
11405      parseElementProperties(getJObject(json, "_preConditions"), res.getPreConditionsElement());
11406    if (json.has("postConditions"))
11407      res.setPostConditionsElement(parseMarkdown(json.get("postConditions").getAsString()));
11408    if (json.has("_postConditions"))
11409      parseElementProperties(getJObject(json, "_postConditions"), res.getPostConditionsElement());
11410    if (json.has("step")) {
11411      JsonArray array = json.getAsJsonArray("step");
11412      for (int i = 0; i < array.size(); i++) {
11413        res.getStep().add(parseExampleScenarioExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject(), owner));
11414      }
11415    };
11416  }
11417
11418  protected ExampleScenario.ExampleScenarioProcessStepComponent parseExampleScenarioExampleScenarioProcessStepComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11419    ExampleScenario.ExampleScenarioProcessStepComponent res = new ExampleScenario.ExampleScenarioProcessStepComponent();
11420    parseExampleScenarioExampleScenarioProcessStepComponentProperties(json, owner, res);
11421    return res;
11422  }
11423
11424  protected void parseExampleScenarioExampleScenarioProcessStepComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepComponent res) throws IOException, FHIRFormatError {
11425    parseBackboneElementProperties(json, res);
11426    if (json.has("process")) {
11427      JsonArray array = json.getAsJsonArray("process");
11428      for (int i = 0; i < array.size(); i++) {
11429        res.getProcess().add(parseExampleScenarioExampleScenarioProcessComponent(array.get(i).getAsJsonObject(), owner));
11430      }
11431    };
11432    if (json.has("pause"))
11433      res.setPauseElement(parseBoolean(json.get("pause").getAsBoolean()));
11434    if (json.has("_pause"))
11435      parseElementProperties(getJObject(json, "_pause"), res.getPauseElement());
11436    if (json.has("operation"))
11437      res.setOperation(parseExampleScenarioExampleScenarioProcessStepOperationComponent(getJObject(json, "operation"), owner));
11438    if (json.has("alternative")) {
11439      JsonArray array = json.getAsJsonArray("alternative");
11440      for (int i = 0; i < array.size(); i++) {
11441        res.getAlternative().add(parseExampleScenarioExampleScenarioProcessStepAlternativeComponent(array.get(i).getAsJsonObject(), owner));
11442      }
11443    };
11444  }
11445
11446  protected ExampleScenario.ExampleScenarioProcessStepOperationComponent parseExampleScenarioExampleScenarioProcessStepOperationComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11447    ExampleScenario.ExampleScenarioProcessStepOperationComponent res = new ExampleScenario.ExampleScenarioProcessStepOperationComponent();
11448    parseExampleScenarioExampleScenarioProcessStepOperationComponentProperties(json, owner, res);
11449    return res;
11450  }
11451
11452  protected void parseExampleScenarioExampleScenarioProcessStepOperationComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepOperationComponent res) throws IOException, FHIRFormatError {
11453    parseBackboneElementProperties(json, res);
11454    if (json.has("number"))
11455      res.setNumberElement(parseString(json.get("number").getAsString()));
11456    if (json.has("_number"))
11457      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
11458    if (json.has("type"))
11459      res.setTypeElement(parseString(json.get("type").getAsString()));
11460    if (json.has("_type"))
11461      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
11462    if (json.has("name"))
11463      res.setNameElement(parseString(json.get("name").getAsString()));
11464    if (json.has("_name"))
11465      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11466    if (json.has("initiator"))
11467      res.setInitiatorElement(parseString(json.get("initiator").getAsString()));
11468    if (json.has("_initiator"))
11469      parseElementProperties(getJObject(json, "_initiator"), res.getInitiatorElement());
11470    if (json.has("receiver"))
11471      res.setReceiverElement(parseString(json.get("receiver").getAsString()));
11472    if (json.has("_receiver"))
11473      parseElementProperties(getJObject(json, "_receiver"), res.getReceiverElement());
11474    if (json.has("description"))
11475      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11476    if (json.has("_description"))
11477      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11478    if (json.has("initiatorActive"))
11479      res.setInitiatorActiveElement(parseBoolean(json.get("initiatorActive").getAsBoolean()));
11480    if (json.has("_initiatorActive"))
11481      parseElementProperties(getJObject(json, "_initiatorActive"), res.getInitiatorActiveElement());
11482    if (json.has("receiverActive"))
11483      res.setReceiverActiveElement(parseBoolean(json.get("receiverActive").getAsBoolean()));
11484    if (json.has("_receiverActive"))
11485      parseElementProperties(getJObject(json, "_receiverActive"), res.getReceiverActiveElement());
11486    if (json.has("request"))
11487      res.setRequest(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(getJObject(json, "request"), owner));
11488    if (json.has("response"))
11489      res.setResponse(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(getJObject(json, "response"), owner));
11490  }
11491
11492  protected ExampleScenario.ExampleScenarioProcessStepAlternativeComponent parseExampleScenarioExampleScenarioProcessStepAlternativeComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11493    ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res = new ExampleScenario.ExampleScenarioProcessStepAlternativeComponent();
11494    parseExampleScenarioExampleScenarioProcessStepAlternativeComponentProperties(json, owner, res);
11495    return res;
11496  }
11497
11498  protected void parseExampleScenarioExampleScenarioProcessStepAlternativeComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res) throws IOException, FHIRFormatError {
11499    parseBackboneElementProperties(json, res);
11500    if (json.has("title"))
11501      res.setTitleElement(parseString(json.get("title").getAsString()));
11502    if (json.has("_title"))
11503      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
11504    if (json.has("description"))
11505      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11506    if (json.has("_description"))
11507      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11508    if (json.has("step")) {
11509      JsonArray array = json.getAsJsonArray("step");
11510      for (int i = 0; i < array.size(); i++) {
11511        res.getStep().add(parseExampleScenarioExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject(), owner));
11512      }
11513    };
11514  }
11515
11516  protected ExplanationOfBenefit parseExplanationOfBenefit(JsonObject json) throws IOException, FHIRFormatError {
11517    ExplanationOfBenefit res = new ExplanationOfBenefit();
11518    parseExplanationOfBenefitProperties(json, res);
11519    return res;
11520  }
11521
11522  protected void parseExplanationOfBenefitProperties(JsonObject json, ExplanationOfBenefit res) throws IOException, FHIRFormatError {
11523    parseDomainResourceProperties(json, res);
11524    if (json.has("identifier")) {
11525      JsonArray array = json.getAsJsonArray("identifier");
11526      for (int i = 0; i < array.size(); i++) {
11527        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11528      }
11529    };
11530    if (json.has("status"))
11531      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ExplanationOfBenefit.ExplanationOfBenefitStatus.NULL, new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory()));
11532    if (json.has("_status"))
11533      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11534    if (json.has("type"))
11535      res.setType(parseCodeableConcept(getJObject(json, "type")));
11536    if (json.has("subType"))
11537      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
11538    if (json.has("use"))
11539      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ExplanationOfBenefit.Use.NULL, new ExplanationOfBenefit.UseEnumFactory()));
11540    if (json.has("_use"))
11541      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
11542    if (json.has("patient"))
11543      res.setPatient(parseReference(getJObject(json, "patient")));
11544    if (json.has("billablePeriod"))
11545      res.setBillablePeriod(parsePeriod(getJObject(json, "billablePeriod")));
11546    if (json.has("created"))
11547      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
11548    if (json.has("_created"))
11549      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
11550    if (json.has("enterer"))
11551      res.setEnterer(parseReference(getJObject(json, "enterer")));
11552    if (json.has("insurer"))
11553      res.setInsurer(parseReference(getJObject(json, "insurer")));
11554    if (json.has("provider"))
11555      res.setProvider(parseReference(getJObject(json, "provider")));
11556    if (json.has("priority"))
11557      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
11558    if (json.has("fundsReserveRequested"))
11559      res.setFundsReserveRequested(parseCodeableConcept(getJObject(json, "fundsReserveRequested")));
11560    if (json.has("fundsReserve"))
11561      res.setFundsReserve(parseCodeableConcept(getJObject(json, "fundsReserve")));
11562    if (json.has("related")) {
11563      JsonArray array = json.getAsJsonArray("related");
11564      for (int i = 0; i < array.size(); i++) {
11565        res.getRelated().add(parseExplanationOfBenefitRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
11566      }
11567    };
11568    if (json.has("prescription"))
11569      res.setPrescription(parseReference(getJObject(json, "prescription")));
11570    if (json.has("originalPrescription"))
11571      res.setOriginalPrescription(parseReference(getJObject(json, "originalPrescription")));
11572    if (json.has("payee"))
11573      res.setPayee(parseExplanationOfBenefitPayeeComponent(getJObject(json, "payee"), res));
11574    if (json.has("referral"))
11575      res.setReferral(parseReference(getJObject(json, "referral")));
11576    if (json.has("facility"))
11577      res.setFacility(parseReference(getJObject(json, "facility")));
11578    if (json.has("claim"))
11579      res.setClaim(parseReference(getJObject(json, "claim")));
11580    if (json.has("claimResponse"))
11581      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
11582    if (json.has("outcome"))
11583      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), ExplanationOfBenefit.RemittanceOutcome.NULL, new ExplanationOfBenefit.RemittanceOutcomeEnumFactory()));
11584    if (json.has("_outcome"))
11585      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
11586    if (json.has("disposition"))
11587      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
11588    if (json.has("_disposition"))
11589      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
11590    if (json.has("preAuthRef")) {
11591      JsonArray array = json.getAsJsonArray("preAuthRef");
11592      for (int i = 0; i < array.size(); i++) {
11593        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
11594      }
11595    };
11596    if (json.has("_preAuthRef")) {
11597      JsonArray array = json.getAsJsonArray("_preAuthRef");
11598      for (int i = 0; i < array.size(); i++) {
11599        if (i == res.getPreAuthRef().size())
11600          res.getPreAuthRef().add(parseString(null));
11601        if (array.get(i) instanceof JsonObject) 
11602          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
11603      }
11604    };
11605    if (json.has("preAuthRefPeriod")) {
11606      JsonArray array = json.getAsJsonArray("preAuthRefPeriod");
11607      for (int i = 0; i < array.size(); i++) {
11608        res.getPreAuthRefPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
11609      }
11610    };
11611    if (json.has("careTeam")) {
11612      JsonArray array = json.getAsJsonArray("careTeam");
11613      for (int i = 0; i < array.size(); i++) {
11614        res.getCareTeam().add(parseExplanationOfBenefitCareTeamComponent(array.get(i).getAsJsonObject(), res));
11615      }
11616    };
11617    if (json.has("supportingInfo")) {
11618      JsonArray array = json.getAsJsonArray("supportingInfo");
11619      for (int i = 0; i < array.size(); i++) {
11620        res.getSupportingInfo().add(parseExplanationOfBenefitSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
11621      }
11622    };
11623    if (json.has("diagnosis")) {
11624      JsonArray array = json.getAsJsonArray("diagnosis");
11625      for (int i = 0; i < array.size(); i++) {
11626        res.getDiagnosis().add(parseExplanationOfBenefitDiagnosisComponent(array.get(i).getAsJsonObject(), res));
11627      }
11628    };
11629    if (json.has("procedure")) {
11630      JsonArray array = json.getAsJsonArray("procedure");
11631      for (int i = 0; i < array.size(); i++) {
11632        res.getProcedure().add(parseExplanationOfBenefitProcedureComponent(array.get(i).getAsJsonObject(), res));
11633      }
11634    };
11635    if (json.has("precedence"))
11636      res.setPrecedenceElement(parsePositiveInt(json.get("precedence").getAsString()));
11637    if (json.has("_precedence"))
11638      parseElementProperties(getJObject(json, "_precedence"), res.getPrecedenceElement());
11639    if (json.has("insurance")) {
11640      JsonArray array = json.getAsJsonArray("insurance");
11641      for (int i = 0; i < array.size(); i++) {
11642        res.getInsurance().add(parseExplanationOfBenefitInsuranceComponent(array.get(i).getAsJsonObject(), res));
11643      }
11644    };
11645    if (json.has("accident"))
11646      res.setAccident(parseExplanationOfBenefitAccidentComponent(getJObject(json, "accident"), res));
11647    if (json.has("item")) {
11648      JsonArray array = json.getAsJsonArray("item");
11649      for (int i = 0; i < array.size(); i++) {
11650        res.getItem().add(parseExplanationOfBenefitItemComponent(array.get(i).getAsJsonObject(), res));
11651      }
11652    };
11653    if (json.has("addItem")) {
11654      JsonArray array = json.getAsJsonArray("addItem");
11655      for (int i = 0; i < array.size(); i++) {
11656        res.getAddItem().add(parseExplanationOfBenefitAddedItemComponent(array.get(i).getAsJsonObject(), res));
11657      }
11658    };
11659    if (json.has("adjudication")) {
11660      JsonArray array = json.getAsJsonArray("adjudication");
11661      for (int i = 0; i < array.size(); i++) {
11662        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), res));
11663      }
11664    };
11665    if (json.has("total")) {
11666      JsonArray array = json.getAsJsonArray("total");
11667      for (int i = 0; i < array.size(); i++) {
11668        res.getTotal().add(parseExplanationOfBenefitTotalComponent(array.get(i).getAsJsonObject(), res));
11669      }
11670    };
11671    if (json.has("payment"))
11672      res.setPayment(parseExplanationOfBenefitPaymentComponent(getJObject(json, "payment"), res));
11673    if (json.has("formCode"))
11674      res.setFormCode(parseCodeableConcept(getJObject(json, "formCode")));
11675    if (json.has("form"))
11676      res.setForm(parseAttachment(getJObject(json, "form")));
11677    if (json.has("processNote")) {
11678      JsonArray array = json.getAsJsonArray("processNote");
11679      for (int i = 0; i < array.size(); i++) {
11680        res.getProcessNote().add(parseExplanationOfBenefitNoteComponent(array.get(i).getAsJsonObject(), res));
11681      }
11682    };
11683    if (json.has("benefitPeriod"))
11684      res.setBenefitPeriod(parsePeriod(getJObject(json, "benefitPeriod")));
11685    if (json.has("benefitBalance")) {
11686      JsonArray array = json.getAsJsonArray("benefitBalance");
11687      for (int i = 0; i < array.size(); i++) {
11688        res.getBenefitBalance().add(parseExplanationOfBenefitBenefitBalanceComponent(array.get(i).getAsJsonObject(), res));
11689      }
11690    };
11691  }
11692
11693  protected ExplanationOfBenefit.RelatedClaimComponent parseExplanationOfBenefitRelatedClaimComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11694    ExplanationOfBenefit.RelatedClaimComponent res = new ExplanationOfBenefit.RelatedClaimComponent();
11695    parseExplanationOfBenefitRelatedClaimComponentProperties(json, owner, res);
11696    return res;
11697  }
11698
11699  protected void parseExplanationOfBenefitRelatedClaimComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.RelatedClaimComponent res) throws IOException, FHIRFormatError {
11700    parseBackboneElementProperties(json, res);
11701    if (json.has("claim"))
11702      res.setClaim(parseReference(getJObject(json, "claim")));
11703    if (json.has("relationship"))
11704      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
11705    if (json.has("reference"))
11706      res.setReference(parseIdentifier(getJObject(json, "reference")));
11707  }
11708
11709  protected ExplanationOfBenefit.PayeeComponent parseExplanationOfBenefitPayeeComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11710    ExplanationOfBenefit.PayeeComponent res = new ExplanationOfBenefit.PayeeComponent();
11711    parseExplanationOfBenefitPayeeComponentProperties(json, owner, res);
11712    return res;
11713  }
11714
11715  protected void parseExplanationOfBenefitPayeeComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.PayeeComponent res) throws IOException, FHIRFormatError {
11716    parseBackboneElementProperties(json, res);
11717    if (json.has("type"))
11718      res.setType(parseCodeableConcept(getJObject(json, "type")));
11719    if (json.has("party"))
11720      res.setParty(parseReference(getJObject(json, "party")));
11721  }
11722
11723  protected ExplanationOfBenefit.CareTeamComponent parseExplanationOfBenefitCareTeamComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11724    ExplanationOfBenefit.CareTeamComponent res = new ExplanationOfBenefit.CareTeamComponent();
11725    parseExplanationOfBenefitCareTeamComponentProperties(json, owner, res);
11726    return res;
11727  }
11728
11729  protected void parseExplanationOfBenefitCareTeamComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.CareTeamComponent res) throws IOException, FHIRFormatError {
11730    parseBackboneElementProperties(json, res);
11731    if (json.has("sequence"))
11732      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11733    if (json.has("_sequence"))
11734      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
11735    if (json.has("provider"))
11736      res.setProvider(parseReference(getJObject(json, "provider")));
11737    if (json.has("responsible"))
11738      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
11739    if (json.has("_responsible"))
11740      parseElementProperties(getJObject(json, "_responsible"), res.getResponsibleElement());
11741    if (json.has("role"))
11742      res.setRole(parseCodeableConcept(getJObject(json, "role")));
11743    if (json.has("qualification"))
11744      res.setQualification(parseCodeableConcept(getJObject(json, "qualification")));
11745  }
11746
11747  protected ExplanationOfBenefit.SupportingInformationComponent parseExplanationOfBenefitSupportingInformationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11748    ExplanationOfBenefit.SupportingInformationComponent res = new ExplanationOfBenefit.SupportingInformationComponent();
11749    parseExplanationOfBenefitSupportingInformationComponentProperties(json, owner, res);
11750    return res;
11751  }
11752
11753  protected void parseExplanationOfBenefitSupportingInformationComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.SupportingInformationComponent res) throws IOException, FHIRFormatError {
11754    parseBackboneElementProperties(json, res);
11755    if (json.has("sequence"))
11756      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11757    if (json.has("_sequence"))
11758      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
11759    if (json.has("category"))
11760      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
11761    if (json.has("code"))
11762      res.setCode(parseCodeableConcept(getJObject(json, "code")));
11763    Type timing = parseType("timing", json);
11764    if (timing != null)
11765      res.setTiming(timing);
11766    Type value = parseType("value", json);
11767    if (value != null)
11768      res.setValue(value);
11769    if (json.has("reason"))
11770      res.setReason(parseCoding(getJObject(json, "reason")));
11771  }
11772
11773  protected ExplanationOfBenefit.DiagnosisComponent parseExplanationOfBenefitDiagnosisComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11774    ExplanationOfBenefit.DiagnosisComponent res = new ExplanationOfBenefit.DiagnosisComponent();
11775    parseExplanationOfBenefitDiagnosisComponentProperties(json, owner, res);
11776    return res;
11777  }
11778
11779  protected void parseExplanationOfBenefitDiagnosisComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.DiagnosisComponent res) throws IOException, FHIRFormatError {
11780    parseBackboneElementProperties(json, res);
11781    if (json.has("sequence"))
11782      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11783    if (json.has("_sequence"))
11784      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
11785    Type diagnosis = parseType("diagnosis", json);
11786    if (diagnosis != null)
11787      res.setDiagnosis(diagnosis);
11788    if (json.has("type")) {
11789      JsonArray array = json.getAsJsonArray("type");
11790      for (int i = 0; i < array.size(); i++) {
11791        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11792      }
11793    };
11794    if (json.has("onAdmission"))
11795      res.setOnAdmission(parseCodeableConcept(getJObject(json, "onAdmission")));
11796    if (json.has("packageCode"))
11797      res.setPackageCode(parseCodeableConcept(getJObject(json, "packageCode")));
11798  }
11799
11800  protected ExplanationOfBenefit.ProcedureComponent parseExplanationOfBenefitProcedureComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11801    ExplanationOfBenefit.ProcedureComponent res = new ExplanationOfBenefit.ProcedureComponent();
11802    parseExplanationOfBenefitProcedureComponentProperties(json, owner, res);
11803    return res;
11804  }
11805
11806  protected void parseExplanationOfBenefitProcedureComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.ProcedureComponent res) throws IOException, FHIRFormatError {
11807    parseBackboneElementProperties(json, res);
11808    if (json.has("sequence"))
11809      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11810    if (json.has("_sequence"))
11811      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
11812    if (json.has("type")) {
11813      JsonArray array = json.getAsJsonArray("type");
11814      for (int i = 0; i < array.size(); i++) {
11815        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11816      }
11817    };
11818    if (json.has("date"))
11819      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11820    if (json.has("_date"))
11821      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
11822    Type procedure = parseType("procedure", json);
11823    if (procedure != null)
11824      res.setProcedure(procedure);
11825    if (json.has("udi")) {
11826      JsonArray array = json.getAsJsonArray("udi");
11827      for (int i = 0; i < array.size(); i++) {
11828        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
11829      }
11830    };
11831  }
11832
11833  protected ExplanationOfBenefit.InsuranceComponent parseExplanationOfBenefitInsuranceComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11834    ExplanationOfBenefit.InsuranceComponent res = new ExplanationOfBenefit.InsuranceComponent();
11835    parseExplanationOfBenefitInsuranceComponentProperties(json, owner, res);
11836    return res;
11837  }
11838
11839  protected void parseExplanationOfBenefitInsuranceComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.InsuranceComponent res) throws IOException, FHIRFormatError {
11840    parseBackboneElementProperties(json, res);
11841    if (json.has("focal"))
11842      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
11843    if (json.has("_focal"))
11844      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
11845    if (json.has("coverage"))
11846      res.setCoverage(parseReference(getJObject(json, "coverage")));
11847    if (json.has("preAuthRef")) {
11848      JsonArray array = json.getAsJsonArray("preAuthRef");
11849      for (int i = 0; i < array.size(); i++) {
11850        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
11851      }
11852    };
11853    if (json.has("_preAuthRef")) {
11854      JsonArray array = json.getAsJsonArray("_preAuthRef");
11855      for (int i = 0; i < array.size(); i++) {
11856        if (i == res.getPreAuthRef().size())
11857          res.getPreAuthRef().add(parseString(null));
11858        if (array.get(i) instanceof JsonObject) 
11859          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
11860      }
11861    };
11862  }
11863
11864  protected ExplanationOfBenefit.AccidentComponent parseExplanationOfBenefitAccidentComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11865    ExplanationOfBenefit.AccidentComponent res = new ExplanationOfBenefit.AccidentComponent();
11866    parseExplanationOfBenefitAccidentComponentProperties(json, owner, res);
11867    return res;
11868  }
11869
11870  protected void parseExplanationOfBenefitAccidentComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AccidentComponent res) throws IOException, FHIRFormatError {
11871    parseBackboneElementProperties(json, res);
11872    if (json.has("date"))
11873      res.setDateElement(parseDate(json.get("date").getAsString()));
11874    if (json.has("_date"))
11875      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
11876    if (json.has("type"))
11877      res.setType(parseCodeableConcept(getJObject(json, "type")));
11878    Type location = parseType("location", json);
11879    if (location != null)
11880      res.setLocation(location);
11881  }
11882
11883  protected ExplanationOfBenefit.ItemComponent parseExplanationOfBenefitItemComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11884    ExplanationOfBenefit.ItemComponent res = new ExplanationOfBenefit.ItemComponent();
11885    parseExplanationOfBenefitItemComponentProperties(json, owner, res);
11886    return res;
11887  }
11888
11889  protected void parseExplanationOfBenefitItemComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.ItemComponent res) throws IOException, FHIRFormatError {
11890    parseBackboneElementProperties(json, res);
11891    if (json.has("sequence"))
11892      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11893    if (json.has("_sequence"))
11894      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
11895    if (json.has("careTeamSequence")) {
11896      JsonArray array = json.getAsJsonArray("careTeamSequence");
11897      for (int i = 0; i < array.size(); i++) {
11898        res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
11899      }
11900    };
11901    if (json.has("_careTeamSequence")) {
11902      JsonArray array = json.getAsJsonArray("_careTeamSequence");
11903      for (int i = 0; i < array.size(); i++) {
11904        if (i == res.getCareTeamSequence().size())
11905          res.getCareTeamSequence().add(parsePositiveInt(null));
11906        if (array.get(i) instanceof JsonObject) 
11907          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
11908      }
11909    };
11910    if (json.has("diagnosisSequence")) {
11911      JsonArray array = json.getAsJsonArray("diagnosisSequence");
11912      for (int i = 0; i < array.size(); i++) {
11913        res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
11914      }
11915    };
11916    if (json.has("_diagnosisSequence")) {
11917      JsonArray array = json.getAsJsonArray("_diagnosisSequence");
11918      for (int i = 0; i < array.size(); i++) {
11919        if (i == res.getDiagnosisSequence().size())
11920          res.getDiagnosisSequence().add(parsePositiveInt(null));
11921        if (array.get(i) instanceof JsonObject) 
11922          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
11923      }
11924    };
11925    if (json.has("procedureSequence")) {
11926      JsonArray array = json.getAsJsonArray("procedureSequence");
11927      for (int i = 0; i < array.size(); i++) {
11928        res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
11929      }
11930    };
11931    if (json.has("_procedureSequence")) {
11932      JsonArray array = json.getAsJsonArray("_procedureSequence");
11933      for (int i = 0; i < array.size(); i++) {
11934        if (i == res.getProcedureSequence().size())
11935          res.getProcedureSequence().add(parsePositiveInt(null));
11936        if (array.get(i) instanceof JsonObject) 
11937          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
11938      }
11939    };
11940    if (json.has("informationSequence")) {
11941      JsonArray array = json.getAsJsonArray("informationSequence");
11942      for (int i = 0; i < array.size(); i++) {
11943        res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
11944      }
11945    };
11946    if (json.has("_informationSequence")) {
11947      JsonArray array = json.getAsJsonArray("_informationSequence");
11948      for (int i = 0; i < array.size(); i++) {
11949        if (i == res.getInformationSequence().size())
11950          res.getInformationSequence().add(parsePositiveInt(null));
11951        if (array.get(i) instanceof JsonObject) 
11952          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
11953      }
11954    };
11955    if (json.has("revenue"))
11956      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
11957    if (json.has("category"))
11958      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
11959    if (json.has("productOrService"))
11960      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
11961    if (json.has("modifier")) {
11962      JsonArray array = json.getAsJsonArray("modifier");
11963      for (int i = 0; i < array.size(); i++) {
11964        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11965      }
11966    };
11967    if (json.has("programCode")) {
11968      JsonArray array = json.getAsJsonArray("programCode");
11969      for (int i = 0; i < array.size(); i++) {
11970        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11971      }
11972    };
11973    Type serviced = parseType("serviced", json);
11974    if (serviced != null)
11975      res.setServiced(serviced);
11976    Type location = parseType("location", json);
11977    if (location != null)
11978      res.setLocation(location);
11979    if (json.has("quantity"))
11980      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
11981    if (json.has("unitPrice"))
11982      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
11983    if (json.has("factor"))
11984      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
11985    if (json.has("_factor"))
11986      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
11987    if (json.has("net"))
11988      res.setNet(parseMoney(getJObject(json, "net")));
11989    if (json.has("udi")) {
11990      JsonArray array = json.getAsJsonArray("udi");
11991      for (int i = 0; i < array.size(); i++) {
11992        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
11993      }
11994    };
11995    if (json.has("bodySite"))
11996      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
11997    if (json.has("subSite")) {
11998      JsonArray array = json.getAsJsonArray("subSite");
11999      for (int i = 0; i < array.size(); i++) {
12000        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12001      }
12002    };
12003    if (json.has("encounter")) {
12004      JsonArray array = json.getAsJsonArray("encounter");
12005      for (int i = 0; i < array.size(); i++) {
12006        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
12007      }
12008    };
12009    if (json.has("noteNumber")) {
12010      JsonArray array = json.getAsJsonArray("noteNumber");
12011      for (int i = 0; i < array.size(); i++) {
12012        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12013      }
12014    };
12015    if (json.has("_noteNumber")) {
12016      JsonArray array = json.getAsJsonArray("_noteNumber");
12017      for (int i = 0; i < array.size(); i++) {
12018        if (i == res.getNoteNumber().size())
12019          res.getNoteNumber().add(parsePositiveInt(null));
12020        if (array.get(i) instanceof JsonObject) 
12021          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12022      }
12023    };
12024    if (json.has("adjudication")) {
12025      JsonArray array = json.getAsJsonArray("adjudication");
12026      for (int i = 0; i < array.size(); i++) {
12027        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12028      }
12029    };
12030    if (json.has("detail")) {
12031      JsonArray array = json.getAsJsonArray("detail");
12032      for (int i = 0; i < array.size(); i++) {
12033        res.getDetail().add(parseExplanationOfBenefitDetailComponent(array.get(i).getAsJsonObject(), owner));
12034      }
12035    };
12036  }
12037
12038  protected ExplanationOfBenefit.AdjudicationComponent parseExplanationOfBenefitAdjudicationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12039    ExplanationOfBenefit.AdjudicationComponent res = new ExplanationOfBenefit.AdjudicationComponent();
12040    parseExplanationOfBenefitAdjudicationComponentProperties(json, owner, res);
12041    return res;
12042  }
12043
12044  protected void parseExplanationOfBenefitAdjudicationComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AdjudicationComponent res) throws IOException, FHIRFormatError {
12045    parseBackboneElementProperties(json, res);
12046    if (json.has("category"))
12047      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
12048    if (json.has("reason"))
12049      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
12050    if (json.has("amount"))
12051      res.setAmount(parseMoney(getJObject(json, "amount")));
12052    if (json.has("value"))
12053      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
12054    if (json.has("_value"))
12055      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
12056  }
12057
12058  protected ExplanationOfBenefit.DetailComponent parseExplanationOfBenefitDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12059    ExplanationOfBenefit.DetailComponent res = new ExplanationOfBenefit.DetailComponent();
12060    parseExplanationOfBenefitDetailComponentProperties(json, owner, res);
12061    return res;
12062  }
12063
12064  protected void parseExplanationOfBenefitDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.DetailComponent res) throws IOException, FHIRFormatError {
12065    parseBackboneElementProperties(json, res);
12066    if (json.has("sequence"))
12067      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
12068    if (json.has("_sequence"))
12069      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
12070    if (json.has("revenue"))
12071      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
12072    if (json.has("category"))
12073      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
12074    if (json.has("productOrService"))
12075      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
12076    if (json.has("modifier")) {
12077      JsonArray array = json.getAsJsonArray("modifier");
12078      for (int i = 0; i < array.size(); i++) {
12079        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12080      }
12081    };
12082    if (json.has("programCode")) {
12083      JsonArray array = json.getAsJsonArray("programCode");
12084      for (int i = 0; i < array.size(); i++) {
12085        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12086      }
12087    };
12088    if (json.has("quantity"))
12089      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
12090    if (json.has("unitPrice"))
12091      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
12092    if (json.has("factor"))
12093      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12094    if (json.has("_factor"))
12095      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
12096    if (json.has("net"))
12097      res.setNet(parseMoney(getJObject(json, "net")));
12098    if (json.has("udi")) {
12099      JsonArray array = json.getAsJsonArray("udi");
12100      for (int i = 0; i < array.size(); i++) {
12101        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
12102      }
12103    };
12104    if (json.has("noteNumber")) {
12105      JsonArray array = json.getAsJsonArray("noteNumber");
12106      for (int i = 0; i < array.size(); i++) {
12107        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12108      }
12109    };
12110    if (json.has("_noteNumber")) {
12111      JsonArray array = json.getAsJsonArray("_noteNumber");
12112      for (int i = 0; i < array.size(); i++) {
12113        if (i == res.getNoteNumber().size())
12114          res.getNoteNumber().add(parsePositiveInt(null));
12115        if (array.get(i) instanceof JsonObject) 
12116          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12117      }
12118    };
12119    if (json.has("adjudication")) {
12120      JsonArray array = json.getAsJsonArray("adjudication");
12121      for (int i = 0; i < array.size(); i++) {
12122        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12123      }
12124    };
12125    if (json.has("subDetail")) {
12126      JsonArray array = json.getAsJsonArray("subDetail");
12127      for (int i = 0; i < array.size(); i++) {
12128        res.getSubDetail().add(parseExplanationOfBenefitSubDetailComponent(array.get(i).getAsJsonObject(), owner));
12129      }
12130    };
12131  }
12132
12133  protected ExplanationOfBenefit.SubDetailComponent parseExplanationOfBenefitSubDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12134    ExplanationOfBenefit.SubDetailComponent res = new ExplanationOfBenefit.SubDetailComponent();
12135    parseExplanationOfBenefitSubDetailComponentProperties(json, owner, res);
12136    return res;
12137  }
12138
12139  protected void parseExplanationOfBenefitSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.SubDetailComponent res) throws IOException, FHIRFormatError {
12140    parseBackboneElementProperties(json, res);
12141    if (json.has("sequence"))
12142      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
12143    if (json.has("_sequence"))
12144      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
12145    if (json.has("revenue"))
12146      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
12147    if (json.has("category"))
12148      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
12149    if (json.has("productOrService"))
12150      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
12151    if (json.has("modifier")) {
12152      JsonArray array = json.getAsJsonArray("modifier");
12153      for (int i = 0; i < array.size(); i++) {
12154        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12155      }
12156    };
12157    if (json.has("programCode")) {
12158      JsonArray array = json.getAsJsonArray("programCode");
12159      for (int i = 0; i < array.size(); i++) {
12160        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12161      }
12162    };
12163    if (json.has("quantity"))
12164      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
12165    if (json.has("unitPrice"))
12166      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
12167    if (json.has("factor"))
12168      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12169    if (json.has("_factor"))
12170      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
12171    if (json.has("net"))
12172      res.setNet(parseMoney(getJObject(json, "net")));
12173    if (json.has("udi")) {
12174      JsonArray array = json.getAsJsonArray("udi");
12175      for (int i = 0; i < array.size(); i++) {
12176        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
12177      }
12178    };
12179    if (json.has("noteNumber")) {
12180      JsonArray array = json.getAsJsonArray("noteNumber");
12181      for (int i = 0; i < array.size(); i++) {
12182        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12183      }
12184    };
12185    if (json.has("_noteNumber")) {
12186      JsonArray array = json.getAsJsonArray("_noteNumber");
12187      for (int i = 0; i < array.size(); i++) {
12188        if (i == res.getNoteNumber().size())
12189          res.getNoteNumber().add(parsePositiveInt(null));
12190        if (array.get(i) instanceof JsonObject) 
12191          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12192      }
12193    };
12194    if (json.has("adjudication")) {
12195      JsonArray array = json.getAsJsonArray("adjudication");
12196      for (int i = 0; i < array.size(); i++) {
12197        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12198      }
12199    };
12200  }
12201
12202  protected ExplanationOfBenefit.AddedItemComponent parseExplanationOfBenefitAddedItemComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12203    ExplanationOfBenefit.AddedItemComponent res = new ExplanationOfBenefit.AddedItemComponent();
12204    parseExplanationOfBenefitAddedItemComponentProperties(json, owner, res);
12205    return res;
12206  }
12207
12208  protected void parseExplanationOfBenefitAddedItemComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemComponent res) throws IOException, FHIRFormatError {
12209    parseBackboneElementProperties(json, res);
12210    if (json.has("itemSequence")) {
12211      JsonArray array = json.getAsJsonArray("itemSequence");
12212      for (int i = 0; i < array.size(); i++) {
12213        res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
12214      }
12215    };
12216    if (json.has("_itemSequence")) {
12217      JsonArray array = json.getAsJsonArray("_itemSequence");
12218      for (int i = 0; i < array.size(); i++) {
12219        if (i == res.getItemSequence().size())
12220          res.getItemSequence().add(parsePositiveInt(null));
12221        if (array.get(i) instanceof JsonObject) 
12222          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
12223      }
12224    };
12225    if (json.has("detailSequence")) {
12226      JsonArray array = json.getAsJsonArray("detailSequence");
12227      for (int i = 0; i < array.size(); i++) {
12228        res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
12229      }
12230    };
12231    if (json.has("_detailSequence")) {
12232      JsonArray array = json.getAsJsonArray("_detailSequence");
12233      for (int i = 0; i < array.size(); i++) {
12234        if (i == res.getDetailSequence().size())
12235          res.getDetailSequence().add(parsePositiveInt(null));
12236        if (array.get(i) instanceof JsonObject) 
12237          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
12238      }
12239    };
12240    if (json.has("subDetailSequence")) {
12241      JsonArray array = json.getAsJsonArray("subDetailSequence");
12242      for (int i = 0; i < array.size(); i++) {
12243        res.getSubDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
12244      }
12245    };
12246    if (json.has("_subDetailSequence")) {
12247      JsonArray array = json.getAsJsonArray("_subDetailSequence");
12248      for (int i = 0; i < array.size(); i++) {
12249        if (i == res.getSubDetailSequence().size())
12250          res.getSubDetailSequence().add(parsePositiveInt(null));
12251        if (array.get(i) instanceof JsonObject) 
12252          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubDetailSequence().get(i));
12253      }
12254    };
12255    if (json.has("provider")) {
12256      JsonArray array = json.getAsJsonArray("provider");
12257      for (int i = 0; i < array.size(); i++) {
12258        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
12259      }
12260    };
12261    if (json.has("productOrService"))
12262      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
12263    if (json.has("modifier")) {
12264      JsonArray array = json.getAsJsonArray("modifier");
12265      for (int i = 0; i < array.size(); i++) {
12266        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12267      }
12268    };
12269    if (json.has("programCode")) {
12270      JsonArray array = json.getAsJsonArray("programCode");
12271      for (int i = 0; i < array.size(); i++) {
12272        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12273      }
12274    };
12275    Type serviced = parseType("serviced", json);
12276    if (serviced != null)
12277      res.setServiced(serviced);
12278    Type location = parseType("location", json);
12279    if (location != null)
12280      res.setLocation(location);
12281    if (json.has("quantity"))
12282      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
12283    if (json.has("unitPrice"))
12284      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
12285    if (json.has("factor"))
12286      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12287    if (json.has("_factor"))
12288      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
12289    if (json.has("net"))
12290      res.setNet(parseMoney(getJObject(json, "net")));
12291    if (json.has("bodySite"))
12292      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
12293    if (json.has("subSite")) {
12294      JsonArray array = json.getAsJsonArray("subSite");
12295      for (int i = 0; i < array.size(); i++) {
12296        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12297      }
12298    };
12299    if (json.has("noteNumber")) {
12300      JsonArray array = json.getAsJsonArray("noteNumber");
12301      for (int i = 0; i < array.size(); i++) {
12302        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12303      }
12304    };
12305    if (json.has("_noteNumber")) {
12306      JsonArray array = json.getAsJsonArray("_noteNumber");
12307      for (int i = 0; i < array.size(); i++) {
12308        if (i == res.getNoteNumber().size())
12309          res.getNoteNumber().add(parsePositiveInt(null));
12310        if (array.get(i) instanceof JsonObject) 
12311          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12312      }
12313    };
12314    if (json.has("adjudication")) {
12315      JsonArray array = json.getAsJsonArray("adjudication");
12316      for (int i = 0; i < array.size(); i++) {
12317        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12318      }
12319    };
12320    if (json.has("detail")) {
12321      JsonArray array = json.getAsJsonArray("detail");
12322      for (int i = 0; i < array.size(); i++) {
12323        res.getDetail().add(parseExplanationOfBenefitAddedItemDetailComponent(array.get(i).getAsJsonObject(), owner));
12324      }
12325    };
12326  }
12327
12328  protected ExplanationOfBenefit.AddedItemDetailComponent parseExplanationOfBenefitAddedItemDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12329    ExplanationOfBenefit.AddedItemDetailComponent res = new ExplanationOfBenefit.AddedItemDetailComponent();
12330    parseExplanationOfBenefitAddedItemDetailComponentProperties(json, owner, res);
12331    return res;
12332  }
12333
12334  protected void parseExplanationOfBenefitAddedItemDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemDetailComponent res) throws IOException, FHIRFormatError {
12335    parseBackboneElementProperties(json, res);
12336    if (json.has("productOrService"))
12337      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
12338    if (json.has("modifier")) {
12339      JsonArray array = json.getAsJsonArray("modifier");
12340      for (int i = 0; i < array.size(); i++) {
12341        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12342      }
12343    };
12344    if (json.has("quantity"))
12345      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
12346    if (json.has("unitPrice"))
12347      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
12348    if (json.has("factor"))
12349      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12350    if (json.has("_factor"))
12351      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
12352    if (json.has("net"))
12353      res.setNet(parseMoney(getJObject(json, "net")));
12354    if (json.has("noteNumber")) {
12355      JsonArray array = json.getAsJsonArray("noteNumber");
12356      for (int i = 0; i < array.size(); i++) {
12357        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12358      }
12359    };
12360    if (json.has("_noteNumber")) {
12361      JsonArray array = json.getAsJsonArray("_noteNumber");
12362      for (int i = 0; i < array.size(); i++) {
12363        if (i == res.getNoteNumber().size())
12364          res.getNoteNumber().add(parsePositiveInt(null));
12365        if (array.get(i) instanceof JsonObject) 
12366          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12367      }
12368    };
12369    if (json.has("adjudication")) {
12370      JsonArray array = json.getAsJsonArray("adjudication");
12371      for (int i = 0; i < array.size(); i++) {
12372        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12373      }
12374    };
12375    if (json.has("subDetail")) {
12376      JsonArray array = json.getAsJsonArray("subDetail");
12377      for (int i = 0; i < array.size(); i++) {
12378        res.getSubDetail().add(parseExplanationOfBenefitAddedItemDetailSubDetailComponent(array.get(i).getAsJsonObject(), owner));
12379      }
12380    };
12381  }
12382
12383  protected ExplanationOfBenefit.AddedItemDetailSubDetailComponent parseExplanationOfBenefitAddedItemDetailSubDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12384    ExplanationOfBenefit.AddedItemDetailSubDetailComponent res = new ExplanationOfBenefit.AddedItemDetailSubDetailComponent();
12385    parseExplanationOfBenefitAddedItemDetailSubDetailComponentProperties(json, owner, res);
12386    return res;
12387  }
12388
12389  protected void parseExplanationOfBenefitAddedItemDetailSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemDetailSubDetailComponent res) throws IOException, FHIRFormatError {
12390    parseBackboneElementProperties(json, res);
12391    if (json.has("productOrService"))
12392      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
12393    if (json.has("modifier")) {
12394      JsonArray array = json.getAsJsonArray("modifier");
12395      for (int i = 0; i < array.size(); i++) {
12396        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12397      }
12398    };
12399    if (json.has("quantity"))
12400      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
12401    if (json.has("unitPrice"))
12402      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
12403    if (json.has("factor"))
12404      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12405    if (json.has("_factor"))
12406      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
12407    if (json.has("net"))
12408      res.setNet(parseMoney(getJObject(json, "net")));
12409    if (json.has("noteNumber")) {
12410      JsonArray array = json.getAsJsonArray("noteNumber");
12411      for (int i = 0; i < array.size(); i++) {
12412        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12413      }
12414    };
12415    if (json.has("_noteNumber")) {
12416      JsonArray array = json.getAsJsonArray("_noteNumber");
12417      for (int i = 0; i < array.size(); i++) {
12418        if (i == res.getNoteNumber().size())
12419          res.getNoteNumber().add(parsePositiveInt(null));
12420        if (array.get(i) instanceof JsonObject) 
12421          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12422      }
12423    };
12424    if (json.has("adjudication")) {
12425      JsonArray array = json.getAsJsonArray("adjudication");
12426      for (int i = 0; i < array.size(); i++) {
12427        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12428      }
12429    };
12430  }
12431
12432  protected ExplanationOfBenefit.TotalComponent parseExplanationOfBenefitTotalComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12433    ExplanationOfBenefit.TotalComponent res = new ExplanationOfBenefit.TotalComponent();
12434    parseExplanationOfBenefitTotalComponentProperties(json, owner, res);
12435    return res;
12436  }
12437
12438  protected void parseExplanationOfBenefitTotalComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.TotalComponent res) throws IOException, FHIRFormatError {
12439    parseBackboneElementProperties(json, res);
12440    if (json.has("category"))
12441      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
12442    if (json.has("amount"))
12443      res.setAmount(parseMoney(getJObject(json, "amount")));
12444  }
12445
12446  protected ExplanationOfBenefit.PaymentComponent parseExplanationOfBenefitPaymentComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12447    ExplanationOfBenefit.PaymentComponent res = new ExplanationOfBenefit.PaymentComponent();
12448    parseExplanationOfBenefitPaymentComponentProperties(json, owner, res);
12449    return res;
12450  }
12451
12452  protected void parseExplanationOfBenefitPaymentComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.PaymentComponent res) throws IOException, FHIRFormatError {
12453    parseBackboneElementProperties(json, res);
12454    if (json.has("type"))
12455      res.setType(parseCodeableConcept(getJObject(json, "type")));
12456    if (json.has("adjustment"))
12457      res.setAdjustment(parseMoney(getJObject(json, "adjustment")));
12458    if (json.has("adjustmentReason"))
12459      res.setAdjustmentReason(parseCodeableConcept(getJObject(json, "adjustmentReason")));
12460    if (json.has("date"))
12461      res.setDateElement(parseDate(json.get("date").getAsString()));
12462    if (json.has("_date"))
12463      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
12464    if (json.has("amount"))
12465      res.setAmount(parseMoney(getJObject(json, "amount")));
12466    if (json.has("identifier"))
12467      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
12468  }
12469
12470  protected ExplanationOfBenefit.NoteComponent parseExplanationOfBenefitNoteComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12471    ExplanationOfBenefit.NoteComponent res = new ExplanationOfBenefit.NoteComponent();
12472    parseExplanationOfBenefitNoteComponentProperties(json, owner, res);
12473    return res;
12474  }
12475
12476  protected void parseExplanationOfBenefitNoteComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.NoteComponent res) throws IOException, FHIRFormatError {
12477    parseBackboneElementProperties(json, res);
12478    if (json.has("number"))
12479      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
12480    if (json.has("_number"))
12481      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
12482    if (json.has("type"))
12483      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
12484    if (json.has("_type"))
12485      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
12486    if (json.has("text"))
12487      res.setTextElement(parseString(json.get("text").getAsString()));
12488    if (json.has("_text"))
12489      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
12490    if (json.has("language"))
12491      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
12492  }
12493
12494  protected ExplanationOfBenefit.BenefitBalanceComponent parseExplanationOfBenefitBenefitBalanceComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12495    ExplanationOfBenefit.BenefitBalanceComponent res = new ExplanationOfBenefit.BenefitBalanceComponent();
12496    parseExplanationOfBenefitBenefitBalanceComponentProperties(json, owner, res);
12497    return res;
12498  }
12499
12500  protected void parseExplanationOfBenefitBenefitBalanceComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitBalanceComponent res) throws IOException, FHIRFormatError {
12501    parseBackboneElementProperties(json, res);
12502    if (json.has("category"))
12503      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
12504    if (json.has("excluded"))
12505      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
12506    if (json.has("_excluded"))
12507      parseElementProperties(getJObject(json, "_excluded"), res.getExcludedElement());
12508    if (json.has("name"))
12509      res.setNameElement(parseString(json.get("name").getAsString()));
12510    if (json.has("_name"))
12511      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
12512    if (json.has("description"))
12513      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12514    if (json.has("_description"))
12515      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12516    if (json.has("network"))
12517      res.setNetwork(parseCodeableConcept(getJObject(json, "network")));
12518    if (json.has("unit"))
12519      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
12520    if (json.has("term"))
12521      res.setTerm(parseCodeableConcept(getJObject(json, "term")));
12522    if (json.has("financial")) {
12523      JsonArray array = json.getAsJsonArray("financial");
12524      for (int i = 0; i < array.size(); i++) {
12525        res.getFinancial().add(parseExplanationOfBenefitBenefitComponent(array.get(i).getAsJsonObject(), owner));
12526      }
12527    };
12528  }
12529
12530  protected ExplanationOfBenefit.BenefitComponent parseExplanationOfBenefitBenefitComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12531    ExplanationOfBenefit.BenefitComponent res = new ExplanationOfBenefit.BenefitComponent();
12532    parseExplanationOfBenefitBenefitComponentProperties(json, owner, res);
12533    return res;
12534  }
12535
12536  protected void parseExplanationOfBenefitBenefitComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitComponent res) throws IOException, FHIRFormatError {
12537    parseBackboneElementProperties(json, res);
12538    if (json.has("type"))
12539      res.setType(parseCodeableConcept(getJObject(json, "type")));
12540    Type allowed = parseType("allowed", json);
12541    if (allowed != null)
12542      res.setAllowed(allowed);
12543    Type used = parseType("used", json);
12544    if (used != null)
12545      res.setUsed(used);
12546  }
12547
12548  protected FamilyMemberHistory parseFamilyMemberHistory(JsonObject json) throws IOException, FHIRFormatError {
12549    FamilyMemberHistory res = new FamilyMemberHistory();
12550    parseFamilyMemberHistoryProperties(json, res);
12551    return res;
12552  }
12553
12554  protected void parseFamilyMemberHistoryProperties(JsonObject json, FamilyMemberHistory res) throws IOException, FHIRFormatError {
12555    parseDomainResourceProperties(json, res);
12556    if (json.has("identifier")) {
12557      JsonArray array = json.getAsJsonArray("identifier");
12558      for (int i = 0; i < array.size(); i++) {
12559        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12560      }
12561    };
12562    if (json.has("instantiatesCanonical")) {
12563      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
12564      for (int i = 0; i < array.size(); i++) {
12565        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
12566      }
12567    };
12568    if (json.has("_instantiatesCanonical")) {
12569      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
12570      for (int i = 0; i < array.size(); i++) {
12571        if (i == res.getInstantiatesCanonical().size())
12572          res.getInstantiatesCanonical().add(parseCanonical(null));
12573        if (array.get(i) instanceof JsonObject) 
12574          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
12575      }
12576    };
12577    if (json.has("instantiatesUri")) {
12578      JsonArray array = json.getAsJsonArray("instantiatesUri");
12579      for (int i = 0; i < array.size(); i++) {
12580        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
12581      }
12582    };
12583    if (json.has("_instantiatesUri")) {
12584      JsonArray array = json.getAsJsonArray("_instantiatesUri");
12585      for (int i = 0; i < array.size(); i++) {
12586        if (i == res.getInstantiatesUri().size())
12587          res.getInstantiatesUri().add(parseUri(null));
12588        if (array.get(i) instanceof JsonObject) 
12589          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
12590      }
12591    };
12592    if (json.has("status"))
12593      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), FamilyMemberHistory.FamilyHistoryStatus.NULL, new FamilyMemberHistory.FamilyHistoryStatusEnumFactory()));
12594    if (json.has("_status"))
12595      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12596    if (json.has("dataAbsentReason"))
12597      res.setDataAbsentReason(parseCodeableConcept(getJObject(json, "dataAbsentReason")));
12598    if (json.has("patient"))
12599      res.setPatient(parseReference(getJObject(json, "patient")));
12600    if (json.has("date"))
12601      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12602    if (json.has("_date"))
12603      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
12604    if (json.has("name"))
12605      res.setNameElement(parseString(json.get("name").getAsString()));
12606    if (json.has("_name"))
12607      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
12608    if (json.has("relationship"))
12609      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
12610    if (json.has("sex"))
12611      res.setSex(parseCodeableConcept(getJObject(json, "sex")));
12612    Type born = parseType("born", json);
12613    if (born != null)
12614      res.setBorn(born);
12615    Type age = parseType("age", json);
12616    if (age != null)
12617      res.setAge(age);
12618    if (json.has("estimatedAge"))
12619      res.setEstimatedAgeElement(parseBoolean(json.get("estimatedAge").getAsBoolean()));
12620    if (json.has("_estimatedAge"))
12621      parseElementProperties(getJObject(json, "_estimatedAge"), res.getEstimatedAgeElement());
12622    Type deceased = parseType("deceased", json);
12623    if (deceased != null)
12624      res.setDeceased(deceased);
12625    if (json.has("reasonCode")) {
12626      JsonArray array = json.getAsJsonArray("reasonCode");
12627      for (int i = 0; i < array.size(); i++) {
12628        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12629      }
12630    };
12631    if (json.has("reasonReference")) {
12632      JsonArray array = json.getAsJsonArray("reasonReference");
12633      for (int i = 0; i < array.size(); i++) {
12634        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
12635      }
12636    };
12637    if (json.has("note")) {
12638      JsonArray array = json.getAsJsonArray("note");
12639      for (int i = 0; i < array.size(); i++) {
12640        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12641      }
12642    };
12643    if (json.has("condition")) {
12644      JsonArray array = json.getAsJsonArray("condition");
12645      for (int i = 0; i < array.size(); i++) {
12646        res.getCondition().add(parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(array.get(i).getAsJsonObject(), res));
12647      }
12648    };
12649  }
12650
12651  protected FamilyMemberHistory.FamilyMemberHistoryConditionComponent parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(JsonObject json, FamilyMemberHistory owner) throws IOException, FHIRFormatError {
12652    FamilyMemberHistory.FamilyMemberHistoryConditionComponent res = new FamilyMemberHistory.FamilyMemberHistoryConditionComponent();
12653    parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(json, owner, res);
12654    return res;
12655  }
12656
12657  protected void parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(JsonObject json, FamilyMemberHistory owner, FamilyMemberHistory.FamilyMemberHistoryConditionComponent res) throws IOException, FHIRFormatError {
12658    parseBackboneElementProperties(json, res);
12659    if (json.has("code"))
12660      res.setCode(parseCodeableConcept(getJObject(json, "code")));
12661    if (json.has("outcome"))
12662      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
12663    if (json.has("contributedToDeath"))
12664      res.setContributedToDeathElement(parseBoolean(json.get("contributedToDeath").getAsBoolean()));
12665    if (json.has("_contributedToDeath"))
12666      parseElementProperties(getJObject(json, "_contributedToDeath"), res.getContributedToDeathElement());
12667    Type onset = parseType("onset", json);
12668    if (onset != null)
12669      res.setOnset(onset);
12670    if (json.has("note")) {
12671      JsonArray array = json.getAsJsonArray("note");
12672      for (int i = 0; i < array.size(); i++) {
12673        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12674      }
12675    };
12676  }
12677
12678  protected Flag parseFlag(JsonObject json) throws IOException, FHIRFormatError {
12679    Flag res = new Flag();
12680    parseFlagProperties(json, res);
12681    return res;
12682  }
12683
12684  protected void parseFlagProperties(JsonObject json, Flag res) throws IOException, FHIRFormatError {
12685    parseDomainResourceProperties(json, res);
12686    if (json.has("identifier")) {
12687      JsonArray array = json.getAsJsonArray("identifier");
12688      for (int i = 0; i < array.size(); i++) {
12689        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12690      }
12691    };
12692    if (json.has("status"))
12693      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Flag.FlagStatus.NULL, new Flag.FlagStatusEnumFactory()));
12694    if (json.has("_status"))
12695      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12696    if (json.has("category")) {
12697      JsonArray array = json.getAsJsonArray("category");
12698      for (int i = 0; i < array.size(); i++) {
12699        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12700      }
12701    };
12702    if (json.has("code"))
12703      res.setCode(parseCodeableConcept(getJObject(json, "code")));
12704    if (json.has("subject"))
12705      res.setSubject(parseReference(getJObject(json, "subject")));
12706    if (json.has("period"))
12707      res.setPeriod(parsePeriod(getJObject(json, "period")));
12708    if (json.has("encounter"))
12709      res.setEncounter(parseReference(getJObject(json, "encounter")));
12710    if (json.has("author"))
12711      res.setAuthor(parseReference(getJObject(json, "author")));
12712  }
12713
12714  protected Goal parseGoal(JsonObject json) throws IOException, FHIRFormatError {
12715    Goal res = new Goal();
12716    parseGoalProperties(json, res);
12717    return res;
12718  }
12719
12720  protected void parseGoalProperties(JsonObject json, Goal res) throws IOException, FHIRFormatError {
12721    parseDomainResourceProperties(json, res);
12722    if (json.has("identifier")) {
12723      JsonArray array = json.getAsJsonArray("identifier");
12724      for (int i = 0; i < array.size(); i++) {
12725        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12726      }
12727    };
12728    if (json.has("lifecycleStatus"))
12729      res.setLifecycleStatusElement(parseEnumeration(json.get("lifecycleStatus").getAsString(), Goal.GoalLifecycleStatus.NULL, new Goal.GoalLifecycleStatusEnumFactory()));
12730    if (json.has("_lifecycleStatus"))
12731      parseElementProperties(getJObject(json, "_lifecycleStatus"), res.getLifecycleStatusElement());
12732    if (json.has("achievementStatus"))
12733      res.setAchievementStatus(parseCodeableConcept(getJObject(json, "achievementStatus")));
12734    if (json.has("category")) {
12735      JsonArray array = json.getAsJsonArray("category");
12736      for (int i = 0; i < array.size(); i++) {
12737        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12738      }
12739    };
12740    if (json.has("priority"))
12741      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
12742    if (json.has("description"))
12743      res.setDescription(parseCodeableConcept(getJObject(json, "description")));
12744    if (json.has("subject"))
12745      res.setSubject(parseReference(getJObject(json, "subject")));
12746    Type start = parseType("start", json);
12747    if (start != null)
12748      res.setStart(start);
12749    if (json.has("target")) {
12750      JsonArray array = json.getAsJsonArray("target");
12751      for (int i = 0; i < array.size(); i++) {
12752        res.getTarget().add(parseGoalGoalTargetComponent(array.get(i).getAsJsonObject(), res));
12753      }
12754    };
12755    if (json.has("statusDate"))
12756      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
12757    if (json.has("_statusDate"))
12758      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
12759    if (json.has("statusReason"))
12760      res.setStatusReasonElement(parseString(json.get("statusReason").getAsString()));
12761    if (json.has("_statusReason"))
12762      parseElementProperties(getJObject(json, "_statusReason"), res.getStatusReasonElement());
12763    if (json.has("expressedBy"))
12764      res.setExpressedBy(parseReference(getJObject(json, "expressedBy")));
12765    if (json.has("addresses")) {
12766      JsonArray array = json.getAsJsonArray("addresses");
12767      for (int i = 0; i < array.size(); i++) {
12768        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
12769      }
12770    };
12771    if (json.has("note")) {
12772      JsonArray array = json.getAsJsonArray("note");
12773      for (int i = 0; i < array.size(); i++) {
12774        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12775      }
12776    };
12777    if (json.has("outcomeCode")) {
12778      JsonArray array = json.getAsJsonArray("outcomeCode");
12779      for (int i = 0; i < array.size(); i++) {
12780        res.getOutcomeCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12781      }
12782    };
12783    if (json.has("outcomeReference")) {
12784      JsonArray array = json.getAsJsonArray("outcomeReference");
12785      for (int i = 0; i < array.size(); i++) {
12786        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
12787      }
12788    };
12789  }
12790
12791  protected Goal.GoalTargetComponent parseGoalGoalTargetComponent(JsonObject json, Goal owner) throws IOException, FHIRFormatError {
12792    Goal.GoalTargetComponent res = new Goal.GoalTargetComponent();
12793    parseGoalGoalTargetComponentProperties(json, owner, res);
12794    return res;
12795  }
12796
12797  protected void parseGoalGoalTargetComponentProperties(JsonObject json, Goal owner, Goal.GoalTargetComponent res) throws IOException, FHIRFormatError {
12798    parseBackboneElementProperties(json, res);
12799    if (json.has("measure"))
12800      res.setMeasure(parseCodeableConcept(getJObject(json, "measure")));
12801    Type detail = parseType("detail", json);
12802    if (detail != null)
12803      res.setDetail(detail);
12804    Type due = parseType("due", json);
12805    if (due != null)
12806      res.setDue(due);
12807  }
12808
12809  protected GraphDefinition parseGraphDefinition(JsonObject json) throws IOException, FHIRFormatError {
12810    GraphDefinition res = new GraphDefinition();
12811    parseGraphDefinitionProperties(json, res);
12812    return res;
12813  }
12814
12815  protected void parseGraphDefinitionProperties(JsonObject json, GraphDefinition res) throws IOException, FHIRFormatError {
12816    parseDomainResourceProperties(json, res);
12817    if (json.has("url"))
12818      res.setUrlElement(parseUri(json.get("url").getAsString()));
12819    if (json.has("_url"))
12820      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
12821    if (json.has("version"))
12822      res.setVersionElement(parseString(json.get("version").getAsString()));
12823    if (json.has("_version"))
12824      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
12825    if (json.has("name"))
12826      res.setNameElement(parseString(json.get("name").getAsString()));
12827    if (json.has("_name"))
12828      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
12829    if (json.has("status"))
12830      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
12831    if (json.has("_status"))
12832      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12833    if (json.has("experimental"))
12834      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
12835    if (json.has("_experimental"))
12836      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
12837    if (json.has("date"))
12838      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12839    if (json.has("_date"))
12840      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
12841    if (json.has("publisher"))
12842      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12843    if (json.has("_publisher"))
12844      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
12845    if (json.has("contact")) {
12846      JsonArray array = json.getAsJsonArray("contact");
12847      for (int i = 0; i < array.size(); i++) {
12848        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12849      }
12850    };
12851    if (json.has("description"))
12852      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12853    if (json.has("_description"))
12854      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12855    if (json.has("useContext")) {
12856      JsonArray array = json.getAsJsonArray("useContext");
12857      for (int i = 0; i < array.size(); i++) {
12858        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12859      }
12860    };
12861    if (json.has("jurisdiction")) {
12862      JsonArray array = json.getAsJsonArray("jurisdiction");
12863      for (int i = 0; i < array.size(); i++) {
12864        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12865      }
12866    };
12867    if (json.has("purpose"))
12868      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
12869    if (json.has("_purpose"))
12870      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
12871    if (json.has("start"))
12872      res.setStartElement(parseCode(json.get("start").getAsString()));
12873    if (json.has("_start"))
12874      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
12875    if (json.has("profile"))
12876      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
12877    if (json.has("_profile"))
12878      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
12879    if (json.has("link")) {
12880      JsonArray array = json.getAsJsonArray("link");
12881      for (int i = 0; i < array.size(); i++) {
12882        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), res));
12883      }
12884    };
12885  }
12886
12887  protected GraphDefinition.GraphDefinitionLinkComponent parseGraphDefinitionGraphDefinitionLinkComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
12888    GraphDefinition.GraphDefinitionLinkComponent res = new GraphDefinition.GraphDefinitionLinkComponent();
12889    parseGraphDefinitionGraphDefinitionLinkComponentProperties(json, owner, res);
12890    return res;
12891  }
12892
12893  protected void parseGraphDefinitionGraphDefinitionLinkComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkComponent res) throws IOException, FHIRFormatError {
12894    parseBackboneElementProperties(json, res);
12895    if (json.has("path"))
12896      res.setPathElement(parseString(json.get("path").getAsString()));
12897    if (json.has("_path"))
12898      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
12899    if (json.has("sliceName"))
12900      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
12901    if (json.has("_sliceName"))
12902      parseElementProperties(getJObject(json, "_sliceName"), res.getSliceNameElement());
12903    if (json.has("min"))
12904      res.setMinElement(parseInteger(json.get("min").getAsLong()));
12905    if (json.has("_min"))
12906      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
12907    if (json.has("max"))
12908      res.setMaxElement(parseString(json.get("max").getAsString()));
12909    if (json.has("_max"))
12910      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
12911    if (json.has("description"))
12912      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12913    if (json.has("_description"))
12914      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12915    if (json.has("target")) {
12916      JsonArray array = json.getAsJsonArray("target");
12917      for (int i = 0; i < array.size(); i++) {
12918        res.getTarget().add(parseGraphDefinitionGraphDefinitionLinkTargetComponent(array.get(i).getAsJsonObject(), owner));
12919      }
12920    };
12921  }
12922
12923  protected GraphDefinition.GraphDefinitionLinkTargetComponent parseGraphDefinitionGraphDefinitionLinkTargetComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
12924    GraphDefinition.GraphDefinitionLinkTargetComponent res = new GraphDefinition.GraphDefinitionLinkTargetComponent();
12925    parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(json, owner, res);
12926    return res;
12927  }
12928
12929  protected void parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetComponent res) throws IOException, FHIRFormatError {
12930    parseBackboneElementProperties(json, res);
12931    if (json.has("type"))
12932      res.setTypeElement(parseCode(json.get("type").getAsString()));
12933    if (json.has("_type"))
12934      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
12935    if (json.has("params"))
12936      res.setParamsElement(parseString(json.get("params").getAsString()));
12937    if (json.has("_params"))
12938      parseElementProperties(getJObject(json, "_params"), res.getParamsElement());
12939    if (json.has("profile"))
12940      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
12941    if (json.has("_profile"))
12942      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
12943    if (json.has("compartment")) {
12944      JsonArray array = json.getAsJsonArray("compartment");
12945      for (int i = 0; i < array.size(); i++) {
12946        res.getCompartment().add(parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(array.get(i).getAsJsonObject(), owner));
12947      }
12948    };
12949    if (json.has("link")) {
12950      JsonArray array = json.getAsJsonArray("link");
12951      for (int i = 0; i < array.size(); i++) {
12952        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), owner));
12953      }
12954    };
12955  }
12956
12957  protected GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
12958    GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res = new GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent();
12959    parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(json, owner, res);
12960    return res;
12961  }
12962
12963  protected void parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res) throws IOException, FHIRFormatError {
12964    parseBackboneElementProperties(json, res);
12965    if (json.has("use"))
12966      res.setUseElement(parseEnumeration(json.get("use").getAsString(), GraphDefinition.GraphCompartmentUse.NULL, new GraphDefinition.GraphCompartmentUseEnumFactory()));
12967    if (json.has("_use"))
12968      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
12969    if (json.has("code"))
12970      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), GraphDefinition.CompartmentCode.NULL, new GraphDefinition.CompartmentCodeEnumFactory()));
12971    if (json.has("_code"))
12972      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
12973    if (json.has("rule"))
12974      res.setRuleElement(parseEnumeration(json.get("rule").getAsString(), GraphDefinition.GraphCompartmentRule.NULL, new GraphDefinition.GraphCompartmentRuleEnumFactory()));
12975    if (json.has("_rule"))
12976      parseElementProperties(getJObject(json, "_rule"), res.getRuleElement());
12977    if (json.has("expression"))
12978      res.setExpressionElement(parseString(json.get("expression").getAsString()));
12979    if (json.has("_expression"))
12980      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
12981    if (json.has("description"))
12982      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12983    if (json.has("_description"))
12984      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12985  }
12986
12987  protected Group parseGroup(JsonObject json) throws IOException, FHIRFormatError {
12988    Group res = new Group();
12989    parseGroupProperties(json, res);
12990    return res;
12991  }
12992
12993  protected void parseGroupProperties(JsonObject json, Group res) throws IOException, FHIRFormatError {
12994    parseDomainResourceProperties(json, res);
12995    if (json.has("identifier")) {
12996      JsonArray array = json.getAsJsonArray("identifier");
12997      for (int i = 0; i < array.size(); i++) {
12998        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12999      }
13000    };
13001    if (json.has("active"))
13002      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
13003    if (json.has("_active"))
13004      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
13005    if (json.has("type"))
13006      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Group.GroupType.NULL, new Group.GroupTypeEnumFactory()));
13007    if (json.has("_type"))
13008      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
13009    if (json.has("actual"))
13010      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
13011    if (json.has("_actual"))
13012      parseElementProperties(getJObject(json, "_actual"), res.getActualElement());
13013    if (json.has("code"))
13014      res.setCode(parseCodeableConcept(getJObject(json, "code")));
13015    if (json.has("name"))
13016      res.setNameElement(parseString(json.get("name").getAsString()));
13017    if (json.has("_name"))
13018      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
13019    if (json.has("quantity"))
13020      res.setQuantityElement(parseUnsignedInt(json.get("quantity").getAsString()));
13021    if (json.has("_quantity"))
13022      parseElementProperties(getJObject(json, "_quantity"), res.getQuantityElement());
13023    if (json.has("managingEntity"))
13024      res.setManagingEntity(parseReference(getJObject(json, "managingEntity")));
13025    if (json.has("characteristic")) {
13026      JsonArray array = json.getAsJsonArray("characteristic");
13027      for (int i = 0; i < array.size(); i++) {
13028        res.getCharacteristic().add(parseGroupGroupCharacteristicComponent(array.get(i).getAsJsonObject(), res));
13029      }
13030    };
13031    if (json.has("member")) {
13032      JsonArray array = json.getAsJsonArray("member");
13033      for (int i = 0; i < array.size(); i++) {
13034        res.getMember().add(parseGroupGroupMemberComponent(array.get(i).getAsJsonObject(), res));
13035      }
13036    };
13037  }
13038
13039  protected Group.GroupCharacteristicComponent parseGroupGroupCharacteristicComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
13040    Group.GroupCharacteristicComponent res = new Group.GroupCharacteristicComponent();
13041    parseGroupGroupCharacteristicComponentProperties(json, owner, res);
13042    return res;
13043  }
13044
13045  protected void parseGroupGroupCharacteristicComponentProperties(JsonObject json, Group owner, Group.GroupCharacteristicComponent res) throws IOException, FHIRFormatError {
13046    parseBackboneElementProperties(json, res);
13047    if (json.has("code"))
13048      res.setCode(parseCodeableConcept(getJObject(json, "code")));
13049    Type value = parseType("value", json);
13050    if (value != null)
13051      res.setValue(value);
13052    if (json.has("exclude"))
13053      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
13054    if (json.has("_exclude"))
13055      parseElementProperties(getJObject(json, "_exclude"), res.getExcludeElement());
13056    if (json.has("period"))
13057      res.setPeriod(parsePeriod(getJObject(json, "period")));
13058  }
13059
13060  protected Group.GroupMemberComponent parseGroupGroupMemberComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
13061    Group.GroupMemberComponent res = new Group.GroupMemberComponent();
13062    parseGroupGroupMemberComponentProperties(json, owner, res);
13063    return res;
13064  }
13065
13066  protected void parseGroupGroupMemberComponentProperties(JsonObject json, Group owner, Group.GroupMemberComponent res) throws IOException, FHIRFormatError {
13067    parseBackboneElementProperties(json, res);
13068    if (json.has("entity"))
13069      res.setEntity(parseReference(getJObject(json, "entity")));
13070    if (json.has("period"))
13071      res.setPeriod(parsePeriod(getJObject(json, "period")));
13072    if (json.has("inactive"))
13073      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
13074    if (json.has("_inactive"))
13075      parseElementProperties(getJObject(json, "_inactive"), res.getInactiveElement());
13076  }
13077
13078  protected GuidanceResponse parseGuidanceResponse(JsonObject json) throws IOException, FHIRFormatError {
13079    GuidanceResponse res = new GuidanceResponse();
13080    parseGuidanceResponseProperties(json, res);
13081    return res;
13082  }
13083
13084  protected void parseGuidanceResponseProperties(JsonObject json, GuidanceResponse res) throws IOException, FHIRFormatError {
13085    parseDomainResourceProperties(json, res);
13086    if (json.has("requestIdentifier"))
13087      res.setRequestIdentifier(parseIdentifier(getJObject(json, "requestIdentifier")));
13088    if (json.has("identifier")) {
13089      JsonArray array = json.getAsJsonArray("identifier");
13090      for (int i = 0; i < array.size(); i++) {
13091        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13092      }
13093    };
13094    Type module = parseType("module", json);
13095    if (module != null)
13096      res.setModule(module);
13097    if (json.has("status"))
13098      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), GuidanceResponse.GuidanceResponseStatus.NULL, new GuidanceResponse.GuidanceResponseStatusEnumFactory()));
13099    if (json.has("_status"))
13100      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13101    if (json.has("subject"))
13102      res.setSubject(parseReference(getJObject(json, "subject")));
13103    if (json.has("encounter"))
13104      res.setEncounter(parseReference(getJObject(json, "encounter")));
13105    if (json.has("occurrenceDateTime"))
13106      res.setOccurrenceDateTimeElement(parseDateTime(json.get("occurrenceDateTime").getAsString()));
13107    if (json.has("_occurrenceDateTime"))
13108      parseElementProperties(getJObject(json, "_occurrenceDateTime"), res.getOccurrenceDateTimeElement());
13109    if (json.has("performer"))
13110      res.setPerformer(parseReference(getJObject(json, "performer")));
13111    if (json.has("reasonCode")) {
13112      JsonArray array = json.getAsJsonArray("reasonCode");
13113      for (int i = 0; i < array.size(); i++) {
13114        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13115      }
13116    };
13117    if (json.has("reasonReference")) {
13118      JsonArray array = json.getAsJsonArray("reasonReference");
13119      for (int i = 0; i < array.size(); i++) {
13120        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
13121      }
13122    };
13123    if (json.has("note")) {
13124      JsonArray array = json.getAsJsonArray("note");
13125      for (int i = 0; i < array.size(); i++) {
13126        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13127      }
13128    };
13129    if (json.has("evaluationMessage")) {
13130      JsonArray array = json.getAsJsonArray("evaluationMessage");
13131      for (int i = 0; i < array.size(); i++) {
13132        res.getEvaluationMessage().add(parseReference(array.get(i).getAsJsonObject()));
13133      }
13134    };
13135    if (json.has("outputParameters"))
13136      res.setOutputParameters(parseReference(getJObject(json, "outputParameters")));
13137    if (json.has("result"))
13138      res.setResult(parseReference(getJObject(json, "result")));
13139    if (json.has("dataRequirement")) {
13140      JsonArray array = json.getAsJsonArray("dataRequirement");
13141      for (int i = 0; i < array.size(); i++) {
13142        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
13143      }
13144    };
13145  }
13146
13147  protected HealthcareService parseHealthcareService(JsonObject json) throws IOException, FHIRFormatError {
13148    HealthcareService res = new HealthcareService();
13149    parseHealthcareServiceProperties(json, res);
13150    return res;
13151  }
13152
13153  protected void parseHealthcareServiceProperties(JsonObject json, HealthcareService res) throws IOException, FHIRFormatError {
13154    parseDomainResourceProperties(json, res);
13155    if (json.has("identifier")) {
13156      JsonArray array = json.getAsJsonArray("identifier");
13157      for (int i = 0; i < array.size(); i++) {
13158        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13159      }
13160    };
13161    if (json.has("active"))
13162      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
13163    if (json.has("_active"))
13164      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
13165    if (json.has("providedBy"))
13166      res.setProvidedBy(parseReference(getJObject(json, "providedBy")));
13167    if (json.has("category")) {
13168      JsonArray array = json.getAsJsonArray("category");
13169      for (int i = 0; i < array.size(); i++) {
13170        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13171      }
13172    };
13173    if (json.has("type")) {
13174      JsonArray array = json.getAsJsonArray("type");
13175      for (int i = 0; i < array.size(); i++) {
13176        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13177      }
13178    };
13179    if (json.has("specialty")) {
13180      JsonArray array = json.getAsJsonArray("specialty");
13181      for (int i = 0; i < array.size(); i++) {
13182        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13183      }
13184    };
13185    if (json.has("location")) {
13186      JsonArray array = json.getAsJsonArray("location");
13187      for (int i = 0; i < array.size(); i++) {
13188        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
13189      }
13190    };
13191    if (json.has("name"))
13192      res.setNameElement(parseString(json.get("name").getAsString()));
13193    if (json.has("_name"))
13194      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
13195    if (json.has("comment"))
13196      res.setCommentElement(parseString(json.get("comment").getAsString()));
13197    if (json.has("_comment"))
13198      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
13199    if (json.has("extraDetails"))
13200      res.setExtraDetailsElement(parseMarkdown(json.get("extraDetails").getAsString()));
13201    if (json.has("_extraDetails"))
13202      parseElementProperties(getJObject(json, "_extraDetails"), res.getExtraDetailsElement());
13203    if (json.has("photo"))
13204      res.setPhoto(parseAttachment(getJObject(json, "photo")));
13205    if (json.has("telecom")) {
13206      JsonArray array = json.getAsJsonArray("telecom");
13207      for (int i = 0; i < array.size(); i++) {
13208        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
13209      }
13210    };
13211    if (json.has("coverageArea")) {
13212      JsonArray array = json.getAsJsonArray("coverageArea");
13213      for (int i = 0; i < array.size(); i++) {
13214        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
13215      }
13216    };
13217    if (json.has("serviceProvisionCode")) {
13218      JsonArray array = json.getAsJsonArray("serviceProvisionCode");
13219      for (int i = 0; i < array.size(); i++) {
13220        res.getServiceProvisionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13221      }
13222    };
13223    if (json.has("eligibility")) {
13224      JsonArray array = json.getAsJsonArray("eligibility");
13225      for (int i = 0; i < array.size(); i++) {
13226        res.getEligibility().add(parseHealthcareServiceHealthcareServiceEligibilityComponent(array.get(i).getAsJsonObject(), res));
13227      }
13228    };
13229    if (json.has("program")) {
13230      JsonArray array = json.getAsJsonArray("program");
13231      for (int i = 0; i < array.size(); i++) {
13232        res.getProgram().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13233      }
13234    };
13235    if (json.has("characteristic")) {
13236      JsonArray array = json.getAsJsonArray("characteristic");
13237      for (int i = 0; i < array.size(); i++) {
13238        res.getCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13239      }
13240    };
13241    if (json.has("communication")) {
13242      JsonArray array = json.getAsJsonArray("communication");
13243      for (int i = 0; i < array.size(); i++) {
13244        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13245      }
13246    };
13247    if (json.has("referralMethod")) {
13248      JsonArray array = json.getAsJsonArray("referralMethod");
13249      for (int i = 0; i < array.size(); i++) {
13250        res.getReferralMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13251      }
13252    };
13253    if (json.has("appointmentRequired"))
13254      res.setAppointmentRequiredElement(parseBoolean(json.get("appointmentRequired").getAsBoolean()));
13255    if (json.has("_appointmentRequired"))
13256      parseElementProperties(getJObject(json, "_appointmentRequired"), res.getAppointmentRequiredElement());
13257    if (json.has("availableTime")) {
13258      JsonArray array = json.getAsJsonArray("availableTime");
13259      for (int i = 0; i < array.size(); i++) {
13260        res.getAvailableTime().add(parseHealthcareServiceHealthcareServiceAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
13261      }
13262    };
13263    if (json.has("notAvailable")) {
13264      JsonArray array = json.getAsJsonArray("notAvailable");
13265      for (int i = 0; i < array.size(); i++) {
13266        res.getNotAvailable().add(parseHealthcareServiceHealthcareServiceNotAvailableComponent(array.get(i).getAsJsonObject(), res));
13267      }
13268    };
13269    if (json.has("availabilityExceptions"))
13270      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
13271    if (json.has("_availabilityExceptions"))
13272      parseElementProperties(getJObject(json, "_availabilityExceptions"), res.getAvailabilityExceptionsElement());
13273    if (json.has("endpoint")) {
13274      JsonArray array = json.getAsJsonArray("endpoint");
13275      for (int i = 0; i < array.size(); i++) {
13276        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
13277      }
13278    };
13279  }
13280
13281  protected HealthcareService.HealthcareServiceEligibilityComponent parseHealthcareServiceHealthcareServiceEligibilityComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
13282    HealthcareService.HealthcareServiceEligibilityComponent res = new HealthcareService.HealthcareServiceEligibilityComponent();
13283    parseHealthcareServiceHealthcareServiceEligibilityComponentProperties(json, owner, res);
13284    return res;
13285  }
13286
13287  protected void parseHealthcareServiceHealthcareServiceEligibilityComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceEligibilityComponent res) throws IOException, FHIRFormatError {
13288    parseBackboneElementProperties(json, res);
13289    if (json.has("code"))
13290      res.setCode(parseCodeableConcept(getJObject(json, "code")));
13291    if (json.has("comment"))
13292      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
13293    if (json.has("_comment"))
13294      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
13295  }
13296
13297  protected HealthcareService.HealthcareServiceAvailableTimeComponent parseHealthcareServiceHealthcareServiceAvailableTimeComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
13298    HealthcareService.HealthcareServiceAvailableTimeComponent res = new HealthcareService.HealthcareServiceAvailableTimeComponent();
13299    parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(json, owner, res);
13300    return res;
13301  }
13302
13303  protected void parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceAvailableTimeComponent res) throws IOException, FHIRFormatError {
13304    parseBackboneElementProperties(json, res);
13305    if (json.has("daysOfWeek")) {
13306      JsonArray array = json.getAsJsonArray("daysOfWeek");
13307      for (int i = 0; i < array.size(); i++) {
13308        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
13309      }
13310    };
13311    if (json.has("_daysOfWeek")) {
13312      JsonArray array = json.getAsJsonArray("_daysOfWeek");
13313      for (int i = 0; i < array.size(); i++) {
13314        if (i == res.getDaysOfWeek().size())
13315          res.getDaysOfWeek().add(parseEnumeration(null, HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
13316        if (array.get(i) instanceof JsonObject) 
13317          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
13318      }
13319    };
13320    if (json.has("allDay"))
13321      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
13322    if (json.has("_allDay"))
13323      parseElementProperties(getJObject(json, "_allDay"), res.getAllDayElement());
13324    if (json.has("availableStartTime"))
13325      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
13326    if (json.has("_availableStartTime"))
13327      parseElementProperties(getJObject(json, "_availableStartTime"), res.getAvailableStartTimeElement());
13328    if (json.has("availableEndTime"))
13329      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
13330    if (json.has("_availableEndTime"))
13331      parseElementProperties(getJObject(json, "_availableEndTime"), res.getAvailableEndTimeElement());
13332  }
13333
13334  protected HealthcareService.HealthcareServiceNotAvailableComponent parseHealthcareServiceHealthcareServiceNotAvailableComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
13335    HealthcareService.HealthcareServiceNotAvailableComponent res = new HealthcareService.HealthcareServiceNotAvailableComponent();
13336    parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(json, owner, res);
13337    return res;
13338  }
13339
13340  protected void parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceNotAvailableComponent res) throws IOException, FHIRFormatError {
13341    parseBackboneElementProperties(json, res);
13342    if (json.has("description"))
13343      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13344    if (json.has("_description"))
13345      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13346    if (json.has("during"))
13347      res.setDuring(parsePeriod(getJObject(json, "during")));
13348  }
13349
13350  protected ImagingStudy parseImagingStudy(JsonObject json) throws IOException, FHIRFormatError {
13351    ImagingStudy res = new ImagingStudy();
13352    parseImagingStudyProperties(json, res);
13353    return res;
13354  }
13355
13356  protected void parseImagingStudyProperties(JsonObject json, ImagingStudy res) throws IOException, FHIRFormatError {
13357    parseDomainResourceProperties(json, res);
13358    if (json.has("identifier")) {
13359      JsonArray array = json.getAsJsonArray("identifier");
13360      for (int i = 0; i < array.size(); i++) {
13361        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13362      }
13363    };
13364    if (json.has("status"))
13365      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImagingStudy.ImagingStudyStatus.NULL, new ImagingStudy.ImagingStudyStatusEnumFactory()));
13366    if (json.has("_status"))
13367      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13368    if (json.has("modality")) {
13369      JsonArray array = json.getAsJsonArray("modality");
13370      for (int i = 0; i < array.size(); i++) {
13371        res.getModality().add(parseCoding(array.get(i).getAsJsonObject()));
13372      }
13373    };
13374    if (json.has("subject"))
13375      res.setSubject(parseReference(getJObject(json, "subject")));
13376    if (json.has("encounter"))
13377      res.setEncounter(parseReference(getJObject(json, "encounter")));
13378    if (json.has("started"))
13379      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
13380    if (json.has("_started"))
13381      parseElementProperties(getJObject(json, "_started"), res.getStartedElement());
13382    if (json.has("basedOn")) {
13383      JsonArray array = json.getAsJsonArray("basedOn");
13384      for (int i = 0; i < array.size(); i++) {
13385        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
13386      }
13387    };
13388    if (json.has("referrer"))
13389      res.setReferrer(parseReference(getJObject(json, "referrer")));
13390    if (json.has("interpreter")) {
13391      JsonArray array = json.getAsJsonArray("interpreter");
13392      for (int i = 0; i < array.size(); i++) {
13393        res.getInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
13394      }
13395    };
13396    if (json.has("endpoint")) {
13397      JsonArray array = json.getAsJsonArray("endpoint");
13398      for (int i = 0; i < array.size(); i++) {
13399        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
13400      }
13401    };
13402    if (json.has("numberOfSeries"))
13403      res.setNumberOfSeriesElement(parseUnsignedInt(json.get("numberOfSeries").getAsString()));
13404    if (json.has("_numberOfSeries"))
13405      parseElementProperties(getJObject(json, "_numberOfSeries"), res.getNumberOfSeriesElement());
13406    if (json.has("numberOfInstances"))
13407      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
13408    if (json.has("_numberOfInstances"))
13409      parseElementProperties(getJObject(json, "_numberOfInstances"), res.getNumberOfInstancesElement());
13410    if (json.has("procedureReference"))
13411      res.setProcedureReference(parseReference(getJObject(json, "procedureReference")));
13412    if (json.has("procedureCode")) {
13413      JsonArray array = json.getAsJsonArray("procedureCode");
13414      for (int i = 0; i < array.size(); i++) {
13415        res.getProcedureCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13416      }
13417    };
13418    if (json.has("location"))
13419      res.setLocation(parseReference(getJObject(json, "location")));
13420    if (json.has("reasonCode")) {
13421      JsonArray array = json.getAsJsonArray("reasonCode");
13422      for (int i = 0; i < array.size(); i++) {
13423        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13424      }
13425    };
13426    if (json.has("reasonReference")) {
13427      JsonArray array = json.getAsJsonArray("reasonReference");
13428      for (int i = 0; i < array.size(); i++) {
13429        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
13430      }
13431    };
13432    if (json.has("note")) {
13433      JsonArray array = json.getAsJsonArray("note");
13434      for (int i = 0; i < array.size(); i++) {
13435        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13436      }
13437    };
13438    if (json.has("description"))
13439      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13440    if (json.has("_description"))
13441      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13442    if (json.has("series")) {
13443      JsonArray array = json.getAsJsonArray("series");
13444      for (int i = 0; i < array.size(); i++) {
13445        res.getSeries().add(parseImagingStudyImagingStudySeriesComponent(array.get(i).getAsJsonObject(), res));
13446      }
13447    };
13448  }
13449
13450  protected ImagingStudy.ImagingStudySeriesComponent parseImagingStudyImagingStudySeriesComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
13451    ImagingStudy.ImagingStudySeriesComponent res = new ImagingStudy.ImagingStudySeriesComponent();
13452    parseImagingStudyImagingStudySeriesComponentProperties(json, owner, res);
13453    return res;
13454  }
13455
13456  protected void parseImagingStudyImagingStudySeriesComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesComponent res) throws IOException, FHIRFormatError {
13457    parseBackboneElementProperties(json, res);
13458    if (json.has("uid"))
13459      res.setUidElement(parseId(json.get("uid").getAsString()));
13460    if (json.has("_uid"))
13461      parseElementProperties(getJObject(json, "_uid"), res.getUidElement());
13462    if (json.has("number"))
13463      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
13464    if (json.has("_number"))
13465      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
13466    if (json.has("modality"))
13467      res.setModality(parseCoding(getJObject(json, "modality")));
13468    if (json.has("description"))
13469      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13470    if (json.has("_description"))
13471      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13472    if (json.has("numberOfInstances"))
13473      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
13474    if (json.has("_numberOfInstances"))
13475      parseElementProperties(getJObject(json, "_numberOfInstances"), res.getNumberOfInstancesElement());
13476    if (json.has("endpoint")) {
13477      JsonArray array = json.getAsJsonArray("endpoint");
13478      for (int i = 0; i < array.size(); i++) {
13479        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
13480      }
13481    };
13482    if (json.has("bodySite"))
13483      res.setBodySite(parseCoding(getJObject(json, "bodySite")));
13484    if (json.has("laterality"))
13485      res.setLaterality(parseCoding(getJObject(json, "laterality")));
13486    if (json.has("specimen")) {
13487      JsonArray array = json.getAsJsonArray("specimen");
13488      for (int i = 0; i < array.size(); i++) {
13489        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
13490      }
13491    };
13492    if (json.has("started"))
13493      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
13494    if (json.has("_started"))
13495      parseElementProperties(getJObject(json, "_started"), res.getStartedElement());
13496    if (json.has("performer")) {
13497      JsonArray array = json.getAsJsonArray("performer");
13498      for (int i = 0; i < array.size(); i++) {
13499        res.getPerformer().add(parseImagingStudyImagingStudySeriesPerformerComponent(array.get(i).getAsJsonObject(), owner));
13500      }
13501    };
13502    if (json.has("instance")) {
13503      JsonArray array = json.getAsJsonArray("instance");
13504      for (int i = 0; i < array.size(); i++) {
13505        res.getInstance().add(parseImagingStudyImagingStudySeriesInstanceComponent(array.get(i).getAsJsonObject(), owner));
13506      }
13507    };
13508  }
13509
13510  protected ImagingStudy.ImagingStudySeriesPerformerComponent parseImagingStudyImagingStudySeriesPerformerComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
13511    ImagingStudy.ImagingStudySeriesPerformerComponent res = new ImagingStudy.ImagingStudySeriesPerformerComponent();
13512    parseImagingStudyImagingStudySeriesPerformerComponentProperties(json, owner, res);
13513    return res;
13514  }
13515
13516  protected void parseImagingStudyImagingStudySeriesPerformerComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesPerformerComponent res) throws IOException, FHIRFormatError {
13517    parseBackboneElementProperties(json, res);
13518    if (json.has("function"))
13519      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
13520    if (json.has("actor"))
13521      res.setActor(parseReference(getJObject(json, "actor")));
13522  }
13523
13524  protected ImagingStudy.ImagingStudySeriesInstanceComponent parseImagingStudyImagingStudySeriesInstanceComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
13525    ImagingStudy.ImagingStudySeriesInstanceComponent res = new ImagingStudy.ImagingStudySeriesInstanceComponent();
13526    parseImagingStudyImagingStudySeriesInstanceComponentProperties(json, owner, res);
13527    return res;
13528  }
13529
13530  protected void parseImagingStudyImagingStudySeriesInstanceComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesInstanceComponent res) throws IOException, FHIRFormatError {
13531    parseBackboneElementProperties(json, res);
13532    if (json.has("uid"))
13533      res.setUidElement(parseId(json.get("uid").getAsString()));
13534    if (json.has("_uid"))
13535      parseElementProperties(getJObject(json, "_uid"), res.getUidElement());
13536    if (json.has("sopClass"))
13537      res.setSopClass(parseCoding(getJObject(json, "sopClass")));
13538    if (json.has("number"))
13539      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
13540    if (json.has("_number"))
13541      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
13542    if (json.has("title"))
13543      res.setTitleElement(parseString(json.get("title").getAsString()));
13544    if (json.has("_title"))
13545      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
13546  }
13547
13548  protected Immunization parseImmunization(JsonObject json) throws IOException, FHIRFormatError {
13549    Immunization res = new Immunization();
13550    parseImmunizationProperties(json, res);
13551    return res;
13552  }
13553
13554  protected void parseImmunizationProperties(JsonObject json, Immunization res) throws IOException, FHIRFormatError {
13555    parseDomainResourceProperties(json, res);
13556    if (json.has("identifier")) {
13557      JsonArray array = json.getAsJsonArray("identifier");
13558      for (int i = 0; i < array.size(); i++) {
13559        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13560      }
13561    };
13562    if (json.has("status"))
13563      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Immunization.ImmunizationStatus.NULL, new Immunization.ImmunizationStatusEnumFactory()));
13564    if (json.has("_status"))
13565      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13566    if (json.has("statusReason"))
13567      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
13568    if (json.has("vaccineCode"))
13569      res.setVaccineCode(parseCodeableConcept(getJObject(json, "vaccineCode")));
13570    if (json.has("patient"))
13571      res.setPatient(parseReference(getJObject(json, "patient")));
13572    if (json.has("encounter"))
13573      res.setEncounter(parseReference(getJObject(json, "encounter")));
13574    Type occurrence = parseType("occurrence", json);
13575    if (occurrence != null)
13576      res.setOccurrence(occurrence);
13577    if (json.has("recorded"))
13578      res.setRecordedElement(parseDateTime(json.get("recorded").getAsString()));
13579    if (json.has("_recorded"))
13580      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
13581    if (json.has("primarySource"))
13582      res.setPrimarySourceElement(parseBoolean(json.get("primarySource").getAsBoolean()));
13583    if (json.has("_primarySource"))
13584      parseElementProperties(getJObject(json, "_primarySource"), res.getPrimarySourceElement());
13585    if (json.has("reportOrigin"))
13586      res.setReportOrigin(parseCodeableConcept(getJObject(json, "reportOrigin")));
13587    if (json.has("location"))
13588      res.setLocation(parseReference(getJObject(json, "location")));
13589    if (json.has("manufacturer"))
13590      res.setManufacturer(parseReference(getJObject(json, "manufacturer")));
13591    if (json.has("lotNumber"))
13592      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
13593    if (json.has("_lotNumber"))
13594      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
13595    if (json.has("expirationDate"))
13596      res.setExpirationDateElement(parseDate(json.get("expirationDate").getAsString()));
13597    if (json.has("_expirationDate"))
13598      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
13599    if (json.has("site"))
13600      res.setSite(parseCodeableConcept(getJObject(json, "site")));
13601    if (json.has("route"))
13602      res.setRoute(parseCodeableConcept(getJObject(json, "route")));
13603    if (json.has("doseQuantity"))
13604      res.setDoseQuantity(parseQuantity(getJObject(json, "doseQuantity")));
13605    if (json.has("performer")) {
13606      JsonArray array = json.getAsJsonArray("performer");
13607      for (int i = 0; i < array.size(); i++) {
13608        res.getPerformer().add(parseImmunizationImmunizationPerformerComponent(array.get(i).getAsJsonObject(), res));
13609      }
13610    };
13611    if (json.has("note")) {
13612      JsonArray array = json.getAsJsonArray("note");
13613      for (int i = 0; i < array.size(); i++) {
13614        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13615      }
13616    };
13617    if (json.has("reasonCode")) {
13618      JsonArray array = json.getAsJsonArray("reasonCode");
13619      for (int i = 0; i < array.size(); i++) {
13620        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13621      }
13622    };
13623    if (json.has("reasonReference")) {
13624      JsonArray array = json.getAsJsonArray("reasonReference");
13625      for (int i = 0; i < array.size(); i++) {
13626        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
13627      }
13628    };
13629    if (json.has("isSubpotent"))
13630      res.setIsSubpotentElement(parseBoolean(json.get("isSubpotent").getAsBoolean()));
13631    if (json.has("_isSubpotent"))
13632      parseElementProperties(getJObject(json, "_isSubpotent"), res.getIsSubpotentElement());
13633    if (json.has("subpotentReason")) {
13634      JsonArray array = json.getAsJsonArray("subpotentReason");
13635      for (int i = 0; i < array.size(); i++) {
13636        res.getSubpotentReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13637      }
13638    };
13639    if (json.has("education")) {
13640      JsonArray array = json.getAsJsonArray("education");
13641      for (int i = 0; i < array.size(); i++) {
13642        res.getEducation().add(parseImmunizationImmunizationEducationComponent(array.get(i).getAsJsonObject(), res));
13643      }
13644    };
13645    if (json.has("programEligibility")) {
13646      JsonArray array = json.getAsJsonArray("programEligibility");
13647      for (int i = 0; i < array.size(); i++) {
13648        res.getProgramEligibility().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13649      }
13650    };
13651    if (json.has("fundingSource"))
13652      res.setFundingSource(parseCodeableConcept(getJObject(json, "fundingSource")));
13653    if (json.has("reaction")) {
13654      JsonArray array = json.getAsJsonArray("reaction");
13655      for (int i = 0; i < array.size(); i++) {
13656        res.getReaction().add(parseImmunizationImmunizationReactionComponent(array.get(i).getAsJsonObject(), res));
13657      }
13658    };
13659    if (json.has("protocolApplied")) {
13660      JsonArray array = json.getAsJsonArray("protocolApplied");
13661      for (int i = 0; i < array.size(); i++) {
13662        res.getProtocolApplied().add(parseImmunizationImmunizationProtocolAppliedComponent(array.get(i).getAsJsonObject(), res));
13663      }
13664    };
13665  }
13666
13667  protected Immunization.ImmunizationPerformerComponent parseImmunizationImmunizationPerformerComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
13668    Immunization.ImmunizationPerformerComponent res = new Immunization.ImmunizationPerformerComponent();
13669    parseImmunizationImmunizationPerformerComponentProperties(json, owner, res);
13670    return res;
13671  }
13672
13673  protected void parseImmunizationImmunizationPerformerComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationPerformerComponent res) throws IOException, FHIRFormatError {
13674    parseBackboneElementProperties(json, res);
13675    if (json.has("function"))
13676      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
13677    if (json.has("actor"))
13678      res.setActor(parseReference(getJObject(json, "actor")));
13679  }
13680
13681  protected Immunization.ImmunizationEducationComponent parseImmunizationImmunizationEducationComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
13682    Immunization.ImmunizationEducationComponent res = new Immunization.ImmunizationEducationComponent();
13683    parseImmunizationImmunizationEducationComponentProperties(json, owner, res);
13684    return res;
13685  }
13686
13687  protected void parseImmunizationImmunizationEducationComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationEducationComponent res) throws IOException, FHIRFormatError {
13688    parseBackboneElementProperties(json, res);
13689    if (json.has("documentType"))
13690      res.setDocumentTypeElement(parseString(json.get("documentType").getAsString()));
13691    if (json.has("_documentType"))
13692      parseElementProperties(getJObject(json, "_documentType"), res.getDocumentTypeElement());
13693    if (json.has("reference"))
13694      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
13695    if (json.has("_reference"))
13696      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
13697    if (json.has("publicationDate"))
13698      res.setPublicationDateElement(parseDateTime(json.get("publicationDate").getAsString()));
13699    if (json.has("_publicationDate"))
13700      parseElementProperties(getJObject(json, "_publicationDate"), res.getPublicationDateElement());
13701    if (json.has("presentationDate"))
13702      res.setPresentationDateElement(parseDateTime(json.get("presentationDate").getAsString()));
13703    if (json.has("_presentationDate"))
13704      parseElementProperties(getJObject(json, "_presentationDate"), res.getPresentationDateElement());
13705  }
13706
13707  protected Immunization.ImmunizationReactionComponent parseImmunizationImmunizationReactionComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
13708    Immunization.ImmunizationReactionComponent res = new Immunization.ImmunizationReactionComponent();
13709    parseImmunizationImmunizationReactionComponentProperties(json, owner, res);
13710    return res;
13711  }
13712
13713  protected void parseImmunizationImmunizationReactionComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationReactionComponent res) throws IOException, FHIRFormatError {
13714    parseBackboneElementProperties(json, res);
13715    if (json.has("date"))
13716      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13717    if (json.has("_date"))
13718      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
13719    if (json.has("detail"))
13720      res.setDetail(parseReference(getJObject(json, "detail")));
13721    if (json.has("reported"))
13722      res.setReportedElement(parseBoolean(json.get("reported").getAsBoolean()));
13723    if (json.has("_reported"))
13724      parseElementProperties(getJObject(json, "_reported"), res.getReportedElement());
13725  }
13726
13727  protected Immunization.ImmunizationProtocolAppliedComponent parseImmunizationImmunizationProtocolAppliedComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
13728    Immunization.ImmunizationProtocolAppliedComponent res = new Immunization.ImmunizationProtocolAppliedComponent();
13729    parseImmunizationImmunizationProtocolAppliedComponentProperties(json, owner, res);
13730    return res;
13731  }
13732
13733  protected void parseImmunizationImmunizationProtocolAppliedComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationProtocolAppliedComponent res) throws IOException, FHIRFormatError {
13734    parseBackboneElementProperties(json, res);
13735    if (json.has("series"))
13736      res.setSeriesElement(parseString(json.get("series").getAsString()));
13737    if (json.has("_series"))
13738      parseElementProperties(getJObject(json, "_series"), res.getSeriesElement());
13739    if (json.has("authority"))
13740      res.setAuthority(parseReference(getJObject(json, "authority")));
13741    if (json.has("targetDisease")) {
13742      JsonArray array = json.getAsJsonArray("targetDisease");
13743      for (int i = 0; i < array.size(); i++) {
13744        res.getTargetDisease().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13745      }
13746    };
13747    Type doseNumber = parseType("doseNumber", json);
13748    if (doseNumber != null)
13749      res.setDoseNumber(doseNumber);
13750    Type seriesDoses = parseType("seriesDoses", json);
13751    if (seriesDoses != null)
13752      res.setSeriesDoses(seriesDoses);
13753  }
13754
13755  protected ImmunizationEvaluation parseImmunizationEvaluation(JsonObject json) throws IOException, FHIRFormatError {
13756    ImmunizationEvaluation res = new ImmunizationEvaluation();
13757    parseImmunizationEvaluationProperties(json, res);
13758    return res;
13759  }
13760
13761  protected void parseImmunizationEvaluationProperties(JsonObject json, ImmunizationEvaluation res) throws IOException, FHIRFormatError {
13762    parseDomainResourceProperties(json, res);
13763    if (json.has("identifier")) {
13764      JsonArray array = json.getAsJsonArray("identifier");
13765      for (int i = 0; i < array.size(); i++) {
13766        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13767      }
13768    };
13769    if (json.has("status"))
13770      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImmunizationEvaluation.ImmunizationEvaluationStatus.NULL, new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory()));
13771    if (json.has("_status"))
13772      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13773    if (json.has("patient"))
13774      res.setPatient(parseReference(getJObject(json, "patient")));
13775    if (json.has("date"))
13776      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13777    if (json.has("_date"))
13778      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
13779    if (json.has("authority"))
13780      res.setAuthority(parseReference(getJObject(json, "authority")));
13781    if (json.has("targetDisease"))
13782      res.setTargetDisease(parseCodeableConcept(getJObject(json, "targetDisease")));
13783    if (json.has("immunizationEvent"))
13784      res.setImmunizationEvent(parseReference(getJObject(json, "immunizationEvent")));
13785    if (json.has("doseStatus"))
13786      res.setDoseStatus(parseCodeableConcept(getJObject(json, "doseStatus")));
13787    if (json.has("doseStatusReason")) {
13788      JsonArray array = json.getAsJsonArray("doseStatusReason");
13789      for (int i = 0; i < array.size(); i++) {
13790        res.getDoseStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13791      }
13792    };
13793    if (json.has("description"))
13794      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13795    if (json.has("_description"))
13796      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13797    if (json.has("series"))
13798      res.setSeriesElement(parseString(json.get("series").getAsString()));
13799    if (json.has("_series"))
13800      parseElementProperties(getJObject(json, "_series"), res.getSeriesElement());
13801    Type doseNumber = parseType("doseNumber", json);
13802    if (doseNumber != null)
13803      res.setDoseNumber(doseNumber);
13804    Type seriesDoses = parseType("seriesDoses", json);
13805    if (seriesDoses != null)
13806      res.setSeriesDoses(seriesDoses);
13807  }
13808
13809  protected ImmunizationRecommendation parseImmunizationRecommendation(JsonObject json) throws IOException, FHIRFormatError {
13810    ImmunizationRecommendation res = new ImmunizationRecommendation();
13811    parseImmunizationRecommendationProperties(json, res);
13812    return res;
13813  }
13814
13815  protected void parseImmunizationRecommendationProperties(JsonObject json, ImmunizationRecommendation res) throws IOException, FHIRFormatError {
13816    parseDomainResourceProperties(json, res);
13817    if (json.has("identifier")) {
13818      JsonArray array = json.getAsJsonArray("identifier");
13819      for (int i = 0; i < array.size(); i++) {
13820        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13821      }
13822    };
13823    if (json.has("patient"))
13824      res.setPatient(parseReference(getJObject(json, "patient")));
13825    if (json.has("date"))
13826      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13827    if (json.has("_date"))
13828      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
13829    if (json.has("authority"))
13830      res.setAuthority(parseReference(getJObject(json, "authority")));
13831    if (json.has("recommendation")) {
13832      JsonArray array = json.getAsJsonArray("recommendation");
13833      for (int i = 0; i < array.size(); i++) {
13834        res.getRecommendation().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(array.get(i).getAsJsonObject(), res));
13835      }
13836    };
13837  }
13838
13839  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
13840    ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent();
13841    parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(json, owner, res);
13842    return res;
13843  }
13844
13845  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res) throws IOException, FHIRFormatError {
13846    parseBackboneElementProperties(json, res);
13847    if (json.has("vaccineCode")) {
13848      JsonArray array = json.getAsJsonArray("vaccineCode");
13849      for (int i = 0; i < array.size(); i++) {
13850        res.getVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13851      }
13852    };
13853    if (json.has("targetDisease"))
13854      res.setTargetDisease(parseCodeableConcept(getJObject(json, "targetDisease")));
13855    if (json.has("contraindicatedVaccineCode")) {
13856      JsonArray array = json.getAsJsonArray("contraindicatedVaccineCode");
13857      for (int i = 0; i < array.size(); i++) {
13858        res.getContraindicatedVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13859      }
13860    };
13861    if (json.has("forecastStatus"))
13862      res.setForecastStatus(parseCodeableConcept(getJObject(json, "forecastStatus")));
13863    if (json.has("forecastReason")) {
13864      JsonArray array = json.getAsJsonArray("forecastReason");
13865      for (int i = 0; i < array.size(); i++) {
13866        res.getForecastReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13867      }
13868    };
13869    if (json.has("dateCriterion")) {
13870      JsonArray array = json.getAsJsonArray("dateCriterion");
13871      for (int i = 0; i < array.size(); i++) {
13872        res.getDateCriterion().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(array.get(i).getAsJsonObject(), owner));
13873      }
13874    };
13875    if (json.has("description"))
13876      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13877    if (json.has("_description"))
13878      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13879    if (json.has("series"))
13880      res.setSeriesElement(parseString(json.get("series").getAsString()));
13881    if (json.has("_series"))
13882      parseElementProperties(getJObject(json, "_series"), res.getSeriesElement());
13883    Type doseNumber = parseType("doseNumber", json);
13884    if (doseNumber != null)
13885      res.setDoseNumber(doseNumber);
13886    Type seriesDoses = parseType("seriesDoses", json);
13887    if (seriesDoses != null)
13888      res.setSeriesDoses(seriesDoses);
13889    if (json.has("supportingImmunization")) {
13890      JsonArray array = json.getAsJsonArray("supportingImmunization");
13891      for (int i = 0; i < array.size(); i++) {
13892        res.getSupportingImmunization().add(parseReference(array.get(i).getAsJsonObject()));
13893      }
13894    };
13895    if (json.has("supportingPatientInformation")) {
13896      JsonArray array = json.getAsJsonArray("supportingPatientInformation");
13897      for (int i = 0; i < array.size(); i++) {
13898        res.getSupportingPatientInformation().add(parseReference(array.get(i).getAsJsonObject()));
13899      }
13900    };
13901  }
13902
13903  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
13904    ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent();
13905    parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(json, owner, res);
13906    return res;
13907  }
13908
13909  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res) throws IOException, FHIRFormatError {
13910    parseBackboneElementProperties(json, res);
13911    if (json.has("code"))
13912      res.setCode(parseCodeableConcept(getJObject(json, "code")));
13913    if (json.has("value"))
13914      res.setValueElement(parseDateTime(json.get("value").getAsString()));
13915    if (json.has("_value"))
13916      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
13917  }
13918
13919  protected ImplementationGuide parseImplementationGuide(JsonObject json) throws IOException, FHIRFormatError {
13920    ImplementationGuide res = new ImplementationGuide();
13921    parseImplementationGuideProperties(json, res);
13922    return res;
13923  }
13924
13925  protected void parseImplementationGuideProperties(JsonObject json, ImplementationGuide res) throws IOException, FHIRFormatError {
13926    parseDomainResourceProperties(json, res);
13927    if (json.has("url"))
13928      res.setUrlElement(parseUri(json.get("url").getAsString()));
13929    if (json.has("_url"))
13930      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
13931    if (json.has("version"))
13932      res.setVersionElement(parseString(json.get("version").getAsString()));
13933    if (json.has("_version"))
13934      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
13935    if (json.has("name"))
13936      res.setNameElement(parseString(json.get("name").getAsString()));
13937    if (json.has("_name"))
13938      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
13939    if (json.has("title"))
13940      res.setTitleElement(parseString(json.get("title").getAsString()));
13941    if (json.has("_title"))
13942      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
13943    if (json.has("status"))
13944      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
13945    if (json.has("_status"))
13946      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13947    if (json.has("experimental"))
13948      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
13949    if (json.has("_experimental"))
13950      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
13951    if (json.has("date"))
13952      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13953    if (json.has("_date"))
13954      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
13955    if (json.has("publisher"))
13956      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
13957    if (json.has("_publisher"))
13958      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
13959    if (json.has("contact")) {
13960      JsonArray array = json.getAsJsonArray("contact");
13961      for (int i = 0; i < array.size(); i++) {
13962        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
13963      }
13964    };
13965    if (json.has("description"))
13966      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
13967    if (json.has("_description"))
13968      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13969    if (json.has("useContext")) {
13970      JsonArray array = json.getAsJsonArray("useContext");
13971      for (int i = 0; i < array.size(); i++) {
13972        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
13973      }
13974    };
13975    if (json.has("jurisdiction")) {
13976      JsonArray array = json.getAsJsonArray("jurisdiction");
13977      for (int i = 0; i < array.size(); i++) {
13978        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13979      }
13980    };
13981    if (json.has("copyright"))
13982      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
13983    if (json.has("_copyright"))
13984      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
13985    if (json.has("packageId"))
13986      res.setPackageIdElement(parseId(json.get("packageId").getAsString()));
13987    if (json.has("_packageId"))
13988      parseElementProperties(getJObject(json, "_packageId"), res.getPackageIdElement());
13989    if (json.has("license"))
13990      res.setLicenseElement(parseEnumeration(json.get("license").getAsString(), ImplementationGuide.SPDXLicense.NULL, new ImplementationGuide.SPDXLicenseEnumFactory()));
13991    if (json.has("_license"))
13992      parseElementProperties(getJObject(json, "_license"), res.getLicenseElement());
13993    if (json.has("fhirVersion")) {
13994      JsonArray array = json.getAsJsonArray("fhirVersion");
13995      for (int i = 0; i < array.size(); i++) {
13996        res.getFhirVersion().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
13997      }
13998    };
13999    if (json.has("_fhirVersion")) {
14000      JsonArray array = json.getAsJsonArray("_fhirVersion");
14001      for (int i = 0; i < array.size(); i++) {
14002        if (i == res.getFhirVersion().size())
14003          res.getFhirVersion().add(parseEnumeration(null, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
14004        if (array.get(i) instanceof JsonObject) 
14005          parseElementProperties(array.get(i).getAsJsonObject(), res.getFhirVersion().get(i));
14006      }
14007    };
14008    if (json.has("dependsOn")) {
14009      JsonArray array = json.getAsJsonArray("dependsOn");
14010      for (int i = 0; i < array.size(); i++) {
14011        res.getDependsOn().add(parseImplementationGuideImplementationGuideDependsOnComponent(array.get(i).getAsJsonObject(), res));
14012      }
14013    };
14014    if (json.has("global")) {
14015      JsonArray array = json.getAsJsonArray("global");
14016      for (int i = 0; i < array.size(); i++) {
14017        res.getGlobal().add(parseImplementationGuideImplementationGuideGlobalComponent(array.get(i).getAsJsonObject(), res));
14018      }
14019    };
14020    if (json.has("definition"))
14021      res.setDefinition(parseImplementationGuideImplementationGuideDefinitionComponent(getJObject(json, "definition"), res));
14022    if (json.has("manifest"))
14023      res.setManifest(parseImplementationGuideImplementationGuideManifestComponent(getJObject(json, "manifest"), res));
14024  }
14025
14026  protected ImplementationGuide.ImplementationGuideDependsOnComponent parseImplementationGuideImplementationGuideDependsOnComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14027    ImplementationGuide.ImplementationGuideDependsOnComponent res = new ImplementationGuide.ImplementationGuideDependsOnComponent();
14028    parseImplementationGuideImplementationGuideDependsOnComponentProperties(json, owner, res);
14029    return res;
14030  }
14031
14032  protected void parseImplementationGuideImplementationGuideDependsOnComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDependsOnComponent res) throws IOException, FHIRFormatError {
14033    parseBackboneElementProperties(json, res);
14034    if (json.has("uri"))
14035      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
14036    if (json.has("_uri"))
14037      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
14038    if (json.has("packageId"))
14039      res.setPackageIdElement(parseId(json.get("packageId").getAsString()));
14040    if (json.has("_packageId"))
14041      parseElementProperties(getJObject(json, "_packageId"), res.getPackageIdElement());
14042    if (json.has("version"))
14043      res.setVersionElement(parseString(json.get("version").getAsString()));
14044    if (json.has("_version"))
14045      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
14046  }
14047
14048  protected ImplementationGuide.ImplementationGuideGlobalComponent parseImplementationGuideImplementationGuideGlobalComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14049    ImplementationGuide.ImplementationGuideGlobalComponent res = new ImplementationGuide.ImplementationGuideGlobalComponent();
14050    parseImplementationGuideImplementationGuideGlobalComponentProperties(json, owner, res);
14051    return res;
14052  }
14053
14054  protected void parseImplementationGuideImplementationGuideGlobalComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideGlobalComponent res) throws IOException, FHIRFormatError {
14055    parseBackboneElementProperties(json, res);
14056    if (json.has("type"))
14057      res.setTypeElement(parseCode(json.get("type").getAsString()));
14058    if (json.has("_type"))
14059      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
14060    if (json.has("profile"))
14061      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
14062    if (json.has("_profile"))
14063      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
14064  }
14065
14066  protected ImplementationGuide.ImplementationGuideDefinitionComponent parseImplementationGuideImplementationGuideDefinitionComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14067    ImplementationGuide.ImplementationGuideDefinitionComponent res = new ImplementationGuide.ImplementationGuideDefinitionComponent();
14068    parseImplementationGuideImplementationGuideDefinitionComponentProperties(json, owner, res);
14069    return res;
14070  }
14071
14072  protected void parseImplementationGuideImplementationGuideDefinitionComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionComponent res) throws IOException, FHIRFormatError {
14073    parseBackboneElementProperties(json, res);
14074    if (json.has("grouping")) {
14075      JsonArray array = json.getAsJsonArray("grouping");
14076      for (int i = 0; i < array.size(); i++) {
14077        res.getGrouping().add(parseImplementationGuideImplementationGuideDefinitionGroupingComponent(array.get(i).getAsJsonObject(), owner));
14078      }
14079    };
14080    if (json.has("resource")) {
14081      JsonArray array = json.getAsJsonArray("resource");
14082      for (int i = 0; i < array.size(); i++) {
14083        res.getResource().add(parseImplementationGuideImplementationGuideDefinitionResourceComponent(array.get(i).getAsJsonObject(), owner));
14084      }
14085    };
14086    if (json.has("page"))
14087      res.setPage(parseImplementationGuideImplementationGuideDefinitionPageComponent(getJObject(json, "page"), owner));
14088    if (json.has("parameter")) {
14089      JsonArray array = json.getAsJsonArray("parameter");
14090      for (int i = 0; i < array.size(); i++) {
14091        res.getParameter().add(parseImplementationGuideImplementationGuideDefinitionParameterComponent(array.get(i).getAsJsonObject(), owner));
14092      }
14093    };
14094    if (json.has("template")) {
14095      JsonArray array = json.getAsJsonArray("template");
14096      for (int i = 0; i < array.size(); i++) {
14097        res.getTemplate().add(parseImplementationGuideImplementationGuideDefinitionTemplateComponent(array.get(i).getAsJsonObject(), owner));
14098      }
14099    };
14100  }
14101
14102  protected ImplementationGuide.ImplementationGuideDefinitionGroupingComponent parseImplementationGuideImplementationGuideDefinitionGroupingComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14103    ImplementationGuide.ImplementationGuideDefinitionGroupingComponent res = new ImplementationGuide.ImplementationGuideDefinitionGroupingComponent();
14104    parseImplementationGuideImplementationGuideDefinitionGroupingComponentProperties(json, owner, res);
14105    return res;
14106  }
14107
14108  protected void parseImplementationGuideImplementationGuideDefinitionGroupingComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionGroupingComponent res) throws IOException, FHIRFormatError {
14109    parseBackboneElementProperties(json, res);
14110    if (json.has("name"))
14111      res.setNameElement(parseString(json.get("name").getAsString()));
14112    if (json.has("_name"))
14113      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14114    if (json.has("description"))
14115      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14116    if (json.has("_description"))
14117      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14118  }
14119
14120  protected ImplementationGuide.ImplementationGuideDefinitionResourceComponent parseImplementationGuideImplementationGuideDefinitionResourceComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14121    ImplementationGuide.ImplementationGuideDefinitionResourceComponent res = new ImplementationGuide.ImplementationGuideDefinitionResourceComponent();
14122    parseImplementationGuideImplementationGuideDefinitionResourceComponentProperties(json, owner, res);
14123    return res;
14124  }
14125
14126  protected void parseImplementationGuideImplementationGuideDefinitionResourceComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionResourceComponent res) throws IOException, FHIRFormatError {
14127    parseBackboneElementProperties(json, res);
14128    if (json.has("reference"))
14129      res.setReference(parseReference(getJObject(json, "reference")));
14130    if (json.has("fhirVersion")) {
14131      JsonArray array = json.getAsJsonArray("fhirVersion");
14132      for (int i = 0; i < array.size(); i++) {
14133        res.getFhirVersion().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
14134      }
14135    };
14136    if (json.has("_fhirVersion")) {
14137      JsonArray array = json.getAsJsonArray("_fhirVersion");
14138      for (int i = 0; i < array.size(); i++) {
14139        if (i == res.getFhirVersion().size())
14140          res.getFhirVersion().add(parseEnumeration(null, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
14141        if (array.get(i) instanceof JsonObject) 
14142          parseElementProperties(array.get(i).getAsJsonObject(), res.getFhirVersion().get(i));
14143      }
14144    };
14145    if (json.has("name"))
14146      res.setNameElement(parseString(json.get("name").getAsString()));
14147    if (json.has("_name"))
14148      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14149    if (json.has("description"))
14150      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14151    if (json.has("_description"))
14152      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14153    Type example = parseType("example", json);
14154    if (example != null)
14155      res.setExample(example);
14156    if (json.has("groupingId"))
14157      res.setGroupingIdElement(parseId(json.get("groupingId").getAsString()));
14158    if (json.has("_groupingId"))
14159      parseElementProperties(getJObject(json, "_groupingId"), res.getGroupingIdElement());
14160  }
14161
14162  protected ImplementationGuide.ImplementationGuideDefinitionPageComponent parseImplementationGuideImplementationGuideDefinitionPageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14163    ImplementationGuide.ImplementationGuideDefinitionPageComponent res = new ImplementationGuide.ImplementationGuideDefinitionPageComponent();
14164    parseImplementationGuideImplementationGuideDefinitionPageComponentProperties(json, owner, res);
14165    return res;
14166  }
14167
14168  protected void parseImplementationGuideImplementationGuideDefinitionPageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionPageComponent res) throws IOException, FHIRFormatError {
14169    parseBackboneElementProperties(json, res);
14170    Type name = parseType("name", json);
14171    if (name != null)
14172      res.setName(name);
14173    if (json.has("title"))
14174      res.setTitleElement(parseString(json.get("title").getAsString()));
14175    if (json.has("_title"))
14176      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
14177    if (json.has("generation"))
14178      res.setGenerationElement(parseEnumeration(json.get("generation").getAsString(), ImplementationGuide.GuidePageGeneration.NULL, new ImplementationGuide.GuidePageGenerationEnumFactory()));
14179    if (json.has("_generation"))
14180      parseElementProperties(getJObject(json, "_generation"), res.getGenerationElement());
14181    if (json.has("page")) {
14182      JsonArray array = json.getAsJsonArray("page");
14183      for (int i = 0; i < array.size(); i++) {
14184        res.getPage().add(parseImplementationGuideImplementationGuideDefinitionPageComponent(array.get(i).getAsJsonObject(), owner));
14185      }
14186    };
14187  }
14188
14189  protected ImplementationGuide.ImplementationGuideDefinitionParameterComponent parseImplementationGuideImplementationGuideDefinitionParameterComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14190    ImplementationGuide.ImplementationGuideDefinitionParameterComponent res = new ImplementationGuide.ImplementationGuideDefinitionParameterComponent();
14191    parseImplementationGuideImplementationGuideDefinitionParameterComponentProperties(json, owner, res);
14192    return res;
14193  }
14194
14195  protected void parseImplementationGuideImplementationGuideDefinitionParameterComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionParameterComponent res) throws IOException, FHIRFormatError {
14196    parseBackboneElementProperties(json, res);
14197    if (json.has("code"))
14198      res.setCodeElement(parseString(json.get("code").getAsString()));
14199    if (json.has("_code"))
14200      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
14201    if (json.has("value"))
14202      res.setValueElement(parseString(json.get("value").getAsString()));
14203    if (json.has("_value"))
14204      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
14205  }
14206
14207  protected ImplementationGuide.ImplementationGuideDefinitionTemplateComponent parseImplementationGuideImplementationGuideDefinitionTemplateComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14208    ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res = new ImplementationGuide.ImplementationGuideDefinitionTemplateComponent();
14209    parseImplementationGuideImplementationGuideDefinitionTemplateComponentProperties(json, owner, res);
14210    return res;
14211  }
14212
14213  protected void parseImplementationGuideImplementationGuideDefinitionTemplateComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res) throws IOException, FHIRFormatError {
14214    parseBackboneElementProperties(json, res);
14215    if (json.has("code"))
14216      res.setCodeElement(parseCode(json.get("code").getAsString()));
14217    if (json.has("_code"))
14218      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
14219    if (json.has("source"))
14220      res.setSourceElement(parseString(json.get("source").getAsString()));
14221    if (json.has("_source"))
14222      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
14223    if (json.has("scope"))
14224      res.setScopeElement(parseString(json.get("scope").getAsString()));
14225    if (json.has("_scope"))
14226      parseElementProperties(getJObject(json, "_scope"), res.getScopeElement());
14227  }
14228
14229  protected ImplementationGuide.ImplementationGuideManifestComponent parseImplementationGuideImplementationGuideManifestComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14230    ImplementationGuide.ImplementationGuideManifestComponent res = new ImplementationGuide.ImplementationGuideManifestComponent();
14231    parseImplementationGuideImplementationGuideManifestComponentProperties(json, owner, res);
14232    return res;
14233  }
14234
14235  protected void parseImplementationGuideImplementationGuideManifestComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideManifestComponent res) throws IOException, FHIRFormatError {
14236    parseBackboneElementProperties(json, res);
14237    if (json.has("rendering"))
14238      res.setRenderingElement(parseUrl(json.get("rendering").getAsString()));
14239    if (json.has("_rendering"))
14240      parseElementProperties(getJObject(json, "_rendering"), res.getRenderingElement());
14241    if (json.has("resource")) {
14242      JsonArray array = json.getAsJsonArray("resource");
14243      for (int i = 0; i < array.size(); i++) {
14244        res.getResource().add(parseImplementationGuideManifestResourceComponent(array.get(i).getAsJsonObject(), owner));
14245      }
14246    };
14247    if (json.has("page")) {
14248      JsonArray array = json.getAsJsonArray("page");
14249      for (int i = 0; i < array.size(); i++) {
14250        res.getPage().add(parseImplementationGuideManifestPageComponent(array.get(i).getAsJsonObject(), owner));
14251      }
14252    };
14253    if (json.has("image")) {
14254      JsonArray array = json.getAsJsonArray("image");
14255      for (int i = 0; i < array.size(); i++) {
14256        res.getImage().add(parseString(array.get(i).getAsString()));
14257      }
14258    };
14259    if (json.has("_image")) {
14260      JsonArray array = json.getAsJsonArray("_image");
14261      for (int i = 0; i < array.size(); i++) {
14262        if (i == res.getImage().size())
14263          res.getImage().add(parseString(null));
14264        if (array.get(i) instanceof JsonObject) 
14265          parseElementProperties(array.get(i).getAsJsonObject(), res.getImage().get(i));
14266      }
14267    };
14268    if (json.has("other")) {
14269      JsonArray array = json.getAsJsonArray("other");
14270      for (int i = 0; i < array.size(); i++) {
14271        res.getOther().add(parseString(array.get(i).getAsString()));
14272      }
14273    };
14274    if (json.has("_other")) {
14275      JsonArray array = json.getAsJsonArray("_other");
14276      for (int i = 0; i < array.size(); i++) {
14277        if (i == res.getOther().size())
14278          res.getOther().add(parseString(null));
14279        if (array.get(i) instanceof JsonObject) 
14280          parseElementProperties(array.get(i).getAsJsonObject(), res.getOther().get(i));
14281      }
14282    };
14283  }
14284
14285  protected ImplementationGuide.ManifestResourceComponent parseImplementationGuideManifestResourceComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14286    ImplementationGuide.ManifestResourceComponent res = new ImplementationGuide.ManifestResourceComponent();
14287    parseImplementationGuideManifestResourceComponentProperties(json, owner, res);
14288    return res;
14289  }
14290
14291  protected void parseImplementationGuideManifestResourceComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ManifestResourceComponent res) throws IOException, FHIRFormatError {
14292    parseBackboneElementProperties(json, res);
14293    if (json.has("reference"))
14294      res.setReference(parseReference(getJObject(json, "reference")));
14295    Type example = parseType("example", json);
14296    if (example != null)
14297      res.setExample(example);
14298    if (json.has("relativePath"))
14299      res.setRelativePathElement(parseUrl(json.get("relativePath").getAsString()));
14300    if (json.has("_relativePath"))
14301      parseElementProperties(getJObject(json, "_relativePath"), res.getRelativePathElement());
14302  }
14303
14304  protected ImplementationGuide.ManifestPageComponent parseImplementationGuideManifestPageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14305    ImplementationGuide.ManifestPageComponent res = new ImplementationGuide.ManifestPageComponent();
14306    parseImplementationGuideManifestPageComponentProperties(json, owner, res);
14307    return res;
14308  }
14309
14310  protected void parseImplementationGuideManifestPageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ManifestPageComponent res) throws IOException, FHIRFormatError {
14311    parseBackboneElementProperties(json, res);
14312    if (json.has("name"))
14313      res.setNameElement(parseString(json.get("name").getAsString()));
14314    if (json.has("_name"))
14315      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14316    if (json.has("title"))
14317      res.setTitleElement(parseString(json.get("title").getAsString()));
14318    if (json.has("_title"))
14319      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
14320    if (json.has("anchor")) {
14321      JsonArray array = json.getAsJsonArray("anchor");
14322      for (int i = 0; i < array.size(); i++) {
14323        res.getAnchor().add(parseString(array.get(i).getAsString()));
14324      }
14325    };
14326    if (json.has("_anchor")) {
14327      JsonArray array = json.getAsJsonArray("_anchor");
14328      for (int i = 0; i < array.size(); i++) {
14329        if (i == res.getAnchor().size())
14330          res.getAnchor().add(parseString(null));
14331        if (array.get(i) instanceof JsonObject) 
14332          parseElementProperties(array.get(i).getAsJsonObject(), res.getAnchor().get(i));
14333      }
14334    };
14335  }
14336
14337  protected InsurancePlan parseInsurancePlan(JsonObject json) throws IOException, FHIRFormatError {
14338    InsurancePlan res = new InsurancePlan();
14339    parseInsurancePlanProperties(json, res);
14340    return res;
14341  }
14342
14343  protected void parseInsurancePlanProperties(JsonObject json, InsurancePlan res) throws IOException, FHIRFormatError {
14344    parseDomainResourceProperties(json, res);
14345    if (json.has("identifier")) {
14346      JsonArray array = json.getAsJsonArray("identifier");
14347      for (int i = 0; i < array.size(); i++) {
14348        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14349      }
14350    };
14351    if (json.has("status"))
14352      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
14353    if (json.has("_status"))
14354      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14355    if (json.has("type")) {
14356      JsonArray array = json.getAsJsonArray("type");
14357      for (int i = 0; i < array.size(); i++) {
14358        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14359      }
14360    };
14361    if (json.has("name"))
14362      res.setNameElement(parseString(json.get("name").getAsString()));
14363    if (json.has("_name"))
14364      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14365    if (json.has("alias")) {
14366      JsonArray array = json.getAsJsonArray("alias");
14367      for (int i = 0; i < array.size(); i++) {
14368        res.getAlias().add(parseString(array.get(i).getAsString()));
14369      }
14370    };
14371    if (json.has("_alias")) {
14372      JsonArray array = json.getAsJsonArray("_alias");
14373      for (int i = 0; i < array.size(); i++) {
14374        if (i == res.getAlias().size())
14375          res.getAlias().add(parseString(null));
14376        if (array.get(i) instanceof JsonObject) 
14377          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
14378      }
14379    };
14380    if (json.has("period"))
14381      res.setPeriod(parsePeriod(getJObject(json, "period")));
14382    if (json.has("ownedBy"))
14383      res.setOwnedBy(parseReference(getJObject(json, "ownedBy")));
14384    if (json.has("administeredBy"))
14385      res.setAdministeredBy(parseReference(getJObject(json, "administeredBy")));
14386    if (json.has("coverageArea")) {
14387      JsonArray array = json.getAsJsonArray("coverageArea");
14388      for (int i = 0; i < array.size(); i++) {
14389        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
14390      }
14391    };
14392    if (json.has("contact")) {
14393      JsonArray array = json.getAsJsonArray("contact");
14394      for (int i = 0; i < array.size(); i++) {
14395        res.getContact().add(parseInsurancePlanInsurancePlanContactComponent(array.get(i).getAsJsonObject(), res));
14396      }
14397    };
14398    if (json.has("endpoint")) {
14399      JsonArray array = json.getAsJsonArray("endpoint");
14400      for (int i = 0; i < array.size(); i++) {
14401        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
14402      }
14403    };
14404    if (json.has("network")) {
14405      JsonArray array = json.getAsJsonArray("network");
14406      for (int i = 0; i < array.size(); i++) {
14407        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
14408      }
14409    };
14410    if (json.has("coverage")) {
14411      JsonArray array = json.getAsJsonArray("coverage");
14412      for (int i = 0; i < array.size(); i++) {
14413        res.getCoverage().add(parseInsurancePlanInsurancePlanCoverageComponent(array.get(i).getAsJsonObject(), res));
14414      }
14415    };
14416    if (json.has("plan")) {
14417      JsonArray array = json.getAsJsonArray("plan");
14418      for (int i = 0; i < array.size(); i++) {
14419        res.getPlan().add(parseInsurancePlanInsurancePlanPlanComponent(array.get(i).getAsJsonObject(), res));
14420      }
14421    };
14422  }
14423
14424  protected InsurancePlan.InsurancePlanContactComponent parseInsurancePlanInsurancePlanContactComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14425    InsurancePlan.InsurancePlanContactComponent res = new InsurancePlan.InsurancePlanContactComponent();
14426    parseInsurancePlanInsurancePlanContactComponentProperties(json, owner, res);
14427    return res;
14428  }
14429
14430  protected void parseInsurancePlanInsurancePlanContactComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanContactComponent res) throws IOException, FHIRFormatError {
14431    parseBackboneElementProperties(json, res);
14432    if (json.has("purpose"))
14433      res.setPurpose(parseCodeableConcept(getJObject(json, "purpose")));
14434    if (json.has("name"))
14435      res.setName(parseHumanName(getJObject(json, "name")));
14436    if (json.has("telecom")) {
14437      JsonArray array = json.getAsJsonArray("telecom");
14438      for (int i = 0; i < array.size(); i++) {
14439        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
14440      }
14441    };
14442    if (json.has("address"))
14443      res.setAddress(parseAddress(getJObject(json, "address")));
14444  }
14445
14446  protected InsurancePlan.InsurancePlanCoverageComponent parseInsurancePlanInsurancePlanCoverageComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14447    InsurancePlan.InsurancePlanCoverageComponent res = new InsurancePlan.InsurancePlanCoverageComponent();
14448    parseInsurancePlanInsurancePlanCoverageComponentProperties(json, owner, res);
14449    return res;
14450  }
14451
14452  protected void parseInsurancePlanInsurancePlanCoverageComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanCoverageComponent res) throws IOException, FHIRFormatError {
14453    parseBackboneElementProperties(json, res);
14454    if (json.has("type"))
14455      res.setType(parseCodeableConcept(getJObject(json, "type")));
14456    if (json.has("network")) {
14457      JsonArray array = json.getAsJsonArray("network");
14458      for (int i = 0; i < array.size(); i++) {
14459        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
14460      }
14461    };
14462    if (json.has("benefit")) {
14463      JsonArray array = json.getAsJsonArray("benefit");
14464      for (int i = 0; i < array.size(); i++) {
14465        res.getBenefit().add(parseInsurancePlanCoverageBenefitComponent(array.get(i).getAsJsonObject(), owner));
14466      }
14467    };
14468  }
14469
14470  protected InsurancePlan.CoverageBenefitComponent parseInsurancePlanCoverageBenefitComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14471    InsurancePlan.CoverageBenefitComponent res = new InsurancePlan.CoverageBenefitComponent();
14472    parseInsurancePlanCoverageBenefitComponentProperties(json, owner, res);
14473    return res;
14474  }
14475
14476  protected void parseInsurancePlanCoverageBenefitComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.CoverageBenefitComponent res) throws IOException, FHIRFormatError {
14477    parseBackboneElementProperties(json, res);
14478    if (json.has("type"))
14479      res.setType(parseCodeableConcept(getJObject(json, "type")));
14480    if (json.has("requirement"))
14481      res.setRequirementElement(parseString(json.get("requirement").getAsString()));
14482    if (json.has("_requirement"))
14483      parseElementProperties(getJObject(json, "_requirement"), res.getRequirementElement());
14484    if (json.has("limit")) {
14485      JsonArray array = json.getAsJsonArray("limit");
14486      for (int i = 0; i < array.size(); i++) {
14487        res.getLimit().add(parseInsurancePlanCoverageBenefitLimitComponent(array.get(i).getAsJsonObject(), owner));
14488      }
14489    };
14490  }
14491
14492  protected InsurancePlan.CoverageBenefitLimitComponent parseInsurancePlanCoverageBenefitLimitComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14493    InsurancePlan.CoverageBenefitLimitComponent res = new InsurancePlan.CoverageBenefitLimitComponent();
14494    parseInsurancePlanCoverageBenefitLimitComponentProperties(json, owner, res);
14495    return res;
14496  }
14497
14498  protected void parseInsurancePlanCoverageBenefitLimitComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.CoverageBenefitLimitComponent res) throws IOException, FHIRFormatError {
14499    parseBackboneElementProperties(json, res);
14500    if (json.has("value"))
14501      res.setValue(parseQuantity(getJObject(json, "value")));
14502    if (json.has("code"))
14503      res.setCode(parseCodeableConcept(getJObject(json, "code")));
14504  }
14505
14506  protected InsurancePlan.InsurancePlanPlanComponent parseInsurancePlanInsurancePlanPlanComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14507    InsurancePlan.InsurancePlanPlanComponent res = new InsurancePlan.InsurancePlanPlanComponent();
14508    parseInsurancePlanInsurancePlanPlanComponentProperties(json, owner, res);
14509    return res;
14510  }
14511
14512  protected void parseInsurancePlanInsurancePlanPlanComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanPlanComponent res) throws IOException, FHIRFormatError {
14513    parseBackboneElementProperties(json, res);
14514    if (json.has("identifier")) {
14515      JsonArray array = json.getAsJsonArray("identifier");
14516      for (int i = 0; i < array.size(); i++) {
14517        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14518      }
14519    };
14520    if (json.has("type"))
14521      res.setType(parseCodeableConcept(getJObject(json, "type")));
14522    if (json.has("coverageArea")) {
14523      JsonArray array = json.getAsJsonArray("coverageArea");
14524      for (int i = 0; i < array.size(); i++) {
14525        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
14526      }
14527    };
14528    if (json.has("network")) {
14529      JsonArray array = json.getAsJsonArray("network");
14530      for (int i = 0; i < array.size(); i++) {
14531        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
14532      }
14533    };
14534    if (json.has("generalCost")) {
14535      JsonArray array = json.getAsJsonArray("generalCost");
14536      for (int i = 0; i < array.size(); i++) {
14537        res.getGeneralCost().add(parseInsurancePlanInsurancePlanPlanGeneralCostComponent(array.get(i).getAsJsonObject(), owner));
14538      }
14539    };
14540    if (json.has("specificCost")) {
14541      JsonArray array = json.getAsJsonArray("specificCost");
14542      for (int i = 0; i < array.size(); i++) {
14543        res.getSpecificCost().add(parseInsurancePlanInsurancePlanPlanSpecificCostComponent(array.get(i).getAsJsonObject(), owner));
14544      }
14545    };
14546  }
14547
14548  protected InsurancePlan.InsurancePlanPlanGeneralCostComponent parseInsurancePlanInsurancePlanPlanGeneralCostComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14549    InsurancePlan.InsurancePlanPlanGeneralCostComponent res = new InsurancePlan.InsurancePlanPlanGeneralCostComponent();
14550    parseInsurancePlanInsurancePlanPlanGeneralCostComponentProperties(json, owner, res);
14551    return res;
14552  }
14553
14554  protected void parseInsurancePlanInsurancePlanPlanGeneralCostComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanPlanGeneralCostComponent res) throws IOException, FHIRFormatError {
14555    parseBackboneElementProperties(json, res);
14556    if (json.has("type"))
14557      res.setType(parseCodeableConcept(getJObject(json, "type")));
14558    if (json.has("groupSize"))
14559      res.setGroupSizeElement(parsePositiveInt(json.get("groupSize").getAsString()));
14560    if (json.has("_groupSize"))
14561      parseElementProperties(getJObject(json, "_groupSize"), res.getGroupSizeElement());
14562    if (json.has("cost"))
14563      res.setCost(parseMoney(getJObject(json, "cost")));
14564    if (json.has("comment"))
14565      res.setCommentElement(parseString(json.get("comment").getAsString()));
14566    if (json.has("_comment"))
14567      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
14568  }
14569
14570  protected InsurancePlan.InsurancePlanPlanSpecificCostComponent parseInsurancePlanInsurancePlanPlanSpecificCostComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14571    InsurancePlan.InsurancePlanPlanSpecificCostComponent res = new InsurancePlan.InsurancePlanPlanSpecificCostComponent();
14572    parseInsurancePlanInsurancePlanPlanSpecificCostComponentProperties(json, owner, res);
14573    return res;
14574  }
14575
14576  protected void parseInsurancePlanInsurancePlanPlanSpecificCostComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanPlanSpecificCostComponent res) throws IOException, FHIRFormatError {
14577    parseBackboneElementProperties(json, res);
14578    if (json.has("category"))
14579      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
14580    if (json.has("benefit")) {
14581      JsonArray array = json.getAsJsonArray("benefit");
14582      for (int i = 0; i < array.size(); i++) {
14583        res.getBenefit().add(parseInsurancePlanPlanBenefitComponent(array.get(i).getAsJsonObject(), owner));
14584      }
14585    };
14586  }
14587
14588  protected InsurancePlan.PlanBenefitComponent parseInsurancePlanPlanBenefitComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14589    InsurancePlan.PlanBenefitComponent res = new InsurancePlan.PlanBenefitComponent();
14590    parseInsurancePlanPlanBenefitComponentProperties(json, owner, res);
14591    return res;
14592  }
14593
14594  protected void parseInsurancePlanPlanBenefitComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.PlanBenefitComponent res) throws IOException, FHIRFormatError {
14595    parseBackboneElementProperties(json, res);
14596    if (json.has("type"))
14597      res.setType(parseCodeableConcept(getJObject(json, "type")));
14598    if (json.has("cost")) {
14599      JsonArray array = json.getAsJsonArray("cost");
14600      for (int i = 0; i < array.size(); i++) {
14601        res.getCost().add(parseInsurancePlanPlanBenefitCostComponent(array.get(i).getAsJsonObject(), owner));
14602      }
14603    };
14604  }
14605
14606  protected InsurancePlan.PlanBenefitCostComponent parseInsurancePlanPlanBenefitCostComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14607    InsurancePlan.PlanBenefitCostComponent res = new InsurancePlan.PlanBenefitCostComponent();
14608    parseInsurancePlanPlanBenefitCostComponentProperties(json, owner, res);
14609    return res;
14610  }
14611
14612  protected void parseInsurancePlanPlanBenefitCostComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.PlanBenefitCostComponent res) throws IOException, FHIRFormatError {
14613    parseBackboneElementProperties(json, res);
14614    if (json.has("type"))
14615      res.setType(parseCodeableConcept(getJObject(json, "type")));
14616    if (json.has("applicability"))
14617      res.setApplicability(parseCodeableConcept(getJObject(json, "applicability")));
14618    if (json.has("qualifiers")) {
14619      JsonArray array = json.getAsJsonArray("qualifiers");
14620      for (int i = 0; i < array.size(); i++) {
14621        res.getQualifiers().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14622      }
14623    };
14624    if (json.has("value"))
14625      res.setValue(parseQuantity(getJObject(json, "value")));
14626  }
14627
14628  protected Invoice parseInvoice(JsonObject json) throws IOException, FHIRFormatError {
14629    Invoice res = new Invoice();
14630    parseInvoiceProperties(json, res);
14631    return res;
14632  }
14633
14634  protected void parseInvoiceProperties(JsonObject json, Invoice res) throws IOException, FHIRFormatError {
14635    parseDomainResourceProperties(json, res);
14636    if (json.has("identifier")) {
14637      JsonArray array = json.getAsJsonArray("identifier");
14638      for (int i = 0; i < array.size(); i++) {
14639        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14640      }
14641    };
14642    if (json.has("status"))
14643      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Invoice.InvoiceStatus.NULL, new Invoice.InvoiceStatusEnumFactory()));
14644    if (json.has("_status"))
14645      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14646    if (json.has("cancelledReason"))
14647      res.setCancelledReasonElement(parseString(json.get("cancelledReason").getAsString()));
14648    if (json.has("_cancelledReason"))
14649      parseElementProperties(getJObject(json, "_cancelledReason"), res.getCancelledReasonElement());
14650    if (json.has("type"))
14651      res.setType(parseCodeableConcept(getJObject(json, "type")));
14652    if (json.has("subject"))
14653      res.setSubject(parseReference(getJObject(json, "subject")));
14654    if (json.has("recipient"))
14655      res.setRecipient(parseReference(getJObject(json, "recipient")));
14656    if (json.has("date"))
14657      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14658    if (json.has("_date"))
14659      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
14660    if (json.has("participant")) {
14661      JsonArray array = json.getAsJsonArray("participant");
14662      for (int i = 0; i < array.size(); i++) {
14663        res.getParticipant().add(parseInvoiceInvoiceParticipantComponent(array.get(i).getAsJsonObject(), res));
14664      }
14665    };
14666    if (json.has("issuer"))
14667      res.setIssuer(parseReference(getJObject(json, "issuer")));
14668    if (json.has("account"))
14669      res.setAccount(parseReference(getJObject(json, "account")));
14670    if (json.has("lineItem")) {
14671      JsonArray array = json.getAsJsonArray("lineItem");
14672      for (int i = 0; i < array.size(); i++) {
14673        res.getLineItem().add(parseInvoiceInvoiceLineItemComponent(array.get(i).getAsJsonObject(), res));
14674      }
14675    };
14676    if (json.has("totalPriceComponent")) {
14677      JsonArray array = json.getAsJsonArray("totalPriceComponent");
14678      for (int i = 0; i < array.size(); i++) {
14679        res.getTotalPriceComponent().add(parseInvoiceInvoiceLineItemPriceComponentComponent(array.get(i).getAsJsonObject(), res));
14680      }
14681    };
14682    if (json.has("totalNet"))
14683      res.setTotalNet(parseMoney(getJObject(json, "totalNet")));
14684    if (json.has("totalGross"))
14685      res.setTotalGross(parseMoney(getJObject(json, "totalGross")));
14686    if (json.has("paymentTerms"))
14687      res.setPaymentTermsElement(parseMarkdown(json.get("paymentTerms").getAsString()));
14688    if (json.has("_paymentTerms"))
14689      parseElementProperties(getJObject(json, "_paymentTerms"), res.getPaymentTermsElement());
14690    if (json.has("note")) {
14691      JsonArray array = json.getAsJsonArray("note");
14692      for (int i = 0; i < array.size(); i++) {
14693        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14694      }
14695    };
14696  }
14697
14698  protected Invoice.InvoiceParticipantComponent parseInvoiceInvoiceParticipantComponent(JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
14699    Invoice.InvoiceParticipantComponent res = new Invoice.InvoiceParticipantComponent();
14700    parseInvoiceInvoiceParticipantComponentProperties(json, owner, res);
14701    return res;
14702  }
14703
14704  protected void parseInvoiceInvoiceParticipantComponentProperties(JsonObject json, Invoice owner, Invoice.InvoiceParticipantComponent res) throws IOException, FHIRFormatError {
14705    parseBackboneElementProperties(json, res);
14706    if (json.has("role"))
14707      res.setRole(parseCodeableConcept(getJObject(json, "role")));
14708    if (json.has("actor"))
14709      res.setActor(parseReference(getJObject(json, "actor")));
14710  }
14711
14712  protected Invoice.InvoiceLineItemComponent parseInvoiceInvoiceLineItemComponent(JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
14713    Invoice.InvoiceLineItemComponent res = new Invoice.InvoiceLineItemComponent();
14714    parseInvoiceInvoiceLineItemComponentProperties(json, owner, res);
14715    return res;
14716  }
14717
14718  protected void parseInvoiceInvoiceLineItemComponentProperties(JsonObject json, Invoice owner, Invoice.InvoiceLineItemComponent res) throws IOException, FHIRFormatError {
14719    parseBackboneElementProperties(json, res);
14720    if (json.has("sequence"))
14721      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
14722    if (json.has("_sequence"))
14723      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
14724    Type chargeItem = parseType("chargeItem", json);
14725    if (chargeItem != null)
14726      res.setChargeItem(chargeItem);
14727    if (json.has("priceComponent")) {
14728      JsonArray array = json.getAsJsonArray("priceComponent");
14729      for (int i = 0; i < array.size(); i++) {
14730        res.getPriceComponent().add(parseInvoiceInvoiceLineItemPriceComponentComponent(array.get(i).getAsJsonObject(), owner));
14731      }
14732    };
14733  }
14734
14735  protected Invoice.InvoiceLineItemPriceComponentComponent parseInvoiceInvoiceLineItemPriceComponentComponent(JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
14736    Invoice.InvoiceLineItemPriceComponentComponent res = new Invoice.InvoiceLineItemPriceComponentComponent();
14737    parseInvoiceInvoiceLineItemPriceComponentComponentProperties(json, owner, res);
14738    return res;
14739  }
14740
14741  protected void parseInvoiceInvoiceLineItemPriceComponentComponentProperties(JsonObject json, Invoice owner, Invoice.InvoiceLineItemPriceComponentComponent res) throws IOException, FHIRFormatError {
14742    parseBackboneElementProperties(json, res);
14743    if (json.has("type"))
14744      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Invoice.InvoicePriceComponentType.NULL, new Invoice.InvoicePriceComponentTypeEnumFactory()));
14745    if (json.has("_type"))
14746      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
14747    if (json.has("code"))
14748      res.setCode(parseCodeableConcept(getJObject(json, "code")));
14749    if (json.has("factor"))
14750      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
14751    if (json.has("_factor"))
14752      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
14753    if (json.has("amount"))
14754      res.setAmount(parseMoney(getJObject(json, "amount")));
14755  }
14756
14757  protected Library parseLibrary(JsonObject json) throws IOException, FHIRFormatError {
14758    Library res = new Library();
14759    parseLibraryProperties(json, res);
14760    return res;
14761  }
14762
14763  protected void parseLibraryProperties(JsonObject json, Library res) throws IOException, FHIRFormatError {
14764    parseDomainResourceProperties(json, res);
14765    if (json.has("url"))
14766      res.setUrlElement(parseUri(json.get("url").getAsString()));
14767    if (json.has("_url"))
14768      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
14769    if (json.has("identifier")) {
14770      JsonArray array = json.getAsJsonArray("identifier");
14771      for (int i = 0; i < array.size(); i++) {
14772        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14773      }
14774    };
14775    if (json.has("version"))
14776      res.setVersionElement(parseString(json.get("version").getAsString()));
14777    if (json.has("_version"))
14778      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
14779    if (json.has("name"))
14780      res.setNameElement(parseString(json.get("name").getAsString()));
14781    if (json.has("_name"))
14782      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14783    if (json.has("title"))
14784      res.setTitleElement(parseString(json.get("title").getAsString()));
14785    if (json.has("_title"))
14786      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
14787    if (json.has("subtitle"))
14788      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
14789    if (json.has("_subtitle"))
14790      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
14791    if (json.has("status"))
14792      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
14793    if (json.has("_status"))
14794      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14795    if (json.has("experimental"))
14796      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
14797    if (json.has("_experimental"))
14798      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
14799    if (json.has("type"))
14800      res.setType(parseCodeableConcept(getJObject(json, "type")));
14801    Type subject = parseType("subject", json);
14802    if (subject != null)
14803      res.setSubject(subject);
14804    if (json.has("date"))
14805      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14806    if (json.has("_date"))
14807      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
14808    if (json.has("publisher"))
14809      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
14810    if (json.has("_publisher"))
14811      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
14812    if (json.has("contact")) {
14813      JsonArray array = json.getAsJsonArray("contact");
14814      for (int i = 0; i < array.size(); i++) {
14815        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
14816      }
14817    };
14818    if (json.has("description"))
14819      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
14820    if (json.has("_description"))
14821      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14822    if (json.has("useContext")) {
14823      JsonArray array = json.getAsJsonArray("useContext");
14824      for (int i = 0; i < array.size(); i++) {
14825        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
14826      }
14827    };
14828    if (json.has("jurisdiction")) {
14829      JsonArray array = json.getAsJsonArray("jurisdiction");
14830      for (int i = 0; i < array.size(); i++) {
14831        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14832      }
14833    };
14834    if (json.has("purpose"))
14835      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
14836    if (json.has("_purpose"))
14837      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
14838    if (json.has("usage"))
14839      res.setUsageElement(parseString(json.get("usage").getAsString()));
14840    if (json.has("_usage"))
14841      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
14842    if (json.has("copyright"))
14843      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
14844    if (json.has("_copyright"))
14845      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
14846    if (json.has("approvalDate"))
14847      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
14848    if (json.has("_approvalDate"))
14849      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
14850    if (json.has("lastReviewDate"))
14851      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
14852    if (json.has("_lastReviewDate"))
14853      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
14854    if (json.has("effectivePeriod"))
14855      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
14856    if (json.has("topic")) {
14857      JsonArray array = json.getAsJsonArray("topic");
14858      for (int i = 0; i < array.size(); i++) {
14859        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14860      }
14861    };
14862    if (json.has("author")) {
14863      JsonArray array = json.getAsJsonArray("author");
14864      for (int i = 0; i < array.size(); i++) {
14865        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
14866      }
14867    };
14868    if (json.has("editor")) {
14869      JsonArray array = json.getAsJsonArray("editor");
14870      for (int i = 0; i < array.size(); i++) {
14871        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
14872      }
14873    };
14874    if (json.has("reviewer")) {
14875      JsonArray array = json.getAsJsonArray("reviewer");
14876      for (int i = 0; i < array.size(); i++) {
14877        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
14878      }
14879    };
14880    if (json.has("endorser")) {
14881      JsonArray array = json.getAsJsonArray("endorser");
14882      for (int i = 0; i < array.size(); i++) {
14883        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
14884      }
14885    };
14886    if (json.has("relatedArtifact")) {
14887      JsonArray array = json.getAsJsonArray("relatedArtifact");
14888      for (int i = 0; i < array.size(); i++) {
14889        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
14890      }
14891    };
14892    if (json.has("parameter")) {
14893      JsonArray array = json.getAsJsonArray("parameter");
14894      for (int i = 0; i < array.size(); i++) {
14895        res.getParameter().add(parseParameterDefinition(array.get(i).getAsJsonObject()));
14896      }
14897    };
14898    if (json.has("dataRequirement")) {
14899      JsonArray array = json.getAsJsonArray("dataRequirement");
14900      for (int i = 0; i < array.size(); i++) {
14901        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
14902      }
14903    };
14904    if (json.has("content")) {
14905      JsonArray array = json.getAsJsonArray("content");
14906      for (int i = 0; i < array.size(); i++) {
14907        res.getContent().add(parseAttachment(array.get(i).getAsJsonObject()));
14908      }
14909    };
14910  }
14911
14912  protected Linkage parseLinkage(JsonObject json) throws IOException, FHIRFormatError {
14913    Linkage res = new Linkage();
14914    parseLinkageProperties(json, res);
14915    return res;
14916  }
14917
14918  protected void parseLinkageProperties(JsonObject json, Linkage res) throws IOException, FHIRFormatError {
14919    parseDomainResourceProperties(json, res);
14920    if (json.has("active"))
14921      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
14922    if (json.has("_active"))
14923      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
14924    if (json.has("author"))
14925      res.setAuthor(parseReference(getJObject(json, "author")));
14926    if (json.has("item")) {
14927      JsonArray array = json.getAsJsonArray("item");
14928      for (int i = 0; i < array.size(); i++) {
14929        res.getItem().add(parseLinkageLinkageItemComponent(array.get(i).getAsJsonObject(), res));
14930      }
14931    };
14932  }
14933
14934  protected Linkage.LinkageItemComponent parseLinkageLinkageItemComponent(JsonObject json, Linkage owner) throws IOException, FHIRFormatError {
14935    Linkage.LinkageItemComponent res = new Linkage.LinkageItemComponent();
14936    parseLinkageLinkageItemComponentProperties(json, owner, res);
14937    return res;
14938  }
14939
14940  protected void parseLinkageLinkageItemComponentProperties(JsonObject json, Linkage owner, Linkage.LinkageItemComponent res) throws IOException, FHIRFormatError {
14941    parseBackboneElementProperties(json, res);
14942    if (json.has("type"))
14943      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Linkage.LinkageType.NULL, new Linkage.LinkageTypeEnumFactory()));
14944    if (json.has("_type"))
14945      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
14946    if (json.has("resource"))
14947      res.setResource(parseReference(getJObject(json, "resource")));
14948  }
14949
14950  protected ListResource parseListResource(JsonObject json) throws IOException, FHIRFormatError {
14951    ListResource res = new ListResource();
14952    parseListResourceProperties(json, res);
14953    return res;
14954  }
14955
14956  protected void parseListResourceProperties(JsonObject json, ListResource res) throws IOException, FHIRFormatError {
14957    parseDomainResourceProperties(json, res);
14958    if (json.has("identifier")) {
14959      JsonArray array = json.getAsJsonArray("identifier");
14960      for (int i = 0; i < array.size(); i++) {
14961        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14962      }
14963    };
14964    if (json.has("status"))
14965      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ListResource.ListStatus.NULL, new ListResource.ListStatusEnumFactory()));
14966    if (json.has("_status"))
14967      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14968    if (json.has("mode"))
14969      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ListResource.ListMode.NULL, new ListResource.ListModeEnumFactory()));
14970    if (json.has("_mode"))
14971      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
14972    if (json.has("title"))
14973      res.setTitleElement(parseString(json.get("title").getAsString()));
14974    if (json.has("_title"))
14975      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
14976    if (json.has("code"))
14977      res.setCode(parseCodeableConcept(getJObject(json, "code")));
14978    if (json.has("subject"))
14979      res.setSubject(parseReference(getJObject(json, "subject")));
14980    if (json.has("encounter"))
14981      res.setEncounter(parseReference(getJObject(json, "encounter")));
14982    if (json.has("date"))
14983      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14984    if (json.has("_date"))
14985      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
14986    if (json.has("source"))
14987      res.setSource(parseReference(getJObject(json, "source")));
14988    if (json.has("orderedBy"))
14989      res.setOrderedBy(parseCodeableConcept(getJObject(json, "orderedBy")));
14990    if (json.has("note")) {
14991      JsonArray array = json.getAsJsonArray("note");
14992      for (int i = 0; i < array.size(); i++) {
14993        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14994      }
14995    };
14996    if (json.has("entry")) {
14997      JsonArray array = json.getAsJsonArray("entry");
14998      for (int i = 0; i < array.size(); i++) {
14999        res.getEntry().add(parseListResourceListEntryComponent(array.get(i).getAsJsonObject(), res));
15000      }
15001    };
15002    if (json.has("emptyReason"))
15003      res.setEmptyReason(parseCodeableConcept(getJObject(json, "emptyReason")));
15004  }
15005
15006  protected ListResource.ListEntryComponent parseListResourceListEntryComponent(JsonObject json, ListResource owner) throws IOException, FHIRFormatError {
15007    ListResource.ListEntryComponent res = new ListResource.ListEntryComponent();
15008    parseListResourceListEntryComponentProperties(json, owner, res);
15009    return res;
15010  }
15011
15012  protected void parseListResourceListEntryComponentProperties(JsonObject json, ListResource owner, ListResource.ListEntryComponent res) throws IOException, FHIRFormatError {
15013    parseBackboneElementProperties(json, res);
15014    if (json.has("flag"))
15015      res.setFlag(parseCodeableConcept(getJObject(json, "flag")));
15016    if (json.has("deleted"))
15017      res.setDeletedElement(parseBoolean(json.get("deleted").getAsBoolean()));
15018    if (json.has("_deleted"))
15019      parseElementProperties(getJObject(json, "_deleted"), res.getDeletedElement());
15020    if (json.has("date"))
15021      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15022    if (json.has("_date"))
15023      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
15024    if (json.has("item"))
15025      res.setItem(parseReference(getJObject(json, "item")));
15026  }
15027
15028  protected Location parseLocation(JsonObject json) throws IOException, FHIRFormatError {
15029    Location res = new Location();
15030    parseLocationProperties(json, res);
15031    return res;
15032  }
15033
15034  protected void parseLocationProperties(JsonObject json, Location res) throws IOException, FHIRFormatError {
15035    parseDomainResourceProperties(json, res);
15036    if (json.has("identifier")) {
15037      JsonArray array = json.getAsJsonArray("identifier");
15038      for (int i = 0; i < array.size(); i++) {
15039        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15040      }
15041    };
15042    if (json.has("status"))
15043      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Location.LocationStatus.NULL, new Location.LocationStatusEnumFactory()));
15044    if (json.has("_status"))
15045      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15046    if (json.has("operationalStatus"))
15047      res.setOperationalStatus(parseCoding(getJObject(json, "operationalStatus")));
15048    if (json.has("name"))
15049      res.setNameElement(parseString(json.get("name").getAsString()));
15050    if (json.has("_name"))
15051      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
15052    if (json.has("alias")) {
15053      JsonArray array = json.getAsJsonArray("alias");
15054      for (int i = 0; i < array.size(); i++) {
15055        res.getAlias().add(parseString(array.get(i).getAsString()));
15056      }
15057    };
15058    if (json.has("_alias")) {
15059      JsonArray array = json.getAsJsonArray("_alias");
15060      for (int i = 0; i < array.size(); i++) {
15061        if (i == res.getAlias().size())
15062          res.getAlias().add(parseString(null));
15063        if (array.get(i) instanceof JsonObject) 
15064          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
15065      }
15066    };
15067    if (json.has("description"))
15068      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15069    if (json.has("_description"))
15070      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15071    if (json.has("mode"))
15072      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Location.LocationMode.NULL, new Location.LocationModeEnumFactory()));
15073    if (json.has("_mode"))
15074      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
15075    if (json.has("type")) {
15076      JsonArray array = json.getAsJsonArray("type");
15077      for (int i = 0; i < array.size(); i++) {
15078        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15079      }
15080    };
15081    if (json.has("telecom")) {
15082      JsonArray array = json.getAsJsonArray("telecom");
15083      for (int i = 0; i < array.size(); i++) {
15084        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
15085      }
15086    };
15087    if (json.has("address"))
15088      res.setAddress(parseAddress(getJObject(json, "address")));
15089    if (json.has("physicalType"))
15090      res.setPhysicalType(parseCodeableConcept(getJObject(json, "physicalType")));
15091    if (json.has("position"))
15092      res.setPosition(parseLocationLocationPositionComponent(getJObject(json, "position"), res));
15093    if (json.has("managingOrganization"))
15094      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
15095    if (json.has("partOf"))
15096      res.setPartOf(parseReference(getJObject(json, "partOf")));
15097    if (json.has("hoursOfOperation")) {
15098      JsonArray array = json.getAsJsonArray("hoursOfOperation");
15099      for (int i = 0; i < array.size(); i++) {
15100        res.getHoursOfOperation().add(parseLocationLocationHoursOfOperationComponent(array.get(i).getAsJsonObject(), res));
15101      }
15102    };
15103    if (json.has("availabilityExceptions"))
15104      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
15105    if (json.has("_availabilityExceptions"))
15106      parseElementProperties(getJObject(json, "_availabilityExceptions"), res.getAvailabilityExceptionsElement());
15107    if (json.has("endpoint")) {
15108      JsonArray array = json.getAsJsonArray("endpoint");
15109      for (int i = 0; i < array.size(); i++) {
15110        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
15111      }
15112    };
15113  }
15114
15115  protected Location.LocationPositionComponent parseLocationLocationPositionComponent(JsonObject json, Location owner) throws IOException, FHIRFormatError {
15116    Location.LocationPositionComponent res = new Location.LocationPositionComponent();
15117    parseLocationLocationPositionComponentProperties(json, owner, res);
15118    return res;
15119  }
15120
15121  protected void parseLocationLocationPositionComponentProperties(JsonObject json, Location owner, Location.LocationPositionComponent res) throws IOException, FHIRFormatError {
15122    parseBackboneElementProperties(json, res);
15123    if (json.has("longitude"))
15124      res.setLongitudeElement(parseDecimal(json.get("longitude").getAsBigDecimal()));
15125    if (json.has("_longitude"))
15126      parseElementProperties(getJObject(json, "_longitude"), res.getLongitudeElement());
15127    if (json.has("latitude"))
15128      res.setLatitudeElement(parseDecimal(json.get("latitude").getAsBigDecimal()));
15129    if (json.has("_latitude"))
15130      parseElementProperties(getJObject(json, "_latitude"), res.getLatitudeElement());
15131    if (json.has("altitude"))
15132      res.setAltitudeElement(parseDecimal(json.get("altitude").getAsBigDecimal()));
15133    if (json.has("_altitude"))
15134      parseElementProperties(getJObject(json, "_altitude"), res.getAltitudeElement());
15135  }
15136
15137  protected Location.LocationHoursOfOperationComponent parseLocationLocationHoursOfOperationComponent(JsonObject json, Location owner) throws IOException, FHIRFormatError {
15138    Location.LocationHoursOfOperationComponent res = new Location.LocationHoursOfOperationComponent();
15139    parseLocationLocationHoursOfOperationComponentProperties(json, owner, res);
15140    return res;
15141  }
15142
15143  protected void parseLocationLocationHoursOfOperationComponentProperties(JsonObject json, Location owner, Location.LocationHoursOfOperationComponent res) throws IOException, FHIRFormatError {
15144    parseBackboneElementProperties(json, res);
15145    if (json.has("daysOfWeek")) {
15146      JsonArray array = json.getAsJsonArray("daysOfWeek");
15147      for (int i = 0; i < array.size(); i++) {
15148        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), Location.DaysOfWeek.NULL, new Location.DaysOfWeekEnumFactory()));
15149      }
15150    };
15151    if (json.has("_daysOfWeek")) {
15152      JsonArray array = json.getAsJsonArray("_daysOfWeek");
15153      for (int i = 0; i < array.size(); i++) {
15154        if (i == res.getDaysOfWeek().size())
15155          res.getDaysOfWeek().add(parseEnumeration(null, Location.DaysOfWeek.NULL, new Location.DaysOfWeekEnumFactory()));
15156        if (array.get(i) instanceof JsonObject) 
15157          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
15158      }
15159    };
15160    if (json.has("allDay"))
15161      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
15162    if (json.has("_allDay"))
15163      parseElementProperties(getJObject(json, "_allDay"), res.getAllDayElement());
15164    if (json.has("openingTime"))
15165      res.setOpeningTimeElement(parseTime(json.get("openingTime").getAsString()));
15166    if (json.has("_openingTime"))
15167      parseElementProperties(getJObject(json, "_openingTime"), res.getOpeningTimeElement());
15168    if (json.has("closingTime"))
15169      res.setClosingTimeElement(parseTime(json.get("closingTime").getAsString()));
15170    if (json.has("_closingTime"))
15171      parseElementProperties(getJObject(json, "_closingTime"), res.getClosingTimeElement());
15172  }
15173
15174  protected Measure parseMeasure(JsonObject json) throws IOException, FHIRFormatError {
15175    Measure res = new Measure();
15176    parseMeasureProperties(json, res);
15177    return res;
15178  }
15179
15180  protected void parseMeasureProperties(JsonObject json, Measure res) throws IOException, FHIRFormatError {
15181    parseDomainResourceProperties(json, res);
15182    if (json.has("url"))
15183      res.setUrlElement(parseUri(json.get("url").getAsString()));
15184    if (json.has("_url"))
15185      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
15186    if (json.has("identifier")) {
15187      JsonArray array = json.getAsJsonArray("identifier");
15188      for (int i = 0; i < array.size(); i++) {
15189        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15190      }
15191    };
15192    if (json.has("version"))
15193      res.setVersionElement(parseString(json.get("version").getAsString()));
15194    if (json.has("_version"))
15195      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
15196    if (json.has("name"))
15197      res.setNameElement(parseString(json.get("name").getAsString()));
15198    if (json.has("_name"))
15199      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
15200    if (json.has("title"))
15201      res.setTitleElement(parseString(json.get("title").getAsString()));
15202    if (json.has("_title"))
15203      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
15204    if (json.has("subtitle"))
15205      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
15206    if (json.has("_subtitle"))
15207      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
15208    if (json.has("status"))
15209      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
15210    if (json.has("_status"))
15211      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15212    if (json.has("experimental"))
15213      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
15214    if (json.has("_experimental"))
15215      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
15216    Type subject = parseType("subject", json);
15217    if (subject != null)
15218      res.setSubject(subject);
15219    if (json.has("date"))
15220      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15221    if (json.has("_date"))
15222      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
15223    if (json.has("publisher"))
15224      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
15225    if (json.has("_publisher"))
15226      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
15227    if (json.has("contact")) {
15228      JsonArray array = json.getAsJsonArray("contact");
15229      for (int i = 0; i < array.size(); i++) {
15230        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
15231      }
15232    };
15233    if (json.has("description"))
15234      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15235    if (json.has("_description"))
15236      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15237    if (json.has("useContext")) {
15238      JsonArray array = json.getAsJsonArray("useContext");
15239      for (int i = 0; i < array.size(); i++) {
15240        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
15241      }
15242    };
15243    if (json.has("jurisdiction")) {
15244      JsonArray array = json.getAsJsonArray("jurisdiction");
15245      for (int i = 0; i < array.size(); i++) {
15246        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15247      }
15248    };
15249    if (json.has("purpose"))
15250      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
15251    if (json.has("_purpose"))
15252      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
15253    if (json.has("usage"))
15254      res.setUsageElement(parseString(json.get("usage").getAsString()));
15255    if (json.has("_usage"))
15256      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
15257    if (json.has("copyright"))
15258      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
15259    if (json.has("_copyright"))
15260      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
15261    if (json.has("approvalDate"))
15262      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
15263    if (json.has("_approvalDate"))
15264      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
15265    if (json.has("lastReviewDate"))
15266      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
15267    if (json.has("_lastReviewDate"))
15268      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
15269    if (json.has("effectivePeriod"))
15270      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
15271    if (json.has("topic")) {
15272      JsonArray array = json.getAsJsonArray("topic");
15273      for (int i = 0; i < array.size(); i++) {
15274        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15275      }
15276    };
15277    if (json.has("author")) {
15278      JsonArray array = json.getAsJsonArray("author");
15279      for (int i = 0; i < array.size(); i++) {
15280        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
15281      }
15282    };
15283    if (json.has("editor")) {
15284      JsonArray array = json.getAsJsonArray("editor");
15285      for (int i = 0; i < array.size(); i++) {
15286        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
15287      }
15288    };
15289    if (json.has("reviewer")) {
15290      JsonArray array = json.getAsJsonArray("reviewer");
15291      for (int i = 0; i < array.size(); i++) {
15292        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
15293      }
15294    };
15295    if (json.has("endorser")) {
15296      JsonArray array = json.getAsJsonArray("endorser");
15297      for (int i = 0; i < array.size(); i++) {
15298        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
15299      }
15300    };
15301    if (json.has("relatedArtifact")) {
15302      JsonArray array = json.getAsJsonArray("relatedArtifact");
15303      for (int i = 0; i < array.size(); i++) {
15304        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
15305      }
15306    };
15307    if (json.has("library")) {
15308      JsonArray array = json.getAsJsonArray("library");
15309      for (int i = 0; i < array.size(); i++) {
15310        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
15311      }
15312    };
15313    if (json.has("_library")) {
15314      JsonArray array = json.getAsJsonArray("_library");
15315      for (int i = 0; i < array.size(); i++) {
15316        if (i == res.getLibrary().size())
15317          res.getLibrary().add(parseCanonical(null));
15318        if (array.get(i) instanceof JsonObject) 
15319          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
15320      }
15321    };
15322    if (json.has("disclaimer"))
15323      res.setDisclaimerElement(parseMarkdown(json.get("disclaimer").getAsString()));
15324    if (json.has("_disclaimer"))
15325      parseElementProperties(getJObject(json, "_disclaimer"), res.getDisclaimerElement());
15326    if (json.has("scoring"))
15327      res.setScoring(parseCodeableConcept(getJObject(json, "scoring")));
15328    if (json.has("compositeScoring"))
15329      res.setCompositeScoring(parseCodeableConcept(getJObject(json, "compositeScoring")));
15330    if (json.has("type")) {
15331      JsonArray array = json.getAsJsonArray("type");
15332      for (int i = 0; i < array.size(); i++) {
15333        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15334      }
15335    };
15336    if (json.has("riskAdjustment"))
15337      res.setRiskAdjustmentElement(parseString(json.get("riskAdjustment").getAsString()));
15338    if (json.has("_riskAdjustment"))
15339      parseElementProperties(getJObject(json, "_riskAdjustment"), res.getRiskAdjustmentElement());
15340    if (json.has("rateAggregation"))
15341      res.setRateAggregationElement(parseString(json.get("rateAggregation").getAsString()));
15342    if (json.has("_rateAggregation"))
15343      parseElementProperties(getJObject(json, "_rateAggregation"), res.getRateAggregationElement());
15344    if (json.has("rationale"))
15345      res.setRationaleElement(parseMarkdown(json.get("rationale").getAsString()));
15346    if (json.has("_rationale"))
15347      parseElementProperties(getJObject(json, "_rationale"), res.getRationaleElement());
15348    if (json.has("clinicalRecommendationStatement"))
15349      res.setClinicalRecommendationStatementElement(parseMarkdown(json.get("clinicalRecommendationStatement").getAsString()));
15350    if (json.has("_clinicalRecommendationStatement"))
15351      parseElementProperties(getJObject(json, "_clinicalRecommendationStatement"), res.getClinicalRecommendationStatementElement());
15352    if (json.has("improvementNotation"))
15353      res.setImprovementNotation(parseCodeableConcept(getJObject(json, "improvementNotation")));
15354    if (json.has("definition")) {
15355      JsonArray array = json.getAsJsonArray("definition");
15356      for (int i = 0; i < array.size(); i++) {
15357        res.getDefinition().add(parseMarkdown(array.get(i).getAsString()));
15358      }
15359    };
15360    if (json.has("_definition")) {
15361      JsonArray array = json.getAsJsonArray("_definition");
15362      for (int i = 0; i < array.size(); i++) {
15363        if (i == res.getDefinition().size())
15364          res.getDefinition().add(parseMarkdown(null));
15365        if (array.get(i) instanceof JsonObject) 
15366          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
15367      }
15368    };
15369    if (json.has("guidance"))
15370      res.setGuidanceElement(parseMarkdown(json.get("guidance").getAsString()));
15371    if (json.has("_guidance"))
15372      parseElementProperties(getJObject(json, "_guidance"), res.getGuidanceElement());
15373    if (json.has("group")) {
15374      JsonArray array = json.getAsJsonArray("group");
15375      for (int i = 0; i < array.size(); i++) {
15376        res.getGroup().add(parseMeasureMeasureGroupComponent(array.get(i).getAsJsonObject(), res));
15377      }
15378    };
15379    if (json.has("supplementalData")) {
15380      JsonArray array = json.getAsJsonArray("supplementalData");
15381      for (int i = 0; i < array.size(); i++) {
15382        res.getSupplementalData().add(parseMeasureMeasureSupplementalDataComponent(array.get(i).getAsJsonObject(), res));
15383      }
15384    };
15385  }
15386
15387  protected Measure.MeasureGroupComponent parseMeasureMeasureGroupComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
15388    Measure.MeasureGroupComponent res = new Measure.MeasureGroupComponent();
15389    parseMeasureMeasureGroupComponentProperties(json, owner, res);
15390    return res;
15391  }
15392
15393  protected void parseMeasureMeasureGroupComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupComponent res) throws IOException, FHIRFormatError {
15394    parseBackboneElementProperties(json, res);
15395    if (json.has("code"))
15396      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15397    if (json.has("description"))
15398      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15399    if (json.has("_description"))
15400      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15401    if (json.has("population")) {
15402      JsonArray array = json.getAsJsonArray("population");
15403      for (int i = 0; i < array.size(); i++) {
15404        res.getPopulation().add(parseMeasureMeasureGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
15405      }
15406    };
15407    if (json.has("stratifier")) {
15408      JsonArray array = json.getAsJsonArray("stratifier");
15409      for (int i = 0; i < array.size(); i++) {
15410        res.getStratifier().add(parseMeasureMeasureGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
15411      }
15412    };
15413  }
15414
15415  protected Measure.MeasureGroupPopulationComponent parseMeasureMeasureGroupPopulationComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
15416    Measure.MeasureGroupPopulationComponent res = new Measure.MeasureGroupPopulationComponent();
15417    parseMeasureMeasureGroupPopulationComponentProperties(json, owner, res);
15418    return res;
15419  }
15420
15421  protected void parseMeasureMeasureGroupPopulationComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupPopulationComponent res) throws IOException, FHIRFormatError {
15422    parseBackboneElementProperties(json, res);
15423    if (json.has("code"))
15424      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15425    if (json.has("description"))
15426      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15427    if (json.has("_description"))
15428      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15429    if (json.has("criteria"))
15430      res.setCriteria(parseExpression(getJObject(json, "criteria")));
15431  }
15432
15433  protected Measure.MeasureGroupStratifierComponent parseMeasureMeasureGroupStratifierComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
15434    Measure.MeasureGroupStratifierComponent res = new Measure.MeasureGroupStratifierComponent();
15435    parseMeasureMeasureGroupStratifierComponentProperties(json, owner, res);
15436    return res;
15437  }
15438
15439  protected void parseMeasureMeasureGroupStratifierComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupStratifierComponent res) throws IOException, FHIRFormatError {
15440    parseBackboneElementProperties(json, res);
15441    if (json.has("code"))
15442      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15443    if (json.has("description"))
15444      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15445    if (json.has("_description"))
15446      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15447    if (json.has("criteria"))
15448      res.setCriteria(parseExpression(getJObject(json, "criteria")));
15449    if (json.has("component")) {
15450      JsonArray array = json.getAsJsonArray("component");
15451      for (int i = 0; i < array.size(); i++) {
15452        res.getComponent().add(parseMeasureMeasureGroupStratifierComponentComponent(array.get(i).getAsJsonObject(), owner));
15453      }
15454    };
15455  }
15456
15457  protected Measure.MeasureGroupStratifierComponentComponent parseMeasureMeasureGroupStratifierComponentComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
15458    Measure.MeasureGroupStratifierComponentComponent res = new Measure.MeasureGroupStratifierComponentComponent();
15459    parseMeasureMeasureGroupStratifierComponentComponentProperties(json, owner, res);
15460    return res;
15461  }
15462
15463  protected void parseMeasureMeasureGroupStratifierComponentComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupStratifierComponentComponent res) throws IOException, FHIRFormatError {
15464    parseBackboneElementProperties(json, res);
15465    if (json.has("code"))
15466      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15467    if (json.has("description"))
15468      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15469    if (json.has("_description"))
15470      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15471    if (json.has("criteria"))
15472      res.setCriteria(parseExpression(getJObject(json, "criteria")));
15473  }
15474
15475  protected Measure.MeasureSupplementalDataComponent parseMeasureMeasureSupplementalDataComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
15476    Measure.MeasureSupplementalDataComponent res = new Measure.MeasureSupplementalDataComponent();
15477    parseMeasureMeasureSupplementalDataComponentProperties(json, owner, res);
15478    return res;
15479  }
15480
15481  protected void parseMeasureMeasureSupplementalDataComponentProperties(JsonObject json, Measure owner, Measure.MeasureSupplementalDataComponent res) throws IOException, FHIRFormatError {
15482    parseBackboneElementProperties(json, res);
15483    if (json.has("code"))
15484      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15485    if (json.has("usage")) {
15486      JsonArray array = json.getAsJsonArray("usage");
15487      for (int i = 0; i < array.size(); i++) {
15488        res.getUsage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15489      }
15490    };
15491    if (json.has("description"))
15492      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15493    if (json.has("_description"))
15494      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15495    if (json.has("criteria"))
15496      res.setCriteria(parseExpression(getJObject(json, "criteria")));
15497  }
15498
15499  protected MeasureReport parseMeasureReport(JsonObject json) throws IOException, FHIRFormatError {
15500    MeasureReport res = new MeasureReport();
15501    parseMeasureReportProperties(json, res);
15502    return res;
15503  }
15504
15505  protected void parseMeasureReportProperties(JsonObject json, MeasureReport res) throws IOException, FHIRFormatError {
15506    parseDomainResourceProperties(json, res);
15507    if (json.has("identifier")) {
15508      JsonArray array = json.getAsJsonArray("identifier");
15509      for (int i = 0; i < array.size(); i++) {
15510        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15511      }
15512    };
15513    if (json.has("status"))
15514      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MeasureReport.MeasureReportStatus.NULL, new MeasureReport.MeasureReportStatusEnumFactory()));
15515    if (json.has("_status"))
15516      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15517    if (json.has("type"))
15518      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MeasureReport.MeasureReportType.NULL, new MeasureReport.MeasureReportTypeEnumFactory()));
15519    if (json.has("_type"))
15520      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
15521    if (json.has("measure"))
15522      res.setMeasureElement(parseCanonical(json.get("measure").getAsString()));
15523    if (json.has("_measure"))
15524      parseElementProperties(getJObject(json, "_measure"), res.getMeasureElement());
15525    if (json.has("subject"))
15526      res.setSubject(parseReference(getJObject(json, "subject")));
15527    if (json.has("date"))
15528      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15529    if (json.has("_date"))
15530      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
15531    if (json.has("reporter"))
15532      res.setReporter(parseReference(getJObject(json, "reporter")));
15533    if (json.has("period"))
15534      res.setPeriod(parsePeriod(getJObject(json, "period")));
15535    if (json.has("improvementNotation"))
15536      res.setImprovementNotation(parseCodeableConcept(getJObject(json, "improvementNotation")));
15537    if (json.has("group")) {
15538      JsonArray array = json.getAsJsonArray("group");
15539      for (int i = 0; i < array.size(); i++) {
15540        res.getGroup().add(parseMeasureReportMeasureReportGroupComponent(array.get(i).getAsJsonObject(), res));
15541      }
15542    };
15543    if (json.has("evaluatedResource")) {
15544      JsonArray array = json.getAsJsonArray("evaluatedResource");
15545      for (int i = 0; i < array.size(); i++) {
15546        res.getEvaluatedResource().add(parseReference(array.get(i).getAsJsonObject()));
15547      }
15548    };
15549  }
15550
15551  protected MeasureReport.MeasureReportGroupComponent parseMeasureReportMeasureReportGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
15552    MeasureReport.MeasureReportGroupComponent res = new MeasureReport.MeasureReportGroupComponent();
15553    parseMeasureReportMeasureReportGroupComponentProperties(json, owner, res);
15554    return res;
15555  }
15556
15557  protected void parseMeasureReportMeasureReportGroupComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupComponent res) throws IOException, FHIRFormatError {
15558    parseBackboneElementProperties(json, res);
15559    if (json.has("code"))
15560      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15561    if (json.has("population")) {
15562      JsonArray array = json.getAsJsonArray("population");
15563      for (int i = 0; i < array.size(); i++) {
15564        res.getPopulation().add(parseMeasureReportMeasureReportGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
15565      }
15566    };
15567    if (json.has("measureScore"))
15568      res.setMeasureScore(parseQuantity(getJObject(json, "measureScore")));
15569    if (json.has("stratifier")) {
15570      JsonArray array = json.getAsJsonArray("stratifier");
15571      for (int i = 0; i < array.size(); i++) {
15572        res.getStratifier().add(parseMeasureReportMeasureReportGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
15573      }
15574    };
15575  }
15576
15577  protected MeasureReport.MeasureReportGroupPopulationComponent parseMeasureReportMeasureReportGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
15578    MeasureReport.MeasureReportGroupPopulationComponent res = new MeasureReport.MeasureReportGroupPopulationComponent();
15579    parseMeasureReportMeasureReportGroupPopulationComponentProperties(json, owner, res);
15580    return res;
15581  }
15582
15583  protected void parseMeasureReportMeasureReportGroupPopulationComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupPopulationComponent res) throws IOException, FHIRFormatError {
15584    parseBackboneElementProperties(json, res);
15585    if (json.has("code"))
15586      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15587    if (json.has("count"))
15588      res.setCountElement(parseInteger(json.get("count").getAsLong()));
15589    if (json.has("_count"))
15590      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
15591    if (json.has("subjectResults"))
15592      res.setSubjectResults(parseReference(getJObject(json, "subjectResults")));
15593  }
15594
15595  protected MeasureReport.MeasureReportGroupStratifierComponent parseMeasureReportMeasureReportGroupStratifierComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
15596    MeasureReport.MeasureReportGroupStratifierComponent res = new MeasureReport.MeasureReportGroupStratifierComponent();
15597    parseMeasureReportMeasureReportGroupStratifierComponentProperties(json, owner, res);
15598    return res;
15599  }
15600
15601  protected void parseMeasureReportMeasureReportGroupStratifierComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupStratifierComponent res) throws IOException, FHIRFormatError {
15602    parseBackboneElementProperties(json, res);
15603    if (json.has("code")) {
15604      JsonArray array = json.getAsJsonArray("code");
15605      for (int i = 0; i < array.size(); i++) {
15606        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15607      }
15608    };
15609    if (json.has("stratum")) {
15610      JsonArray array = json.getAsJsonArray("stratum");
15611      for (int i = 0; i < array.size(); i++) {
15612        res.getStratum().add(parseMeasureReportStratifierGroupComponent(array.get(i).getAsJsonObject(), owner));
15613      }
15614    };
15615  }
15616
15617  protected MeasureReport.StratifierGroupComponent parseMeasureReportStratifierGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
15618    MeasureReport.StratifierGroupComponent res = new MeasureReport.StratifierGroupComponent();
15619    parseMeasureReportStratifierGroupComponentProperties(json, owner, res);
15620    return res;
15621  }
15622
15623  protected void parseMeasureReportStratifierGroupComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupComponent res) throws IOException, FHIRFormatError {
15624    parseBackboneElementProperties(json, res);
15625    if (json.has("value"))
15626      res.setValue(parseCodeableConcept(getJObject(json, "value")));
15627    if (json.has("component")) {
15628      JsonArray array = json.getAsJsonArray("component");
15629      for (int i = 0; i < array.size(); i++) {
15630        res.getComponent().add(parseMeasureReportStratifierGroupComponentComponent(array.get(i).getAsJsonObject(), owner));
15631      }
15632    };
15633    if (json.has("population")) {
15634      JsonArray array = json.getAsJsonArray("population");
15635      for (int i = 0; i < array.size(); i++) {
15636        res.getPopulation().add(parseMeasureReportStratifierGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
15637      }
15638    };
15639    if (json.has("measureScore"))
15640      res.setMeasureScore(parseQuantity(getJObject(json, "measureScore")));
15641  }
15642
15643  protected MeasureReport.StratifierGroupComponentComponent parseMeasureReportStratifierGroupComponentComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
15644    MeasureReport.StratifierGroupComponentComponent res = new MeasureReport.StratifierGroupComponentComponent();
15645    parseMeasureReportStratifierGroupComponentComponentProperties(json, owner, res);
15646    return res;
15647  }
15648
15649  protected void parseMeasureReportStratifierGroupComponentComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupComponentComponent res) throws IOException, FHIRFormatError {
15650    parseBackboneElementProperties(json, res);
15651    if (json.has("code"))
15652      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15653    if (json.has("value"))
15654      res.setValue(parseCodeableConcept(getJObject(json, "value")));
15655  }
15656
15657  protected MeasureReport.StratifierGroupPopulationComponent parseMeasureReportStratifierGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
15658    MeasureReport.StratifierGroupPopulationComponent res = new MeasureReport.StratifierGroupPopulationComponent();
15659    parseMeasureReportStratifierGroupPopulationComponentProperties(json, owner, res);
15660    return res;
15661  }
15662
15663  protected void parseMeasureReportStratifierGroupPopulationComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupPopulationComponent res) throws IOException, FHIRFormatError {
15664    parseBackboneElementProperties(json, res);
15665    if (json.has("code"))
15666      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15667    if (json.has("count"))
15668      res.setCountElement(parseInteger(json.get("count").getAsLong()));
15669    if (json.has("_count"))
15670      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
15671    if (json.has("subjectResults"))
15672      res.setSubjectResults(parseReference(getJObject(json, "subjectResults")));
15673  }
15674
15675  protected Media parseMedia(JsonObject json) throws IOException, FHIRFormatError {
15676    Media res = new Media();
15677    parseMediaProperties(json, res);
15678    return res;
15679  }
15680
15681  protected void parseMediaProperties(JsonObject json, Media res) throws IOException, FHIRFormatError {
15682    parseDomainResourceProperties(json, res);
15683    if (json.has("identifier")) {
15684      JsonArray array = json.getAsJsonArray("identifier");
15685      for (int i = 0; i < array.size(); i++) {
15686        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15687      }
15688    };
15689    if (json.has("basedOn")) {
15690      JsonArray array = json.getAsJsonArray("basedOn");
15691      for (int i = 0; i < array.size(); i++) {
15692        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
15693      }
15694    };
15695    if (json.has("partOf")) {
15696      JsonArray array = json.getAsJsonArray("partOf");
15697      for (int i = 0; i < array.size(); i++) {
15698        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
15699      }
15700    };
15701    if (json.has("status"))
15702      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Media.MediaStatus.NULL, new Media.MediaStatusEnumFactory()));
15703    if (json.has("_status"))
15704      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15705    if (json.has("type"))
15706      res.setType(parseCodeableConcept(getJObject(json, "type")));
15707    if (json.has("modality"))
15708      res.setModality(parseCodeableConcept(getJObject(json, "modality")));
15709    if (json.has("view"))
15710      res.setView(parseCodeableConcept(getJObject(json, "view")));
15711    if (json.has("subject"))
15712      res.setSubject(parseReference(getJObject(json, "subject")));
15713    if (json.has("encounter"))
15714      res.setEncounter(parseReference(getJObject(json, "encounter")));
15715    Type created = parseType("created", json);
15716    if (created != null)
15717      res.setCreated(created);
15718    if (json.has("issued"))
15719      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
15720    if (json.has("_issued"))
15721      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
15722    if (json.has("operator"))
15723      res.setOperator(parseReference(getJObject(json, "operator")));
15724    if (json.has("reasonCode")) {
15725      JsonArray array = json.getAsJsonArray("reasonCode");
15726      for (int i = 0; i < array.size(); i++) {
15727        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15728      }
15729    };
15730    if (json.has("bodySite"))
15731      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
15732    if (json.has("deviceName"))
15733      res.setDeviceNameElement(parseString(json.get("deviceName").getAsString()));
15734    if (json.has("_deviceName"))
15735      parseElementProperties(getJObject(json, "_deviceName"), res.getDeviceNameElement());
15736    if (json.has("device"))
15737      res.setDevice(parseReference(getJObject(json, "device")));
15738    if (json.has("height"))
15739      res.setHeightElement(parsePositiveInt(json.get("height").getAsString()));
15740    if (json.has("_height"))
15741      parseElementProperties(getJObject(json, "_height"), res.getHeightElement());
15742    if (json.has("width"))
15743      res.setWidthElement(parsePositiveInt(json.get("width").getAsString()));
15744    if (json.has("_width"))
15745      parseElementProperties(getJObject(json, "_width"), res.getWidthElement());
15746    if (json.has("frames"))
15747      res.setFramesElement(parsePositiveInt(json.get("frames").getAsString()));
15748    if (json.has("_frames"))
15749      parseElementProperties(getJObject(json, "_frames"), res.getFramesElement());
15750    if (json.has("duration"))
15751      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
15752    if (json.has("_duration"))
15753      parseElementProperties(getJObject(json, "_duration"), res.getDurationElement());
15754    if (json.has("content"))
15755      res.setContent(parseAttachment(getJObject(json, "content")));
15756    if (json.has("note")) {
15757      JsonArray array = json.getAsJsonArray("note");
15758      for (int i = 0; i < array.size(); i++) {
15759        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15760      }
15761    };
15762  }
15763
15764  protected Medication parseMedication(JsonObject json) throws IOException, FHIRFormatError {
15765    Medication res = new Medication();
15766    parseMedicationProperties(json, res);
15767    return res;
15768  }
15769
15770  protected void parseMedicationProperties(JsonObject json, Medication res) throws IOException, FHIRFormatError {
15771    parseDomainResourceProperties(json, res);
15772    if (json.has("identifier")) {
15773      JsonArray array = json.getAsJsonArray("identifier");
15774      for (int i = 0; i < array.size(); i++) {
15775        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15776      }
15777    };
15778    if (json.has("code"))
15779      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15780    if (json.has("status"))
15781      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Medication.MedicationStatus.NULL, new Medication.MedicationStatusEnumFactory()));
15782    if (json.has("_status"))
15783      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15784    if (json.has("manufacturer"))
15785      res.setManufacturer(parseReference(getJObject(json, "manufacturer")));
15786    if (json.has("form"))
15787      res.setForm(parseCodeableConcept(getJObject(json, "form")));
15788    if (json.has("amount"))
15789      res.setAmount(parseRatio(getJObject(json, "amount")));
15790    if (json.has("ingredient")) {
15791      JsonArray array = json.getAsJsonArray("ingredient");
15792      for (int i = 0; i < array.size(); i++) {
15793        res.getIngredient().add(parseMedicationMedicationIngredientComponent(array.get(i).getAsJsonObject(), res));
15794      }
15795    };
15796    if (json.has("batch"))
15797      res.setBatch(parseMedicationMedicationBatchComponent(getJObject(json, "batch"), res));
15798  }
15799
15800  protected Medication.MedicationIngredientComponent parseMedicationMedicationIngredientComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
15801    Medication.MedicationIngredientComponent res = new Medication.MedicationIngredientComponent();
15802    parseMedicationMedicationIngredientComponentProperties(json, owner, res);
15803    return res;
15804  }
15805
15806  protected void parseMedicationMedicationIngredientComponentProperties(JsonObject json, Medication owner, Medication.MedicationIngredientComponent res) throws IOException, FHIRFormatError {
15807    parseBackboneElementProperties(json, res);
15808    Type item = parseType("item", json);
15809    if (item != null)
15810      res.setItem(item);
15811    if (json.has("isActive"))
15812      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
15813    if (json.has("_isActive"))
15814      parseElementProperties(getJObject(json, "_isActive"), res.getIsActiveElement());
15815    if (json.has("strength"))
15816      res.setStrength(parseRatio(getJObject(json, "strength")));
15817  }
15818
15819  protected Medication.MedicationBatchComponent parseMedicationMedicationBatchComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
15820    Medication.MedicationBatchComponent res = new Medication.MedicationBatchComponent();
15821    parseMedicationMedicationBatchComponentProperties(json, owner, res);
15822    return res;
15823  }
15824
15825  protected void parseMedicationMedicationBatchComponentProperties(JsonObject json, Medication owner, Medication.MedicationBatchComponent res) throws IOException, FHIRFormatError {
15826    parseBackboneElementProperties(json, res);
15827    if (json.has("lotNumber"))
15828      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
15829    if (json.has("_lotNumber"))
15830      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
15831    if (json.has("expirationDate"))
15832      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
15833    if (json.has("_expirationDate"))
15834      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
15835  }
15836
15837  protected MedicationAdministration parseMedicationAdministration(JsonObject json) throws IOException, FHIRFormatError {
15838    MedicationAdministration res = new MedicationAdministration();
15839    parseMedicationAdministrationProperties(json, res);
15840    return res;
15841  }
15842
15843  protected void parseMedicationAdministrationProperties(JsonObject json, MedicationAdministration res) throws IOException, FHIRFormatError {
15844    parseDomainResourceProperties(json, res);
15845    if (json.has("identifier")) {
15846      JsonArray array = json.getAsJsonArray("identifier");
15847      for (int i = 0; i < array.size(); i++) {
15848        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15849      }
15850    };
15851    if (json.has("instantiates")) {
15852      JsonArray array = json.getAsJsonArray("instantiates");
15853      for (int i = 0; i < array.size(); i++) {
15854        res.getInstantiates().add(parseUri(array.get(i).getAsString()));
15855      }
15856    };
15857    if (json.has("_instantiates")) {
15858      JsonArray array = json.getAsJsonArray("_instantiates");
15859      for (int i = 0; i < array.size(); i++) {
15860        if (i == res.getInstantiates().size())
15861          res.getInstantiates().add(parseUri(null));
15862        if (array.get(i) instanceof JsonObject) 
15863          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
15864      }
15865    };
15866    if (json.has("partOf")) {
15867      JsonArray array = json.getAsJsonArray("partOf");
15868      for (int i = 0; i < array.size(); i++) {
15869        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
15870      }
15871    };
15872    if (json.has("status"))
15873      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationAdministration.MedicationAdministrationStatus.NULL, new MedicationAdministration.MedicationAdministrationStatusEnumFactory()));
15874    if (json.has("_status"))
15875      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15876    if (json.has("statusReason")) {
15877      JsonArray array = json.getAsJsonArray("statusReason");
15878      for (int i = 0; i < array.size(); i++) {
15879        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15880      }
15881    };
15882    if (json.has("category"))
15883      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
15884    Type medication = parseType("medication", json);
15885    if (medication != null)
15886      res.setMedication(medication);
15887    if (json.has("subject"))
15888      res.setSubject(parseReference(getJObject(json, "subject")));
15889    if (json.has("context"))
15890      res.setContext(parseReference(getJObject(json, "context")));
15891    if (json.has("supportingInformation")) {
15892      JsonArray array = json.getAsJsonArray("supportingInformation");
15893      for (int i = 0; i < array.size(); i++) {
15894        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
15895      }
15896    };
15897    Type effective = parseType("effective", json);
15898    if (effective != null)
15899      res.setEffective(effective);
15900    if (json.has("performer")) {
15901      JsonArray array = json.getAsJsonArray("performer");
15902      for (int i = 0; i < array.size(); i++) {
15903        res.getPerformer().add(parseMedicationAdministrationMedicationAdministrationPerformerComponent(array.get(i).getAsJsonObject(), res));
15904      }
15905    };
15906    if (json.has("reasonCode")) {
15907      JsonArray array = json.getAsJsonArray("reasonCode");
15908      for (int i = 0; i < array.size(); i++) {
15909        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15910      }
15911    };
15912    if (json.has("reasonReference")) {
15913      JsonArray array = json.getAsJsonArray("reasonReference");
15914      for (int i = 0; i < array.size(); i++) {
15915        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
15916      }
15917    };
15918    if (json.has("request"))
15919      res.setRequest(parseReference(getJObject(json, "request")));
15920    if (json.has("device")) {
15921      JsonArray array = json.getAsJsonArray("device");
15922      for (int i = 0; i < array.size(); i++) {
15923        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
15924      }
15925    };
15926    if (json.has("note")) {
15927      JsonArray array = json.getAsJsonArray("note");
15928      for (int i = 0; i < array.size(); i++) {
15929        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15930      }
15931    };
15932    if (json.has("dosage"))
15933      res.setDosage(parseMedicationAdministrationMedicationAdministrationDosageComponent(getJObject(json, "dosage"), res));
15934    if (json.has("eventHistory")) {
15935      JsonArray array = json.getAsJsonArray("eventHistory");
15936      for (int i = 0; i < array.size(); i++) {
15937        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
15938      }
15939    };
15940  }
15941
15942  protected MedicationAdministration.MedicationAdministrationPerformerComponent parseMedicationAdministrationMedicationAdministrationPerformerComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
15943    MedicationAdministration.MedicationAdministrationPerformerComponent res = new MedicationAdministration.MedicationAdministrationPerformerComponent();
15944    parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(json, owner, res);
15945    return res;
15946  }
15947
15948  protected void parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(JsonObject json, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationPerformerComponent res) throws IOException, FHIRFormatError {
15949    parseBackboneElementProperties(json, res);
15950    if (json.has("function"))
15951      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
15952    if (json.has("actor"))
15953      res.setActor(parseReference(getJObject(json, "actor")));
15954  }
15955
15956  protected MedicationAdministration.MedicationAdministrationDosageComponent parseMedicationAdministrationMedicationAdministrationDosageComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
15957    MedicationAdministration.MedicationAdministrationDosageComponent res = new MedicationAdministration.MedicationAdministrationDosageComponent();
15958    parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(json, owner, res);
15959    return res;
15960  }
15961
15962  protected void parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(JsonObject json, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationDosageComponent res) throws IOException, FHIRFormatError {
15963    parseBackboneElementProperties(json, res);
15964    if (json.has("text"))
15965      res.setTextElement(parseString(json.get("text").getAsString()));
15966    if (json.has("_text"))
15967      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
15968    if (json.has("site"))
15969      res.setSite(parseCodeableConcept(getJObject(json, "site")));
15970    if (json.has("route"))
15971      res.setRoute(parseCodeableConcept(getJObject(json, "route")));
15972    if (json.has("method"))
15973      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
15974    if (json.has("dose"))
15975      res.setDose(parseQuantity(getJObject(json, "dose")));
15976    Type rate = parseType("rate", json);
15977    if (rate != null)
15978      res.setRate(rate);
15979  }
15980
15981  protected MedicationDispense parseMedicationDispense(JsonObject json) throws IOException, FHIRFormatError {
15982    MedicationDispense res = new MedicationDispense();
15983    parseMedicationDispenseProperties(json, res);
15984    return res;
15985  }
15986
15987  protected void parseMedicationDispenseProperties(JsonObject json, MedicationDispense res) throws IOException, FHIRFormatError {
15988    parseDomainResourceProperties(json, res);
15989    if (json.has("identifier")) {
15990      JsonArray array = json.getAsJsonArray("identifier");
15991      for (int i = 0; i < array.size(); i++) {
15992        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15993      }
15994    };
15995    if (json.has("partOf")) {
15996      JsonArray array = json.getAsJsonArray("partOf");
15997      for (int i = 0; i < array.size(); i++) {
15998        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
15999      }
16000    };
16001    if (json.has("status"))
16002      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationDispense.MedicationDispenseStatus.NULL, new MedicationDispense.MedicationDispenseStatusEnumFactory()));
16003    if (json.has("_status"))
16004      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16005    Type statusReason = parseType("statusReason", json);
16006    if (statusReason != null)
16007      res.setStatusReason(statusReason);
16008    if (json.has("category"))
16009      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
16010    Type medication = parseType("medication", json);
16011    if (medication != null)
16012      res.setMedication(medication);
16013    if (json.has("subject"))
16014      res.setSubject(parseReference(getJObject(json, "subject")));
16015    if (json.has("context"))
16016      res.setContext(parseReference(getJObject(json, "context")));
16017    if (json.has("supportingInformation")) {
16018      JsonArray array = json.getAsJsonArray("supportingInformation");
16019      for (int i = 0; i < array.size(); i++) {
16020        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
16021      }
16022    };
16023    if (json.has("performer")) {
16024      JsonArray array = json.getAsJsonArray("performer");
16025      for (int i = 0; i < array.size(); i++) {
16026        res.getPerformer().add(parseMedicationDispenseMedicationDispensePerformerComponent(array.get(i).getAsJsonObject(), res));
16027      }
16028    };
16029    if (json.has("location"))
16030      res.setLocation(parseReference(getJObject(json, "location")));
16031    if (json.has("authorizingPrescription")) {
16032      JsonArray array = json.getAsJsonArray("authorizingPrescription");
16033      for (int i = 0; i < array.size(); i++) {
16034        res.getAuthorizingPrescription().add(parseReference(array.get(i).getAsJsonObject()));
16035      }
16036    };
16037    if (json.has("type"))
16038      res.setType(parseCodeableConcept(getJObject(json, "type")));
16039    if (json.has("quantity"))
16040      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
16041    if (json.has("daysSupply"))
16042      res.setDaysSupply(parseQuantity(getJObject(json, "daysSupply")));
16043    if (json.has("whenPrepared"))
16044      res.setWhenPreparedElement(parseDateTime(json.get("whenPrepared").getAsString()));
16045    if (json.has("_whenPrepared"))
16046      parseElementProperties(getJObject(json, "_whenPrepared"), res.getWhenPreparedElement());
16047    if (json.has("whenHandedOver"))
16048      res.setWhenHandedOverElement(parseDateTime(json.get("whenHandedOver").getAsString()));
16049    if (json.has("_whenHandedOver"))
16050      parseElementProperties(getJObject(json, "_whenHandedOver"), res.getWhenHandedOverElement());
16051    if (json.has("destination"))
16052      res.setDestination(parseReference(getJObject(json, "destination")));
16053    if (json.has("receiver")) {
16054      JsonArray array = json.getAsJsonArray("receiver");
16055      for (int i = 0; i < array.size(); i++) {
16056        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
16057      }
16058    };
16059    if (json.has("note")) {
16060      JsonArray array = json.getAsJsonArray("note");
16061      for (int i = 0; i < array.size(); i++) {
16062        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16063      }
16064    };
16065    if (json.has("dosageInstruction")) {
16066      JsonArray array = json.getAsJsonArray("dosageInstruction");
16067      for (int i = 0; i < array.size(); i++) {
16068        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
16069      }
16070    };
16071    if (json.has("substitution"))
16072      res.setSubstitution(parseMedicationDispenseMedicationDispenseSubstitutionComponent(getJObject(json, "substitution"), res));
16073    if (json.has("detectedIssue")) {
16074      JsonArray array = json.getAsJsonArray("detectedIssue");
16075      for (int i = 0; i < array.size(); i++) {
16076        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
16077      }
16078    };
16079    if (json.has("eventHistory")) {
16080      JsonArray array = json.getAsJsonArray("eventHistory");
16081      for (int i = 0; i < array.size(); i++) {
16082        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
16083      }
16084    };
16085  }
16086
16087  protected MedicationDispense.MedicationDispensePerformerComponent parseMedicationDispenseMedicationDispensePerformerComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
16088    MedicationDispense.MedicationDispensePerformerComponent res = new MedicationDispense.MedicationDispensePerformerComponent();
16089    parseMedicationDispenseMedicationDispensePerformerComponentProperties(json, owner, res);
16090    return res;
16091  }
16092
16093  protected void parseMedicationDispenseMedicationDispensePerformerComponentProperties(JsonObject json, MedicationDispense owner, MedicationDispense.MedicationDispensePerformerComponent res) throws IOException, FHIRFormatError {
16094    parseBackboneElementProperties(json, res);
16095    if (json.has("function"))
16096      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
16097    if (json.has("actor"))
16098      res.setActor(parseReference(getJObject(json, "actor")));
16099  }
16100
16101  protected MedicationDispense.MedicationDispenseSubstitutionComponent parseMedicationDispenseMedicationDispenseSubstitutionComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
16102    MedicationDispense.MedicationDispenseSubstitutionComponent res = new MedicationDispense.MedicationDispenseSubstitutionComponent();
16103    parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(json, owner, res);
16104    return res;
16105  }
16106
16107  protected void parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(JsonObject json, MedicationDispense owner, MedicationDispense.MedicationDispenseSubstitutionComponent res) throws IOException, FHIRFormatError {
16108    parseBackboneElementProperties(json, res);
16109    if (json.has("wasSubstituted"))
16110      res.setWasSubstitutedElement(parseBoolean(json.get("wasSubstituted").getAsBoolean()));
16111    if (json.has("_wasSubstituted"))
16112      parseElementProperties(getJObject(json, "_wasSubstituted"), res.getWasSubstitutedElement());
16113    if (json.has("type"))
16114      res.setType(parseCodeableConcept(getJObject(json, "type")));
16115    if (json.has("reason")) {
16116      JsonArray array = json.getAsJsonArray("reason");
16117      for (int i = 0; i < array.size(); i++) {
16118        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16119      }
16120    };
16121    if (json.has("responsibleParty")) {
16122      JsonArray array = json.getAsJsonArray("responsibleParty");
16123      for (int i = 0; i < array.size(); i++) {
16124        res.getResponsibleParty().add(parseReference(array.get(i).getAsJsonObject()));
16125      }
16126    };
16127  }
16128
16129  protected MedicationKnowledge parseMedicationKnowledge(JsonObject json) throws IOException, FHIRFormatError {
16130    MedicationKnowledge res = new MedicationKnowledge();
16131    parseMedicationKnowledgeProperties(json, res);
16132    return res;
16133  }
16134
16135  protected void parseMedicationKnowledgeProperties(JsonObject json, MedicationKnowledge res) throws IOException, FHIRFormatError {
16136    parseDomainResourceProperties(json, res);
16137    if (json.has("code"))
16138      res.setCode(parseCodeableConcept(getJObject(json, "code")));
16139    if (json.has("status"))
16140      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationKnowledge.MedicationKnowledgeStatus.NULL, new MedicationKnowledge.MedicationKnowledgeStatusEnumFactory()));
16141    if (json.has("_status"))
16142      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16143    if (json.has("manufacturer"))
16144      res.setManufacturer(parseReference(getJObject(json, "manufacturer")));
16145    if (json.has("doseForm"))
16146      res.setDoseForm(parseCodeableConcept(getJObject(json, "doseForm")));
16147    if (json.has("amount"))
16148      res.setAmount(parseQuantity(getJObject(json, "amount")));
16149    if (json.has("synonym")) {
16150      JsonArray array = json.getAsJsonArray("synonym");
16151      for (int i = 0; i < array.size(); i++) {
16152        res.getSynonym().add(parseString(array.get(i).getAsString()));
16153      }
16154    };
16155    if (json.has("_synonym")) {
16156      JsonArray array = json.getAsJsonArray("_synonym");
16157      for (int i = 0; i < array.size(); i++) {
16158        if (i == res.getSynonym().size())
16159          res.getSynonym().add(parseString(null));
16160        if (array.get(i) instanceof JsonObject) 
16161          parseElementProperties(array.get(i).getAsJsonObject(), res.getSynonym().get(i));
16162      }
16163    };
16164    if (json.has("relatedMedicationKnowledge")) {
16165      JsonArray array = json.getAsJsonArray("relatedMedicationKnowledge");
16166      for (int i = 0; i < array.size(); i++) {
16167        res.getRelatedMedicationKnowledge().add(parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(array.get(i).getAsJsonObject(), res));
16168      }
16169    };
16170    if (json.has("associatedMedication")) {
16171      JsonArray array = json.getAsJsonArray("associatedMedication");
16172      for (int i = 0; i < array.size(); i++) {
16173        res.getAssociatedMedication().add(parseReference(array.get(i).getAsJsonObject()));
16174      }
16175    };
16176    if (json.has("productType")) {
16177      JsonArray array = json.getAsJsonArray("productType");
16178      for (int i = 0; i < array.size(); i++) {
16179        res.getProductType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16180      }
16181    };
16182    if (json.has("monograph")) {
16183      JsonArray array = json.getAsJsonArray("monograph");
16184      for (int i = 0; i < array.size(); i++) {
16185        res.getMonograph().add(parseMedicationKnowledgeMedicationKnowledgeMonographComponent(array.get(i).getAsJsonObject(), res));
16186      }
16187    };
16188    if (json.has("ingredient")) {
16189      JsonArray array = json.getAsJsonArray("ingredient");
16190      for (int i = 0; i < array.size(); i++) {
16191        res.getIngredient().add(parseMedicationKnowledgeMedicationKnowledgeIngredientComponent(array.get(i).getAsJsonObject(), res));
16192      }
16193    };
16194    if (json.has("preparationInstruction"))
16195      res.setPreparationInstructionElement(parseMarkdown(json.get("preparationInstruction").getAsString()));
16196    if (json.has("_preparationInstruction"))
16197      parseElementProperties(getJObject(json, "_preparationInstruction"), res.getPreparationInstructionElement());
16198    if (json.has("intendedRoute")) {
16199      JsonArray array = json.getAsJsonArray("intendedRoute");
16200      for (int i = 0; i < array.size(); i++) {
16201        res.getIntendedRoute().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16202      }
16203    };
16204    if (json.has("cost")) {
16205      JsonArray array = json.getAsJsonArray("cost");
16206      for (int i = 0; i < array.size(); i++) {
16207        res.getCost().add(parseMedicationKnowledgeMedicationKnowledgeCostComponent(array.get(i).getAsJsonObject(), res));
16208      }
16209    };
16210    if (json.has("monitoringProgram")) {
16211      JsonArray array = json.getAsJsonArray("monitoringProgram");
16212      for (int i = 0; i < array.size(); i++) {
16213        res.getMonitoringProgram().add(parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(array.get(i).getAsJsonObject(), res));
16214      }
16215    };
16216    if (json.has("administrationGuidelines")) {
16217      JsonArray array = json.getAsJsonArray("administrationGuidelines");
16218      for (int i = 0; i < array.size(); i++) {
16219        res.getAdministrationGuidelines().add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(array.get(i).getAsJsonObject(), res));
16220      }
16221    };
16222    if (json.has("medicineClassification")) {
16223      JsonArray array = json.getAsJsonArray("medicineClassification");
16224      for (int i = 0; i < array.size(); i++) {
16225        res.getMedicineClassification().add(parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(array.get(i).getAsJsonObject(), res));
16226      }
16227    };
16228    if (json.has("packaging"))
16229      res.setPackaging(parseMedicationKnowledgeMedicationKnowledgePackagingComponent(getJObject(json, "packaging"), res));
16230    if (json.has("drugCharacteristic")) {
16231      JsonArray array = json.getAsJsonArray("drugCharacteristic");
16232      for (int i = 0; i < array.size(); i++) {
16233        res.getDrugCharacteristic().add(parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(array.get(i).getAsJsonObject(), res));
16234      }
16235    };
16236    if (json.has("contraindication")) {
16237      JsonArray array = json.getAsJsonArray("contraindication");
16238      for (int i = 0; i < array.size(); i++) {
16239        res.getContraindication().add(parseReference(array.get(i).getAsJsonObject()));
16240      }
16241    };
16242    if (json.has("regulatory")) {
16243      JsonArray array = json.getAsJsonArray("regulatory");
16244      for (int i = 0; i < array.size(); i++) {
16245        res.getRegulatory().add(parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(array.get(i).getAsJsonObject(), res));
16246      }
16247    };
16248    if (json.has("kinetics")) {
16249      JsonArray array = json.getAsJsonArray("kinetics");
16250      for (int i = 0; i < array.size(); i++) {
16251        res.getKinetics().add(parseMedicationKnowledgeMedicationKnowledgeKineticsComponent(array.get(i).getAsJsonObject(), res));
16252      }
16253    };
16254  }
16255
16256  protected MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16257    MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent res = new MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent();
16258    parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(json, owner, res);
16259    return res;
16260  }
16261
16262  protected void parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent res) throws IOException, FHIRFormatError {
16263    parseBackboneElementProperties(json, res);
16264    if (json.has("type"))
16265      res.setType(parseCodeableConcept(getJObject(json, "type")));
16266    if (json.has("reference")) {
16267      JsonArray array = json.getAsJsonArray("reference");
16268      for (int i = 0; i < array.size(); i++) {
16269        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
16270      }
16271    };
16272  }
16273
16274  protected MedicationKnowledge.MedicationKnowledgeMonographComponent parseMedicationKnowledgeMedicationKnowledgeMonographComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16275    MedicationKnowledge.MedicationKnowledgeMonographComponent res = new MedicationKnowledge.MedicationKnowledgeMonographComponent();
16276    parseMedicationKnowledgeMedicationKnowledgeMonographComponentProperties(json, owner, res);
16277    return res;
16278  }
16279
16280  protected void parseMedicationKnowledgeMedicationKnowledgeMonographComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMonographComponent res) throws IOException, FHIRFormatError {
16281    parseBackboneElementProperties(json, res);
16282    if (json.has("type"))
16283      res.setType(parseCodeableConcept(getJObject(json, "type")));
16284    if (json.has("source"))
16285      res.setSource(parseReference(getJObject(json, "source")));
16286  }
16287
16288  protected MedicationKnowledge.MedicationKnowledgeIngredientComponent parseMedicationKnowledgeMedicationKnowledgeIngredientComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16289    MedicationKnowledge.MedicationKnowledgeIngredientComponent res = new MedicationKnowledge.MedicationKnowledgeIngredientComponent();
16290    parseMedicationKnowledgeMedicationKnowledgeIngredientComponentProperties(json, owner, res);
16291    return res;
16292  }
16293
16294  protected void parseMedicationKnowledgeMedicationKnowledgeIngredientComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeIngredientComponent res) throws IOException, FHIRFormatError {
16295    parseBackboneElementProperties(json, res);
16296    Type item = parseType("item", json);
16297    if (item != null)
16298      res.setItem(item);
16299    if (json.has("isActive"))
16300      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
16301    if (json.has("_isActive"))
16302      parseElementProperties(getJObject(json, "_isActive"), res.getIsActiveElement());
16303    if (json.has("strength"))
16304      res.setStrength(parseRatio(getJObject(json, "strength")));
16305  }
16306
16307  protected MedicationKnowledge.MedicationKnowledgeCostComponent parseMedicationKnowledgeMedicationKnowledgeCostComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16308    MedicationKnowledge.MedicationKnowledgeCostComponent res = new MedicationKnowledge.MedicationKnowledgeCostComponent();
16309    parseMedicationKnowledgeMedicationKnowledgeCostComponentProperties(json, owner, res);
16310    return res;
16311  }
16312
16313  protected void parseMedicationKnowledgeMedicationKnowledgeCostComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeCostComponent res) throws IOException, FHIRFormatError {
16314    parseBackboneElementProperties(json, res);
16315    if (json.has("type"))
16316      res.setType(parseCodeableConcept(getJObject(json, "type")));
16317    if (json.has("source"))
16318      res.setSourceElement(parseString(json.get("source").getAsString()));
16319    if (json.has("_source"))
16320      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
16321    if (json.has("cost"))
16322      res.setCost(parseMoney(getJObject(json, "cost")));
16323  }
16324
16325  protected MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16326    MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res = new MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent();
16327    parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentProperties(json, owner, res);
16328    return res;
16329  }
16330
16331  protected void parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res) throws IOException, FHIRFormatError {
16332    parseBackboneElementProperties(json, res);
16333    if (json.has("type"))
16334      res.setType(parseCodeableConcept(getJObject(json, "type")));
16335    if (json.has("name"))
16336      res.setNameElement(parseString(json.get("name").getAsString()));
16337    if (json.has("_name"))
16338      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
16339  }
16340
16341  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16342    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent();
16343    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentProperties(json, owner, res);
16344    return res;
16345  }
16346
16347  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent res) throws IOException, FHIRFormatError {
16348    parseBackboneElementProperties(json, res);
16349    if (json.has("dosage")) {
16350      JsonArray array = json.getAsJsonArray("dosage");
16351      for (int i = 0; i < array.size(); i++) {
16352        res.getDosage().add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(array.get(i).getAsJsonObject(), owner));
16353      }
16354    };
16355    Type indication = parseType("indication", json);
16356    if (indication != null)
16357      res.setIndication(indication);
16358    if (json.has("patientCharacteristics")) {
16359      JsonArray array = json.getAsJsonArray("patientCharacteristics");
16360      for (int i = 0; i < array.size(); i++) {
16361        res.getPatientCharacteristics().add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(array.get(i).getAsJsonObject(), owner));
16362      }
16363    };
16364  }
16365
16366  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16367    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent();
16368    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentProperties(json, owner, res);
16369    return res;
16370  }
16371
16372  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent res) throws IOException, FHIRFormatError {
16373    parseBackboneElementProperties(json, res);
16374    if (json.has("type"))
16375      res.setType(parseCodeableConcept(getJObject(json, "type")));
16376    if (json.has("dosage")) {
16377      JsonArray array = json.getAsJsonArray("dosage");
16378      for (int i = 0; i < array.size(); i++) {
16379        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
16380      }
16381    };
16382  }
16383
16384  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16385    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent();
16386    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentProperties(json, owner, res);
16387    return res;
16388  }
16389
16390  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent res) throws IOException, FHIRFormatError {
16391    parseBackboneElementProperties(json, res);
16392    Type characteristic = parseType("characteristic", json);
16393    if (characteristic != null)
16394      res.setCharacteristic(characteristic);
16395    if (json.has("value")) {
16396      JsonArray array = json.getAsJsonArray("value");
16397      for (int i = 0; i < array.size(); i++) {
16398        res.getValue().add(parseString(array.get(i).getAsString()));
16399      }
16400    };
16401    if (json.has("_value")) {
16402      JsonArray array = json.getAsJsonArray("_value");
16403      for (int i = 0; i < array.size(); i++) {
16404        if (i == res.getValue().size())
16405          res.getValue().add(parseString(null));
16406        if (array.get(i) instanceof JsonObject) 
16407          parseElementProperties(array.get(i).getAsJsonObject(), res.getValue().get(i));
16408      }
16409    };
16410  }
16411
16412  protected MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16413    MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res = new MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent();
16414    parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentProperties(json, owner, res);
16415    return res;
16416  }
16417
16418  protected void parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res) throws IOException, FHIRFormatError {
16419    parseBackboneElementProperties(json, res);
16420    if (json.has("type"))
16421      res.setType(parseCodeableConcept(getJObject(json, "type")));
16422    if (json.has("classification")) {
16423      JsonArray array = json.getAsJsonArray("classification");
16424      for (int i = 0; i < array.size(); i++) {
16425        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16426      }
16427    };
16428  }
16429
16430  protected MedicationKnowledge.MedicationKnowledgePackagingComponent parseMedicationKnowledgeMedicationKnowledgePackagingComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16431    MedicationKnowledge.MedicationKnowledgePackagingComponent res = new MedicationKnowledge.MedicationKnowledgePackagingComponent();
16432    parseMedicationKnowledgeMedicationKnowledgePackagingComponentProperties(json, owner, res);
16433    return res;
16434  }
16435
16436  protected void parseMedicationKnowledgeMedicationKnowledgePackagingComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgePackagingComponent res) throws IOException, FHIRFormatError {
16437    parseBackboneElementProperties(json, res);
16438    if (json.has("type"))
16439      res.setType(parseCodeableConcept(getJObject(json, "type")));
16440    if (json.has("quantity"))
16441      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
16442  }
16443
16444  protected MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16445    MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent res = new MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent();
16446    parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentProperties(json, owner, res);
16447    return res;
16448  }
16449
16450  protected void parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent res) throws IOException, FHIRFormatError {
16451    parseBackboneElementProperties(json, res);
16452    if (json.has("type"))
16453      res.setType(parseCodeableConcept(getJObject(json, "type")));
16454    Type value = parseType("value", json);
16455    if (value != null)
16456      res.setValue(value);
16457  }
16458
16459  protected MedicationKnowledge.MedicationKnowledgeRegulatoryComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16460    MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryComponent();
16461    parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponentProperties(json, owner, res);
16462    return res;
16463  }
16464
16465  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res) throws IOException, FHIRFormatError {
16466    parseBackboneElementProperties(json, res);
16467    if (json.has("regulatoryAuthority"))
16468      res.setRegulatoryAuthority(parseReference(getJObject(json, "regulatoryAuthority")));
16469    if (json.has("substitution")) {
16470      JsonArray array = json.getAsJsonArray("substitution");
16471      for (int i = 0; i < array.size(); i++) {
16472        res.getSubstitution().add(parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(array.get(i).getAsJsonObject(), owner));
16473      }
16474    };
16475    if (json.has("schedule")) {
16476      JsonArray array = json.getAsJsonArray("schedule");
16477      for (int i = 0; i < array.size(); i++) {
16478        res.getSchedule().add(parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(array.get(i).getAsJsonObject(), owner));
16479      }
16480    };
16481    if (json.has("maxDispense"))
16482      res.setMaxDispense(parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(getJObject(json, "maxDispense"), owner));
16483  }
16484
16485  protected MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16486    MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent();
16487    parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentProperties(json, owner, res);
16488    return res;
16489  }
16490
16491  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent res) throws IOException, FHIRFormatError {
16492    parseBackboneElementProperties(json, res);
16493    if (json.has("type"))
16494      res.setType(parseCodeableConcept(getJObject(json, "type")));
16495    if (json.has("allowed"))
16496      res.setAllowedElement(parseBoolean(json.get("allowed").getAsBoolean()));
16497    if (json.has("_allowed"))
16498      parseElementProperties(getJObject(json, "_allowed"), res.getAllowedElement());
16499  }
16500
16501  protected MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16502    MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent();
16503    parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentProperties(json, owner, res);
16504    return res;
16505  }
16506
16507  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent res) throws IOException, FHIRFormatError {
16508    parseBackboneElementProperties(json, res);
16509    if (json.has("schedule"))
16510      res.setSchedule(parseCodeableConcept(getJObject(json, "schedule")));
16511  }
16512
16513  protected MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16514    MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent();
16515    parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(json, owner, res);
16516    return res;
16517  }
16518
16519  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res) throws IOException, FHIRFormatError {
16520    parseBackboneElementProperties(json, res);
16521    if (json.has("quantity"))
16522      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
16523    if (json.has("period"))
16524      res.setPeriod(parseDuration(getJObject(json, "period")));
16525  }
16526
16527  protected MedicationKnowledge.MedicationKnowledgeKineticsComponent parseMedicationKnowledgeMedicationKnowledgeKineticsComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16528    MedicationKnowledge.MedicationKnowledgeKineticsComponent res = new MedicationKnowledge.MedicationKnowledgeKineticsComponent();
16529    parseMedicationKnowledgeMedicationKnowledgeKineticsComponentProperties(json, owner, res);
16530    return res;
16531  }
16532
16533  protected void parseMedicationKnowledgeMedicationKnowledgeKineticsComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeKineticsComponent res) throws IOException, FHIRFormatError {
16534    parseBackboneElementProperties(json, res);
16535    if (json.has("areaUnderCurve")) {
16536      JsonArray array = json.getAsJsonArray("areaUnderCurve");
16537      for (int i = 0; i < array.size(); i++) {
16538        res.getAreaUnderCurve().add(parseQuantity(array.get(i).getAsJsonObject()));
16539      }
16540    };
16541    if (json.has("lethalDose50")) {
16542      JsonArray array = json.getAsJsonArray("lethalDose50");
16543      for (int i = 0; i < array.size(); i++) {
16544        res.getLethalDose50().add(parseQuantity(array.get(i).getAsJsonObject()));
16545      }
16546    };
16547    if (json.has("halfLifePeriod"))
16548      res.setHalfLifePeriod(parseDuration(getJObject(json, "halfLifePeriod")));
16549  }
16550
16551  protected MedicationRequest parseMedicationRequest(JsonObject json) throws IOException, FHIRFormatError {
16552    MedicationRequest res = new MedicationRequest();
16553    parseMedicationRequestProperties(json, res);
16554    return res;
16555  }
16556
16557  protected void parseMedicationRequestProperties(JsonObject json, MedicationRequest res) throws IOException, FHIRFormatError {
16558    parseDomainResourceProperties(json, res);
16559    if (json.has("identifier")) {
16560      JsonArray array = json.getAsJsonArray("identifier");
16561      for (int i = 0; i < array.size(); i++) {
16562        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16563      }
16564    };
16565    if (json.has("status"))
16566      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationRequest.MedicationRequestStatus.NULL, new MedicationRequest.MedicationRequestStatusEnumFactory()));
16567    if (json.has("_status"))
16568      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16569    if (json.has("statusReason"))
16570      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
16571    if (json.has("intent"))
16572      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), MedicationRequest.MedicationRequestIntent.NULL, new MedicationRequest.MedicationRequestIntentEnumFactory()));
16573    if (json.has("_intent"))
16574      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
16575    if (json.has("category")) {
16576      JsonArray array = json.getAsJsonArray("category");
16577      for (int i = 0; i < array.size(); i++) {
16578        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16579      }
16580    };
16581    if (json.has("priority"))
16582      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), MedicationRequest.MedicationRequestPriority.NULL, new MedicationRequest.MedicationRequestPriorityEnumFactory()));
16583    if (json.has("_priority"))
16584      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
16585    if (json.has("doNotPerform"))
16586      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
16587    if (json.has("_doNotPerform"))
16588      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
16589    Type reported = parseType("reported", json);
16590    if (reported != null)
16591      res.setReported(reported);
16592    Type medication = parseType("medication", json);
16593    if (medication != null)
16594      res.setMedication(medication);
16595    if (json.has("subject"))
16596      res.setSubject(parseReference(getJObject(json, "subject")));
16597    if (json.has("encounter"))
16598      res.setEncounter(parseReference(getJObject(json, "encounter")));
16599    if (json.has("supportingInformation")) {
16600      JsonArray array = json.getAsJsonArray("supportingInformation");
16601      for (int i = 0; i < array.size(); i++) {
16602        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
16603      }
16604    };
16605    if (json.has("authoredOn"))
16606      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
16607    if (json.has("_authoredOn"))
16608      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
16609    if (json.has("requester"))
16610      res.setRequester(parseReference(getJObject(json, "requester")));
16611    if (json.has("performer"))
16612      res.setPerformer(parseReference(getJObject(json, "performer")));
16613    if (json.has("performerType"))
16614      res.setPerformerType(parseCodeableConcept(getJObject(json, "performerType")));
16615    if (json.has("recorder"))
16616      res.setRecorder(parseReference(getJObject(json, "recorder")));
16617    if (json.has("reasonCode")) {
16618      JsonArray array = json.getAsJsonArray("reasonCode");
16619      for (int i = 0; i < array.size(); i++) {
16620        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16621      }
16622    };
16623    if (json.has("reasonReference")) {
16624      JsonArray array = json.getAsJsonArray("reasonReference");
16625      for (int i = 0; i < array.size(); i++) {
16626        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
16627      }
16628    };
16629    if (json.has("instantiatesCanonical")) {
16630      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
16631      for (int i = 0; i < array.size(); i++) {
16632        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
16633      }
16634    };
16635    if (json.has("_instantiatesCanonical")) {
16636      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
16637      for (int i = 0; i < array.size(); i++) {
16638        if (i == res.getInstantiatesCanonical().size())
16639          res.getInstantiatesCanonical().add(parseCanonical(null));
16640        if (array.get(i) instanceof JsonObject) 
16641          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
16642      }
16643    };
16644    if (json.has("instantiatesUri")) {
16645      JsonArray array = json.getAsJsonArray("instantiatesUri");
16646      for (int i = 0; i < array.size(); i++) {
16647        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
16648      }
16649    };
16650    if (json.has("_instantiatesUri")) {
16651      JsonArray array = json.getAsJsonArray("_instantiatesUri");
16652      for (int i = 0; i < array.size(); i++) {
16653        if (i == res.getInstantiatesUri().size())
16654          res.getInstantiatesUri().add(parseUri(null));
16655        if (array.get(i) instanceof JsonObject) 
16656          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
16657      }
16658    };
16659    if (json.has("basedOn")) {
16660      JsonArray array = json.getAsJsonArray("basedOn");
16661      for (int i = 0; i < array.size(); i++) {
16662        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
16663      }
16664    };
16665    if (json.has("groupIdentifier"))
16666      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
16667    if (json.has("courseOfTherapyType"))
16668      res.setCourseOfTherapyType(parseCodeableConcept(getJObject(json, "courseOfTherapyType")));
16669    if (json.has("insurance")) {
16670      JsonArray array = json.getAsJsonArray("insurance");
16671      for (int i = 0; i < array.size(); i++) {
16672        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
16673      }
16674    };
16675    if (json.has("note")) {
16676      JsonArray array = json.getAsJsonArray("note");
16677      for (int i = 0; i < array.size(); i++) {
16678        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16679      }
16680    };
16681    if (json.has("dosageInstruction")) {
16682      JsonArray array = json.getAsJsonArray("dosageInstruction");
16683      for (int i = 0; i < array.size(); i++) {
16684        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
16685      }
16686    };
16687    if (json.has("dispenseRequest"))
16688      res.setDispenseRequest(parseMedicationRequestMedicationRequestDispenseRequestComponent(getJObject(json, "dispenseRequest"), res));
16689    if (json.has("substitution"))
16690      res.setSubstitution(parseMedicationRequestMedicationRequestSubstitutionComponent(getJObject(json, "substitution"), res));
16691    if (json.has("priorPrescription"))
16692      res.setPriorPrescription(parseReference(getJObject(json, "priorPrescription")));
16693    if (json.has("detectedIssue")) {
16694      JsonArray array = json.getAsJsonArray("detectedIssue");
16695      for (int i = 0; i < array.size(); i++) {
16696        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
16697      }
16698    };
16699    if (json.has("eventHistory")) {
16700      JsonArray array = json.getAsJsonArray("eventHistory");
16701      for (int i = 0; i < array.size(); i++) {
16702        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
16703      }
16704    };
16705  }
16706
16707  protected MedicationRequest.MedicationRequestDispenseRequestComponent parseMedicationRequestMedicationRequestDispenseRequestComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
16708    MedicationRequest.MedicationRequestDispenseRequestComponent res = new MedicationRequest.MedicationRequestDispenseRequestComponent();
16709    parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(json, owner, res);
16710    return res;
16711  }
16712
16713  protected void parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestDispenseRequestComponent res) throws IOException, FHIRFormatError {
16714    parseBackboneElementProperties(json, res);
16715    if (json.has("initialFill"))
16716      res.setInitialFill(parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(getJObject(json, "initialFill"), owner));
16717    if (json.has("dispenseInterval"))
16718      res.setDispenseInterval(parseDuration(getJObject(json, "dispenseInterval")));
16719    if (json.has("validityPeriod"))
16720      res.setValidityPeriod(parsePeriod(getJObject(json, "validityPeriod")));
16721    if (json.has("numberOfRepeatsAllowed"))
16722      res.setNumberOfRepeatsAllowedElement(parseUnsignedInt(json.get("numberOfRepeatsAllowed").getAsString()));
16723    if (json.has("_numberOfRepeatsAllowed"))
16724      parseElementProperties(getJObject(json, "_numberOfRepeatsAllowed"), res.getNumberOfRepeatsAllowedElement());
16725    if (json.has("quantity"))
16726      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
16727    if (json.has("expectedSupplyDuration"))
16728      res.setExpectedSupplyDuration(parseDuration(getJObject(json, "expectedSupplyDuration")));
16729    if (json.has("performer"))
16730      res.setPerformer(parseReference(getJObject(json, "performer")));
16731  }
16732
16733  protected MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
16734    MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent res = new MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent();
16735    parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponentProperties(json, owner, res);
16736    return res;
16737  }
16738
16739  protected void parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent res) throws IOException, FHIRFormatError {
16740    parseBackboneElementProperties(json, res);
16741    if (json.has("quantity"))
16742      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
16743    if (json.has("duration"))
16744      res.setDuration(parseDuration(getJObject(json, "duration")));
16745  }
16746
16747  protected MedicationRequest.MedicationRequestSubstitutionComponent parseMedicationRequestMedicationRequestSubstitutionComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
16748    MedicationRequest.MedicationRequestSubstitutionComponent res = new MedicationRequest.MedicationRequestSubstitutionComponent();
16749    parseMedicationRequestMedicationRequestSubstitutionComponentProperties(json, owner, res);
16750    return res;
16751  }
16752
16753  protected void parseMedicationRequestMedicationRequestSubstitutionComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestSubstitutionComponent res) throws IOException, FHIRFormatError {
16754    parseBackboneElementProperties(json, res);
16755    Type allowed = parseType("allowed", json);
16756    if (allowed != null)
16757      res.setAllowed(allowed);
16758    if (json.has("reason"))
16759      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
16760  }
16761
16762  protected MedicationStatement parseMedicationStatement(JsonObject json) throws IOException, FHIRFormatError {
16763    MedicationStatement res = new MedicationStatement();
16764    parseMedicationStatementProperties(json, res);
16765    return res;
16766  }
16767
16768  protected void parseMedicationStatementProperties(JsonObject json, MedicationStatement res) throws IOException, FHIRFormatError {
16769    parseDomainResourceProperties(json, res);
16770    if (json.has("identifier")) {
16771      JsonArray array = json.getAsJsonArray("identifier");
16772      for (int i = 0; i < array.size(); i++) {
16773        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16774      }
16775    };
16776    if (json.has("basedOn")) {
16777      JsonArray array = json.getAsJsonArray("basedOn");
16778      for (int i = 0; i < array.size(); i++) {
16779        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
16780      }
16781    };
16782    if (json.has("partOf")) {
16783      JsonArray array = json.getAsJsonArray("partOf");
16784      for (int i = 0; i < array.size(); i++) {
16785        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
16786      }
16787    };
16788    if (json.has("status"))
16789      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationStatement.MedicationStatementStatus.NULL, new MedicationStatement.MedicationStatementStatusEnumFactory()));
16790    if (json.has("_status"))
16791      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16792    if (json.has("statusReason")) {
16793      JsonArray array = json.getAsJsonArray("statusReason");
16794      for (int i = 0; i < array.size(); i++) {
16795        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16796      }
16797    };
16798    if (json.has("category"))
16799      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
16800    Type medication = parseType("medication", json);
16801    if (medication != null)
16802      res.setMedication(medication);
16803    if (json.has("subject"))
16804      res.setSubject(parseReference(getJObject(json, "subject")));
16805    if (json.has("context"))
16806      res.setContext(parseReference(getJObject(json, "context")));
16807    Type effective = parseType("effective", json);
16808    if (effective != null)
16809      res.setEffective(effective);
16810    if (json.has("dateAsserted"))
16811      res.setDateAssertedElement(parseDateTime(json.get("dateAsserted").getAsString()));
16812    if (json.has("_dateAsserted"))
16813      parseElementProperties(getJObject(json, "_dateAsserted"), res.getDateAssertedElement());
16814    if (json.has("informationSource"))
16815      res.setInformationSource(parseReference(getJObject(json, "informationSource")));
16816    if (json.has("derivedFrom")) {
16817      JsonArray array = json.getAsJsonArray("derivedFrom");
16818      for (int i = 0; i < array.size(); i++) {
16819        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
16820      }
16821    };
16822    if (json.has("reasonCode")) {
16823      JsonArray array = json.getAsJsonArray("reasonCode");
16824      for (int i = 0; i < array.size(); i++) {
16825        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16826      }
16827    };
16828    if (json.has("reasonReference")) {
16829      JsonArray array = json.getAsJsonArray("reasonReference");
16830      for (int i = 0; i < array.size(); i++) {
16831        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
16832      }
16833    };
16834    if (json.has("note")) {
16835      JsonArray array = json.getAsJsonArray("note");
16836      for (int i = 0; i < array.size(); i++) {
16837        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16838      }
16839    };
16840    if (json.has("dosage")) {
16841      JsonArray array = json.getAsJsonArray("dosage");
16842      for (int i = 0; i < array.size(); i++) {
16843        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
16844      }
16845    };
16846  }
16847
16848  protected MedicinalProduct parseMedicinalProduct(JsonObject json) throws IOException, FHIRFormatError {
16849    MedicinalProduct res = new MedicinalProduct();
16850    parseMedicinalProductProperties(json, res);
16851    return res;
16852  }
16853
16854  protected void parseMedicinalProductProperties(JsonObject json, MedicinalProduct res) throws IOException, FHIRFormatError {
16855    parseDomainResourceProperties(json, res);
16856    if (json.has("identifier")) {
16857      JsonArray array = json.getAsJsonArray("identifier");
16858      for (int i = 0; i < array.size(); i++) {
16859        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16860      }
16861    };
16862    if (json.has("type"))
16863      res.setType(parseCodeableConcept(getJObject(json, "type")));
16864    if (json.has("domain"))
16865      res.setDomain(parseCoding(getJObject(json, "domain")));
16866    if (json.has("combinedPharmaceuticalDoseForm"))
16867      res.setCombinedPharmaceuticalDoseForm(parseCodeableConcept(getJObject(json, "combinedPharmaceuticalDoseForm")));
16868    if (json.has("legalStatusOfSupply"))
16869      res.setLegalStatusOfSupply(parseCodeableConcept(getJObject(json, "legalStatusOfSupply")));
16870    if (json.has("additionalMonitoringIndicator"))
16871      res.setAdditionalMonitoringIndicator(parseCodeableConcept(getJObject(json, "additionalMonitoringIndicator")));
16872    if (json.has("specialMeasures")) {
16873      JsonArray array = json.getAsJsonArray("specialMeasures");
16874      for (int i = 0; i < array.size(); i++) {
16875        res.getSpecialMeasures().add(parseString(array.get(i).getAsString()));
16876      }
16877    };
16878    if (json.has("_specialMeasures")) {
16879      JsonArray array = json.getAsJsonArray("_specialMeasures");
16880      for (int i = 0; i < array.size(); i++) {
16881        if (i == res.getSpecialMeasures().size())
16882          res.getSpecialMeasures().add(parseString(null));
16883        if (array.get(i) instanceof JsonObject) 
16884          parseElementProperties(array.get(i).getAsJsonObject(), res.getSpecialMeasures().get(i));
16885      }
16886    };
16887    if (json.has("paediatricUseIndicator"))
16888      res.setPaediatricUseIndicator(parseCodeableConcept(getJObject(json, "paediatricUseIndicator")));
16889    if (json.has("productClassification")) {
16890      JsonArray array = json.getAsJsonArray("productClassification");
16891      for (int i = 0; i < array.size(); i++) {
16892        res.getProductClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16893      }
16894    };
16895    if (json.has("marketingStatus")) {
16896      JsonArray array = json.getAsJsonArray("marketingStatus");
16897      for (int i = 0; i < array.size(); i++) {
16898        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
16899      }
16900    };
16901    if (json.has("pharmaceuticalProduct")) {
16902      JsonArray array = json.getAsJsonArray("pharmaceuticalProduct");
16903      for (int i = 0; i < array.size(); i++) {
16904        res.getPharmaceuticalProduct().add(parseReference(array.get(i).getAsJsonObject()));
16905      }
16906    };
16907    if (json.has("packagedMedicinalProduct")) {
16908      JsonArray array = json.getAsJsonArray("packagedMedicinalProduct");
16909      for (int i = 0; i < array.size(); i++) {
16910        res.getPackagedMedicinalProduct().add(parseReference(array.get(i).getAsJsonObject()));
16911      }
16912    };
16913    if (json.has("attachedDocument")) {
16914      JsonArray array = json.getAsJsonArray("attachedDocument");
16915      for (int i = 0; i < array.size(); i++) {
16916        res.getAttachedDocument().add(parseReference(array.get(i).getAsJsonObject()));
16917      }
16918    };
16919    if (json.has("masterFile")) {
16920      JsonArray array = json.getAsJsonArray("masterFile");
16921      for (int i = 0; i < array.size(); i++) {
16922        res.getMasterFile().add(parseReference(array.get(i).getAsJsonObject()));
16923      }
16924    };
16925    if (json.has("contact")) {
16926      JsonArray array = json.getAsJsonArray("contact");
16927      for (int i = 0; i < array.size(); i++) {
16928        res.getContact().add(parseReference(array.get(i).getAsJsonObject()));
16929      }
16930    };
16931    if (json.has("clinicalTrial")) {
16932      JsonArray array = json.getAsJsonArray("clinicalTrial");
16933      for (int i = 0; i < array.size(); i++) {
16934        res.getClinicalTrial().add(parseReference(array.get(i).getAsJsonObject()));
16935      }
16936    };
16937    if (json.has("name")) {
16938      JsonArray array = json.getAsJsonArray("name");
16939      for (int i = 0; i < array.size(); i++) {
16940        res.getName().add(parseMedicinalProductMedicinalProductNameComponent(array.get(i).getAsJsonObject(), res));
16941      }
16942    };
16943    if (json.has("crossReference")) {
16944      JsonArray array = json.getAsJsonArray("crossReference");
16945      for (int i = 0; i < array.size(); i++) {
16946        res.getCrossReference().add(parseIdentifier(array.get(i).getAsJsonObject()));
16947      }
16948    };
16949    if (json.has("manufacturingBusinessOperation")) {
16950      JsonArray array = json.getAsJsonArray("manufacturingBusinessOperation");
16951      for (int i = 0; i < array.size(); i++) {
16952        res.getManufacturingBusinessOperation().add(parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(array.get(i).getAsJsonObject(), res));
16953      }
16954    };
16955    if (json.has("specialDesignation")) {
16956      JsonArray array = json.getAsJsonArray("specialDesignation");
16957      for (int i = 0; i < array.size(); i++) {
16958        res.getSpecialDesignation().add(parseMedicinalProductMedicinalProductSpecialDesignationComponent(array.get(i).getAsJsonObject(), res));
16959      }
16960    };
16961  }
16962
16963  protected MedicinalProduct.MedicinalProductNameComponent parseMedicinalProductMedicinalProductNameComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
16964    MedicinalProduct.MedicinalProductNameComponent res = new MedicinalProduct.MedicinalProductNameComponent();
16965    parseMedicinalProductMedicinalProductNameComponentProperties(json, owner, res);
16966    return res;
16967  }
16968
16969  protected void parseMedicinalProductMedicinalProductNameComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductNameComponent res) throws IOException, FHIRFormatError {
16970    parseBackboneElementProperties(json, res);
16971    if (json.has("productName"))
16972      res.setProductNameElement(parseString(json.get("productName").getAsString()));
16973    if (json.has("_productName"))
16974      parseElementProperties(getJObject(json, "_productName"), res.getProductNameElement());
16975    if (json.has("namePart")) {
16976      JsonArray array = json.getAsJsonArray("namePart");
16977      for (int i = 0; i < array.size(); i++) {
16978        res.getNamePart().add(parseMedicinalProductMedicinalProductNameNamePartComponent(array.get(i).getAsJsonObject(), owner));
16979      }
16980    };
16981    if (json.has("countryLanguage")) {
16982      JsonArray array = json.getAsJsonArray("countryLanguage");
16983      for (int i = 0; i < array.size(); i++) {
16984        res.getCountryLanguage().add(parseMedicinalProductMedicinalProductNameCountryLanguageComponent(array.get(i).getAsJsonObject(), owner));
16985      }
16986    };
16987  }
16988
16989  protected MedicinalProduct.MedicinalProductNameNamePartComponent parseMedicinalProductMedicinalProductNameNamePartComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
16990    MedicinalProduct.MedicinalProductNameNamePartComponent res = new MedicinalProduct.MedicinalProductNameNamePartComponent();
16991    parseMedicinalProductMedicinalProductNameNamePartComponentProperties(json, owner, res);
16992    return res;
16993  }
16994
16995  protected void parseMedicinalProductMedicinalProductNameNamePartComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductNameNamePartComponent res) throws IOException, FHIRFormatError {
16996    parseBackboneElementProperties(json, res);
16997    if (json.has("part"))
16998      res.setPartElement(parseString(json.get("part").getAsString()));
16999    if (json.has("_part"))
17000      parseElementProperties(getJObject(json, "_part"), res.getPartElement());
17001    if (json.has("type"))
17002      res.setType(parseCoding(getJObject(json, "type")));
17003  }
17004
17005  protected MedicinalProduct.MedicinalProductNameCountryLanguageComponent parseMedicinalProductMedicinalProductNameCountryLanguageComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
17006    MedicinalProduct.MedicinalProductNameCountryLanguageComponent res = new MedicinalProduct.MedicinalProductNameCountryLanguageComponent();
17007    parseMedicinalProductMedicinalProductNameCountryLanguageComponentProperties(json, owner, res);
17008    return res;
17009  }
17010
17011  protected void parseMedicinalProductMedicinalProductNameCountryLanguageComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductNameCountryLanguageComponent res) throws IOException, FHIRFormatError {
17012    parseBackboneElementProperties(json, res);
17013    if (json.has("country"))
17014      res.setCountry(parseCodeableConcept(getJObject(json, "country")));
17015    if (json.has("jurisdiction"))
17016      res.setJurisdiction(parseCodeableConcept(getJObject(json, "jurisdiction")));
17017    if (json.has("language"))
17018      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
17019  }
17020
17021  protected MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
17022    MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent res = new MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent();
17023    parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponentProperties(json, owner, res);
17024    return res;
17025  }
17026
17027  protected void parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent res) throws IOException, FHIRFormatError {
17028    parseBackboneElementProperties(json, res);
17029    if (json.has("operationType"))
17030      res.setOperationType(parseCodeableConcept(getJObject(json, "operationType")));
17031    if (json.has("authorisationReferenceNumber"))
17032      res.setAuthorisationReferenceNumber(parseIdentifier(getJObject(json, "authorisationReferenceNumber")));
17033    if (json.has("effectiveDate"))
17034      res.setEffectiveDateElement(parseDateTime(json.get("effectiveDate").getAsString()));
17035    if (json.has("_effectiveDate"))
17036      parseElementProperties(getJObject(json, "_effectiveDate"), res.getEffectiveDateElement());
17037    if (json.has("confidentialityIndicator"))
17038      res.setConfidentialityIndicator(parseCodeableConcept(getJObject(json, "confidentialityIndicator")));
17039    if (json.has("manufacturer")) {
17040      JsonArray array = json.getAsJsonArray("manufacturer");
17041      for (int i = 0; i < array.size(); i++) {
17042        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
17043      }
17044    };
17045    if (json.has("regulator"))
17046      res.setRegulator(parseReference(getJObject(json, "regulator")));
17047  }
17048
17049  protected MedicinalProduct.MedicinalProductSpecialDesignationComponent parseMedicinalProductMedicinalProductSpecialDesignationComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
17050    MedicinalProduct.MedicinalProductSpecialDesignationComponent res = new MedicinalProduct.MedicinalProductSpecialDesignationComponent();
17051    parseMedicinalProductMedicinalProductSpecialDesignationComponentProperties(json, owner, res);
17052    return res;
17053  }
17054
17055  protected void parseMedicinalProductMedicinalProductSpecialDesignationComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductSpecialDesignationComponent res) throws IOException, FHIRFormatError {
17056    parseBackboneElementProperties(json, res);
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    if (json.has("type"))
17064      res.setType(parseCodeableConcept(getJObject(json, "type")));
17065    if (json.has("intendedUse"))
17066      res.setIntendedUse(parseCodeableConcept(getJObject(json, "intendedUse")));
17067    Type indication = parseType("indication", json);
17068    if (indication != null)
17069      res.setIndication(indication);
17070    if (json.has("status"))
17071      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
17072    if (json.has("date"))
17073      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17074    if (json.has("_date"))
17075      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
17076    if (json.has("species"))
17077      res.setSpecies(parseCodeableConcept(getJObject(json, "species")));
17078  }
17079
17080  protected MedicinalProductAuthorization parseMedicinalProductAuthorization(JsonObject json) throws IOException, FHIRFormatError {
17081    MedicinalProductAuthorization res = new MedicinalProductAuthorization();
17082    parseMedicinalProductAuthorizationProperties(json, res);
17083    return res;
17084  }
17085
17086  protected void parseMedicinalProductAuthorizationProperties(JsonObject json, MedicinalProductAuthorization res) throws IOException, FHIRFormatError {
17087    parseDomainResourceProperties(json, res);
17088    if (json.has("identifier")) {
17089      JsonArray array = json.getAsJsonArray("identifier");
17090      for (int i = 0; i < array.size(); i++) {
17091        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17092      }
17093    };
17094    if (json.has("subject"))
17095      res.setSubject(parseReference(getJObject(json, "subject")));
17096    if (json.has("country")) {
17097      JsonArray array = json.getAsJsonArray("country");
17098      for (int i = 0; i < array.size(); i++) {
17099        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17100      }
17101    };
17102    if (json.has("jurisdiction")) {
17103      JsonArray array = json.getAsJsonArray("jurisdiction");
17104      for (int i = 0; i < array.size(); i++) {
17105        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17106      }
17107    };
17108    if (json.has("status"))
17109      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
17110    if (json.has("statusDate"))
17111      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
17112    if (json.has("_statusDate"))
17113      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
17114    if (json.has("restoreDate"))
17115      res.setRestoreDateElement(parseDateTime(json.get("restoreDate").getAsString()));
17116    if (json.has("_restoreDate"))
17117      parseElementProperties(getJObject(json, "_restoreDate"), res.getRestoreDateElement());
17118    if (json.has("validityPeriod"))
17119      res.setValidityPeriod(parsePeriod(getJObject(json, "validityPeriod")));
17120    if (json.has("dataExclusivityPeriod"))
17121      res.setDataExclusivityPeriod(parsePeriod(getJObject(json, "dataExclusivityPeriod")));
17122    if (json.has("dateOfFirstAuthorization"))
17123      res.setDateOfFirstAuthorizationElement(parseDateTime(json.get("dateOfFirstAuthorization").getAsString()));
17124    if (json.has("_dateOfFirstAuthorization"))
17125      parseElementProperties(getJObject(json, "_dateOfFirstAuthorization"), res.getDateOfFirstAuthorizationElement());
17126    if (json.has("internationalBirthDate"))
17127      res.setInternationalBirthDateElement(parseDateTime(json.get("internationalBirthDate").getAsString()));
17128    if (json.has("_internationalBirthDate"))
17129      parseElementProperties(getJObject(json, "_internationalBirthDate"), res.getInternationalBirthDateElement());
17130    if (json.has("legalBasis"))
17131      res.setLegalBasis(parseCodeableConcept(getJObject(json, "legalBasis")));
17132    if (json.has("jurisdictionalAuthorization")) {
17133      JsonArray array = json.getAsJsonArray("jurisdictionalAuthorization");
17134      for (int i = 0; i < array.size(); i++) {
17135        res.getJurisdictionalAuthorization().add(parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(array.get(i).getAsJsonObject(), res));
17136      }
17137    };
17138    if (json.has("holder"))
17139      res.setHolder(parseReference(getJObject(json, "holder")));
17140    if (json.has("regulator"))
17141      res.setRegulator(parseReference(getJObject(json, "regulator")));
17142    if (json.has("procedure"))
17143      res.setProcedure(parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(getJObject(json, "procedure"), res));
17144  }
17145
17146  protected MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(JsonObject json, MedicinalProductAuthorization owner) throws IOException, FHIRFormatError {
17147    MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent res = new MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent();
17148    parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentProperties(json, owner, res);
17149    return res;
17150  }
17151
17152  protected void parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentProperties(JsonObject json, MedicinalProductAuthorization owner, MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent res) throws IOException, FHIRFormatError {
17153    parseBackboneElementProperties(json, res);
17154    if (json.has("identifier")) {
17155      JsonArray array = json.getAsJsonArray("identifier");
17156      for (int i = 0; i < array.size(); i++) {
17157        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17158      }
17159    };
17160    if (json.has("country"))
17161      res.setCountry(parseCodeableConcept(getJObject(json, "country")));
17162    if (json.has("jurisdiction")) {
17163      JsonArray array = json.getAsJsonArray("jurisdiction");
17164      for (int i = 0; i < array.size(); i++) {
17165        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17166      }
17167    };
17168    if (json.has("legalStatusOfSupply"))
17169      res.setLegalStatusOfSupply(parseCodeableConcept(getJObject(json, "legalStatusOfSupply")));
17170    if (json.has("validityPeriod"))
17171      res.setValidityPeriod(parsePeriod(getJObject(json, "validityPeriod")));
17172  }
17173
17174  protected MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(JsonObject json, MedicinalProductAuthorization owner) throws IOException, FHIRFormatError {
17175    MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent res = new MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent();
17176    parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentProperties(json, owner, res);
17177    return res;
17178  }
17179
17180  protected void parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentProperties(JsonObject json, MedicinalProductAuthorization owner, MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent res) throws IOException, FHIRFormatError {
17181    parseBackboneElementProperties(json, res);
17182    if (json.has("identifier"))
17183      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
17184    if (json.has("type"))
17185      res.setType(parseCodeableConcept(getJObject(json, "type")));
17186    Type date = parseType("date", json);
17187    if (date != null)
17188      res.setDate(date);
17189    if (json.has("application")) {
17190      JsonArray array = json.getAsJsonArray("application");
17191      for (int i = 0; i < array.size(); i++) {
17192        res.getApplication().add(parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(array.get(i).getAsJsonObject(), owner));
17193      }
17194    };
17195  }
17196
17197  protected MedicinalProductContraindication parseMedicinalProductContraindication(JsonObject json) throws IOException, FHIRFormatError {
17198    MedicinalProductContraindication res = new MedicinalProductContraindication();
17199    parseMedicinalProductContraindicationProperties(json, res);
17200    return res;
17201  }
17202
17203  protected void parseMedicinalProductContraindicationProperties(JsonObject json, MedicinalProductContraindication res) throws IOException, FHIRFormatError {
17204    parseDomainResourceProperties(json, res);
17205    if (json.has("subject")) {
17206      JsonArray array = json.getAsJsonArray("subject");
17207      for (int i = 0; i < array.size(); i++) {
17208        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
17209      }
17210    };
17211    if (json.has("disease"))
17212      res.setDisease(parseCodeableConcept(getJObject(json, "disease")));
17213    if (json.has("diseaseStatus"))
17214      res.setDiseaseStatus(parseCodeableConcept(getJObject(json, "diseaseStatus")));
17215    if (json.has("comorbidity")) {
17216      JsonArray array = json.getAsJsonArray("comorbidity");
17217      for (int i = 0; i < array.size(); i++) {
17218        res.getComorbidity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17219      }
17220    };
17221    if (json.has("therapeuticIndication")) {
17222      JsonArray array = json.getAsJsonArray("therapeuticIndication");
17223      for (int i = 0; i < array.size(); i++) {
17224        res.getTherapeuticIndication().add(parseReference(array.get(i).getAsJsonObject()));
17225      }
17226    };
17227    if (json.has("otherTherapy")) {
17228      JsonArray array = json.getAsJsonArray("otherTherapy");
17229      for (int i = 0; i < array.size(); i++) {
17230        res.getOtherTherapy().add(parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(array.get(i).getAsJsonObject(), res));
17231      }
17232    };
17233    if (json.has("population")) {
17234      JsonArray array = json.getAsJsonArray("population");
17235      for (int i = 0; i < array.size(); i++) {
17236        res.getPopulation().add(parsePopulation(array.get(i).getAsJsonObject()));
17237      }
17238    };
17239  }
17240
17241  protected MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(JsonObject json, MedicinalProductContraindication owner) throws IOException, FHIRFormatError {
17242    MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent res = new MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent();
17243    parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentProperties(json, owner, res);
17244    return res;
17245  }
17246
17247  protected void parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentProperties(JsonObject json, MedicinalProductContraindication owner, MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent res) throws IOException, FHIRFormatError {
17248    parseBackboneElementProperties(json, res);
17249    if (json.has("therapyRelationshipType"))
17250      res.setTherapyRelationshipType(parseCodeableConcept(getJObject(json, "therapyRelationshipType")));
17251    Type medication = parseType("medication", json);
17252    if (medication != null)
17253      res.setMedication(medication);
17254  }
17255
17256  protected MedicinalProductIndication parseMedicinalProductIndication(JsonObject json) throws IOException, FHIRFormatError {
17257    MedicinalProductIndication res = new MedicinalProductIndication();
17258    parseMedicinalProductIndicationProperties(json, res);
17259    return res;
17260  }
17261
17262  protected void parseMedicinalProductIndicationProperties(JsonObject json, MedicinalProductIndication res) throws IOException, FHIRFormatError {
17263    parseDomainResourceProperties(json, res);
17264    if (json.has("subject")) {
17265      JsonArray array = json.getAsJsonArray("subject");
17266      for (int i = 0; i < array.size(); i++) {
17267        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
17268      }
17269    };
17270    if (json.has("diseaseSymptomProcedure"))
17271      res.setDiseaseSymptomProcedure(parseCodeableConcept(getJObject(json, "diseaseSymptomProcedure")));
17272    if (json.has("diseaseStatus"))
17273      res.setDiseaseStatus(parseCodeableConcept(getJObject(json, "diseaseStatus")));
17274    if (json.has("comorbidity")) {
17275      JsonArray array = json.getAsJsonArray("comorbidity");
17276      for (int i = 0; i < array.size(); i++) {
17277        res.getComorbidity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17278      }
17279    };
17280    if (json.has("intendedEffect"))
17281      res.setIntendedEffect(parseCodeableConcept(getJObject(json, "intendedEffect")));
17282    if (json.has("duration"))
17283      res.setDuration(parseQuantity(getJObject(json, "duration")));
17284    if (json.has("otherTherapy")) {
17285      JsonArray array = json.getAsJsonArray("otherTherapy");
17286      for (int i = 0; i < array.size(); i++) {
17287        res.getOtherTherapy().add(parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(array.get(i).getAsJsonObject(), res));
17288      }
17289    };
17290    if (json.has("undesirableEffect")) {
17291      JsonArray array = json.getAsJsonArray("undesirableEffect");
17292      for (int i = 0; i < array.size(); i++) {
17293        res.getUndesirableEffect().add(parseReference(array.get(i).getAsJsonObject()));
17294      }
17295    };
17296    if (json.has("population")) {
17297      JsonArray array = json.getAsJsonArray("population");
17298      for (int i = 0; i < array.size(); i++) {
17299        res.getPopulation().add(parsePopulation(array.get(i).getAsJsonObject()));
17300      }
17301    };
17302  }
17303
17304  protected MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(JsonObject json, MedicinalProductIndication owner) throws IOException, FHIRFormatError {
17305    MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent res = new MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent();
17306    parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentProperties(json, owner, res);
17307    return res;
17308  }
17309
17310  protected void parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentProperties(JsonObject json, MedicinalProductIndication owner, MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent res) throws IOException, FHIRFormatError {
17311    parseBackboneElementProperties(json, res);
17312    if (json.has("therapyRelationshipType"))
17313      res.setTherapyRelationshipType(parseCodeableConcept(getJObject(json, "therapyRelationshipType")));
17314    Type medication = parseType("medication", json);
17315    if (medication != null)
17316      res.setMedication(medication);
17317  }
17318
17319  protected MedicinalProductIngredient parseMedicinalProductIngredient(JsonObject json) throws IOException, FHIRFormatError {
17320    MedicinalProductIngredient res = new MedicinalProductIngredient();
17321    parseMedicinalProductIngredientProperties(json, res);
17322    return res;
17323  }
17324
17325  protected void parseMedicinalProductIngredientProperties(JsonObject json, MedicinalProductIngredient res) throws IOException, FHIRFormatError {
17326    parseDomainResourceProperties(json, res);
17327    if (json.has("identifier"))
17328      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
17329    if (json.has("role"))
17330      res.setRole(parseCodeableConcept(getJObject(json, "role")));
17331    if (json.has("allergenicIndicator"))
17332      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
17333    if (json.has("_allergenicIndicator"))
17334      parseElementProperties(getJObject(json, "_allergenicIndicator"), res.getAllergenicIndicatorElement());
17335    if (json.has("manufacturer")) {
17336      JsonArray array = json.getAsJsonArray("manufacturer");
17337      for (int i = 0; i < array.size(); i++) {
17338        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
17339      }
17340    };
17341    if (json.has("specifiedSubstance")) {
17342      JsonArray array = json.getAsJsonArray("specifiedSubstance");
17343      for (int i = 0; i < array.size(); i++) {
17344        res.getSpecifiedSubstance().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(array.get(i).getAsJsonObject(), res));
17345      }
17346    };
17347    if (json.has("substance"))
17348      res.setSubstance(parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(getJObject(json, "substance"), res));
17349  }
17350
17351  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
17352    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent();
17353    parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentProperties(json, owner, res);
17354    return res;
17355  }
17356
17357  protected void parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent res) throws IOException, FHIRFormatError {
17358    parseBackboneElementProperties(json, res);
17359    if (json.has("code"))
17360      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17361    if (json.has("group"))
17362      res.setGroup(parseCodeableConcept(getJObject(json, "group")));
17363    if (json.has("confidentiality"))
17364      res.setConfidentiality(parseCodeableConcept(getJObject(json, "confidentiality")));
17365    if (json.has("strength")) {
17366      JsonArray array = json.getAsJsonArray("strength");
17367      for (int i = 0; i < array.size(); i++) {
17368        res.getStrength().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(array.get(i).getAsJsonObject(), owner));
17369      }
17370    };
17371  }
17372
17373  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
17374    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent();
17375    parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentProperties(json, owner, res);
17376    return res;
17377  }
17378
17379  protected void parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent res) throws IOException, FHIRFormatError {
17380    parseBackboneElementProperties(json, res);
17381    if (json.has("presentation"))
17382      res.setPresentation(parseRatio(getJObject(json, "presentation")));
17383    if (json.has("presentationLowLimit"))
17384      res.setPresentationLowLimit(parseRatio(getJObject(json, "presentationLowLimit")));
17385    if (json.has("concentration"))
17386      res.setConcentration(parseRatio(getJObject(json, "concentration")));
17387    if (json.has("concentrationLowLimit"))
17388      res.setConcentrationLowLimit(parseRatio(getJObject(json, "concentrationLowLimit")));
17389    if (json.has("measurementPoint"))
17390      res.setMeasurementPointElement(parseString(json.get("measurementPoint").getAsString()));
17391    if (json.has("_measurementPoint"))
17392      parseElementProperties(getJObject(json, "_measurementPoint"), res.getMeasurementPointElement());
17393    if (json.has("country")) {
17394      JsonArray array = json.getAsJsonArray("country");
17395      for (int i = 0; i < array.size(); i++) {
17396        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17397      }
17398    };
17399    if (json.has("referenceStrength")) {
17400      JsonArray array = json.getAsJsonArray("referenceStrength");
17401      for (int i = 0; i < array.size(); i++) {
17402        res.getReferenceStrength().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(array.get(i).getAsJsonObject(), owner));
17403      }
17404    };
17405  }
17406
17407  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
17408    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent();
17409    parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentProperties(json, owner, res);
17410    return res;
17411  }
17412
17413  protected void parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent res) throws IOException, FHIRFormatError {
17414    parseBackboneElementProperties(json, res);
17415    if (json.has("substance"))
17416      res.setSubstance(parseCodeableConcept(getJObject(json, "substance")));
17417    if (json.has("strength"))
17418      res.setStrength(parseRatio(getJObject(json, "strength")));
17419    if (json.has("strengthLowLimit"))
17420      res.setStrengthLowLimit(parseRatio(getJObject(json, "strengthLowLimit")));
17421    if (json.has("measurementPoint"))
17422      res.setMeasurementPointElement(parseString(json.get("measurementPoint").getAsString()));
17423    if (json.has("_measurementPoint"))
17424      parseElementProperties(getJObject(json, "_measurementPoint"), res.getMeasurementPointElement());
17425    if (json.has("country")) {
17426      JsonArray array = json.getAsJsonArray("country");
17427      for (int i = 0; i < array.size(); i++) {
17428        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17429      }
17430    };
17431  }
17432
17433  protected MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
17434    MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent();
17435    parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentProperties(json, owner, res);
17436    return res;
17437  }
17438
17439  protected void parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent res) throws IOException, FHIRFormatError {
17440    parseBackboneElementProperties(json, res);
17441    if (json.has("code"))
17442      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17443    if (json.has("strength")) {
17444      JsonArray array = json.getAsJsonArray("strength");
17445      for (int i = 0; i < array.size(); i++) {
17446        res.getStrength().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(array.get(i).getAsJsonObject(), owner));
17447      }
17448    };
17449  }
17450
17451  protected MedicinalProductInteraction parseMedicinalProductInteraction(JsonObject json) throws IOException, FHIRFormatError {
17452    MedicinalProductInteraction res = new MedicinalProductInteraction();
17453    parseMedicinalProductInteractionProperties(json, res);
17454    return res;
17455  }
17456
17457  protected void parseMedicinalProductInteractionProperties(JsonObject json, MedicinalProductInteraction res) throws IOException, FHIRFormatError {
17458    parseDomainResourceProperties(json, res);
17459    if (json.has("subject")) {
17460      JsonArray array = json.getAsJsonArray("subject");
17461      for (int i = 0; i < array.size(); i++) {
17462        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
17463      }
17464    };
17465    if (json.has("description"))
17466      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17467    if (json.has("_description"))
17468      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17469    if (json.has("interactant")) {
17470      JsonArray array = json.getAsJsonArray("interactant");
17471      for (int i = 0; i < array.size(); i++) {
17472        res.getInteractant().add(parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(array.get(i).getAsJsonObject(), res));
17473      }
17474    };
17475    if (json.has("type"))
17476      res.setType(parseCodeableConcept(getJObject(json, "type")));
17477    if (json.has("effect"))
17478      res.setEffect(parseCodeableConcept(getJObject(json, "effect")));
17479    if (json.has("incidence"))
17480      res.setIncidence(parseCodeableConcept(getJObject(json, "incidence")));
17481    if (json.has("management"))
17482      res.setManagement(parseCodeableConcept(getJObject(json, "management")));
17483  }
17484
17485  protected MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(JsonObject json, MedicinalProductInteraction owner) throws IOException, FHIRFormatError {
17486    MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent res = new MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent();
17487    parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponentProperties(json, owner, res);
17488    return res;
17489  }
17490
17491  protected void parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponentProperties(JsonObject json, MedicinalProductInteraction owner, MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent res) throws IOException, FHIRFormatError {
17492    parseBackboneElementProperties(json, res);
17493    Type item = parseType("item", json);
17494    if (item != null)
17495      res.setItem(item);
17496  }
17497
17498  protected MedicinalProductManufactured parseMedicinalProductManufactured(JsonObject json) throws IOException, FHIRFormatError {
17499    MedicinalProductManufactured res = new MedicinalProductManufactured();
17500    parseMedicinalProductManufacturedProperties(json, res);
17501    return res;
17502  }
17503
17504  protected void parseMedicinalProductManufacturedProperties(JsonObject json, MedicinalProductManufactured res) throws IOException, FHIRFormatError {
17505    parseDomainResourceProperties(json, res);
17506    if (json.has("manufacturedDoseForm"))
17507      res.setManufacturedDoseForm(parseCodeableConcept(getJObject(json, "manufacturedDoseForm")));
17508    if (json.has("unitOfPresentation"))
17509      res.setUnitOfPresentation(parseCodeableConcept(getJObject(json, "unitOfPresentation")));
17510    if (json.has("quantity"))
17511      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
17512    if (json.has("manufacturer")) {
17513      JsonArray array = json.getAsJsonArray("manufacturer");
17514      for (int i = 0; i < array.size(); i++) {
17515        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
17516      }
17517    };
17518    if (json.has("ingredient")) {
17519      JsonArray array = json.getAsJsonArray("ingredient");
17520      for (int i = 0; i < array.size(); i++) {
17521        res.getIngredient().add(parseReference(array.get(i).getAsJsonObject()));
17522      }
17523    };
17524    if (json.has("physicalCharacteristics"))
17525      res.setPhysicalCharacteristics(parseProdCharacteristic(getJObject(json, "physicalCharacteristics")));
17526    if (json.has("otherCharacteristics")) {
17527      JsonArray array = json.getAsJsonArray("otherCharacteristics");
17528      for (int i = 0; i < array.size(); i++) {
17529        res.getOtherCharacteristics().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17530      }
17531    };
17532  }
17533
17534  protected MedicinalProductPackaged parseMedicinalProductPackaged(JsonObject json) throws IOException, FHIRFormatError {
17535    MedicinalProductPackaged res = new MedicinalProductPackaged();
17536    parseMedicinalProductPackagedProperties(json, res);
17537    return res;
17538  }
17539
17540  protected void parseMedicinalProductPackagedProperties(JsonObject json, MedicinalProductPackaged res) throws IOException, FHIRFormatError {
17541    parseDomainResourceProperties(json, res);
17542    if (json.has("identifier")) {
17543      JsonArray array = json.getAsJsonArray("identifier");
17544      for (int i = 0; i < array.size(); i++) {
17545        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17546      }
17547    };
17548    if (json.has("subject")) {
17549      JsonArray array = json.getAsJsonArray("subject");
17550      for (int i = 0; i < array.size(); i++) {
17551        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
17552      }
17553    };
17554    if (json.has("description"))
17555      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17556    if (json.has("_description"))
17557      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17558    if (json.has("legalStatusOfSupply"))
17559      res.setLegalStatusOfSupply(parseCodeableConcept(getJObject(json, "legalStatusOfSupply")));
17560    if (json.has("marketingStatus")) {
17561      JsonArray array = json.getAsJsonArray("marketingStatus");
17562      for (int i = 0; i < array.size(); i++) {
17563        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
17564      }
17565    };
17566    if (json.has("marketingAuthorization"))
17567      res.setMarketingAuthorization(parseReference(getJObject(json, "marketingAuthorization")));
17568    if (json.has("manufacturer")) {
17569      JsonArray array = json.getAsJsonArray("manufacturer");
17570      for (int i = 0; i < array.size(); i++) {
17571        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
17572      }
17573    };
17574    if (json.has("batchIdentifier")) {
17575      JsonArray array = json.getAsJsonArray("batchIdentifier");
17576      for (int i = 0; i < array.size(); i++) {
17577        res.getBatchIdentifier().add(parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(array.get(i).getAsJsonObject(), res));
17578      }
17579    };
17580    if (json.has("packageItem")) {
17581      JsonArray array = json.getAsJsonArray("packageItem");
17582      for (int i = 0; i < array.size(); i++) {
17583        res.getPackageItem().add(parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(array.get(i).getAsJsonObject(), res));
17584      }
17585    };
17586  }
17587
17588  protected MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(JsonObject json, MedicinalProductPackaged owner) throws IOException, FHIRFormatError {
17589    MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent res = new MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent();
17590    parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentProperties(json, owner, res);
17591    return res;
17592  }
17593
17594  protected void parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentProperties(JsonObject json, MedicinalProductPackaged owner, MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent res) throws IOException, FHIRFormatError {
17595    parseBackboneElementProperties(json, res);
17596    if (json.has("outerPackaging"))
17597      res.setOuterPackaging(parseIdentifier(getJObject(json, "outerPackaging")));
17598    if (json.has("immediatePackaging"))
17599      res.setImmediatePackaging(parseIdentifier(getJObject(json, "immediatePackaging")));
17600  }
17601
17602  protected MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(JsonObject json, MedicinalProductPackaged owner) throws IOException, FHIRFormatError {
17603    MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent res = new MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent();
17604    parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentProperties(json, owner, res);
17605    return res;
17606  }
17607
17608  protected void parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentProperties(JsonObject json, MedicinalProductPackaged owner, MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent res) throws IOException, FHIRFormatError {
17609    parseBackboneElementProperties(json, res);
17610    if (json.has("identifier")) {
17611      JsonArray array = json.getAsJsonArray("identifier");
17612      for (int i = 0; i < array.size(); i++) {
17613        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17614      }
17615    };
17616    if (json.has("type"))
17617      res.setType(parseCodeableConcept(getJObject(json, "type")));
17618    if (json.has("quantity"))
17619      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
17620    if (json.has("material")) {
17621      JsonArray array = json.getAsJsonArray("material");
17622      for (int i = 0; i < array.size(); i++) {
17623        res.getMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17624      }
17625    };
17626    if (json.has("alternateMaterial")) {
17627      JsonArray array = json.getAsJsonArray("alternateMaterial");
17628      for (int i = 0; i < array.size(); i++) {
17629        res.getAlternateMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17630      }
17631    };
17632    if (json.has("device")) {
17633      JsonArray array = json.getAsJsonArray("device");
17634      for (int i = 0; i < array.size(); i++) {
17635        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
17636      }
17637    };
17638    if (json.has("manufacturedItem")) {
17639      JsonArray array = json.getAsJsonArray("manufacturedItem");
17640      for (int i = 0; i < array.size(); i++) {
17641        res.getManufacturedItem().add(parseReference(array.get(i).getAsJsonObject()));
17642      }
17643    };
17644    if (json.has("packageItem")) {
17645      JsonArray array = json.getAsJsonArray("packageItem");
17646      for (int i = 0; i < array.size(); i++) {
17647        res.getPackageItem().add(parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(array.get(i).getAsJsonObject(), owner));
17648      }
17649    };
17650    if (json.has("physicalCharacteristics"))
17651      res.setPhysicalCharacteristics(parseProdCharacteristic(getJObject(json, "physicalCharacteristics")));
17652    if (json.has("otherCharacteristics")) {
17653      JsonArray array = json.getAsJsonArray("otherCharacteristics");
17654      for (int i = 0; i < array.size(); i++) {
17655        res.getOtherCharacteristics().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17656      }
17657    };
17658    if (json.has("shelfLifeStorage")) {
17659      JsonArray array = json.getAsJsonArray("shelfLifeStorage");
17660      for (int i = 0; i < array.size(); i++) {
17661        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
17662      }
17663    };
17664    if (json.has("manufacturer")) {
17665      JsonArray array = json.getAsJsonArray("manufacturer");
17666      for (int i = 0; i < array.size(); i++) {
17667        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
17668      }
17669    };
17670  }
17671
17672  protected MedicinalProductPharmaceutical parseMedicinalProductPharmaceutical(JsonObject json) throws IOException, FHIRFormatError {
17673    MedicinalProductPharmaceutical res = new MedicinalProductPharmaceutical();
17674    parseMedicinalProductPharmaceuticalProperties(json, res);
17675    return res;
17676  }
17677
17678  protected void parseMedicinalProductPharmaceuticalProperties(JsonObject json, MedicinalProductPharmaceutical res) throws IOException, FHIRFormatError {
17679    parseDomainResourceProperties(json, res);
17680    if (json.has("identifier")) {
17681      JsonArray array = json.getAsJsonArray("identifier");
17682      for (int i = 0; i < array.size(); i++) {
17683        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17684      }
17685    };
17686    if (json.has("administrableDoseForm"))
17687      res.setAdministrableDoseForm(parseCodeableConcept(getJObject(json, "administrableDoseForm")));
17688    if (json.has("unitOfPresentation"))
17689      res.setUnitOfPresentation(parseCodeableConcept(getJObject(json, "unitOfPresentation")));
17690    if (json.has("ingredient")) {
17691      JsonArray array = json.getAsJsonArray("ingredient");
17692      for (int i = 0; i < array.size(); i++) {
17693        res.getIngredient().add(parseReference(array.get(i).getAsJsonObject()));
17694      }
17695    };
17696    if (json.has("device")) {
17697      JsonArray array = json.getAsJsonArray("device");
17698      for (int i = 0; i < array.size(); i++) {
17699        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
17700      }
17701    };
17702    if (json.has("characteristics")) {
17703      JsonArray array = json.getAsJsonArray("characteristics");
17704      for (int i = 0; i < array.size(); i++) {
17705        res.getCharacteristics().add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(array.get(i).getAsJsonObject(), res));
17706      }
17707    };
17708    if (json.has("routeOfAdministration")) {
17709      JsonArray array = json.getAsJsonArray("routeOfAdministration");
17710      for (int i = 0; i < array.size(); i++) {
17711        res.getRouteOfAdministration().add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(array.get(i).getAsJsonObject(), res));
17712      }
17713    };
17714  }
17715
17716  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
17717    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent();
17718    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentProperties(json, owner, res);
17719    return res;
17720  }
17721
17722  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentProperties(JsonObject json, MedicinalProductPharmaceutical owner, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent res) throws IOException, FHIRFormatError {
17723    parseBackboneElementProperties(json, res);
17724    if (json.has("code"))
17725      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17726    if (json.has("status"))
17727      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
17728  }
17729
17730  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
17731    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent();
17732    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentProperties(json, owner, res);
17733    return res;
17734  }
17735
17736  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentProperties(JsonObject json, MedicinalProductPharmaceutical owner, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent res) throws IOException, FHIRFormatError {
17737    parseBackboneElementProperties(json, res);
17738    if (json.has("code"))
17739      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17740    if (json.has("firstDose"))
17741      res.setFirstDose(parseQuantity(getJObject(json, "firstDose")));
17742    if (json.has("maxSingleDose"))
17743      res.setMaxSingleDose(parseQuantity(getJObject(json, "maxSingleDose")));
17744    if (json.has("maxDosePerDay"))
17745      res.setMaxDosePerDay(parseQuantity(getJObject(json, "maxDosePerDay")));
17746    if (json.has("maxDosePerTreatmentPeriod"))
17747      res.setMaxDosePerTreatmentPeriod(parseRatio(getJObject(json, "maxDosePerTreatmentPeriod")));
17748    if (json.has("maxTreatmentPeriod"))
17749      res.setMaxTreatmentPeriod(parseDuration(getJObject(json, "maxTreatmentPeriod")));
17750    if (json.has("targetSpecies")) {
17751      JsonArray array = json.getAsJsonArray("targetSpecies");
17752      for (int i = 0; i < array.size(); i++) {
17753        res.getTargetSpecies().add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(array.get(i).getAsJsonObject(), owner));
17754      }
17755    };
17756  }
17757
17758  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
17759    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent();
17760    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentProperties(json, owner, res);
17761    return res;
17762  }
17763
17764  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentProperties(JsonObject json, MedicinalProductPharmaceutical owner, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent res) throws IOException, FHIRFormatError {
17765    parseBackboneElementProperties(json, res);
17766    if (json.has("code"))
17767      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17768    if (json.has("withdrawalPeriod")) {
17769      JsonArray array = json.getAsJsonArray("withdrawalPeriod");
17770      for (int i = 0; i < array.size(); i++) {
17771        res.getWithdrawalPeriod().add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(array.get(i).getAsJsonObject(), owner));
17772      }
17773    };
17774  }
17775
17776  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
17777    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent();
17778    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(json, owner, res);
17779    return res;
17780  }
17781
17782  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(JsonObject json, MedicinalProductPharmaceutical owner, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res) throws IOException, FHIRFormatError {
17783    parseBackboneElementProperties(json, res);
17784    if (json.has("tissue"))
17785      res.setTissue(parseCodeableConcept(getJObject(json, "tissue")));
17786    if (json.has("value"))
17787      res.setValue(parseQuantity(getJObject(json, "value")));
17788    if (json.has("supportingInformation"))
17789      res.setSupportingInformationElement(parseString(json.get("supportingInformation").getAsString()));
17790    if (json.has("_supportingInformation"))
17791      parseElementProperties(getJObject(json, "_supportingInformation"), res.getSupportingInformationElement());
17792  }
17793
17794  protected MedicinalProductUndesirableEffect parseMedicinalProductUndesirableEffect(JsonObject json) throws IOException, FHIRFormatError {
17795    MedicinalProductUndesirableEffect res = new MedicinalProductUndesirableEffect();
17796    parseMedicinalProductUndesirableEffectProperties(json, res);
17797    return res;
17798  }
17799
17800  protected void parseMedicinalProductUndesirableEffectProperties(JsonObject json, MedicinalProductUndesirableEffect res) throws IOException, FHIRFormatError {
17801    parseDomainResourceProperties(json, res);
17802    if (json.has("subject")) {
17803      JsonArray array = json.getAsJsonArray("subject");
17804      for (int i = 0; i < array.size(); i++) {
17805        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
17806      }
17807    };
17808    if (json.has("symptomConditionEffect"))
17809      res.setSymptomConditionEffect(parseCodeableConcept(getJObject(json, "symptomConditionEffect")));
17810    if (json.has("classification"))
17811      res.setClassification(parseCodeableConcept(getJObject(json, "classification")));
17812    if (json.has("frequencyOfOccurrence"))
17813      res.setFrequencyOfOccurrence(parseCodeableConcept(getJObject(json, "frequencyOfOccurrence")));
17814    if (json.has("population")) {
17815      JsonArray array = json.getAsJsonArray("population");
17816      for (int i = 0; i < array.size(); i++) {
17817        res.getPopulation().add(parsePopulation(array.get(i).getAsJsonObject()));
17818      }
17819    };
17820  }
17821
17822  protected MessageDefinition parseMessageDefinition(JsonObject json) throws IOException, FHIRFormatError {
17823    MessageDefinition res = new MessageDefinition();
17824    parseMessageDefinitionProperties(json, res);
17825    return res;
17826  }
17827
17828  protected void parseMessageDefinitionProperties(JsonObject json, MessageDefinition res) throws IOException, FHIRFormatError {
17829    parseDomainResourceProperties(json, res);
17830    if (json.has("url"))
17831      res.setUrlElement(parseUri(json.get("url").getAsString()));
17832    if (json.has("_url"))
17833      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
17834    if (json.has("identifier")) {
17835      JsonArray array = json.getAsJsonArray("identifier");
17836      for (int i = 0; i < array.size(); i++) {
17837        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17838      }
17839    };
17840    if (json.has("version"))
17841      res.setVersionElement(parseString(json.get("version").getAsString()));
17842    if (json.has("_version"))
17843      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
17844    if (json.has("name"))
17845      res.setNameElement(parseString(json.get("name").getAsString()));
17846    if (json.has("_name"))
17847      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
17848    if (json.has("title"))
17849      res.setTitleElement(parseString(json.get("title").getAsString()));
17850    if (json.has("_title"))
17851      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
17852    if (json.has("replaces")) {
17853      JsonArray array = json.getAsJsonArray("replaces");
17854      for (int i = 0; i < array.size(); i++) {
17855        res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
17856      }
17857    };
17858    if (json.has("_replaces")) {
17859      JsonArray array = json.getAsJsonArray("_replaces");
17860      for (int i = 0; i < array.size(); i++) {
17861        if (i == res.getReplaces().size())
17862          res.getReplaces().add(parseCanonical(null));
17863        if (array.get(i) instanceof JsonObject) 
17864          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
17865      }
17866    };
17867    if (json.has("status"))
17868      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
17869    if (json.has("_status"))
17870      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17871    if (json.has("experimental"))
17872      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
17873    if (json.has("_experimental"))
17874      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
17875    if (json.has("date"))
17876      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17877    if (json.has("_date"))
17878      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
17879    if (json.has("publisher"))
17880      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
17881    if (json.has("_publisher"))
17882      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
17883    if (json.has("contact")) {
17884      JsonArray array = json.getAsJsonArray("contact");
17885      for (int i = 0; i < array.size(); i++) {
17886        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
17887      }
17888    };
17889    if (json.has("description"))
17890      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
17891    if (json.has("_description"))
17892      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17893    if (json.has("useContext")) {
17894      JsonArray array = json.getAsJsonArray("useContext");
17895      for (int i = 0; i < array.size(); i++) {
17896        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
17897      }
17898    };
17899    if (json.has("jurisdiction")) {
17900      JsonArray array = json.getAsJsonArray("jurisdiction");
17901      for (int i = 0; i < array.size(); i++) {
17902        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17903      }
17904    };
17905    if (json.has("purpose"))
17906      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
17907    if (json.has("_purpose"))
17908      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
17909    if (json.has("copyright"))
17910      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
17911    if (json.has("_copyright"))
17912      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
17913    if (json.has("base"))
17914      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
17915    if (json.has("_base"))
17916      parseElementProperties(getJObject(json, "_base"), res.getBaseElement());
17917    if (json.has("parent")) {
17918      JsonArray array = json.getAsJsonArray("parent");
17919      for (int i = 0; i < array.size(); i++) {
17920        res.getParent().add(parseCanonical(array.get(i).getAsString()));
17921      }
17922    };
17923    if (json.has("_parent")) {
17924      JsonArray array = json.getAsJsonArray("_parent");
17925      for (int i = 0; i < array.size(); i++) {
17926        if (i == res.getParent().size())
17927          res.getParent().add(parseCanonical(null));
17928        if (array.get(i) instanceof JsonObject) 
17929          parseElementProperties(array.get(i).getAsJsonObject(), res.getParent().get(i));
17930      }
17931    };
17932    Type event = parseType("event", json);
17933    if (event != null)
17934      res.setEvent(event);
17935    if (json.has("category"))
17936      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), MessageDefinition.MessageSignificanceCategory.NULL, new MessageDefinition.MessageSignificanceCategoryEnumFactory()));
17937    if (json.has("_category"))
17938      parseElementProperties(getJObject(json, "_category"), res.getCategoryElement());
17939    if (json.has("focus")) {
17940      JsonArray array = json.getAsJsonArray("focus");
17941      for (int i = 0; i < array.size(); i++) {
17942        res.getFocus().add(parseMessageDefinitionMessageDefinitionFocusComponent(array.get(i).getAsJsonObject(), res));
17943      }
17944    };
17945    if (json.has("responseRequired"))
17946      res.setResponseRequiredElement(parseEnumeration(json.get("responseRequired").getAsString(), MessageDefinition.MessageheaderResponseRequest.NULL, new MessageDefinition.MessageheaderResponseRequestEnumFactory()));
17947    if (json.has("_responseRequired"))
17948      parseElementProperties(getJObject(json, "_responseRequired"), res.getResponseRequiredElement());
17949    if (json.has("allowedResponse")) {
17950      JsonArray array = json.getAsJsonArray("allowedResponse");
17951      for (int i = 0; i < array.size(); i++) {
17952        res.getAllowedResponse().add(parseMessageDefinitionMessageDefinitionAllowedResponseComponent(array.get(i).getAsJsonObject(), res));
17953      }
17954    };
17955    if (json.has("graph")) {
17956      JsonArray array = json.getAsJsonArray("graph");
17957      for (int i = 0; i < array.size(); i++) {
17958        res.getGraph().add(parseCanonical(array.get(i).getAsString()));
17959      }
17960    };
17961    if (json.has("_graph")) {
17962      JsonArray array = json.getAsJsonArray("_graph");
17963      for (int i = 0; i < array.size(); i++) {
17964        if (i == res.getGraph().size())
17965          res.getGraph().add(parseCanonical(null));
17966        if (array.get(i) instanceof JsonObject) 
17967          parseElementProperties(array.get(i).getAsJsonObject(), res.getGraph().get(i));
17968      }
17969    };
17970  }
17971
17972  protected MessageDefinition.MessageDefinitionFocusComponent parseMessageDefinitionMessageDefinitionFocusComponent(JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
17973    MessageDefinition.MessageDefinitionFocusComponent res = new MessageDefinition.MessageDefinitionFocusComponent();
17974    parseMessageDefinitionMessageDefinitionFocusComponentProperties(json, owner, res);
17975    return res;
17976  }
17977
17978  protected void parseMessageDefinitionMessageDefinitionFocusComponentProperties(JsonObject json, MessageDefinition owner, MessageDefinition.MessageDefinitionFocusComponent res) throws IOException, FHIRFormatError {
17979    parseBackboneElementProperties(json, res);
17980    if (json.has("code"))
17981      res.setCodeElement(parseCode(json.get("code").getAsString()));
17982    if (json.has("_code"))
17983      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
17984    if (json.has("profile"))
17985      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
17986    if (json.has("_profile"))
17987      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
17988    if (json.has("min"))
17989      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
17990    if (json.has("_min"))
17991      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
17992    if (json.has("max"))
17993      res.setMaxElement(parseString(json.get("max").getAsString()));
17994    if (json.has("_max"))
17995      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
17996  }
17997
17998  protected MessageDefinition.MessageDefinitionAllowedResponseComponent parseMessageDefinitionMessageDefinitionAllowedResponseComponent(JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
17999    MessageDefinition.MessageDefinitionAllowedResponseComponent res = new MessageDefinition.MessageDefinitionAllowedResponseComponent();
18000    parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(json, owner, res);
18001    return res;
18002  }
18003
18004  protected void parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(JsonObject json, MessageDefinition owner, MessageDefinition.MessageDefinitionAllowedResponseComponent res) throws IOException, FHIRFormatError {
18005    parseBackboneElementProperties(json, res);
18006    if (json.has("message"))
18007      res.setMessageElement(parseCanonical(json.get("message").getAsString()));
18008    if (json.has("_message"))
18009      parseElementProperties(getJObject(json, "_message"), res.getMessageElement());
18010    if (json.has("situation"))
18011      res.setSituationElement(parseMarkdown(json.get("situation").getAsString()));
18012    if (json.has("_situation"))
18013      parseElementProperties(getJObject(json, "_situation"), res.getSituationElement());
18014  }
18015
18016  protected MessageHeader parseMessageHeader(JsonObject json) throws IOException, FHIRFormatError {
18017    MessageHeader res = new MessageHeader();
18018    parseMessageHeaderProperties(json, res);
18019    return res;
18020  }
18021
18022  protected void parseMessageHeaderProperties(JsonObject json, MessageHeader res) throws IOException, FHIRFormatError {
18023    parseDomainResourceProperties(json, res);
18024    Type event = parseType("event", json);
18025    if (event != null)
18026      res.setEvent(event);
18027    if (json.has("destination")) {
18028      JsonArray array = json.getAsJsonArray("destination");
18029      for (int i = 0; i < array.size(); i++) {
18030        res.getDestination().add(parseMessageHeaderMessageDestinationComponent(array.get(i).getAsJsonObject(), res));
18031      }
18032    };
18033    if (json.has("sender"))
18034      res.setSender(parseReference(getJObject(json, "sender")));
18035    if (json.has("enterer"))
18036      res.setEnterer(parseReference(getJObject(json, "enterer")));
18037    if (json.has("author"))
18038      res.setAuthor(parseReference(getJObject(json, "author")));
18039    if (json.has("source"))
18040      res.setSource(parseMessageHeaderMessageSourceComponent(getJObject(json, "source"), res));
18041    if (json.has("responsible"))
18042      res.setResponsible(parseReference(getJObject(json, "responsible")));
18043    if (json.has("reason"))
18044      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
18045    if (json.has("response"))
18046      res.setResponse(parseMessageHeaderMessageHeaderResponseComponent(getJObject(json, "response"), res));
18047    if (json.has("focus")) {
18048      JsonArray array = json.getAsJsonArray("focus");
18049      for (int i = 0; i < array.size(); i++) {
18050        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
18051      }
18052    };
18053    if (json.has("definition"))
18054      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
18055    if (json.has("_definition"))
18056      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
18057  }
18058
18059  protected MessageHeader.MessageDestinationComponent parseMessageHeaderMessageDestinationComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
18060    MessageHeader.MessageDestinationComponent res = new MessageHeader.MessageDestinationComponent();
18061    parseMessageHeaderMessageDestinationComponentProperties(json, owner, res);
18062    return res;
18063  }
18064
18065  protected void parseMessageHeaderMessageDestinationComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageDestinationComponent res) throws IOException, FHIRFormatError {
18066    parseBackboneElementProperties(json, res);
18067    if (json.has("name"))
18068      res.setNameElement(parseString(json.get("name").getAsString()));
18069    if (json.has("_name"))
18070      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
18071    if (json.has("target"))
18072      res.setTarget(parseReference(getJObject(json, "target")));
18073    if (json.has("endpoint"))
18074      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
18075    if (json.has("_endpoint"))
18076      parseElementProperties(getJObject(json, "_endpoint"), res.getEndpointElement());
18077    if (json.has("receiver"))
18078      res.setReceiver(parseReference(getJObject(json, "receiver")));
18079  }
18080
18081  protected MessageHeader.MessageSourceComponent parseMessageHeaderMessageSourceComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
18082    MessageHeader.MessageSourceComponent res = new MessageHeader.MessageSourceComponent();
18083    parseMessageHeaderMessageSourceComponentProperties(json, owner, res);
18084    return res;
18085  }
18086
18087  protected void parseMessageHeaderMessageSourceComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageSourceComponent res) throws IOException, FHIRFormatError {
18088    parseBackboneElementProperties(json, res);
18089    if (json.has("name"))
18090      res.setNameElement(parseString(json.get("name").getAsString()));
18091    if (json.has("_name"))
18092      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
18093    if (json.has("software"))
18094      res.setSoftwareElement(parseString(json.get("software").getAsString()));
18095    if (json.has("_software"))
18096      parseElementProperties(getJObject(json, "_software"), res.getSoftwareElement());
18097    if (json.has("version"))
18098      res.setVersionElement(parseString(json.get("version").getAsString()));
18099    if (json.has("_version"))
18100      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
18101    if (json.has("contact"))
18102      res.setContact(parseContactPoint(getJObject(json, "contact")));
18103    if (json.has("endpoint"))
18104      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
18105    if (json.has("_endpoint"))
18106      parseElementProperties(getJObject(json, "_endpoint"), res.getEndpointElement());
18107  }
18108
18109  protected MessageHeader.MessageHeaderResponseComponent parseMessageHeaderMessageHeaderResponseComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
18110    MessageHeader.MessageHeaderResponseComponent res = new MessageHeader.MessageHeaderResponseComponent();
18111    parseMessageHeaderMessageHeaderResponseComponentProperties(json, owner, res);
18112    return res;
18113  }
18114
18115  protected void parseMessageHeaderMessageHeaderResponseComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageHeaderResponseComponent res) throws IOException, FHIRFormatError {
18116    parseBackboneElementProperties(json, res);
18117    if (json.has("identifier"))
18118      res.setIdentifierElement(parseId(json.get("identifier").getAsString()));
18119    if (json.has("_identifier"))
18120      parseElementProperties(getJObject(json, "_identifier"), res.getIdentifierElement());
18121    if (json.has("code"))
18122      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), MessageHeader.ResponseType.NULL, new MessageHeader.ResponseTypeEnumFactory()));
18123    if (json.has("_code"))
18124      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
18125    if (json.has("details"))
18126      res.setDetails(parseReference(getJObject(json, "details")));
18127  }
18128
18129  protected MolecularSequence parseMolecularSequence(JsonObject json) throws IOException, FHIRFormatError {
18130    MolecularSequence res = new MolecularSequence();
18131    parseMolecularSequenceProperties(json, res);
18132    return res;
18133  }
18134
18135  protected void parseMolecularSequenceProperties(JsonObject json, MolecularSequence res) throws IOException, FHIRFormatError {
18136    parseDomainResourceProperties(json, res);
18137    if (json.has("identifier")) {
18138      JsonArray array = json.getAsJsonArray("identifier");
18139      for (int i = 0; i < array.size(); i++) {
18140        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18141      }
18142    };
18143    if (json.has("type"))
18144      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.SequenceType.NULL, new MolecularSequence.SequenceTypeEnumFactory()));
18145    if (json.has("_type"))
18146      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
18147    if (json.has("coordinateSystem"))
18148      res.setCoordinateSystemElement(parseInteger(json.get("coordinateSystem").getAsLong()));
18149    if (json.has("_coordinateSystem"))
18150      parseElementProperties(getJObject(json, "_coordinateSystem"), res.getCoordinateSystemElement());
18151    if (json.has("patient"))
18152      res.setPatient(parseReference(getJObject(json, "patient")));
18153    if (json.has("specimen"))
18154      res.setSpecimen(parseReference(getJObject(json, "specimen")));
18155    if (json.has("device"))
18156      res.setDevice(parseReference(getJObject(json, "device")));
18157    if (json.has("performer"))
18158      res.setPerformer(parseReference(getJObject(json, "performer")));
18159    if (json.has("quantity"))
18160      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
18161    if (json.has("referenceSeq"))
18162      res.setReferenceSeq(parseMolecularSequenceMolecularSequenceReferenceSeqComponent(getJObject(json, "referenceSeq"), res));
18163    if (json.has("variant")) {
18164      JsonArray array = json.getAsJsonArray("variant");
18165      for (int i = 0; i < array.size(); i++) {
18166        res.getVariant().add(parseMolecularSequenceMolecularSequenceVariantComponent(array.get(i).getAsJsonObject(), res));
18167      }
18168    };
18169    if (json.has("observedSeq"))
18170      res.setObservedSeqElement(parseString(json.get("observedSeq").getAsString()));
18171    if (json.has("_observedSeq"))
18172      parseElementProperties(getJObject(json, "_observedSeq"), res.getObservedSeqElement());
18173    if (json.has("quality")) {
18174      JsonArray array = json.getAsJsonArray("quality");
18175      for (int i = 0; i < array.size(); i++) {
18176        res.getQuality().add(parseMolecularSequenceMolecularSequenceQualityComponent(array.get(i).getAsJsonObject(), res));
18177      }
18178    };
18179    if (json.has("readCoverage"))
18180      res.setReadCoverageElement(parseInteger(json.get("readCoverage").getAsLong()));
18181    if (json.has("_readCoverage"))
18182      parseElementProperties(getJObject(json, "_readCoverage"), res.getReadCoverageElement());
18183    if (json.has("repository")) {
18184      JsonArray array = json.getAsJsonArray("repository");
18185      for (int i = 0; i < array.size(); i++) {
18186        res.getRepository().add(parseMolecularSequenceMolecularSequenceRepositoryComponent(array.get(i).getAsJsonObject(), res));
18187      }
18188    };
18189    if (json.has("pointer")) {
18190      JsonArray array = json.getAsJsonArray("pointer");
18191      for (int i = 0; i < array.size(); i++) {
18192        res.getPointer().add(parseReference(array.get(i).getAsJsonObject()));
18193      }
18194    };
18195    if (json.has("structureVariant")) {
18196      JsonArray array = json.getAsJsonArray("structureVariant");
18197      for (int i = 0; i < array.size(); i++) {
18198        res.getStructureVariant().add(parseMolecularSequenceMolecularSequenceStructureVariantComponent(array.get(i).getAsJsonObject(), res));
18199      }
18200    };
18201  }
18202
18203  protected MolecularSequence.MolecularSequenceReferenceSeqComponent parseMolecularSequenceMolecularSequenceReferenceSeqComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18204    MolecularSequence.MolecularSequenceReferenceSeqComponent res = new MolecularSequence.MolecularSequenceReferenceSeqComponent();
18205    parseMolecularSequenceMolecularSequenceReferenceSeqComponentProperties(json, owner, res);
18206    return res;
18207  }
18208
18209  protected void parseMolecularSequenceMolecularSequenceReferenceSeqComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceReferenceSeqComponent res) throws IOException, FHIRFormatError {
18210    parseBackboneElementProperties(json, res);
18211    if (json.has("chromosome"))
18212      res.setChromosome(parseCodeableConcept(getJObject(json, "chromosome")));
18213    if (json.has("genomeBuild"))
18214      res.setGenomeBuildElement(parseString(json.get("genomeBuild").getAsString()));
18215    if (json.has("_genomeBuild"))
18216      parseElementProperties(getJObject(json, "_genomeBuild"), res.getGenomeBuildElement());
18217    if (json.has("orientation"))
18218      res.setOrientationElement(parseEnumeration(json.get("orientation").getAsString(), MolecularSequence.OrientationType.NULL, new MolecularSequence.OrientationTypeEnumFactory()));
18219    if (json.has("_orientation"))
18220      parseElementProperties(getJObject(json, "_orientation"), res.getOrientationElement());
18221    if (json.has("referenceSeqId"))
18222      res.setReferenceSeqId(parseCodeableConcept(getJObject(json, "referenceSeqId")));
18223    if (json.has("referenceSeqPointer"))
18224      res.setReferenceSeqPointer(parseReference(getJObject(json, "referenceSeqPointer")));
18225    if (json.has("referenceSeqString"))
18226      res.setReferenceSeqStringElement(parseString(json.get("referenceSeqString").getAsString()));
18227    if (json.has("_referenceSeqString"))
18228      parseElementProperties(getJObject(json, "_referenceSeqString"), res.getReferenceSeqStringElement());
18229    if (json.has("strand"))
18230      res.setStrandElement(parseEnumeration(json.get("strand").getAsString(), MolecularSequence.StrandType.NULL, new MolecularSequence.StrandTypeEnumFactory()));
18231    if (json.has("_strand"))
18232      parseElementProperties(getJObject(json, "_strand"), res.getStrandElement());
18233    if (json.has("windowStart"))
18234      res.setWindowStartElement(parseInteger(json.get("windowStart").getAsLong()));
18235    if (json.has("_windowStart"))
18236      parseElementProperties(getJObject(json, "_windowStart"), res.getWindowStartElement());
18237    if (json.has("windowEnd"))
18238      res.setWindowEndElement(parseInteger(json.get("windowEnd").getAsLong()));
18239    if (json.has("_windowEnd"))
18240      parseElementProperties(getJObject(json, "_windowEnd"), res.getWindowEndElement());
18241  }
18242
18243  protected MolecularSequence.MolecularSequenceVariantComponent parseMolecularSequenceMolecularSequenceVariantComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18244    MolecularSequence.MolecularSequenceVariantComponent res = new MolecularSequence.MolecularSequenceVariantComponent();
18245    parseMolecularSequenceMolecularSequenceVariantComponentProperties(json, owner, res);
18246    return res;
18247  }
18248
18249  protected void parseMolecularSequenceMolecularSequenceVariantComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceVariantComponent res) throws IOException, FHIRFormatError {
18250    parseBackboneElementProperties(json, res);
18251    if (json.has("start"))
18252      res.setStartElement(parseInteger(json.get("start").getAsLong()));
18253    if (json.has("_start"))
18254      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
18255    if (json.has("end"))
18256      res.setEndElement(parseInteger(json.get("end").getAsLong()));
18257    if (json.has("_end"))
18258      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
18259    if (json.has("observedAllele"))
18260      res.setObservedAlleleElement(parseString(json.get("observedAllele").getAsString()));
18261    if (json.has("_observedAllele"))
18262      parseElementProperties(getJObject(json, "_observedAllele"), res.getObservedAlleleElement());
18263    if (json.has("referenceAllele"))
18264      res.setReferenceAlleleElement(parseString(json.get("referenceAllele").getAsString()));
18265    if (json.has("_referenceAllele"))
18266      parseElementProperties(getJObject(json, "_referenceAllele"), res.getReferenceAlleleElement());
18267    if (json.has("cigar"))
18268      res.setCigarElement(parseString(json.get("cigar").getAsString()));
18269    if (json.has("_cigar"))
18270      parseElementProperties(getJObject(json, "_cigar"), res.getCigarElement());
18271    if (json.has("variantPointer"))
18272      res.setVariantPointer(parseReference(getJObject(json, "variantPointer")));
18273  }
18274
18275  protected MolecularSequence.MolecularSequenceQualityComponent parseMolecularSequenceMolecularSequenceQualityComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18276    MolecularSequence.MolecularSequenceQualityComponent res = new MolecularSequence.MolecularSequenceQualityComponent();
18277    parseMolecularSequenceMolecularSequenceQualityComponentProperties(json, owner, res);
18278    return res;
18279  }
18280
18281  protected void parseMolecularSequenceMolecularSequenceQualityComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceQualityComponent res) throws IOException, FHIRFormatError {
18282    parseBackboneElementProperties(json, res);
18283    if (json.has("type"))
18284      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.QualityType.NULL, new MolecularSequence.QualityTypeEnumFactory()));
18285    if (json.has("_type"))
18286      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
18287    if (json.has("standardSequence"))
18288      res.setStandardSequence(parseCodeableConcept(getJObject(json, "standardSequence")));
18289    if (json.has("start"))
18290      res.setStartElement(parseInteger(json.get("start").getAsLong()));
18291    if (json.has("_start"))
18292      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
18293    if (json.has("end"))
18294      res.setEndElement(parseInteger(json.get("end").getAsLong()));
18295    if (json.has("_end"))
18296      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
18297    if (json.has("score"))
18298      res.setScore(parseQuantity(getJObject(json, "score")));
18299    if (json.has("method"))
18300      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
18301    if (json.has("truthTP"))
18302      res.setTruthTPElement(parseDecimal(json.get("truthTP").getAsBigDecimal()));
18303    if (json.has("_truthTP"))
18304      parseElementProperties(getJObject(json, "_truthTP"), res.getTruthTPElement());
18305    if (json.has("queryTP"))
18306      res.setQueryTPElement(parseDecimal(json.get("queryTP").getAsBigDecimal()));
18307    if (json.has("_queryTP"))
18308      parseElementProperties(getJObject(json, "_queryTP"), res.getQueryTPElement());
18309    if (json.has("truthFN"))
18310      res.setTruthFNElement(parseDecimal(json.get("truthFN").getAsBigDecimal()));
18311    if (json.has("_truthFN"))
18312      parseElementProperties(getJObject(json, "_truthFN"), res.getTruthFNElement());
18313    if (json.has("queryFP"))
18314      res.setQueryFPElement(parseDecimal(json.get("queryFP").getAsBigDecimal()));
18315    if (json.has("_queryFP"))
18316      parseElementProperties(getJObject(json, "_queryFP"), res.getQueryFPElement());
18317    if (json.has("gtFP"))
18318      res.setGtFPElement(parseDecimal(json.get("gtFP").getAsBigDecimal()));
18319    if (json.has("_gtFP"))
18320      parseElementProperties(getJObject(json, "_gtFP"), res.getGtFPElement());
18321    if (json.has("precision"))
18322      res.setPrecisionElement(parseDecimal(json.get("precision").getAsBigDecimal()));
18323    if (json.has("_precision"))
18324      parseElementProperties(getJObject(json, "_precision"), res.getPrecisionElement());
18325    if (json.has("recall"))
18326      res.setRecallElement(parseDecimal(json.get("recall").getAsBigDecimal()));
18327    if (json.has("_recall"))
18328      parseElementProperties(getJObject(json, "_recall"), res.getRecallElement());
18329    if (json.has("fScore"))
18330      res.setFScoreElement(parseDecimal(json.get("fScore").getAsBigDecimal()));
18331    if (json.has("_fScore"))
18332      parseElementProperties(getJObject(json, "_fScore"), res.getFScoreElement());
18333    if (json.has("roc"))
18334      res.setRoc(parseMolecularSequenceMolecularSequenceQualityRocComponent(getJObject(json, "roc"), owner));
18335  }
18336
18337  protected MolecularSequence.MolecularSequenceQualityRocComponent parseMolecularSequenceMolecularSequenceQualityRocComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18338    MolecularSequence.MolecularSequenceQualityRocComponent res = new MolecularSequence.MolecularSequenceQualityRocComponent();
18339    parseMolecularSequenceMolecularSequenceQualityRocComponentProperties(json, owner, res);
18340    return res;
18341  }
18342
18343  protected void parseMolecularSequenceMolecularSequenceQualityRocComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceQualityRocComponent res) throws IOException, FHIRFormatError {
18344    parseBackboneElementProperties(json, res);
18345    if (json.has("score")) {
18346      JsonArray array = json.getAsJsonArray("score");
18347      for (int i = 0; i < array.size(); i++) {
18348        res.getScore().add(parseInteger(array.get(i).getAsLong()));
18349      }
18350    };
18351    if (json.has("_score")) {
18352      JsonArray array = json.getAsJsonArray("_score");
18353      for (int i = 0; i < array.size(); i++) {
18354        if (i == res.getScore().size())
18355          res.getScore().add(parseInteger(null));
18356        if (array.get(i) instanceof JsonObject) 
18357          parseElementProperties(array.get(i).getAsJsonObject(), res.getScore().get(i));
18358      }
18359    };
18360    if (json.has("numTP")) {
18361      JsonArray array = json.getAsJsonArray("numTP");
18362      for (int i = 0; i < array.size(); i++) {
18363        res.getNumTP().add(parseInteger(array.get(i).getAsLong()));
18364      }
18365    };
18366    if (json.has("_numTP")) {
18367      JsonArray array = json.getAsJsonArray("_numTP");
18368      for (int i = 0; i < array.size(); i++) {
18369        if (i == res.getNumTP().size())
18370          res.getNumTP().add(parseInteger(null));
18371        if (array.get(i) instanceof JsonObject) 
18372          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumTP().get(i));
18373      }
18374    };
18375    if (json.has("numFP")) {
18376      JsonArray array = json.getAsJsonArray("numFP");
18377      for (int i = 0; i < array.size(); i++) {
18378        res.getNumFP().add(parseInteger(array.get(i).getAsLong()));
18379      }
18380    };
18381    if (json.has("_numFP")) {
18382      JsonArray array = json.getAsJsonArray("_numFP");
18383      for (int i = 0; i < array.size(); i++) {
18384        if (i == res.getNumFP().size())
18385          res.getNumFP().add(parseInteger(null));
18386        if (array.get(i) instanceof JsonObject) 
18387          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumFP().get(i));
18388      }
18389    };
18390    if (json.has("numFN")) {
18391      JsonArray array = json.getAsJsonArray("numFN");
18392      for (int i = 0; i < array.size(); i++) {
18393        res.getNumFN().add(parseInteger(array.get(i).getAsLong()));
18394      }
18395    };
18396    if (json.has("_numFN")) {
18397      JsonArray array = json.getAsJsonArray("_numFN");
18398      for (int i = 0; i < array.size(); i++) {
18399        if (i == res.getNumFN().size())
18400          res.getNumFN().add(parseInteger(null));
18401        if (array.get(i) instanceof JsonObject) 
18402          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumFN().get(i));
18403      }
18404    };
18405    if (json.has("precision")) {
18406      JsonArray array = json.getAsJsonArray("precision");
18407      for (int i = 0; i < array.size(); i++) {
18408        res.getPrecision().add(parseDecimal(array.get(i).getAsBigDecimal()));
18409      }
18410    };
18411    if (json.has("_precision")) {
18412      JsonArray array = json.getAsJsonArray("_precision");
18413      for (int i = 0; i < array.size(); i++) {
18414        if (i == res.getPrecision().size())
18415          res.getPrecision().add(parseDecimal(null));
18416        if (array.get(i) instanceof JsonObject) 
18417          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrecision().get(i));
18418      }
18419    };
18420    if (json.has("sensitivity")) {
18421      JsonArray array = json.getAsJsonArray("sensitivity");
18422      for (int i = 0; i < array.size(); i++) {
18423        res.getSensitivity().add(parseDecimal(array.get(i).getAsBigDecimal()));
18424      }
18425    };
18426    if (json.has("_sensitivity")) {
18427      JsonArray array = json.getAsJsonArray("_sensitivity");
18428      for (int i = 0; i < array.size(); i++) {
18429        if (i == res.getSensitivity().size())
18430          res.getSensitivity().add(parseDecimal(null));
18431        if (array.get(i) instanceof JsonObject) 
18432          parseElementProperties(array.get(i).getAsJsonObject(), res.getSensitivity().get(i));
18433      }
18434    };
18435    if (json.has("fMeasure")) {
18436      JsonArray array = json.getAsJsonArray("fMeasure");
18437      for (int i = 0; i < array.size(); i++) {
18438        res.getFMeasure().add(parseDecimal(array.get(i).getAsBigDecimal()));
18439      }
18440    };
18441    if (json.has("_fMeasure")) {
18442      JsonArray array = json.getAsJsonArray("_fMeasure");
18443      for (int i = 0; i < array.size(); i++) {
18444        if (i == res.getFMeasure().size())
18445          res.getFMeasure().add(parseDecimal(null));
18446        if (array.get(i) instanceof JsonObject) 
18447          parseElementProperties(array.get(i).getAsJsonObject(), res.getFMeasure().get(i));
18448      }
18449    };
18450  }
18451
18452  protected MolecularSequence.MolecularSequenceRepositoryComponent parseMolecularSequenceMolecularSequenceRepositoryComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18453    MolecularSequence.MolecularSequenceRepositoryComponent res = new MolecularSequence.MolecularSequenceRepositoryComponent();
18454    parseMolecularSequenceMolecularSequenceRepositoryComponentProperties(json, owner, res);
18455    return res;
18456  }
18457
18458  protected void parseMolecularSequenceMolecularSequenceRepositoryComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceRepositoryComponent res) throws IOException, FHIRFormatError {
18459    parseBackboneElementProperties(json, res);
18460    if (json.has("type"))
18461      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.RepositoryType.NULL, new MolecularSequence.RepositoryTypeEnumFactory()));
18462    if (json.has("_type"))
18463      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
18464    if (json.has("url"))
18465      res.setUrlElement(parseUri(json.get("url").getAsString()));
18466    if (json.has("_url"))
18467      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
18468    if (json.has("name"))
18469      res.setNameElement(parseString(json.get("name").getAsString()));
18470    if (json.has("_name"))
18471      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
18472    if (json.has("datasetId"))
18473      res.setDatasetIdElement(parseString(json.get("datasetId").getAsString()));
18474    if (json.has("_datasetId"))
18475      parseElementProperties(getJObject(json, "_datasetId"), res.getDatasetIdElement());
18476    if (json.has("variantsetId"))
18477      res.setVariantsetIdElement(parseString(json.get("variantsetId").getAsString()));
18478    if (json.has("_variantsetId"))
18479      parseElementProperties(getJObject(json, "_variantsetId"), res.getVariantsetIdElement());
18480    if (json.has("readsetId"))
18481      res.setReadsetIdElement(parseString(json.get("readsetId").getAsString()));
18482    if (json.has("_readsetId"))
18483      parseElementProperties(getJObject(json, "_readsetId"), res.getReadsetIdElement());
18484  }
18485
18486  protected MolecularSequence.MolecularSequenceStructureVariantComponent parseMolecularSequenceMolecularSequenceStructureVariantComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18487    MolecularSequence.MolecularSequenceStructureVariantComponent res = new MolecularSequence.MolecularSequenceStructureVariantComponent();
18488    parseMolecularSequenceMolecularSequenceStructureVariantComponentProperties(json, owner, res);
18489    return res;
18490  }
18491
18492  protected void parseMolecularSequenceMolecularSequenceStructureVariantComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceStructureVariantComponent res) throws IOException, FHIRFormatError {
18493    parseBackboneElementProperties(json, res);
18494    if (json.has("variantType"))
18495      res.setVariantType(parseCodeableConcept(getJObject(json, "variantType")));
18496    if (json.has("exact"))
18497      res.setExactElement(parseBoolean(json.get("exact").getAsBoolean()));
18498    if (json.has("_exact"))
18499      parseElementProperties(getJObject(json, "_exact"), res.getExactElement());
18500    if (json.has("length"))
18501      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
18502    if (json.has("_length"))
18503      parseElementProperties(getJObject(json, "_length"), res.getLengthElement());
18504    if (json.has("outer"))
18505      res.setOuter(parseMolecularSequenceMolecularSequenceStructureVariantOuterComponent(getJObject(json, "outer"), owner));
18506    if (json.has("inner"))
18507      res.setInner(parseMolecularSequenceMolecularSequenceStructureVariantInnerComponent(getJObject(json, "inner"), owner));
18508  }
18509
18510  protected MolecularSequence.MolecularSequenceStructureVariantOuterComponent parseMolecularSequenceMolecularSequenceStructureVariantOuterComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18511    MolecularSequence.MolecularSequenceStructureVariantOuterComponent res = new MolecularSequence.MolecularSequenceStructureVariantOuterComponent();
18512    parseMolecularSequenceMolecularSequenceStructureVariantOuterComponentProperties(json, owner, res);
18513    return res;
18514  }
18515
18516  protected void parseMolecularSequenceMolecularSequenceStructureVariantOuterComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceStructureVariantOuterComponent res) throws IOException, FHIRFormatError {
18517    parseBackboneElementProperties(json, res);
18518    if (json.has("start"))
18519      res.setStartElement(parseInteger(json.get("start").getAsLong()));
18520    if (json.has("_start"))
18521      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
18522    if (json.has("end"))
18523      res.setEndElement(parseInteger(json.get("end").getAsLong()));
18524    if (json.has("_end"))
18525      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
18526  }
18527
18528  protected MolecularSequence.MolecularSequenceStructureVariantInnerComponent parseMolecularSequenceMolecularSequenceStructureVariantInnerComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18529    MolecularSequence.MolecularSequenceStructureVariantInnerComponent res = new MolecularSequence.MolecularSequenceStructureVariantInnerComponent();
18530    parseMolecularSequenceMolecularSequenceStructureVariantInnerComponentProperties(json, owner, res);
18531    return res;
18532  }
18533
18534  protected void parseMolecularSequenceMolecularSequenceStructureVariantInnerComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceStructureVariantInnerComponent res) throws IOException, FHIRFormatError {
18535    parseBackboneElementProperties(json, res);
18536    if (json.has("start"))
18537      res.setStartElement(parseInteger(json.get("start").getAsLong()));
18538    if (json.has("_start"))
18539      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
18540    if (json.has("end"))
18541      res.setEndElement(parseInteger(json.get("end").getAsLong()));
18542    if (json.has("_end"))
18543      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
18544  }
18545
18546  protected NamingSystem parseNamingSystem(JsonObject json) throws IOException, FHIRFormatError {
18547    NamingSystem res = new NamingSystem();
18548    parseNamingSystemProperties(json, res);
18549    return res;
18550  }
18551
18552  protected void parseNamingSystemProperties(JsonObject json, NamingSystem res) throws IOException, FHIRFormatError {
18553    parseDomainResourceProperties(json, res);
18554    if (json.has("name"))
18555      res.setNameElement(parseString(json.get("name").getAsString()));
18556    if (json.has("_name"))
18557      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
18558    if (json.has("status"))
18559      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
18560    if (json.has("_status"))
18561      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18562    if (json.has("kind"))
18563      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), NamingSystem.NamingSystemType.NULL, new NamingSystem.NamingSystemTypeEnumFactory()));
18564    if (json.has("_kind"))
18565      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
18566    if (json.has("date"))
18567      res.setDateElement(parseDateTime(json.get("date").getAsString()));
18568    if (json.has("_date"))
18569      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
18570    if (json.has("publisher"))
18571      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
18572    if (json.has("_publisher"))
18573      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
18574    if (json.has("contact")) {
18575      JsonArray array = json.getAsJsonArray("contact");
18576      for (int i = 0; i < array.size(); i++) {
18577        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
18578      }
18579    };
18580    if (json.has("responsible"))
18581      res.setResponsibleElement(parseString(json.get("responsible").getAsString()));
18582    if (json.has("_responsible"))
18583      parseElementProperties(getJObject(json, "_responsible"), res.getResponsibleElement());
18584    if (json.has("type"))
18585      res.setType(parseCodeableConcept(getJObject(json, "type")));
18586    if (json.has("description"))
18587      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
18588    if (json.has("_description"))
18589      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
18590    if (json.has("useContext")) {
18591      JsonArray array = json.getAsJsonArray("useContext");
18592      for (int i = 0; i < array.size(); i++) {
18593        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
18594      }
18595    };
18596    if (json.has("jurisdiction")) {
18597      JsonArray array = json.getAsJsonArray("jurisdiction");
18598      for (int i = 0; i < array.size(); i++) {
18599        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18600      }
18601    };
18602    if (json.has("usage"))
18603      res.setUsageElement(parseString(json.get("usage").getAsString()));
18604    if (json.has("_usage"))
18605      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
18606    if (json.has("uniqueId")) {
18607      JsonArray array = json.getAsJsonArray("uniqueId");
18608      for (int i = 0; i < array.size(); i++) {
18609        res.getUniqueId().add(parseNamingSystemNamingSystemUniqueIdComponent(array.get(i).getAsJsonObject(), res));
18610      }
18611    };
18612  }
18613
18614  protected NamingSystem.NamingSystemUniqueIdComponent parseNamingSystemNamingSystemUniqueIdComponent(JsonObject json, NamingSystem owner) throws IOException, FHIRFormatError {
18615    NamingSystem.NamingSystemUniqueIdComponent res = new NamingSystem.NamingSystemUniqueIdComponent();
18616    parseNamingSystemNamingSystemUniqueIdComponentProperties(json, owner, res);
18617    return res;
18618  }
18619
18620  protected void parseNamingSystemNamingSystemUniqueIdComponentProperties(JsonObject json, NamingSystem owner, NamingSystem.NamingSystemUniqueIdComponent res) throws IOException, FHIRFormatError {
18621    parseBackboneElementProperties(json, res);
18622    if (json.has("type"))
18623      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), NamingSystem.NamingSystemIdentifierType.NULL, new NamingSystem.NamingSystemIdentifierTypeEnumFactory()));
18624    if (json.has("_type"))
18625      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
18626    if (json.has("value"))
18627      res.setValueElement(parseString(json.get("value").getAsString()));
18628    if (json.has("_value"))
18629      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
18630    if (json.has("preferred"))
18631      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
18632    if (json.has("_preferred"))
18633      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
18634    if (json.has("comment"))
18635      res.setCommentElement(parseString(json.get("comment").getAsString()));
18636    if (json.has("_comment"))
18637      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
18638    if (json.has("period"))
18639      res.setPeriod(parsePeriod(getJObject(json, "period")));
18640  }
18641
18642  protected NutritionOrder parseNutritionOrder(JsonObject json) throws IOException, FHIRFormatError {
18643    NutritionOrder res = new NutritionOrder();
18644    parseNutritionOrderProperties(json, res);
18645    return res;
18646  }
18647
18648  protected void parseNutritionOrderProperties(JsonObject json, NutritionOrder res) throws IOException, FHIRFormatError {
18649    parseDomainResourceProperties(json, res);
18650    if (json.has("identifier")) {
18651      JsonArray array = json.getAsJsonArray("identifier");
18652      for (int i = 0; i < array.size(); i++) {
18653        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18654      }
18655    };
18656    if (json.has("instantiatesCanonical")) {
18657      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
18658      for (int i = 0; i < array.size(); i++) {
18659        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
18660      }
18661    };
18662    if (json.has("_instantiatesCanonical")) {
18663      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
18664      for (int i = 0; i < array.size(); i++) {
18665        if (i == res.getInstantiatesCanonical().size())
18666          res.getInstantiatesCanonical().add(parseCanonical(null));
18667        if (array.get(i) instanceof JsonObject) 
18668          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
18669      }
18670    };
18671    if (json.has("instantiatesUri")) {
18672      JsonArray array = json.getAsJsonArray("instantiatesUri");
18673      for (int i = 0; i < array.size(); i++) {
18674        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
18675      }
18676    };
18677    if (json.has("_instantiatesUri")) {
18678      JsonArray array = json.getAsJsonArray("_instantiatesUri");
18679      for (int i = 0; i < array.size(); i++) {
18680        if (i == res.getInstantiatesUri().size())
18681          res.getInstantiatesUri().add(parseUri(null));
18682        if (array.get(i) instanceof JsonObject) 
18683          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
18684      }
18685    };
18686    if (json.has("instantiates")) {
18687      JsonArray array = json.getAsJsonArray("instantiates");
18688      for (int i = 0; i < array.size(); i++) {
18689        res.getInstantiates().add(parseUri(array.get(i).getAsString()));
18690      }
18691    };
18692    if (json.has("_instantiates")) {
18693      JsonArray array = json.getAsJsonArray("_instantiates");
18694      for (int i = 0; i < array.size(); i++) {
18695        if (i == res.getInstantiates().size())
18696          res.getInstantiates().add(parseUri(null));
18697        if (array.get(i) instanceof JsonObject) 
18698          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
18699      }
18700    };
18701    if (json.has("status"))
18702      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), NutritionOrder.NutritionOrderStatus.NULL, new NutritionOrder.NutritionOrderStatusEnumFactory()));
18703    if (json.has("_status"))
18704      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18705    if (json.has("intent"))
18706      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), NutritionOrder.NutritiionOrderIntent.NULL, new NutritionOrder.NutritiionOrderIntentEnumFactory()));
18707    if (json.has("_intent"))
18708      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
18709    if (json.has("patient"))
18710      res.setPatient(parseReference(getJObject(json, "patient")));
18711    if (json.has("encounter"))
18712      res.setEncounter(parseReference(getJObject(json, "encounter")));
18713    if (json.has("dateTime"))
18714      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
18715    if (json.has("_dateTime"))
18716      parseElementProperties(getJObject(json, "_dateTime"), res.getDateTimeElement());
18717    if (json.has("orderer"))
18718      res.setOrderer(parseReference(getJObject(json, "orderer")));
18719    if (json.has("allergyIntolerance")) {
18720      JsonArray array = json.getAsJsonArray("allergyIntolerance");
18721      for (int i = 0; i < array.size(); i++) {
18722        res.getAllergyIntolerance().add(parseReference(array.get(i).getAsJsonObject()));
18723      }
18724    };
18725    if (json.has("foodPreferenceModifier")) {
18726      JsonArray array = json.getAsJsonArray("foodPreferenceModifier");
18727      for (int i = 0; i < array.size(); i++) {
18728        res.getFoodPreferenceModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18729      }
18730    };
18731    if (json.has("excludeFoodModifier")) {
18732      JsonArray array = json.getAsJsonArray("excludeFoodModifier");
18733      for (int i = 0; i < array.size(); i++) {
18734        res.getExcludeFoodModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18735      }
18736    };
18737    if (json.has("oralDiet"))
18738      res.setOralDiet(parseNutritionOrderNutritionOrderOralDietComponent(getJObject(json, "oralDiet"), res));
18739    if (json.has("supplement")) {
18740      JsonArray array = json.getAsJsonArray("supplement");
18741      for (int i = 0; i < array.size(); i++) {
18742        res.getSupplement().add(parseNutritionOrderNutritionOrderSupplementComponent(array.get(i).getAsJsonObject(), res));
18743      }
18744    };
18745    if (json.has("enteralFormula"))
18746      res.setEnteralFormula(parseNutritionOrderNutritionOrderEnteralFormulaComponent(getJObject(json, "enteralFormula"), res));
18747    if (json.has("note")) {
18748      JsonArray array = json.getAsJsonArray("note");
18749      for (int i = 0; i < array.size(); i++) {
18750        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
18751      }
18752    };
18753  }
18754
18755  protected NutritionOrder.NutritionOrderOralDietComponent parseNutritionOrderNutritionOrderOralDietComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
18756    NutritionOrder.NutritionOrderOralDietComponent res = new NutritionOrder.NutritionOrderOralDietComponent();
18757    parseNutritionOrderNutritionOrderOralDietComponentProperties(json, owner, res);
18758    return res;
18759  }
18760
18761  protected void parseNutritionOrderNutritionOrderOralDietComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietComponent res) throws IOException, FHIRFormatError {
18762    parseBackboneElementProperties(json, res);
18763    if (json.has("type")) {
18764      JsonArray array = json.getAsJsonArray("type");
18765      for (int i = 0; i < array.size(); i++) {
18766        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18767      }
18768    };
18769    if (json.has("schedule")) {
18770      JsonArray array = json.getAsJsonArray("schedule");
18771      for (int i = 0; i < array.size(); i++) {
18772        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
18773      }
18774    };
18775    if (json.has("nutrient")) {
18776      JsonArray array = json.getAsJsonArray("nutrient");
18777      for (int i = 0; i < array.size(); i++) {
18778        res.getNutrient().add(parseNutritionOrderNutritionOrderOralDietNutrientComponent(array.get(i).getAsJsonObject(), owner));
18779      }
18780    };
18781    if (json.has("texture")) {
18782      JsonArray array = json.getAsJsonArray("texture");
18783      for (int i = 0; i < array.size(); i++) {
18784        res.getTexture().add(parseNutritionOrderNutritionOrderOralDietTextureComponent(array.get(i).getAsJsonObject(), owner));
18785      }
18786    };
18787    if (json.has("fluidConsistencyType")) {
18788      JsonArray array = json.getAsJsonArray("fluidConsistencyType");
18789      for (int i = 0; i < array.size(); i++) {
18790        res.getFluidConsistencyType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18791      }
18792    };
18793    if (json.has("instruction"))
18794      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
18795    if (json.has("_instruction"))
18796      parseElementProperties(getJObject(json, "_instruction"), res.getInstructionElement());
18797  }
18798
18799  protected NutritionOrder.NutritionOrderOralDietNutrientComponent parseNutritionOrderNutritionOrderOralDietNutrientComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
18800    NutritionOrder.NutritionOrderOralDietNutrientComponent res = new NutritionOrder.NutritionOrderOralDietNutrientComponent();
18801    parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(json, owner, res);
18802    return res;
18803  }
18804
18805  protected void parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietNutrientComponent res) throws IOException, FHIRFormatError {
18806    parseBackboneElementProperties(json, res);
18807    if (json.has("modifier"))
18808      res.setModifier(parseCodeableConcept(getJObject(json, "modifier")));
18809    if (json.has("amount"))
18810      res.setAmount(parseQuantity(getJObject(json, "amount")));
18811  }
18812
18813  protected NutritionOrder.NutritionOrderOralDietTextureComponent parseNutritionOrderNutritionOrderOralDietTextureComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
18814    NutritionOrder.NutritionOrderOralDietTextureComponent res = new NutritionOrder.NutritionOrderOralDietTextureComponent();
18815    parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(json, owner, res);
18816    return res;
18817  }
18818
18819  protected void parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietTextureComponent res) throws IOException, FHIRFormatError {
18820    parseBackboneElementProperties(json, res);
18821    if (json.has("modifier"))
18822      res.setModifier(parseCodeableConcept(getJObject(json, "modifier")));
18823    if (json.has("foodType"))
18824      res.setFoodType(parseCodeableConcept(getJObject(json, "foodType")));
18825  }
18826
18827  protected NutritionOrder.NutritionOrderSupplementComponent parseNutritionOrderNutritionOrderSupplementComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
18828    NutritionOrder.NutritionOrderSupplementComponent res = new NutritionOrder.NutritionOrderSupplementComponent();
18829    parseNutritionOrderNutritionOrderSupplementComponentProperties(json, owner, res);
18830    return res;
18831  }
18832
18833  protected void parseNutritionOrderNutritionOrderSupplementComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderSupplementComponent res) throws IOException, FHIRFormatError {
18834    parseBackboneElementProperties(json, res);
18835    if (json.has("type"))
18836      res.setType(parseCodeableConcept(getJObject(json, "type")));
18837    if (json.has("productName"))
18838      res.setProductNameElement(parseString(json.get("productName").getAsString()));
18839    if (json.has("_productName"))
18840      parseElementProperties(getJObject(json, "_productName"), res.getProductNameElement());
18841    if (json.has("schedule")) {
18842      JsonArray array = json.getAsJsonArray("schedule");
18843      for (int i = 0; i < array.size(); i++) {
18844        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
18845      }
18846    };
18847    if (json.has("quantity"))
18848      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
18849    if (json.has("instruction"))
18850      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
18851    if (json.has("_instruction"))
18852      parseElementProperties(getJObject(json, "_instruction"), res.getInstructionElement());
18853  }
18854
18855  protected NutritionOrder.NutritionOrderEnteralFormulaComponent parseNutritionOrderNutritionOrderEnteralFormulaComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
18856    NutritionOrder.NutritionOrderEnteralFormulaComponent res = new NutritionOrder.NutritionOrderEnteralFormulaComponent();
18857    parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(json, owner, res);
18858    return res;
18859  }
18860
18861  protected void parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaComponent res) throws IOException, FHIRFormatError {
18862    parseBackboneElementProperties(json, res);
18863    if (json.has("baseFormulaType"))
18864      res.setBaseFormulaType(parseCodeableConcept(getJObject(json, "baseFormulaType")));
18865    if (json.has("baseFormulaProductName"))
18866      res.setBaseFormulaProductNameElement(parseString(json.get("baseFormulaProductName").getAsString()));
18867    if (json.has("_baseFormulaProductName"))
18868      parseElementProperties(getJObject(json, "_baseFormulaProductName"), res.getBaseFormulaProductNameElement());
18869    if (json.has("additiveType"))
18870      res.setAdditiveType(parseCodeableConcept(getJObject(json, "additiveType")));
18871    if (json.has("additiveProductName"))
18872      res.setAdditiveProductNameElement(parseString(json.get("additiveProductName").getAsString()));
18873    if (json.has("_additiveProductName"))
18874      parseElementProperties(getJObject(json, "_additiveProductName"), res.getAdditiveProductNameElement());
18875    if (json.has("caloricDensity"))
18876      res.setCaloricDensity(parseQuantity(getJObject(json, "caloricDensity")));
18877    if (json.has("routeofAdministration"))
18878      res.setRouteofAdministration(parseCodeableConcept(getJObject(json, "routeofAdministration")));
18879    if (json.has("administration")) {
18880      JsonArray array = json.getAsJsonArray("administration");
18881      for (int i = 0; i < array.size(); i++) {
18882        res.getAdministration().add(parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(array.get(i).getAsJsonObject(), owner));
18883      }
18884    };
18885    if (json.has("maxVolumeToDeliver"))
18886      res.setMaxVolumeToDeliver(parseQuantity(getJObject(json, "maxVolumeToDeliver")));
18887    if (json.has("administrationInstruction"))
18888      res.setAdministrationInstructionElement(parseString(json.get("administrationInstruction").getAsString()));
18889    if (json.has("_administrationInstruction"))
18890      parseElementProperties(getJObject(json, "_administrationInstruction"), res.getAdministrationInstructionElement());
18891  }
18892
18893  protected NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
18894    NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res = new NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent();
18895    parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(json, owner, res);
18896    return res;
18897  }
18898
18899  protected void parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res) throws IOException, FHIRFormatError {
18900    parseBackboneElementProperties(json, res);
18901    if (json.has("schedule"))
18902      res.setSchedule(parseTiming(getJObject(json, "schedule")));
18903    if (json.has("quantity"))
18904      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
18905    Type rate = parseType("rate", json);
18906    if (rate != null)
18907      res.setRate(rate);
18908  }
18909
18910  protected Observation parseObservation(JsonObject json) throws IOException, FHIRFormatError {
18911    Observation res = new Observation();
18912    parseObservationProperties(json, res);
18913    return res;
18914  }
18915
18916  protected void parseObservationProperties(JsonObject json, Observation res) throws IOException, FHIRFormatError {
18917    parseDomainResourceProperties(json, res);
18918    if (json.has("identifier")) {
18919      JsonArray array = json.getAsJsonArray("identifier");
18920      for (int i = 0; i < array.size(); i++) {
18921        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18922      }
18923    };
18924    if (json.has("basedOn")) {
18925      JsonArray array = json.getAsJsonArray("basedOn");
18926      for (int i = 0; i < array.size(); i++) {
18927        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
18928      }
18929    };
18930    if (json.has("partOf")) {
18931      JsonArray array = json.getAsJsonArray("partOf");
18932      for (int i = 0; i < array.size(); i++) {
18933        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
18934      }
18935    };
18936    if (json.has("status"))
18937      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Observation.ObservationStatus.NULL, new Observation.ObservationStatusEnumFactory()));
18938    if (json.has("_status"))
18939      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18940    if (json.has("category")) {
18941      JsonArray array = json.getAsJsonArray("category");
18942      for (int i = 0; i < array.size(); i++) {
18943        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18944      }
18945    };
18946    if (json.has("code"))
18947      res.setCode(parseCodeableConcept(getJObject(json, "code")));
18948    if (json.has("subject"))
18949      res.setSubject(parseReference(getJObject(json, "subject")));
18950    if (json.has("focus")) {
18951      JsonArray array = json.getAsJsonArray("focus");
18952      for (int i = 0; i < array.size(); i++) {
18953        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
18954      }
18955    };
18956    if (json.has("encounter"))
18957      res.setEncounter(parseReference(getJObject(json, "encounter")));
18958    Type effective = parseType("effective", json);
18959    if (effective != null)
18960      res.setEffective(effective);
18961    if (json.has("issued"))
18962      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
18963    if (json.has("_issued"))
18964      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
18965    if (json.has("performer")) {
18966      JsonArray array = json.getAsJsonArray("performer");
18967      for (int i = 0; i < array.size(); i++) {
18968        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
18969      }
18970    };
18971    Type value = parseType("value", json);
18972    if (value != null)
18973      res.setValue(value);
18974    if (json.has("dataAbsentReason"))
18975      res.setDataAbsentReason(parseCodeableConcept(getJObject(json, "dataAbsentReason")));
18976    if (json.has("interpretation")) {
18977      JsonArray array = json.getAsJsonArray("interpretation");
18978      for (int i = 0; i < array.size(); i++) {
18979        res.getInterpretation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18980      }
18981    };
18982    if (json.has("note")) {
18983      JsonArray array = json.getAsJsonArray("note");
18984      for (int i = 0; i < array.size(); i++) {
18985        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
18986      }
18987    };
18988    if (json.has("bodySite"))
18989      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
18990    if (json.has("method"))
18991      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
18992    if (json.has("specimen"))
18993      res.setSpecimen(parseReference(getJObject(json, "specimen")));
18994    if (json.has("device"))
18995      res.setDevice(parseReference(getJObject(json, "device")));
18996    if (json.has("referenceRange")) {
18997      JsonArray array = json.getAsJsonArray("referenceRange");
18998      for (int i = 0; i < array.size(); i++) {
18999        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), res));
19000      }
19001    };
19002    if (json.has("hasMember")) {
19003      JsonArray array = json.getAsJsonArray("hasMember");
19004      for (int i = 0; i < array.size(); i++) {
19005        res.getHasMember().add(parseReference(array.get(i).getAsJsonObject()));
19006      }
19007    };
19008    if (json.has("derivedFrom")) {
19009      JsonArray array = json.getAsJsonArray("derivedFrom");
19010      for (int i = 0; i < array.size(); i++) {
19011        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
19012      }
19013    };
19014    if (json.has("component")) {
19015      JsonArray array = json.getAsJsonArray("component");
19016      for (int i = 0; i < array.size(); i++) {
19017        res.getComponent().add(parseObservationObservationComponentComponent(array.get(i).getAsJsonObject(), res));
19018      }
19019    };
19020  }
19021
19022  protected Observation.ObservationReferenceRangeComponent parseObservationObservationReferenceRangeComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
19023    Observation.ObservationReferenceRangeComponent res = new Observation.ObservationReferenceRangeComponent();
19024    parseObservationObservationReferenceRangeComponentProperties(json, owner, res);
19025    return res;
19026  }
19027
19028  protected void parseObservationObservationReferenceRangeComponentProperties(JsonObject json, Observation owner, Observation.ObservationReferenceRangeComponent res) throws IOException, FHIRFormatError {
19029    parseBackboneElementProperties(json, res);
19030    if (json.has("low"))
19031      res.setLow(parseQuantity(getJObject(json, "low")));
19032    if (json.has("high"))
19033      res.setHigh(parseQuantity(getJObject(json, "high")));
19034    if (json.has("type"))
19035      res.setType(parseCodeableConcept(getJObject(json, "type")));
19036    if (json.has("appliesTo")) {
19037      JsonArray array = json.getAsJsonArray("appliesTo");
19038      for (int i = 0; i < array.size(); i++) {
19039        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19040      }
19041    };
19042    if (json.has("age"))
19043      res.setAge(parseRange(getJObject(json, "age")));
19044    if (json.has("text"))
19045      res.setTextElement(parseString(json.get("text").getAsString()));
19046    if (json.has("_text"))
19047      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
19048  }
19049
19050  protected Observation.ObservationComponentComponent parseObservationObservationComponentComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
19051    Observation.ObservationComponentComponent res = new Observation.ObservationComponentComponent();
19052    parseObservationObservationComponentComponentProperties(json, owner, res);
19053    return res;
19054  }
19055
19056  protected void parseObservationObservationComponentComponentProperties(JsonObject json, Observation owner, Observation.ObservationComponentComponent res) throws IOException, FHIRFormatError {
19057    parseBackboneElementProperties(json, res);
19058    if (json.has("code"))
19059      res.setCode(parseCodeableConcept(getJObject(json, "code")));
19060    Type value = parseType("value", json);
19061    if (value != null)
19062      res.setValue(value);
19063    if (json.has("dataAbsentReason"))
19064      res.setDataAbsentReason(parseCodeableConcept(getJObject(json, "dataAbsentReason")));
19065    if (json.has("interpretation")) {
19066      JsonArray array = json.getAsJsonArray("interpretation");
19067      for (int i = 0; i < array.size(); i++) {
19068        res.getInterpretation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19069      }
19070    };
19071    if (json.has("referenceRange")) {
19072      JsonArray array = json.getAsJsonArray("referenceRange");
19073      for (int i = 0; i < array.size(); i++) {
19074        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), owner));
19075      }
19076    };
19077  }
19078
19079  protected ObservationDefinition parseObservationDefinition(JsonObject json) throws IOException, FHIRFormatError {
19080    ObservationDefinition res = new ObservationDefinition();
19081    parseObservationDefinitionProperties(json, res);
19082    return res;
19083  }
19084
19085  protected void parseObservationDefinitionProperties(JsonObject json, ObservationDefinition res) throws IOException, FHIRFormatError {
19086    parseDomainResourceProperties(json, res);
19087    if (json.has("category")) {
19088      JsonArray array = json.getAsJsonArray("category");
19089      for (int i = 0; i < array.size(); i++) {
19090        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19091      }
19092    };
19093    if (json.has("code"))
19094      res.setCode(parseCodeableConcept(getJObject(json, "code")));
19095    if (json.has("identifier")) {
19096      JsonArray array = json.getAsJsonArray("identifier");
19097      for (int i = 0; i < array.size(); i++) {
19098        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19099      }
19100    };
19101    if (json.has("permittedDataType")) {
19102      JsonArray array = json.getAsJsonArray("permittedDataType");
19103      for (int i = 0; i < array.size(); i++) {
19104        res.getPermittedDataType().add(parseEnumeration(array.get(i).getAsString(), ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
19105      }
19106    };
19107    if (json.has("_permittedDataType")) {
19108      JsonArray array = json.getAsJsonArray("_permittedDataType");
19109      for (int i = 0; i < array.size(); i++) {
19110        if (i == res.getPermittedDataType().size())
19111          res.getPermittedDataType().add(parseEnumeration(null, ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
19112        if (array.get(i) instanceof JsonObject) 
19113          parseElementProperties(array.get(i).getAsJsonObject(), res.getPermittedDataType().get(i));
19114      }
19115    };
19116    if (json.has("multipleResultsAllowed"))
19117      res.setMultipleResultsAllowedElement(parseBoolean(json.get("multipleResultsAllowed").getAsBoolean()));
19118    if (json.has("_multipleResultsAllowed"))
19119      parseElementProperties(getJObject(json, "_multipleResultsAllowed"), res.getMultipleResultsAllowedElement());
19120    if (json.has("method"))
19121      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
19122    if (json.has("preferredReportName"))
19123      res.setPreferredReportNameElement(parseString(json.get("preferredReportName").getAsString()));
19124    if (json.has("_preferredReportName"))
19125      parseElementProperties(getJObject(json, "_preferredReportName"), res.getPreferredReportNameElement());
19126    if (json.has("quantitativeDetails"))
19127      res.setQuantitativeDetails(parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(getJObject(json, "quantitativeDetails"), res));
19128    if (json.has("qualifiedInterval")) {
19129      JsonArray array = json.getAsJsonArray("qualifiedInterval");
19130      for (int i = 0; i < array.size(); i++) {
19131        res.getQualifiedInterval().add(parseObservationDefinitionObservationDefinitionQualifiedIntervalComponent(array.get(i).getAsJsonObject(), res));
19132      }
19133    };
19134    if (json.has("validCodedValueSet"))
19135      res.setValidCodedValueSet(parseReference(getJObject(json, "validCodedValueSet")));
19136    if (json.has("normalCodedValueSet"))
19137      res.setNormalCodedValueSet(parseReference(getJObject(json, "normalCodedValueSet")));
19138    if (json.has("abnormalCodedValueSet"))
19139      res.setAbnormalCodedValueSet(parseReference(getJObject(json, "abnormalCodedValueSet")));
19140    if (json.has("criticalCodedValueSet"))
19141      res.setCriticalCodedValueSet(parseReference(getJObject(json, "criticalCodedValueSet")));
19142  }
19143
19144  protected ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(JsonObject json, ObservationDefinition owner) throws IOException, FHIRFormatError {
19145    ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res = new ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent();
19146    parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponentProperties(json, owner, res);
19147    return res;
19148  }
19149
19150  protected void parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponentProperties(JsonObject json, ObservationDefinition owner, ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res) throws IOException, FHIRFormatError {
19151    parseBackboneElementProperties(json, res);
19152    if (json.has("customaryUnit"))
19153      res.setCustomaryUnit(parseCodeableConcept(getJObject(json, "customaryUnit")));
19154    if (json.has("unit"))
19155      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
19156    if (json.has("conversionFactor"))
19157      res.setConversionFactorElement(parseDecimal(json.get("conversionFactor").getAsBigDecimal()));
19158    if (json.has("_conversionFactor"))
19159      parseElementProperties(getJObject(json, "_conversionFactor"), res.getConversionFactorElement());
19160    if (json.has("decimalPrecision"))
19161      res.setDecimalPrecisionElement(parseInteger(json.get("decimalPrecision").getAsLong()));
19162    if (json.has("_decimalPrecision"))
19163      parseElementProperties(getJObject(json, "_decimalPrecision"), res.getDecimalPrecisionElement());
19164  }
19165
19166  protected ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent parseObservationDefinitionObservationDefinitionQualifiedIntervalComponent(JsonObject json, ObservationDefinition owner) throws IOException, FHIRFormatError {
19167    ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res = new ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent();
19168    parseObservationDefinitionObservationDefinitionQualifiedIntervalComponentProperties(json, owner, res);
19169    return res;
19170  }
19171
19172  protected void parseObservationDefinitionObservationDefinitionQualifiedIntervalComponentProperties(JsonObject json, ObservationDefinition owner, ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res) throws IOException, FHIRFormatError {
19173    parseBackboneElementProperties(json, res);
19174    if (json.has("category"))
19175      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), ObservationDefinition.ObservationRangeCategory.NULL, new ObservationDefinition.ObservationRangeCategoryEnumFactory()));
19176    if (json.has("_category"))
19177      parseElementProperties(getJObject(json, "_category"), res.getCategoryElement());
19178    if (json.has("range"))
19179      res.setRange(parseRange(getJObject(json, "range")));
19180    if (json.has("context"))
19181      res.setContext(parseCodeableConcept(getJObject(json, "context")));
19182    if (json.has("appliesTo")) {
19183      JsonArray array = json.getAsJsonArray("appliesTo");
19184      for (int i = 0; i < array.size(); i++) {
19185        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19186      }
19187    };
19188    if (json.has("gender"))
19189      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
19190    if (json.has("_gender"))
19191      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
19192    if (json.has("age"))
19193      res.setAge(parseRange(getJObject(json, "age")));
19194    if (json.has("gestationalAge"))
19195      res.setGestationalAge(parseRange(getJObject(json, "gestationalAge")));
19196    if (json.has("condition"))
19197      res.setConditionElement(parseString(json.get("condition").getAsString()));
19198    if (json.has("_condition"))
19199      parseElementProperties(getJObject(json, "_condition"), res.getConditionElement());
19200  }
19201
19202  protected OperationDefinition parseOperationDefinition(JsonObject json) throws IOException, FHIRFormatError {
19203    OperationDefinition res = new OperationDefinition();
19204    parseOperationDefinitionProperties(json, res);
19205    return res;
19206  }
19207
19208  protected void parseOperationDefinitionProperties(JsonObject json, OperationDefinition res) throws IOException, FHIRFormatError {
19209    parseDomainResourceProperties(json, res);
19210    if (json.has("url"))
19211      res.setUrlElement(parseUri(json.get("url").getAsString()));
19212    if (json.has("_url"))
19213      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
19214    if (json.has("version"))
19215      res.setVersionElement(parseString(json.get("version").getAsString()));
19216    if (json.has("_version"))
19217      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
19218    if (json.has("name"))
19219      res.setNameElement(parseString(json.get("name").getAsString()));
19220    if (json.has("_name"))
19221      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19222    if (json.has("title"))
19223      res.setTitleElement(parseString(json.get("title").getAsString()));
19224    if (json.has("_title"))
19225      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
19226    if (json.has("status"))
19227      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
19228    if (json.has("_status"))
19229      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
19230    if (json.has("kind"))
19231      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), OperationDefinition.OperationKind.NULL, new OperationDefinition.OperationKindEnumFactory()));
19232    if (json.has("_kind"))
19233      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
19234    if (json.has("experimental"))
19235      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
19236    if (json.has("_experimental"))
19237      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
19238    if (json.has("date"))
19239      res.setDateElement(parseDateTime(json.get("date").getAsString()));
19240    if (json.has("_date"))
19241      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
19242    if (json.has("publisher"))
19243      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
19244    if (json.has("_publisher"))
19245      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
19246    if (json.has("contact")) {
19247      JsonArray array = json.getAsJsonArray("contact");
19248      for (int i = 0; i < array.size(); i++) {
19249        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
19250      }
19251    };
19252    if (json.has("description"))
19253      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
19254    if (json.has("_description"))
19255      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
19256    if (json.has("useContext")) {
19257      JsonArray array = json.getAsJsonArray("useContext");
19258      for (int i = 0; i < array.size(); i++) {
19259        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
19260      }
19261    };
19262    if (json.has("jurisdiction")) {
19263      JsonArray array = json.getAsJsonArray("jurisdiction");
19264      for (int i = 0; i < array.size(); i++) {
19265        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19266      }
19267    };
19268    if (json.has("purpose"))
19269      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
19270    if (json.has("_purpose"))
19271      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
19272    if (json.has("affectsState"))
19273      res.setAffectsStateElement(parseBoolean(json.get("affectsState").getAsBoolean()));
19274    if (json.has("_affectsState"))
19275      parseElementProperties(getJObject(json, "_affectsState"), res.getAffectsStateElement());
19276    if (json.has("code"))
19277      res.setCodeElement(parseCode(json.get("code").getAsString()));
19278    if (json.has("_code"))
19279      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
19280    if (json.has("comment"))
19281      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
19282    if (json.has("_comment"))
19283      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
19284    if (json.has("base"))
19285      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
19286    if (json.has("_base"))
19287      parseElementProperties(getJObject(json, "_base"), res.getBaseElement());
19288    if (json.has("resource")) {
19289      JsonArray array = json.getAsJsonArray("resource");
19290      for (int i = 0; i < array.size(); i++) {
19291        res.getResource().add(parseCode(array.get(i).getAsString()));
19292      }
19293    };
19294    if (json.has("_resource")) {
19295      JsonArray array = json.getAsJsonArray("_resource");
19296      for (int i = 0; i < array.size(); i++) {
19297        if (i == res.getResource().size())
19298          res.getResource().add(parseCode(null));
19299        if (array.get(i) instanceof JsonObject) 
19300          parseElementProperties(array.get(i).getAsJsonObject(), res.getResource().get(i));
19301      }
19302    };
19303    if (json.has("system"))
19304      res.setSystemElement(parseBoolean(json.get("system").getAsBoolean()));
19305    if (json.has("_system"))
19306      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
19307    if (json.has("type"))
19308      res.setTypeElement(parseBoolean(json.get("type").getAsBoolean()));
19309    if (json.has("_type"))
19310      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
19311    if (json.has("instance"))
19312      res.setInstanceElement(parseBoolean(json.get("instance").getAsBoolean()));
19313    if (json.has("_instance"))
19314      parseElementProperties(getJObject(json, "_instance"), res.getInstanceElement());
19315    if (json.has("inputProfile"))
19316      res.setInputProfileElement(parseCanonical(json.get("inputProfile").getAsString()));
19317    if (json.has("_inputProfile"))
19318      parseElementProperties(getJObject(json, "_inputProfile"), res.getInputProfileElement());
19319    if (json.has("outputProfile"))
19320      res.setOutputProfileElement(parseCanonical(json.get("outputProfile").getAsString()));
19321    if (json.has("_outputProfile"))
19322      parseElementProperties(getJObject(json, "_outputProfile"), res.getOutputProfileElement());
19323    if (json.has("parameter")) {
19324      JsonArray array = json.getAsJsonArray("parameter");
19325      for (int i = 0; i < array.size(); i++) {
19326        res.getParameter().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), res));
19327      }
19328    };
19329    if (json.has("overload")) {
19330      JsonArray array = json.getAsJsonArray("overload");
19331      for (int i = 0; i < array.size(); i++) {
19332        res.getOverload().add(parseOperationDefinitionOperationDefinitionOverloadComponent(array.get(i).getAsJsonObject(), res));
19333      }
19334    };
19335  }
19336
19337  protected OperationDefinition.OperationDefinitionParameterComponent parseOperationDefinitionOperationDefinitionParameterComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
19338    OperationDefinition.OperationDefinitionParameterComponent res = new OperationDefinition.OperationDefinitionParameterComponent();
19339    parseOperationDefinitionOperationDefinitionParameterComponentProperties(json, owner, res);
19340    return res;
19341  }
19342
19343  protected void parseOperationDefinitionOperationDefinitionParameterComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterComponent res) throws IOException, FHIRFormatError {
19344    parseBackboneElementProperties(json, res);
19345    if (json.has("name"))
19346      res.setNameElement(parseCode(json.get("name").getAsString()));
19347    if (json.has("_name"))
19348      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19349    if (json.has("use"))
19350      res.setUseElement(parseEnumeration(json.get("use").getAsString(), OperationDefinition.OperationParameterUse.NULL, new OperationDefinition.OperationParameterUseEnumFactory()));
19351    if (json.has("_use"))
19352      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
19353    if (json.has("min"))
19354      res.setMinElement(parseInteger(json.get("min").getAsLong()));
19355    if (json.has("_min"))
19356      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
19357    if (json.has("max"))
19358      res.setMaxElement(parseString(json.get("max").getAsString()));
19359    if (json.has("_max"))
19360      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
19361    if (json.has("documentation"))
19362      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
19363    if (json.has("_documentation"))
19364      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
19365    if (json.has("type"))
19366      res.setTypeElement(parseCode(json.get("type").getAsString()));
19367    if (json.has("_type"))
19368      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
19369    if (json.has("targetProfile")) {
19370      JsonArray array = json.getAsJsonArray("targetProfile");
19371      for (int i = 0; i < array.size(); i++) {
19372        res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
19373      }
19374    };
19375    if (json.has("_targetProfile")) {
19376      JsonArray array = json.getAsJsonArray("_targetProfile");
19377      for (int i = 0; i < array.size(); i++) {
19378        if (i == res.getTargetProfile().size())
19379          res.getTargetProfile().add(parseCanonical(null));
19380        if (array.get(i) instanceof JsonObject) 
19381          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
19382      }
19383    };
19384    if (json.has("searchType"))
19385      res.setSearchTypeElement(parseEnumeration(json.get("searchType").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
19386    if (json.has("_searchType"))
19387      parseElementProperties(getJObject(json, "_searchType"), res.getSearchTypeElement());
19388    if (json.has("binding"))
19389      res.setBinding(parseOperationDefinitionOperationDefinitionParameterBindingComponent(getJObject(json, "binding"), owner));
19390    if (json.has("referencedFrom")) {
19391      JsonArray array = json.getAsJsonArray("referencedFrom");
19392      for (int i = 0; i < array.size(); i++) {
19393        res.getReferencedFrom().add(parseOperationDefinitionOperationDefinitionParameterReferencedFromComponent(array.get(i).getAsJsonObject(), owner));
19394      }
19395    };
19396    if (json.has("part")) {
19397      JsonArray array = json.getAsJsonArray("part");
19398      for (int i = 0; i < array.size(); i++) {
19399        res.getPart().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), owner));
19400      }
19401    };
19402  }
19403
19404  protected OperationDefinition.OperationDefinitionParameterBindingComponent parseOperationDefinitionOperationDefinitionParameterBindingComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
19405    OperationDefinition.OperationDefinitionParameterBindingComponent res = new OperationDefinition.OperationDefinitionParameterBindingComponent();
19406    parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(json, owner, res);
19407    return res;
19408  }
19409
19410  protected void parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterBindingComponent res) throws IOException, FHIRFormatError {
19411    parseBackboneElementProperties(json, res);
19412    if (json.has("strength"))
19413      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
19414    if (json.has("_strength"))
19415      parseElementProperties(getJObject(json, "_strength"), res.getStrengthElement());
19416    if (json.has("valueSet"))
19417      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
19418    if (json.has("_valueSet"))
19419      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
19420  }
19421
19422  protected OperationDefinition.OperationDefinitionParameterReferencedFromComponent parseOperationDefinitionOperationDefinitionParameterReferencedFromComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
19423    OperationDefinition.OperationDefinitionParameterReferencedFromComponent res = new OperationDefinition.OperationDefinitionParameterReferencedFromComponent();
19424    parseOperationDefinitionOperationDefinitionParameterReferencedFromComponentProperties(json, owner, res);
19425    return res;
19426  }
19427
19428  protected void parseOperationDefinitionOperationDefinitionParameterReferencedFromComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterReferencedFromComponent res) throws IOException, FHIRFormatError {
19429    parseBackboneElementProperties(json, res);
19430    if (json.has("source"))
19431      res.setSourceElement(parseString(json.get("source").getAsString()));
19432    if (json.has("_source"))
19433      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
19434    if (json.has("sourceId"))
19435      res.setSourceIdElement(parseString(json.get("sourceId").getAsString()));
19436    if (json.has("_sourceId"))
19437      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
19438  }
19439
19440  protected OperationDefinition.OperationDefinitionOverloadComponent parseOperationDefinitionOperationDefinitionOverloadComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
19441    OperationDefinition.OperationDefinitionOverloadComponent res = new OperationDefinition.OperationDefinitionOverloadComponent();
19442    parseOperationDefinitionOperationDefinitionOverloadComponentProperties(json, owner, res);
19443    return res;
19444  }
19445
19446  protected void parseOperationDefinitionOperationDefinitionOverloadComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionOverloadComponent res) throws IOException, FHIRFormatError {
19447    parseBackboneElementProperties(json, res);
19448    if (json.has("parameterName")) {
19449      JsonArray array = json.getAsJsonArray("parameterName");
19450      for (int i = 0; i < array.size(); i++) {
19451        res.getParameterName().add(parseString(array.get(i).getAsString()));
19452      }
19453    };
19454    if (json.has("_parameterName")) {
19455      JsonArray array = json.getAsJsonArray("_parameterName");
19456      for (int i = 0; i < array.size(); i++) {
19457        if (i == res.getParameterName().size())
19458          res.getParameterName().add(parseString(null));
19459        if (array.get(i) instanceof JsonObject) 
19460          parseElementProperties(array.get(i).getAsJsonObject(), res.getParameterName().get(i));
19461      }
19462    };
19463    if (json.has("comment"))
19464      res.setCommentElement(parseString(json.get("comment").getAsString()));
19465    if (json.has("_comment"))
19466      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
19467  }
19468
19469  protected OperationOutcome parseOperationOutcome(JsonObject json) throws IOException, FHIRFormatError {
19470    OperationOutcome res = new OperationOutcome();
19471    parseOperationOutcomeProperties(json, res);
19472    return res;
19473  }
19474
19475  protected void parseOperationOutcomeProperties(JsonObject json, OperationOutcome res) throws IOException, FHIRFormatError {
19476    parseDomainResourceProperties(json, res);
19477    if (json.has("issue")) {
19478      JsonArray array = json.getAsJsonArray("issue");
19479      for (int i = 0; i < array.size(); i++) {
19480        res.getIssue().add(parseOperationOutcomeOperationOutcomeIssueComponent(array.get(i).getAsJsonObject(), res));
19481      }
19482    };
19483  }
19484
19485  protected OperationOutcome.OperationOutcomeIssueComponent parseOperationOutcomeOperationOutcomeIssueComponent(JsonObject json, OperationOutcome owner) throws IOException, FHIRFormatError {
19486    OperationOutcome.OperationOutcomeIssueComponent res = new OperationOutcome.OperationOutcomeIssueComponent();
19487    parseOperationOutcomeOperationOutcomeIssueComponentProperties(json, owner, res);
19488    return res;
19489  }
19490
19491  protected void parseOperationOutcomeOperationOutcomeIssueComponentProperties(JsonObject json, OperationOutcome owner, OperationOutcome.OperationOutcomeIssueComponent res) throws IOException, FHIRFormatError {
19492    parseBackboneElementProperties(json, res);
19493    if (json.has("severity"))
19494      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), OperationOutcome.IssueSeverity.NULL, new OperationOutcome.IssueSeverityEnumFactory()));
19495    if (json.has("_severity"))
19496      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
19497    if (json.has("code"))
19498      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), OperationOutcome.IssueType.NULL, new OperationOutcome.IssueTypeEnumFactory()));
19499    if (json.has("_code"))
19500      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
19501    if (json.has("details"))
19502      res.setDetails(parseCodeableConcept(getJObject(json, "details")));
19503    if (json.has("diagnostics"))
19504      res.setDiagnosticsElement(parseString(json.get("diagnostics").getAsString()));
19505    if (json.has("_diagnostics"))
19506      parseElementProperties(getJObject(json, "_diagnostics"), res.getDiagnosticsElement());
19507    if (json.has("location")) {
19508      JsonArray array = json.getAsJsonArray("location");
19509      for (int i = 0; i < array.size(); i++) {
19510        res.getLocation().add(parseString(array.get(i).getAsString()));
19511      }
19512    };
19513    if (json.has("_location")) {
19514      JsonArray array = json.getAsJsonArray("_location");
19515      for (int i = 0; i < array.size(); i++) {
19516        if (i == res.getLocation().size())
19517          res.getLocation().add(parseString(null));
19518        if (array.get(i) instanceof JsonObject) 
19519          parseElementProperties(array.get(i).getAsJsonObject(), res.getLocation().get(i));
19520      }
19521    };
19522    if (json.has("expression")) {
19523      JsonArray array = json.getAsJsonArray("expression");
19524      for (int i = 0; i < array.size(); i++) {
19525        res.getExpression().add(parseString(array.get(i).getAsString()));
19526      }
19527    };
19528    if (json.has("_expression")) {
19529      JsonArray array = json.getAsJsonArray("_expression");
19530      for (int i = 0; i < array.size(); i++) {
19531        if (i == res.getExpression().size())
19532          res.getExpression().add(parseString(null));
19533        if (array.get(i) instanceof JsonObject) 
19534          parseElementProperties(array.get(i).getAsJsonObject(), res.getExpression().get(i));
19535      }
19536    };
19537  }
19538
19539  protected Organization parseOrganization(JsonObject json) throws IOException, FHIRFormatError {
19540    Organization res = new Organization();
19541    parseOrganizationProperties(json, res);
19542    return res;
19543  }
19544
19545  protected void parseOrganizationProperties(JsonObject json, Organization res) throws IOException, FHIRFormatError {
19546    parseDomainResourceProperties(json, res);
19547    if (json.has("identifier")) {
19548      JsonArray array = json.getAsJsonArray("identifier");
19549      for (int i = 0; i < array.size(); i++) {
19550        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19551      }
19552    };
19553    if (json.has("active"))
19554      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
19555    if (json.has("_active"))
19556      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
19557    if (json.has("type")) {
19558      JsonArray array = json.getAsJsonArray("type");
19559      for (int i = 0; i < array.size(); i++) {
19560        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19561      }
19562    };
19563    if (json.has("name"))
19564      res.setNameElement(parseString(json.get("name").getAsString()));
19565    if (json.has("_name"))
19566      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19567    if (json.has("alias")) {
19568      JsonArray array = json.getAsJsonArray("alias");
19569      for (int i = 0; i < array.size(); i++) {
19570        res.getAlias().add(parseString(array.get(i).getAsString()));
19571      }
19572    };
19573    if (json.has("_alias")) {
19574      JsonArray array = json.getAsJsonArray("_alias");
19575      for (int i = 0; i < array.size(); i++) {
19576        if (i == res.getAlias().size())
19577          res.getAlias().add(parseString(null));
19578        if (array.get(i) instanceof JsonObject) 
19579          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
19580      }
19581    };
19582    if (json.has("telecom")) {
19583      JsonArray array = json.getAsJsonArray("telecom");
19584      for (int i = 0; i < array.size(); i++) {
19585        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
19586      }
19587    };
19588    if (json.has("address")) {
19589      JsonArray array = json.getAsJsonArray("address");
19590      for (int i = 0; i < array.size(); i++) {
19591        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
19592      }
19593    };
19594    if (json.has("partOf"))
19595      res.setPartOf(parseReference(getJObject(json, "partOf")));
19596    if (json.has("contact")) {
19597      JsonArray array = json.getAsJsonArray("contact");
19598      for (int i = 0; i < array.size(); i++) {
19599        res.getContact().add(parseOrganizationOrganizationContactComponent(array.get(i).getAsJsonObject(), res));
19600      }
19601    };
19602    if (json.has("endpoint")) {
19603      JsonArray array = json.getAsJsonArray("endpoint");
19604      for (int i = 0; i < array.size(); i++) {
19605        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
19606      }
19607    };
19608  }
19609
19610  protected Organization.OrganizationContactComponent parseOrganizationOrganizationContactComponent(JsonObject json, Organization owner) throws IOException, FHIRFormatError {
19611    Organization.OrganizationContactComponent res = new Organization.OrganizationContactComponent();
19612    parseOrganizationOrganizationContactComponentProperties(json, owner, res);
19613    return res;
19614  }
19615
19616  protected void parseOrganizationOrganizationContactComponentProperties(JsonObject json, Organization owner, Organization.OrganizationContactComponent res) throws IOException, FHIRFormatError {
19617    parseBackboneElementProperties(json, res);
19618    if (json.has("purpose"))
19619      res.setPurpose(parseCodeableConcept(getJObject(json, "purpose")));
19620    if (json.has("name"))
19621      res.setName(parseHumanName(getJObject(json, "name")));
19622    if (json.has("telecom")) {
19623      JsonArray array = json.getAsJsonArray("telecom");
19624      for (int i = 0; i < array.size(); i++) {
19625        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
19626      }
19627    };
19628    if (json.has("address"))
19629      res.setAddress(parseAddress(getJObject(json, "address")));
19630  }
19631
19632  protected OrganizationAffiliation parseOrganizationAffiliation(JsonObject json) throws IOException, FHIRFormatError {
19633    OrganizationAffiliation res = new OrganizationAffiliation();
19634    parseOrganizationAffiliationProperties(json, res);
19635    return res;
19636  }
19637
19638  protected void parseOrganizationAffiliationProperties(JsonObject json, OrganizationAffiliation res) throws IOException, FHIRFormatError {
19639    parseDomainResourceProperties(json, res);
19640    if (json.has("identifier")) {
19641      JsonArray array = json.getAsJsonArray("identifier");
19642      for (int i = 0; i < array.size(); i++) {
19643        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19644      }
19645    };
19646    if (json.has("active"))
19647      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
19648    if (json.has("_active"))
19649      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
19650    if (json.has("period"))
19651      res.setPeriod(parsePeriod(getJObject(json, "period")));
19652    if (json.has("organization"))
19653      res.setOrganization(parseReference(getJObject(json, "organization")));
19654    if (json.has("participatingOrganization"))
19655      res.setParticipatingOrganization(parseReference(getJObject(json, "participatingOrganization")));
19656    if (json.has("network")) {
19657      JsonArray array = json.getAsJsonArray("network");
19658      for (int i = 0; i < array.size(); i++) {
19659        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
19660      }
19661    };
19662    if (json.has("code")) {
19663      JsonArray array = json.getAsJsonArray("code");
19664      for (int i = 0; i < array.size(); i++) {
19665        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19666      }
19667    };
19668    if (json.has("specialty")) {
19669      JsonArray array = json.getAsJsonArray("specialty");
19670      for (int i = 0; i < array.size(); i++) {
19671        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19672      }
19673    };
19674    if (json.has("location")) {
19675      JsonArray array = json.getAsJsonArray("location");
19676      for (int i = 0; i < array.size(); i++) {
19677        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
19678      }
19679    };
19680    if (json.has("healthcareService")) {
19681      JsonArray array = json.getAsJsonArray("healthcareService");
19682      for (int i = 0; i < array.size(); i++) {
19683        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
19684      }
19685    };
19686    if (json.has("telecom")) {
19687      JsonArray array = json.getAsJsonArray("telecom");
19688      for (int i = 0; i < array.size(); i++) {
19689        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
19690      }
19691    };
19692    if (json.has("endpoint")) {
19693      JsonArray array = json.getAsJsonArray("endpoint");
19694      for (int i = 0; i < array.size(); i++) {
19695        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
19696      }
19697    };
19698  }
19699
19700  protected Patient parsePatient(JsonObject json) throws IOException, FHIRFormatError {
19701    Patient res = new Patient();
19702    parsePatientProperties(json, res);
19703    return res;
19704  }
19705
19706  protected void parsePatientProperties(JsonObject json, Patient res) throws IOException, FHIRFormatError {
19707    parseDomainResourceProperties(json, res);
19708    if (json.has("identifier")) {
19709      JsonArray array = json.getAsJsonArray("identifier");
19710      for (int i = 0; i < array.size(); i++) {
19711        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19712      }
19713    };
19714    if (json.has("active"))
19715      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
19716    if (json.has("_active"))
19717      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
19718    if (json.has("name")) {
19719      JsonArray array = json.getAsJsonArray("name");
19720      for (int i = 0; i < array.size(); i++) {
19721        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
19722      }
19723    };
19724    if (json.has("telecom")) {
19725      JsonArray array = json.getAsJsonArray("telecom");
19726      for (int i = 0; i < array.size(); i++) {
19727        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
19728      }
19729    };
19730    if (json.has("gender"))
19731      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
19732    if (json.has("_gender"))
19733      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
19734    if (json.has("birthDate"))
19735      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
19736    if (json.has("_birthDate"))
19737      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
19738    Type deceased = parseType("deceased", json);
19739    if (deceased != null)
19740      res.setDeceased(deceased);
19741    if (json.has("address")) {
19742      JsonArray array = json.getAsJsonArray("address");
19743      for (int i = 0; i < array.size(); i++) {
19744        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
19745      }
19746    };
19747    if (json.has("maritalStatus"))
19748      res.setMaritalStatus(parseCodeableConcept(getJObject(json, "maritalStatus")));
19749    Type multipleBirth = parseType("multipleBirth", json);
19750    if (multipleBirth != null)
19751      res.setMultipleBirth(multipleBirth);
19752    if (json.has("photo")) {
19753      JsonArray array = json.getAsJsonArray("photo");
19754      for (int i = 0; i < array.size(); i++) {
19755        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
19756      }
19757    };
19758    if (json.has("contact")) {
19759      JsonArray array = json.getAsJsonArray("contact");
19760      for (int i = 0; i < array.size(); i++) {
19761        res.getContact().add(parsePatientContactComponent(array.get(i).getAsJsonObject(), res));
19762      }
19763    };
19764    if (json.has("communication")) {
19765      JsonArray array = json.getAsJsonArray("communication");
19766      for (int i = 0; i < array.size(); i++) {
19767        res.getCommunication().add(parsePatientPatientCommunicationComponent(array.get(i).getAsJsonObject(), res));
19768      }
19769    };
19770    if (json.has("generalPractitioner")) {
19771      JsonArray array = json.getAsJsonArray("generalPractitioner");
19772      for (int i = 0; i < array.size(); i++) {
19773        res.getGeneralPractitioner().add(parseReference(array.get(i).getAsJsonObject()));
19774      }
19775    };
19776    if (json.has("managingOrganization"))
19777      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
19778    if (json.has("link")) {
19779      JsonArray array = json.getAsJsonArray("link");
19780      for (int i = 0; i < array.size(); i++) {
19781        res.getLink().add(parsePatientPatientLinkComponent(array.get(i).getAsJsonObject(), res));
19782      }
19783    };
19784  }
19785
19786  protected Patient.ContactComponent parsePatientContactComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
19787    Patient.ContactComponent res = new Patient.ContactComponent();
19788    parsePatientContactComponentProperties(json, owner, res);
19789    return res;
19790  }
19791
19792  protected void parsePatientContactComponentProperties(JsonObject json, Patient owner, Patient.ContactComponent res) throws IOException, FHIRFormatError {
19793    parseBackboneElementProperties(json, res);
19794    if (json.has("relationship")) {
19795      JsonArray array = json.getAsJsonArray("relationship");
19796      for (int i = 0; i < array.size(); i++) {
19797        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19798      }
19799    };
19800    if (json.has("name"))
19801      res.setName(parseHumanName(getJObject(json, "name")));
19802    if (json.has("telecom")) {
19803      JsonArray array = json.getAsJsonArray("telecom");
19804      for (int i = 0; i < array.size(); i++) {
19805        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
19806      }
19807    };
19808    if (json.has("address"))
19809      res.setAddress(parseAddress(getJObject(json, "address")));
19810    if (json.has("gender"))
19811      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
19812    if (json.has("_gender"))
19813      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
19814    if (json.has("organization"))
19815      res.setOrganization(parseReference(getJObject(json, "organization")));
19816    if (json.has("period"))
19817      res.setPeriod(parsePeriod(getJObject(json, "period")));
19818  }
19819
19820  protected Patient.PatientCommunicationComponent parsePatientPatientCommunicationComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
19821    Patient.PatientCommunicationComponent res = new Patient.PatientCommunicationComponent();
19822    parsePatientPatientCommunicationComponentProperties(json, owner, res);
19823    return res;
19824  }
19825
19826  protected void parsePatientPatientCommunicationComponentProperties(JsonObject json, Patient owner, Patient.PatientCommunicationComponent res) throws IOException, FHIRFormatError {
19827    parseBackboneElementProperties(json, res);
19828    if (json.has("language"))
19829      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
19830    if (json.has("preferred"))
19831      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
19832    if (json.has("_preferred"))
19833      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
19834  }
19835
19836  protected Patient.PatientLinkComponent parsePatientPatientLinkComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
19837    Patient.PatientLinkComponent res = new Patient.PatientLinkComponent();
19838    parsePatientPatientLinkComponentProperties(json, owner, res);
19839    return res;
19840  }
19841
19842  protected void parsePatientPatientLinkComponentProperties(JsonObject json, Patient owner, Patient.PatientLinkComponent res) throws IOException, FHIRFormatError {
19843    parseBackboneElementProperties(json, res);
19844    if (json.has("other"))
19845      res.setOther(parseReference(getJObject(json, "other")));
19846    if (json.has("type"))
19847      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Patient.LinkType.NULL, new Patient.LinkTypeEnumFactory()));
19848    if (json.has("_type"))
19849      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
19850  }
19851
19852  protected PaymentNotice parsePaymentNotice(JsonObject json) throws IOException, FHIRFormatError {
19853    PaymentNotice res = new PaymentNotice();
19854    parsePaymentNoticeProperties(json, res);
19855    return res;
19856  }
19857
19858  protected void parsePaymentNoticeProperties(JsonObject json, PaymentNotice res) throws IOException, FHIRFormatError {
19859    parseDomainResourceProperties(json, res);
19860    if (json.has("identifier")) {
19861      JsonArray array = json.getAsJsonArray("identifier");
19862      for (int i = 0; i < array.size(); i++) {
19863        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19864      }
19865    };
19866    if (json.has("status"))
19867      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), PaymentNotice.PaymentNoticeStatus.NULL, new PaymentNotice.PaymentNoticeStatusEnumFactory()));
19868    if (json.has("_status"))
19869      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
19870    if (json.has("request"))
19871      res.setRequest(parseReference(getJObject(json, "request")));
19872    if (json.has("response"))
19873      res.setResponse(parseReference(getJObject(json, "response")));
19874    if (json.has("created"))
19875      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
19876    if (json.has("_created"))
19877      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
19878    if (json.has("provider"))
19879      res.setProvider(parseReference(getJObject(json, "provider")));
19880    if (json.has("payment"))
19881      res.setPayment(parseReference(getJObject(json, "payment")));
19882    if (json.has("paymentDate"))
19883      res.setPaymentDateElement(parseDate(json.get("paymentDate").getAsString()));
19884    if (json.has("_paymentDate"))
19885      parseElementProperties(getJObject(json, "_paymentDate"), res.getPaymentDateElement());
19886    if (json.has("payee"))
19887      res.setPayee(parseReference(getJObject(json, "payee")));
19888    if (json.has("recipient"))
19889      res.setRecipient(parseReference(getJObject(json, "recipient")));
19890    if (json.has("amount"))
19891      res.setAmount(parseMoney(getJObject(json, "amount")));
19892    if (json.has("paymentStatus"))
19893      res.setPaymentStatus(parseCodeableConcept(getJObject(json, "paymentStatus")));
19894  }
19895
19896  protected PaymentReconciliation parsePaymentReconciliation(JsonObject json) throws IOException, FHIRFormatError {
19897    PaymentReconciliation res = new PaymentReconciliation();
19898    parsePaymentReconciliationProperties(json, res);
19899    return res;
19900  }
19901
19902  protected void parsePaymentReconciliationProperties(JsonObject json, PaymentReconciliation res) throws IOException, FHIRFormatError {
19903    parseDomainResourceProperties(json, res);
19904    if (json.has("identifier")) {
19905      JsonArray array = json.getAsJsonArray("identifier");
19906      for (int i = 0; i < array.size(); i++) {
19907        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19908      }
19909    };
19910    if (json.has("status"))
19911      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), PaymentReconciliation.PaymentReconciliationStatus.NULL, new PaymentReconciliation.PaymentReconciliationStatusEnumFactory()));
19912    if (json.has("_status"))
19913      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
19914    if (json.has("period"))
19915      res.setPeriod(parsePeriod(getJObject(json, "period")));
19916    if (json.has("created"))
19917      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
19918    if (json.has("_created"))
19919      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
19920    if (json.has("paymentIssuer"))
19921      res.setPaymentIssuer(parseReference(getJObject(json, "paymentIssuer")));
19922    if (json.has("request"))
19923      res.setRequest(parseReference(getJObject(json, "request")));
19924    if (json.has("requestor"))
19925      res.setRequestor(parseReference(getJObject(json, "requestor")));
19926    if (json.has("outcome"))
19927      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
19928    if (json.has("_outcome"))
19929      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
19930    if (json.has("disposition"))
19931      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
19932    if (json.has("_disposition"))
19933      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
19934    if (json.has("paymentDate"))
19935      res.setPaymentDateElement(parseDate(json.get("paymentDate").getAsString()));
19936    if (json.has("_paymentDate"))
19937      parseElementProperties(getJObject(json, "_paymentDate"), res.getPaymentDateElement());
19938    if (json.has("paymentAmount"))
19939      res.setPaymentAmount(parseMoney(getJObject(json, "paymentAmount")));
19940    if (json.has("paymentIdentifier"))
19941      res.setPaymentIdentifier(parseIdentifier(getJObject(json, "paymentIdentifier")));
19942    if (json.has("detail")) {
19943      JsonArray array = json.getAsJsonArray("detail");
19944      for (int i = 0; i < array.size(); i++) {
19945        res.getDetail().add(parsePaymentReconciliationDetailsComponent(array.get(i).getAsJsonObject(), res));
19946      }
19947    };
19948    if (json.has("formCode"))
19949      res.setFormCode(parseCodeableConcept(getJObject(json, "formCode")));
19950    if (json.has("processNote")) {
19951      JsonArray array = json.getAsJsonArray("processNote");
19952      for (int i = 0; i < array.size(); i++) {
19953        res.getProcessNote().add(parsePaymentReconciliationNotesComponent(array.get(i).getAsJsonObject(), res));
19954      }
19955    };
19956  }
19957
19958  protected PaymentReconciliation.DetailsComponent parsePaymentReconciliationDetailsComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
19959    PaymentReconciliation.DetailsComponent res = new PaymentReconciliation.DetailsComponent();
19960    parsePaymentReconciliationDetailsComponentProperties(json, owner, res);
19961    return res;
19962  }
19963
19964  protected void parsePaymentReconciliationDetailsComponentProperties(JsonObject json, PaymentReconciliation owner, PaymentReconciliation.DetailsComponent res) throws IOException, FHIRFormatError {
19965    parseBackboneElementProperties(json, res);
19966    if (json.has("identifier"))
19967      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
19968    if (json.has("predecessor"))
19969      res.setPredecessor(parseIdentifier(getJObject(json, "predecessor")));
19970    if (json.has("type"))
19971      res.setType(parseCodeableConcept(getJObject(json, "type")));
19972    if (json.has("request"))
19973      res.setRequest(parseReference(getJObject(json, "request")));
19974    if (json.has("submitter"))
19975      res.setSubmitter(parseReference(getJObject(json, "submitter")));
19976    if (json.has("response"))
19977      res.setResponse(parseReference(getJObject(json, "response")));
19978    if (json.has("date"))
19979      res.setDateElement(parseDate(json.get("date").getAsString()));
19980    if (json.has("_date"))
19981      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
19982    if (json.has("responsible"))
19983      res.setResponsible(parseReference(getJObject(json, "responsible")));
19984    if (json.has("payee"))
19985      res.setPayee(parseReference(getJObject(json, "payee")));
19986    if (json.has("amount"))
19987      res.setAmount(parseMoney(getJObject(json, "amount")));
19988  }
19989
19990  protected PaymentReconciliation.NotesComponent parsePaymentReconciliationNotesComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
19991    PaymentReconciliation.NotesComponent res = new PaymentReconciliation.NotesComponent();
19992    parsePaymentReconciliationNotesComponentProperties(json, owner, res);
19993    return res;
19994  }
19995
19996  protected void parsePaymentReconciliationNotesComponentProperties(JsonObject json, PaymentReconciliation owner, PaymentReconciliation.NotesComponent res) throws IOException, FHIRFormatError {
19997    parseBackboneElementProperties(json, res);
19998    if (json.has("type"))
19999      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
20000    if (json.has("_type"))
20001      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
20002    if (json.has("text"))
20003      res.setTextElement(parseString(json.get("text").getAsString()));
20004    if (json.has("_text"))
20005      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
20006  }
20007
20008  protected Person parsePerson(JsonObject json) throws IOException, FHIRFormatError {
20009    Person res = new Person();
20010    parsePersonProperties(json, res);
20011    return res;
20012  }
20013
20014  protected void parsePersonProperties(JsonObject json, Person res) throws IOException, FHIRFormatError {
20015    parseDomainResourceProperties(json, res);
20016    if (json.has("identifier")) {
20017      JsonArray array = json.getAsJsonArray("identifier");
20018      for (int i = 0; i < array.size(); i++) {
20019        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20020      }
20021    };
20022    if (json.has("name")) {
20023      JsonArray array = json.getAsJsonArray("name");
20024      for (int i = 0; i < array.size(); i++) {
20025        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
20026      }
20027    };
20028    if (json.has("telecom")) {
20029      JsonArray array = json.getAsJsonArray("telecom");
20030      for (int i = 0; i < array.size(); i++) {
20031        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20032      }
20033    };
20034    if (json.has("gender"))
20035      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
20036    if (json.has("_gender"))
20037      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
20038    if (json.has("birthDate"))
20039      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
20040    if (json.has("_birthDate"))
20041      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
20042    if (json.has("address")) {
20043      JsonArray array = json.getAsJsonArray("address");
20044      for (int i = 0; i < array.size(); i++) {
20045        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
20046      }
20047    };
20048    if (json.has("photo"))
20049      res.setPhoto(parseAttachment(getJObject(json, "photo")));
20050    if (json.has("managingOrganization"))
20051      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
20052    if (json.has("active"))
20053      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20054    if (json.has("_active"))
20055      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
20056    if (json.has("link")) {
20057      JsonArray array = json.getAsJsonArray("link");
20058      for (int i = 0; i < array.size(); i++) {
20059        res.getLink().add(parsePersonPersonLinkComponent(array.get(i).getAsJsonObject(), res));
20060      }
20061    };
20062  }
20063
20064  protected Person.PersonLinkComponent parsePersonPersonLinkComponent(JsonObject json, Person owner) throws IOException, FHIRFormatError {
20065    Person.PersonLinkComponent res = new Person.PersonLinkComponent();
20066    parsePersonPersonLinkComponentProperties(json, owner, res);
20067    return res;
20068  }
20069
20070  protected void parsePersonPersonLinkComponentProperties(JsonObject json, Person owner, Person.PersonLinkComponent res) throws IOException, FHIRFormatError {
20071    parseBackboneElementProperties(json, res);
20072    if (json.has("target"))
20073      res.setTarget(parseReference(getJObject(json, "target")));
20074    if (json.has("assurance"))
20075      res.setAssuranceElement(parseEnumeration(json.get("assurance").getAsString(), Person.IdentityAssuranceLevel.NULL, new Person.IdentityAssuranceLevelEnumFactory()));
20076    if (json.has("_assurance"))
20077      parseElementProperties(getJObject(json, "_assurance"), res.getAssuranceElement());
20078  }
20079
20080  protected PlanDefinition parsePlanDefinition(JsonObject json) throws IOException, FHIRFormatError {
20081    PlanDefinition res = new PlanDefinition();
20082    parsePlanDefinitionProperties(json, res);
20083    return res;
20084  }
20085
20086  protected void parsePlanDefinitionProperties(JsonObject json, PlanDefinition res) throws IOException, FHIRFormatError {
20087    parseDomainResourceProperties(json, res);
20088    if (json.has("url"))
20089      res.setUrlElement(parseUri(json.get("url").getAsString()));
20090    if (json.has("_url"))
20091      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
20092    if (json.has("identifier")) {
20093      JsonArray array = json.getAsJsonArray("identifier");
20094      for (int i = 0; i < array.size(); i++) {
20095        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20096      }
20097    };
20098    if (json.has("version"))
20099      res.setVersionElement(parseString(json.get("version").getAsString()));
20100    if (json.has("_version"))
20101      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
20102    if (json.has("name"))
20103      res.setNameElement(parseString(json.get("name").getAsString()));
20104    if (json.has("_name"))
20105      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
20106    if (json.has("title"))
20107      res.setTitleElement(parseString(json.get("title").getAsString()));
20108    if (json.has("_title"))
20109      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
20110    if (json.has("subtitle"))
20111      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
20112    if (json.has("_subtitle"))
20113      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
20114    if (json.has("type"))
20115      res.setType(parseCodeableConcept(getJObject(json, "type")));
20116    if (json.has("status"))
20117      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
20118    if (json.has("_status"))
20119      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
20120    if (json.has("experimental"))
20121      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
20122    if (json.has("_experimental"))
20123      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
20124    Type subject = parseType("subject", json);
20125    if (subject != null)
20126      res.setSubject(subject);
20127    if (json.has("date"))
20128      res.setDateElement(parseDateTime(json.get("date").getAsString()));
20129    if (json.has("_date"))
20130      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
20131    if (json.has("publisher"))
20132      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
20133    if (json.has("_publisher"))
20134      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
20135    if (json.has("contact")) {
20136      JsonArray array = json.getAsJsonArray("contact");
20137      for (int i = 0; i < array.size(); i++) {
20138        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
20139      }
20140    };
20141    if (json.has("description"))
20142      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
20143    if (json.has("_description"))
20144      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
20145    if (json.has("useContext")) {
20146      JsonArray array = json.getAsJsonArray("useContext");
20147      for (int i = 0; i < array.size(); i++) {
20148        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
20149      }
20150    };
20151    if (json.has("jurisdiction")) {
20152      JsonArray array = json.getAsJsonArray("jurisdiction");
20153      for (int i = 0; i < array.size(); i++) {
20154        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20155      }
20156    };
20157    if (json.has("purpose"))
20158      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
20159    if (json.has("_purpose"))
20160      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
20161    if (json.has("usage"))
20162      res.setUsageElement(parseString(json.get("usage").getAsString()));
20163    if (json.has("_usage"))
20164      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
20165    if (json.has("copyright"))
20166      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
20167    if (json.has("_copyright"))
20168      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
20169    if (json.has("approvalDate"))
20170      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
20171    if (json.has("_approvalDate"))
20172      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
20173    if (json.has("lastReviewDate"))
20174      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
20175    if (json.has("_lastReviewDate"))
20176      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
20177    if (json.has("effectivePeriod"))
20178      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
20179    if (json.has("topic")) {
20180      JsonArray array = json.getAsJsonArray("topic");
20181      for (int i = 0; i < array.size(); i++) {
20182        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20183      }
20184    };
20185    if (json.has("author")) {
20186      JsonArray array = json.getAsJsonArray("author");
20187      for (int i = 0; i < array.size(); i++) {
20188        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
20189      }
20190    };
20191    if (json.has("editor")) {
20192      JsonArray array = json.getAsJsonArray("editor");
20193      for (int i = 0; i < array.size(); i++) {
20194        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
20195      }
20196    };
20197    if (json.has("reviewer")) {
20198      JsonArray array = json.getAsJsonArray("reviewer");
20199      for (int i = 0; i < array.size(); i++) {
20200        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
20201      }
20202    };
20203    if (json.has("endorser")) {
20204      JsonArray array = json.getAsJsonArray("endorser");
20205      for (int i = 0; i < array.size(); i++) {
20206        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
20207      }
20208    };
20209    if (json.has("relatedArtifact")) {
20210      JsonArray array = json.getAsJsonArray("relatedArtifact");
20211      for (int i = 0; i < array.size(); i++) {
20212        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
20213      }
20214    };
20215    if (json.has("library")) {
20216      JsonArray array = json.getAsJsonArray("library");
20217      for (int i = 0; i < array.size(); i++) {
20218        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
20219      }
20220    };
20221    if (json.has("_library")) {
20222      JsonArray array = json.getAsJsonArray("_library");
20223      for (int i = 0; i < array.size(); i++) {
20224        if (i == res.getLibrary().size())
20225          res.getLibrary().add(parseCanonical(null));
20226        if (array.get(i) instanceof JsonObject) 
20227          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
20228      }
20229    };
20230    if (json.has("goal")) {
20231      JsonArray array = json.getAsJsonArray("goal");
20232      for (int i = 0; i < array.size(); i++) {
20233        res.getGoal().add(parsePlanDefinitionPlanDefinitionGoalComponent(array.get(i).getAsJsonObject(), res));
20234      }
20235    };
20236    if (json.has("action")) {
20237      JsonArray array = json.getAsJsonArray("action");
20238      for (int i = 0; i < array.size(); i++) {
20239        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), res));
20240      }
20241    };
20242  }
20243
20244  protected PlanDefinition.PlanDefinitionGoalComponent parsePlanDefinitionPlanDefinitionGoalComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20245    PlanDefinition.PlanDefinitionGoalComponent res = new PlanDefinition.PlanDefinitionGoalComponent();
20246    parsePlanDefinitionPlanDefinitionGoalComponentProperties(json, owner, res);
20247    return res;
20248  }
20249
20250  protected void parsePlanDefinitionPlanDefinitionGoalComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalComponent res) throws IOException, FHIRFormatError {
20251    parseBackboneElementProperties(json, res);
20252    if (json.has("category"))
20253      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
20254    if (json.has("description"))
20255      res.setDescription(parseCodeableConcept(getJObject(json, "description")));
20256    if (json.has("priority"))
20257      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
20258    if (json.has("start"))
20259      res.setStart(parseCodeableConcept(getJObject(json, "start")));
20260    if (json.has("addresses")) {
20261      JsonArray array = json.getAsJsonArray("addresses");
20262      for (int i = 0; i < array.size(); i++) {
20263        res.getAddresses().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20264      }
20265    };
20266    if (json.has("documentation")) {
20267      JsonArray array = json.getAsJsonArray("documentation");
20268      for (int i = 0; i < array.size(); i++) {
20269        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
20270      }
20271    };
20272    if (json.has("target")) {
20273      JsonArray array = json.getAsJsonArray("target");
20274      for (int i = 0; i < array.size(); i++) {
20275        res.getTarget().add(parsePlanDefinitionPlanDefinitionGoalTargetComponent(array.get(i).getAsJsonObject(), owner));
20276      }
20277    };
20278  }
20279
20280  protected PlanDefinition.PlanDefinitionGoalTargetComponent parsePlanDefinitionPlanDefinitionGoalTargetComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20281    PlanDefinition.PlanDefinitionGoalTargetComponent res = new PlanDefinition.PlanDefinitionGoalTargetComponent();
20282    parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(json, owner, res);
20283    return res;
20284  }
20285
20286  protected void parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalTargetComponent res) throws IOException, FHIRFormatError {
20287    parseBackboneElementProperties(json, res);
20288    if (json.has("measure"))
20289      res.setMeasure(parseCodeableConcept(getJObject(json, "measure")));
20290    Type detail = parseType("detail", json);
20291    if (detail != null)
20292      res.setDetail(detail);
20293    if (json.has("due"))
20294      res.setDue(parseDuration(getJObject(json, "due")));
20295  }
20296
20297  protected PlanDefinition.PlanDefinitionActionComponent parsePlanDefinitionPlanDefinitionActionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20298    PlanDefinition.PlanDefinitionActionComponent res = new PlanDefinition.PlanDefinitionActionComponent();
20299    parsePlanDefinitionPlanDefinitionActionComponentProperties(json, owner, res);
20300    return res;
20301  }
20302
20303  protected void parsePlanDefinitionPlanDefinitionActionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionComponent res) throws IOException, FHIRFormatError {
20304    parseBackboneElementProperties(json, res);
20305    if (json.has("prefix"))
20306      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
20307    if (json.has("_prefix"))
20308      parseElementProperties(getJObject(json, "_prefix"), res.getPrefixElement());
20309    if (json.has("title"))
20310      res.setTitleElement(parseString(json.get("title").getAsString()));
20311    if (json.has("_title"))
20312      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
20313    if (json.has("description"))
20314      res.setDescriptionElement(parseString(json.get("description").getAsString()));
20315    if (json.has("_description"))
20316      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
20317    if (json.has("textEquivalent"))
20318      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
20319    if (json.has("_textEquivalent"))
20320      parseElementProperties(getJObject(json, "_textEquivalent"), res.getTextEquivalentElement());
20321    if (json.has("priority"))
20322      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), PlanDefinition.RequestPriority.NULL, new PlanDefinition.RequestPriorityEnumFactory()));
20323    if (json.has("_priority"))
20324      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
20325    if (json.has("code")) {
20326      JsonArray array = json.getAsJsonArray("code");
20327      for (int i = 0; i < array.size(); i++) {
20328        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20329      }
20330    };
20331    if (json.has("reason")) {
20332      JsonArray array = json.getAsJsonArray("reason");
20333      for (int i = 0; i < array.size(); i++) {
20334        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20335      }
20336    };
20337    if (json.has("documentation")) {
20338      JsonArray array = json.getAsJsonArray("documentation");
20339      for (int i = 0; i < array.size(); i++) {
20340        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
20341      }
20342    };
20343    if (json.has("goalId")) {
20344      JsonArray array = json.getAsJsonArray("goalId");
20345      for (int i = 0; i < array.size(); i++) {
20346        res.getGoalId().add(parseId(array.get(i).getAsString()));
20347      }
20348    };
20349    if (json.has("_goalId")) {
20350      JsonArray array = json.getAsJsonArray("_goalId");
20351      for (int i = 0; i < array.size(); i++) {
20352        if (i == res.getGoalId().size())
20353          res.getGoalId().add(parseId(null));
20354        if (array.get(i) instanceof JsonObject) 
20355          parseElementProperties(array.get(i).getAsJsonObject(), res.getGoalId().get(i));
20356      }
20357    };
20358    Type subject = parseType("subject", json);
20359    if (subject != null)
20360      res.setSubject(subject);
20361    if (json.has("trigger")) {
20362      JsonArray array = json.getAsJsonArray("trigger");
20363      for (int i = 0; i < array.size(); i++) {
20364        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
20365      }
20366    };
20367    if (json.has("condition")) {
20368      JsonArray array = json.getAsJsonArray("condition");
20369      for (int i = 0; i < array.size(); i++) {
20370        res.getCondition().add(parsePlanDefinitionPlanDefinitionActionConditionComponent(array.get(i).getAsJsonObject(), owner));
20371      }
20372    };
20373    if (json.has("input")) {
20374      JsonArray array = json.getAsJsonArray("input");
20375      for (int i = 0; i < array.size(); i++) {
20376        res.getInput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
20377      }
20378    };
20379    if (json.has("output")) {
20380      JsonArray array = json.getAsJsonArray("output");
20381      for (int i = 0; i < array.size(); i++) {
20382        res.getOutput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
20383      }
20384    };
20385    if (json.has("relatedAction")) {
20386      JsonArray array = json.getAsJsonArray("relatedAction");
20387      for (int i = 0; i < array.size(); i++) {
20388        res.getRelatedAction().add(parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
20389      }
20390    };
20391    Type timing = parseType("timing", json);
20392    if (timing != null)
20393      res.setTiming(timing);
20394    if (json.has("participant")) {
20395      JsonArray array = json.getAsJsonArray("participant");
20396      for (int i = 0; i < array.size(); i++) {
20397        res.getParticipant().add(parsePlanDefinitionPlanDefinitionActionParticipantComponent(array.get(i).getAsJsonObject(), owner));
20398      }
20399    };
20400    if (json.has("type"))
20401      res.setType(parseCodeableConcept(getJObject(json, "type")));
20402    if (json.has("groupingBehavior"))
20403      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), PlanDefinition.ActionGroupingBehavior.NULL, new PlanDefinition.ActionGroupingBehaviorEnumFactory()));
20404    if (json.has("_groupingBehavior"))
20405      parseElementProperties(getJObject(json, "_groupingBehavior"), res.getGroupingBehaviorElement());
20406    if (json.has("selectionBehavior"))
20407      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), PlanDefinition.ActionSelectionBehavior.NULL, new PlanDefinition.ActionSelectionBehaviorEnumFactory()));
20408    if (json.has("_selectionBehavior"))
20409      parseElementProperties(getJObject(json, "_selectionBehavior"), res.getSelectionBehaviorElement());
20410    if (json.has("requiredBehavior"))
20411      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), PlanDefinition.ActionRequiredBehavior.NULL, new PlanDefinition.ActionRequiredBehaviorEnumFactory()));
20412    if (json.has("_requiredBehavior"))
20413      parseElementProperties(getJObject(json, "_requiredBehavior"), res.getRequiredBehaviorElement());
20414    if (json.has("precheckBehavior"))
20415      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), PlanDefinition.ActionPrecheckBehavior.NULL, new PlanDefinition.ActionPrecheckBehaviorEnumFactory()));
20416    if (json.has("_precheckBehavior"))
20417      parseElementProperties(getJObject(json, "_precheckBehavior"), res.getPrecheckBehaviorElement());
20418    if (json.has("cardinalityBehavior"))
20419      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), PlanDefinition.ActionCardinalityBehavior.NULL, new PlanDefinition.ActionCardinalityBehaviorEnumFactory()));
20420    if (json.has("_cardinalityBehavior"))
20421      parseElementProperties(getJObject(json, "_cardinalityBehavior"), res.getCardinalityBehaviorElement());
20422    Type definition = parseType("definition", json);
20423    if (definition != null)
20424      res.setDefinition(definition);
20425    if (json.has("transform"))
20426      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
20427    if (json.has("_transform"))
20428      parseElementProperties(getJObject(json, "_transform"), res.getTransformElement());
20429    if (json.has("dynamicValue")) {
20430      JsonArray array = json.getAsJsonArray("dynamicValue");
20431      for (int i = 0; i < array.size(); i++) {
20432        res.getDynamicValue().add(parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(array.get(i).getAsJsonObject(), owner));
20433      }
20434    };
20435    if (json.has("action")) {
20436      JsonArray array = json.getAsJsonArray("action");
20437      for (int i = 0; i < array.size(); i++) {
20438        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), owner));
20439      }
20440    };
20441  }
20442
20443  protected PlanDefinition.PlanDefinitionActionConditionComponent parsePlanDefinitionPlanDefinitionActionConditionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20444    PlanDefinition.PlanDefinitionActionConditionComponent res = new PlanDefinition.PlanDefinitionActionConditionComponent();
20445    parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(json, owner, res);
20446    return res;
20447  }
20448
20449  protected void parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionConditionComponent res) throws IOException, FHIRFormatError {
20450    parseBackboneElementProperties(json, res);
20451    if (json.has("kind"))
20452      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), PlanDefinition.ActionConditionKind.NULL, new PlanDefinition.ActionConditionKindEnumFactory()));
20453    if (json.has("_kind"))
20454      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
20455    if (json.has("expression"))
20456      res.setExpression(parseExpression(getJObject(json, "expression")));
20457  }
20458
20459  protected PlanDefinition.PlanDefinitionActionRelatedActionComponent parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20460    PlanDefinition.PlanDefinitionActionRelatedActionComponent res = new PlanDefinition.PlanDefinitionActionRelatedActionComponent();
20461    parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(json, owner, res);
20462    return res;
20463  }
20464
20465  protected void parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionRelatedActionComponent res) throws IOException, FHIRFormatError {
20466    parseBackboneElementProperties(json, res);
20467    if (json.has("actionId"))
20468      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
20469    if (json.has("_actionId"))
20470      parseElementProperties(getJObject(json, "_actionId"), res.getActionIdElement());
20471    if (json.has("relationship"))
20472      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), PlanDefinition.ActionRelationshipType.NULL, new PlanDefinition.ActionRelationshipTypeEnumFactory()));
20473    if (json.has("_relationship"))
20474      parseElementProperties(getJObject(json, "_relationship"), res.getRelationshipElement());
20475    Type offset = parseType("offset", json);
20476    if (offset != null)
20477      res.setOffset(offset);
20478  }
20479
20480  protected PlanDefinition.PlanDefinitionActionParticipantComponent parsePlanDefinitionPlanDefinitionActionParticipantComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20481    PlanDefinition.PlanDefinitionActionParticipantComponent res = new PlanDefinition.PlanDefinitionActionParticipantComponent();
20482    parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(json, owner, res);
20483    return res;
20484  }
20485
20486  protected void parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionParticipantComponent res) throws IOException, FHIRFormatError {
20487    parseBackboneElementProperties(json, res);
20488    if (json.has("type"))
20489      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), PlanDefinition.ActionParticipantType.NULL, new PlanDefinition.ActionParticipantTypeEnumFactory()));
20490    if (json.has("_type"))
20491      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
20492    if (json.has("role"))
20493      res.setRole(parseCodeableConcept(getJObject(json, "role")));
20494  }
20495
20496  protected PlanDefinition.PlanDefinitionActionDynamicValueComponent parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20497    PlanDefinition.PlanDefinitionActionDynamicValueComponent res = new PlanDefinition.PlanDefinitionActionDynamicValueComponent();
20498    parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(json, owner, res);
20499    return res;
20500  }
20501
20502  protected void parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionDynamicValueComponent res) throws IOException, FHIRFormatError {
20503    parseBackboneElementProperties(json, res);
20504    if (json.has("path"))
20505      res.setPathElement(parseString(json.get("path").getAsString()));
20506    if (json.has("_path"))
20507      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
20508    if (json.has("expression"))
20509      res.setExpression(parseExpression(getJObject(json, "expression")));
20510  }
20511
20512  protected Practitioner parsePractitioner(JsonObject json) throws IOException, FHIRFormatError {
20513    Practitioner res = new Practitioner();
20514    parsePractitionerProperties(json, res);
20515    return res;
20516  }
20517
20518  protected void parsePractitionerProperties(JsonObject json, Practitioner res) throws IOException, FHIRFormatError {
20519    parseDomainResourceProperties(json, res);
20520    if (json.has("identifier")) {
20521      JsonArray array = json.getAsJsonArray("identifier");
20522      for (int i = 0; i < array.size(); i++) {
20523        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20524      }
20525    };
20526    if (json.has("active"))
20527      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20528    if (json.has("_active"))
20529      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
20530    if (json.has("name")) {
20531      JsonArray array = json.getAsJsonArray("name");
20532      for (int i = 0; i < array.size(); i++) {
20533        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
20534      }
20535    };
20536    if (json.has("telecom")) {
20537      JsonArray array = json.getAsJsonArray("telecom");
20538      for (int i = 0; i < array.size(); i++) {
20539        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20540      }
20541    };
20542    if (json.has("address")) {
20543      JsonArray array = json.getAsJsonArray("address");
20544      for (int i = 0; i < array.size(); i++) {
20545        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
20546      }
20547    };
20548    if (json.has("gender"))
20549      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
20550    if (json.has("_gender"))
20551      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
20552    if (json.has("birthDate"))
20553      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
20554    if (json.has("_birthDate"))
20555      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
20556    if (json.has("photo")) {
20557      JsonArray array = json.getAsJsonArray("photo");
20558      for (int i = 0; i < array.size(); i++) {
20559        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
20560      }
20561    };
20562    if (json.has("qualification")) {
20563      JsonArray array = json.getAsJsonArray("qualification");
20564      for (int i = 0; i < array.size(); i++) {
20565        res.getQualification().add(parsePractitionerPractitionerQualificationComponent(array.get(i).getAsJsonObject(), res));
20566      }
20567    };
20568    if (json.has("communication")) {
20569      JsonArray array = json.getAsJsonArray("communication");
20570      for (int i = 0; i < array.size(); i++) {
20571        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20572      }
20573    };
20574  }
20575
20576  protected Practitioner.PractitionerQualificationComponent parsePractitionerPractitionerQualificationComponent(JsonObject json, Practitioner owner) throws IOException, FHIRFormatError {
20577    Practitioner.PractitionerQualificationComponent res = new Practitioner.PractitionerQualificationComponent();
20578    parsePractitionerPractitionerQualificationComponentProperties(json, owner, res);
20579    return res;
20580  }
20581
20582  protected void parsePractitionerPractitionerQualificationComponentProperties(JsonObject json, Practitioner owner, Practitioner.PractitionerQualificationComponent res) throws IOException, FHIRFormatError {
20583    parseBackboneElementProperties(json, res);
20584    if (json.has("identifier")) {
20585      JsonArray array = json.getAsJsonArray("identifier");
20586      for (int i = 0; i < array.size(); i++) {
20587        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20588      }
20589    };
20590    if (json.has("code"))
20591      res.setCode(parseCodeableConcept(getJObject(json, "code")));
20592    if (json.has("period"))
20593      res.setPeriod(parsePeriod(getJObject(json, "period")));
20594    if (json.has("issuer"))
20595      res.setIssuer(parseReference(getJObject(json, "issuer")));
20596  }
20597
20598  protected PractitionerRole parsePractitionerRole(JsonObject json) throws IOException, FHIRFormatError {
20599    PractitionerRole res = new PractitionerRole();
20600    parsePractitionerRoleProperties(json, res);
20601    return res;
20602  }
20603
20604  protected void parsePractitionerRoleProperties(JsonObject json, PractitionerRole res) throws IOException, FHIRFormatError {
20605    parseDomainResourceProperties(json, res);
20606    if (json.has("identifier")) {
20607      JsonArray array = json.getAsJsonArray("identifier");
20608      for (int i = 0; i < array.size(); i++) {
20609        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20610      }
20611    };
20612    if (json.has("active"))
20613      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20614    if (json.has("_active"))
20615      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
20616    if (json.has("period"))
20617      res.setPeriod(parsePeriod(getJObject(json, "period")));
20618    if (json.has("practitioner"))
20619      res.setPractitioner(parseReference(getJObject(json, "practitioner")));
20620    if (json.has("organization"))
20621      res.setOrganization(parseReference(getJObject(json, "organization")));
20622    if (json.has("code")) {
20623      JsonArray array = json.getAsJsonArray("code");
20624      for (int i = 0; i < array.size(); i++) {
20625        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20626      }
20627    };
20628    if (json.has("specialty")) {
20629      JsonArray array = json.getAsJsonArray("specialty");
20630      for (int i = 0; i < array.size(); i++) {
20631        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20632      }
20633    };
20634    if (json.has("location")) {
20635      JsonArray array = json.getAsJsonArray("location");
20636      for (int i = 0; i < array.size(); i++) {
20637        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
20638      }
20639    };
20640    if (json.has("healthcareService")) {
20641      JsonArray array = json.getAsJsonArray("healthcareService");
20642      for (int i = 0; i < array.size(); i++) {
20643        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
20644      }
20645    };
20646    if (json.has("telecom")) {
20647      JsonArray array = json.getAsJsonArray("telecom");
20648      for (int i = 0; i < array.size(); i++) {
20649        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20650      }
20651    };
20652    if (json.has("availableTime")) {
20653      JsonArray array = json.getAsJsonArray("availableTime");
20654      for (int i = 0; i < array.size(); i++) {
20655        res.getAvailableTime().add(parsePractitionerRolePractitionerRoleAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
20656      }
20657    };
20658    if (json.has("notAvailable")) {
20659      JsonArray array = json.getAsJsonArray("notAvailable");
20660      for (int i = 0; i < array.size(); i++) {
20661        res.getNotAvailable().add(parsePractitionerRolePractitionerRoleNotAvailableComponent(array.get(i).getAsJsonObject(), res));
20662      }
20663    };
20664    if (json.has("availabilityExceptions"))
20665      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
20666    if (json.has("_availabilityExceptions"))
20667      parseElementProperties(getJObject(json, "_availabilityExceptions"), res.getAvailabilityExceptionsElement());
20668    if (json.has("endpoint")) {
20669      JsonArray array = json.getAsJsonArray("endpoint");
20670      for (int i = 0; i < array.size(); i++) {
20671        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
20672      }
20673    };
20674  }
20675
20676  protected PractitionerRole.PractitionerRoleAvailableTimeComponent parsePractitionerRolePractitionerRoleAvailableTimeComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
20677    PractitionerRole.PractitionerRoleAvailableTimeComponent res = new PractitionerRole.PractitionerRoleAvailableTimeComponent();
20678    parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(json, owner, res);
20679    return res;
20680  }
20681
20682  protected void parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(JsonObject json, PractitionerRole owner, PractitionerRole.PractitionerRoleAvailableTimeComponent res) throws IOException, FHIRFormatError {
20683    parseBackboneElementProperties(json, res);
20684    if (json.has("daysOfWeek")) {
20685      JsonArray array = json.getAsJsonArray("daysOfWeek");
20686      for (int i = 0; i < array.size(); i++) {
20687        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
20688      }
20689    };
20690    if (json.has("_daysOfWeek")) {
20691      JsonArray array = json.getAsJsonArray("_daysOfWeek");
20692      for (int i = 0; i < array.size(); i++) {
20693        if (i == res.getDaysOfWeek().size())
20694          res.getDaysOfWeek().add(parseEnumeration(null, PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
20695        if (array.get(i) instanceof JsonObject) 
20696          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
20697      }
20698    };
20699    if (json.has("allDay"))
20700      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
20701    if (json.has("_allDay"))
20702      parseElementProperties(getJObject(json, "_allDay"), res.getAllDayElement());
20703    if (json.has("availableStartTime"))
20704      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
20705    if (json.has("_availableStartTime"))
20706      parseElementProperties(getJObject(json, "_availableStartTime"), res.getAvailableStartTimeElement());
20707    if (json.has("availableEndTime"))
20708      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
20709    if (json.has("_availableEndTime"))
20710      parseElementProperties(getJObject(json, "_availableEndTime"), res.getAvailableEndTimeElement());
20711  }
20712
20713  protected PractitionerRole.PractitionerRoleNotAvailableComponent parsePractitionerRolePractitionerRoleNotAvailableComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
20714    PractitionerRole.PractitionerRoleNotAvailableComponent res = new PractitionerRole.PractitionerRoleNotAvailableComponent();
20715    parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(json, owner, res);
20716    return res;
20717  }
20718
20719  protected void parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(JsonObject json, PractitionerRole owner, PractitionerRole.PractitionerRoleNotAvailableComponent res) throws IOException, FHIRFormatError {
20720    parseBackboneElementProperties(json, res);
20721    if (json.has("description"))
20722      res.setDescriptionElement(parseString(json.get("description").getAsString()));
20723    if (json.has("_description"))
20724      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
20725    if (json.has("during"))
20726      res.setDuring(parsePeriod(getJObject(json, "during")));
20727  }
20728
20729  protected Procedure parseProcedure(JsonObject json) throws IOException, FHIRFormatError {
20730    Procedure res = new Procedure();
20731    parseProcedureProperties(json, res);
20732    return res;
20733  }
20734
20735  protected void parseProcedureProperties(JsonObject json, Procedure res) throws IOException, FHIRFormatError {
20736    parseDomainResourceProperties(json, res);
20737    if (json.has("identifier")) {
20738      JsonArray array = json.getAsJsonArray("identifier");
20739      for (int i = 0; i < array.size(); i++) {
20740        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20741      }
20742    };
20743    if (json.has("instantiatesCanonical")) {
20744      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
20745      for (int i = 0; i < array.size(); i++) {
20746        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
20747      }
20748    };
20749    if (json.has("_instantiatesCanonical")) {
20750      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
20751      for (int i = 0; i < array.size(); i++) {
20752        if (i == res.getInstantiatesCanonical().size())
20753          res.getInstantiatesCanonical().add(parseCanonical(null));
20754        if (array.get(i) instanceof JsonObject) 
20755          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
20756      }
20757    };
20758    if (json.has("instantiatesUri")) {
20759      JsonArray array = json.getAsJsonArray("instantiatesUri");
20760      for (int i = 0; i < array.size(); i++) {
20761        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
20762      }
20763    };
20764    if (json.has("_instantiatesUri")) {
20765      JsonArray array = json.getAsJsonArray("_instantiatesUri");
20766      for (int i = 0; i < array.size(); i++) {
20767        if (i == res.getInstantiatesUri().size())
20768          res.getInstantiatesUri().add(parseUri(null));
20769        if (array.get(i) instanceof JsonObject) 
20770          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
20771      }
20772    };
20773    if (json.has("basedOn")) {
20774      JsonArray array = json.getAsJsonArray("basedOn");
20775      for (int i = 0; i < array.size(); i++) {
20776        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
20777      }
20778    };
20779    if (json.has("partOf")) {
20780      JsonArray array = json.getAsJsonArray("partOf");
20781      for (int i = 0; i < array.size(); i++) {
20782        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
20783      }
20784    };
20785    if (json.has("status"))
20786      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Procedure.ProcedureStatus.NULL, new Procedure.ProcedureStatusEnumFactory()));
20787    if (json.has("_status"))
20788      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
20789    if (json.has("statusReason"))
20790      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
20791    if (json.has("category"))
20792      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
20793    if (json.has("code"))
20794      res.setCode(parseCodeableConcept(getJObject(json, "code")));
20795    if (json.has("subject"))
20796      res.setSubject(parseReference(getJObject(json, "subject")));
20797    if (json.has("encounter"))
20798      res.setEncounter(parseReference(getJObject(json, "encounter")));
20799    Type performed = parseType("performed", json);
20800    if (performed != null)
20801      res.setPerformed(performed);
20802    if (json.has("recorder"))
20803      res.setRecorder(parseReference(getJObject(json, "recorder")));
20804    if (json.has("asserter"))
20805      res.setAsserter(parseReference(getJObject(json, "asserter")));
20806    if (json.has("performer")) {
20807      JsonArray array = json.getAsJsonArray("performer");
20808      for (int i = 0; i < array.size(); i++) {
20809        res.getPerformer().add(parseProcedureProcedurePerformerComponent(array.get(i).getAsJsonObject(), res));
20810      }
20811    };
20812    if (json.has("location"))
20813      res.setLocation(parseReference(getJObject(json, "location")));
20814    if (json.has("reasonCode")) {
20815      JsonArray array = json.getAsJsonArray("reasonCode");
20816      for (int i = 0; i < array.size(); i++) {
20817        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20818      }
20819    };
20820    if (json.has("reasonReference")) {
20821      JsonArray array = json.getAsJsonArray("reasonReference");
20822      for (int i = 0; i < array.size(); i++) {
20823        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
20824      }
20825    };
20826    if (json.has("bodySite")) {
20827      JsonArray array = json.getAsJsonArray("bodySite");
20828      for (int i = 0; i < array.size(); i++) {
20829        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20830      }
20831    };
20832    if (json.has("outcome"))
20833      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
20834    if (json.has("report")) {
20835      JsonArray array = json.getAsJsonArray("report");
20836      for (int i = 0; i < array.size(); i++) {
20837        res.getReport().add(parseReference(array.get(i).getAsJsonObject()));
20838      }
20839    };
20840    if (json.has("complication")) {
20841      JsonArray array = json.getAsJsonArray("complication");
20842      for (int i = 0; i < array.size(); i++) {
20843        res.getComplication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20844      }
20845    };
20846    if (json.has("complicationDetail")) {
20847      JsonArray array = json.getAsJsonArray("complicationDetail");
20848      for (int i = 0; i < array.size(); i++) {
20849        res.getComplicationDetail().add(parseReference(array.get(i).getAsJsonObject()));
20850      }
20851    };
20852    if (json.has("followUp")) {
20853      JsonArray array = json.getAsJsonArray("followUp");
20854      for (int i = 0; i < array.size(); i++) {
20855        res.getFollowUp().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20856      }
20857    };
20858    if (json.has("note")) {
20859      JsonArray array = json.getAsJsonArray("note");
20860      for (int i = 0; i < array.size(); i++) {
20861        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
20862      }
20863    };
20864    if (json.has("focalDevice")) {
20865      JsonArray array = json.getAsJsonArray("focalDevice");
20866      for (int i = 0; i < array.size(); i++) {
20867        res.getFocalDevice().add(parseProcedureProcedureFocalDeviceComponent(array.get(i).getAsJsonObject(), res));
20868      }
20869    };
20870    if (json.has("usedReference")) {
20871      JsonArray array = json.getAsJsonArray("usedReference");
20872      for (int i = 0; i < array.size(); i++) {
20873        res.getUsedReference().add(parseReference(array.get(i).getAsJsonObject()));
20874      }
20875    };
20876    if (json.has("usedCode")) {
20877      JsonArray array = json.getAsJsonArray("usedCode");
20878      for (int i = 0; i < array.size(); i++) {
20879        res.getUsedCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20880      }
20881    };
20882  }
20883
20884  protected Procedure.ProcedurePerformerComponent parseProcedureProcedurePerformerComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
20885    Procedure.ProcedurePerformerComponent res = new Procedure.ProcedurePerformerComponent();
20886    parseProcedureProcedurePerformerComponentProperties(json, owner, res);
20887    return res;
20888  }
20889
20890  protected void parseProcedureProcedurePerformerComponentProperties(JsonObject json, Procedure owner, Procedure.ProcedurePerformerComponent res) throws IOException, FHIRFormatError {
20891    parseBackboneElementProperties(json, res);
20892    if (json.has("function"))
20893      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
20894    if (json.has("actor"))
20895      res.setActor(parseReference(getJObject(json, "actor")));
20896    if (json.has("onBehalfOf"))
20897      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
20898  }
20899
20900  protected Procedure.ProcedureFocalDeviceComponent parseProcedureProcedureFocalDeviceComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
20901    Procedure.ProcedureFocalDeviceComponent res = new Procedure.ProcedureFocalDeviceComponent();
20902    parseProcedureProcedureFocalDeviceComponentProperties(json, owner, res);
20903    return res;
20904  }
20905
20906  protected void parseProcedureProcedureFocalDeviceComponentProperties(JsonObject json, Procedure owner, Procedure.ProcedureFocalDeviceComponent res) throws IOException, FHIRFormatError {
20907    parseBackboneElementProperties(json, res);
20908    if (json.has("action"))
20909      res.setAction(parseCodeableConcept(getJObject(json, "action")));
20910    if (json.has("manipulated"))
20911      res.setManipulated(parseReference(getJObject(json, "manipulated")));
20912  }
20913
20914  protected Provenance parseProvenance(JsonObject json) throws IOException, FHIRFormatError {
20915    Provenance res = new Provenance();
20916    parseProvenanceProperties(json, res);
20917    return res;
20918  }
20919
20920  protected void parseProvenanceProperties(JsonObject json, Provenance res) throws IOException, FHIRFormatError {
20921    parseDomainResourceProperties(json, res);
20922    if (json.has("target")) {
20923      JsonArray array = json.getAsJsonArray("target");
20924      for (int i = 0; i < array.size(); i++) {
20925        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
20926      }
20927    };
20928    Type occurred = parseType("occurred", json);
20929    if (occurred != null)
20930      res.setOccurred(occurred);
20931    if (json.has("recorded"))
20932      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
20933    if (json.has("_recorded"))
20934      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
20935    if (json.has("policy")) {
20936      JsonArray array = json.getAsJsonArray("policy");
20937      for (int i = 0; i < array.size(); i++) {
20938        res.getPolicy().add(parseUri(array.get(i).getAsString()));
20939      }
20940    };
20941    if (json.has("_policy")) {
20942      JsonArray array = json.getAsJsonArray("_policy");
20943      for (int i = 0; i < array.size(); i++) {
20944        if (i == res.getPolicy().size())
20945          res.getPolicy().add(parseUri(null));
20946        if (array.get(i) instanceof JsonObject) 
20947          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
20948      }
20949    };
20950    if (json.has("location"))
20951      res.setLocation(parseReference(getJObject(json, "location")));
20952    if (json.has("reason")) {
20953      JsonArray array = json.getAsJsonArray("reason");
20954      for (int i = 0; i < array.size(); i++) {
20955        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20956      }
20957    };
20958    if (json.has("activity"))
20959      res.setActivity(parseCodeableConcept(getJObject(json, "activity")));
20960    if (json.has("agent")) {
20961      JsonArray array = json.getAsJsonArray("agent");
20962      for (int i = 0; i < array.size(); i++) {
20963        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), res));
20964      }
20965    };
20966    if (json.has("entity")) {
20967      JsonArray array = json.getAsJsonArray("entity");
20968      for (int i = 0; i < array.size(); i++) {
20969        res.getEntity().add(parseProvenanceProvenanceEntityComponent(array.get(i).getAsJsonObject(), res));
20970      }
20971    };
20972    if (json.has("signature")) {
20973      JsonArray array = json.getAsJsonArray("signature");
20974      for (int i = 0; i < array.size(); i++) {
20975        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
20976      }
20977    };
20978  }
20979
20980  protected Provenance.ProvenanceAgentComponent parseProvenanceProvenanceAgentComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
20981    Provenance.ProvenanceAgentComponent res = new Provenance.ProvenanceAgentComponent();
20982    parseProvenanceProvenanceAgentComponentProperties(json, owner, res);
20983    return res;
20984  }
20985
20986  protected void parseProvenanceProvenanceAgentComponentProperties(JsonObject json, Provenance owner, Provenance.ProvenanceAgentComponent res) throws IOException, FHIRFormatError {
20987    parseBackboneElementProperties(json, res);
20988    if (json.has("type"))
20989      res.setType(parseCodeableConcept(getJObject(json, "type")));
20990    if (json.has("role")) {
20991      JsonArray array = json.getAsJsonArray("role");
20992      for (int i = 0; i < array.size(); i++) {
20993        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20994      }
20995    };
20996    if (json.has("who"))
20997      res.setWho(parseReference(getJObject(json, "who")));
20998    if (json.has("onBehalfOf"))
20999      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
21000  }
21001
21002  protected Provenance.ProvenanceEntityComponent parseProvenanceProvenanceEntityComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
21003    Provenance.ProvenanceEntityComponent res = new Provenance.ProvenanceEntityComponent();
21004    parseProvenanceProvenanceEntityComponentProperties(json, owner, res);
21005    return res;
21006  }
21007
21008  protected void parseProvenanceProvenanceEntityComponentProperties(JsonObject json, Provenance owner, Provenance.ProvenanceEntityComponent res) throws IOException, FHIRFormatError {
21009    parseBackboneElementProperties(json, res);
21010    if (json.has("role"))
21011      res.setRoleElement(parseEnumeration(json.get("role").getAsString(), Provenance.ProvenanceEntityRole.NULL, new Provenance.ProvenanceEntityRoleEnumFactory()));
21012    if (json.has("_role"))
21013      parseElementProperties(getJObject(json, "_role"), res.getRoleElement());
21014    if (json.has("what"))
21015      res.setWhat(parseReference(getJObject(json, "what")));
21016    if (json.has("agent")) {
21017      JsonArray array = json.getAsJsonArray("agent");
21018      for (int i = 0; i < array.size(); i++) {
21019        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), owner));
21020      }
21021    };
21022  }
21023
21024  protected Questionnaire parseQuestionnaire(JsonObject json) throws IOException, FHIRFormatError {
21025    Questionnaire res = new Questionnaire();
21026    parseQuestionnaireProperties(json, res);
21027    return res;
21028  }
21029
21030  protected void parseQuestionnaireProperties(JsonObject json, Questionnaire res) throws IOException, FHIRFormatError {
21031    parseDomainResourceProperties(json, res);
21032    if (json.has("url"))
21033      res.setUrlElement(parseUri(json.get("url").getAsString()));
21034    if (json.has("_url"))
21035      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
21036    if (json.has("identifier")) {
21037      JsonArray array = json.getAsJsonArray("identifier");
21038      for (int i = 0; i < array.size(); i++) {
21039        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21040      }
21041    };
21042    if (json.has("version"))
21043      res.setVersionElement(parseString(json.get("version").getAsString()));
21044    if (json.has("_version"))
21045      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
21046    if (json.has("name"))
21047      res.setNameElement(parseString(json.get("name").getAsString()));
21048    if (json.has("_name"))
21049      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
21050    if (json.has("title"))
21051      res.setTitleElement(parseString(json.get("title").getAsString()));
21052    if (json.has("_title"))
21053      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
21054    if (json.has("derivedFrom")) {
21055      JsonArray array = json.getAsJsonArray("derivedFrom");
21056      for (int i = 0; i < array.size(); i++) {
21057        res.getDerivedFrom().add(parseCanonical(array.get(i).getAsString()));
21058      }
21059    };
21060    if (json.has("_derivedFrom")) {
21061      JsonArray array = json.getAsJsonArray("_derivedFrom");
21062      for (int i = 0; i < array.size(); i++) {
21063        if (i == res.getDerivedFrom().size())
21064          res.getDerivedFrom().add(parseCanonical(null));
21065        if (array.get(i) instanceof JsonObject) 
21066          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFrom().get(i));
21067      }
21068    };
21069    if (json.has("status"))
21070      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
21071    if (json.has("_status"))
21072      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
21073    if (json.has("experimental"))
21074      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
21075    if (json.has("_experimental"))
21076      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
21077    if (json.has("subjectType")) {
21078      JsonArray array = json.getAsJsonArray("subjectType");
21079      for (int i = 0; i < array.size(); i++) {
21080        res.getSubjectType().add(parseCode(array.get(i).getAsString()));
21081      }
21082    };
21083    if (json.has("_subjectType")) {
21084      JsonArray array = json.getAsJsonArray("_subjectType");
21085      for (int i = 0; i < array.size(); i++) {
21086        if (i == res.getSubjectType().size())
21087          res.getSubjectType().add(parseCode(null));
21088        if (array.get(i) instanceof JsonObject) 
21089          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubjectType().get(i));
21090      }
21091    };
21092    if (json.has("date"))
21093      res.setDateElement(parseDateTime(json.get("date").getAsString()));
21094    if (json.has("_date"))
21095      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
21096    if (json.has("publisher"))
21097      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
21098    if (json.has("_publisher"))
21099      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
21100    if (json.has("contact")) {
21101      JsonArray array = json.getAsJsonArray("contact");
21102      for (int i = 0; i < array.size(); i++) {
21103        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
21104      }
21105    };
21106    if (json.has("description"))
21107      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
21108    if (json.has("_description"))
21109      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
21110    if (json.has("useContext")) {
21111      JsonArray array = json.getAsJsonArray("useContext");
21112      for (int i = 0; i < array.size(); i++) {
21113        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
21114      }
21115    };
21116    if (json.has("jurisdiction")) {
21117      JsonArray array = json.getAsJsonArray("jurisdiction");
21118      for (int i = 0; i < array.size(); i++) {
21119        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21120      }
21121    };
21122    if (json.has("purpose"))
21123      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
21124    if (json.has("_purpose"))
21125      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
21126    if (json.has("copyright"))
21127      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
21128    if (json.has("_copyright"))
21129      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
21130    if (json.has("approvalDate"))
21131      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
21132    if (json.has("_approvalDate"))
21133      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
21134    if (json.has("lastReviewDate"))
21135      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
21136    if (json.has("_lastReviewDate"))
21137      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
21138    if (json.has("effectivePeriod"))
21139      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
21140    if (json.has("code")) {
21141      JsonArray array = json.getAsJsonArray("code");
21142      for (int i = 0; i < array.size(); i++) {
21143        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
21144      }
21145    };
21146    if (json.has("item")) {
21147      JsonArray array = json.getAsJsonArray("item");
21148      for (int i = 0; i < array.size(); i++) {
21149        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), res));
21150      }
21151    };
21152  }
21153
21154  protected Questionnaire.QuestionnaireItemComponent parseQuestionnaireQuestionnaireItemComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
21155    Questionnaire.QuestionnaireItemComponent res = new Questionnaire.QuestionnaireItemComponent();
21156    parseQuestionnaireQuestionnaireItemComponentProperties(json, owner, res);
21157    return res;
21158  }
21159
21160  protected void parseQuestionnaireQuestionnaireItemComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemComponent res) throws IOException, FHIRFormatError {
21161    parseBackboneElementProperties(json, res);
21162    if (json.has("linkId"))
21163      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
21164    if (json.has("_linkId"))
21165      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
21166    if (json.has("definition"))
21167      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
21168    if (json.has("_definition"))
21169      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
21170    if (json.has("code")) {
21171      JsonArray array = json.getAsJsonArray("code");
21172      for (int i = 0; i < array.size(); i++) {
21173        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
21174      }
21175    };
21176    if (json.has("prefix"))
21177      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
21178    if (json.has("_prefix"))
21179      parseElementProperties(getJObject(json, "_prefix"), res.getPrefixElement());
21180    if (json.has("text"))
21181      res.setTextElement(parseString(json.get("text").getAsString()));
21182    if (json.has("_text"))
21183      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
21184    if (json.has("type"))
21185      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Questionnaire.QuestionnaireItemType.NULL, new Questionnaire.QuestionnaireItemTypeEnumFactory()));
21186    if (json.has("_type"))
21187      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
21188    if (json.has("enableWhen")) {
21189      JsonArray array = json.getAsJsonArray("enableWhen");
21190      for (int i = 0; i < array.size(); i++) {
21191        res.getEnableWhen().add(parseQuestionnaireQuestionnaireItemEnableWhenComponent(array.get(i).getAsJsonObject(), owner));
21192      }
21193    };
21194    if (json.has("enableBehavior"))
21195      res.setEnableBehaviorElement(parseEnumeration(json.get("enableBehavior").getAsString(), Questionnaire.EnableWhenBehavior.NULL, new Questionnaire.EnableWhenBehaviorEnumFactory()));
21196    if (json.has("_enableBehavior"))
21197      parseElementProperties(getJObject(json, "_enableBehavior"), res.getEnableBehaviorElement());
21198    if (json.has("required"))
21199      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
21200    if (json.has("_required"))
21201      parseElementProperties(getJObject(json, "_required"), res.getRequiredElement());
21202    if (json.has("repeats"))
21203      res.setRepeatsElement(parseBoolean(json.get("repeats").getAsBoolean()));
21204    if (json.has("_repeats"))
21205      parseElementProperties(getJObject(json, "_repeats"), res.getRepeatsElement());
21206    if (json.has("readOnly"))
21207      res.setReadOnlyElement(parseBoolean(json.get("readOnly").getAsBoolean()));
21208    if (json.has("_readOnly"))
21209      parseElementProperties(getJObject(json, "_readOnly"), res.getReadOnlyElement());
21210    if (json.has("maxLength"))
21211      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
21212    if (json.has("_maxLength"))
21213      parseElementProperties(getJObject(json, "_maxLength"), res.getMaxLengthElement());
21214    if (json.has("answerValueSet"))
21215      res.setAnswerValueSetElement(parseCanonical(json.get("answerValueSet").getAsString()));
21216    if (json.has("_answerValueSet"))
21217      parseElementProperties(getJObject(json, "_answerValueSet"), res.getAnswerValueSetElement());
21218    if (json.has("answerOption")) {
21219      JsonArray array = json.getAsJsonArray("answerOption");
21220      for (int i = 0; i < array.size(); i++) {
21221        res.getAnswerOption().add(parseQuestionnaireQuestionnaireItemAnswerOptionComponent(array.get(i).getAsJsonObject(), owner));
21222      }
21223    };
21224    if (json.has("initial")) {
21225      JsonArray array = json.getAsJsonArray("initial");
21226      for (int i = 0; i < array.size(); i++) {
21227        res.getInitial().add(parseQuestionnaireQuestionnaireItemInitialComponent(array.get(i).getAsJsonObject(), owner));
21228      }
21229    };
21230    if (json.has("item")) {
21231      JsonArray array = json.getAsJsonArray("item");
21232      for (int i = 0; i < array.size(); i++) {
21233        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), owner));
21234      }
21235    };
21236  }
21237
21238  protected Questionnaire.QuestionnaireItemEnableWhenComponent parseQuestionnaireQuestionnaireItemEnableWhenComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
21239    Questionnaire.QuestionnaireItemEnableWhenComponent res = new Questionnaire.QuestionnaireItemEnableWhenComponent();
21240    parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(json, owner, res);
21241    return res;
21242  }
21243
21244  protected void parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemEnableWhenComponent res) throws IOException, FHIRFormatError {
21245    parseBackboneElementProperties(json, res);
21246    if (json.has("question"))
21247      res.setQuestionElement(parseString(json.get("question").getAsString()));
21248    if (json.has("_question"))
21249      parseElementProperties(getJObject(json, "_question"), res.getQuestionElement());
21250    if (json.has("operator"))
21251      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), Questionnaire.QuestionnaireItemOperator.NULL, new Questionnaire.QuestionnaireItemOperatorEnumFactory()));
21252    if (json.has("_operator"))
21253      parseElementProperties(getJObject(json, "_operator"), res.getOperatorElement());
21254    Type answer = parseType("answer", json);
21255    if (answer != null)
21256      res.setAnswer(answer);
21257  }
21258
21259  protected Questionnaire.QuestionnaireItemAnswerOptionComponent parseQuestionnaireQuestionnaireItemAnswerOptionComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
21260    Questionnaire.QuestionnaireItemAnswerOptionComponent res = new Questionnaire.QuestionnaireItemAnswerOptionComponent();
21261    parseQuestionnaireQuestionnaireItemAnswerOptionComponentProperties(json, owner, res);
21262    return res;
21263  }
21264
21265  protected void parseQuestionnaireQuestionnaireItemAnswerOptionComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemAnswerOptionComponent res) throws IOException, FHIRFormatError {
21266    parseBackboneElementProperties(json, res);
21267    Type value = parseType("value", json);
21268    if (value != null)
21269      res.setValue(value);
21270    if (json.has("initialSelected"))
21271      res.setInitialSelectedElement(parseBoolean(json.get("initialSelected").getAsBoolean()));
21272    if (json.has("_initialSelected"))
21273      parseElementProperties(getJObject(json, "_initialSelected"), res.getInitialSelectedElement());
21274  }
21275
21276  protected Questionnaire.QuestionnaireItemInitialComponent parseQuestionnaireQuestionnaireItemInitialComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
21277    Questionnaire.QuestionnaireItemInitialComponent res = new Questionnaire.QuestionnaireItemInitialComponent();
21278    parseQuestionnaireQuestionnaireItemInitialComponentProperties(json, owner, res);
21279    return res;
21280  }
21281
21282  protected void parseQuestionnaireQuestionnaireItemInitialComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemInitialComponent res) throws IOException, FHIRFormatError {
21283    parseBackboneElementProperties(json, res);
21284    Type value = parseType("value", json);
21285    if (value != null)
21286      res.setValue(value);
21287  }
21288
21289  protected QuestionnaireResponse parseQuestionnaireResponse(JsonObject json) throws IOException, FHIRFormatError {
21290    QuestionnaireResponse res = new QuestionnaireResponse();
21291    parseQuestionnaireResponseProperties(json, res);
21292    return res;
21293  }
21294
21295  protected void parseQuestionnaireResponseProperties(JsonObject json, QuestionnaireResponse res) throws IOException, FHIRFormatError {
21296    parseDomainResourceProperties(json, res);
21297    if (json.has("identifier"))
21298      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
21299    if (json.has("basedOn")) {
21300      JsonArray array = json.getAsJsonArray("basedOn");
21301      for (int i = 0; i < array.size(); i++) {
21302        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
21303      }
21304    };
21305    if (json.has("partOf")) {
21306      JsonArray array = json.getAsJsonArray("partOf");
21307      for (int i = 0; i < array.size(); i++) {
21308        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
21309      }
21310    };
21311    if (json.has("questionnaire"))
21312      res.setQuestionnaireElement(parseCanonical(json.get("questionnaire").getAsString()));
21313    if (json.has("_questionnaire"))
21314      parseElementProperties(getJObject(json, "_questionnaire"), res.getQuestionnaireElement());
21315    if (json.has("status"))
21316      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), QuestionnaireResponse.QuestionnaireResponseStatus.NULL, new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory()));
21317    if (json.has("_status"))
21318      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
21319    if (json.has("subject"))
21320      res.setSubject(parseReference(getJObject(json, "subject")));
21321    if (json.has("encounter"))
21322      res.setEncounter(parseReference(getJObject(json, "encounter")));
21323    if (json.has("authored"))
21324      res.setAuthoredElement(parseDateTime(json.get("authored").getAsString()));
21325    if (json.has("_authored"))
21326      parseElementProperties(getJObject(json, "_authored"), res.getAuthoredElement());
21327    if (json.has("author"))
21328      res.setAuthor(parseReference(getJObject(json, "author")));
21329    if (json.has("source"))
21330      res.setSource(parseReference(getJObject(json, "source")));
21331    if (json.has("item")) {
21332      JsonArray array = json.getAsJsonArray("item");
21333      for (int i = 0; i < array.size(); i++) {
21334        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), res));
21335      }
21336    };
21337  }
21338
21339  protected QuestionnaireResponse.QuestionnaireResponseItemComponent parseQuestionnaireResponseQuestionnaireResponseItemComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
21340    QuestionnaireResponse.QuestionnaireResponseItemComponent res = new QuestionnaireResponse.QuestionnaireResponseItemComponent();
21341    parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(json, owner, res);
21342    return res;
21343  }
21344
21345  protected void parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(JsonObject json, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemComponent res) throws IOException, FHIRFormatError {
21346    parseBackboneElementProperties(json, res);
21347    if (json.has("linkId"))
21348      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
21349    if (json.has("_linkId"))
21350      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
21351    if (json.has("definition"))
21352      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
21353    if (json.has("_definition"))
21354      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
21355    if (json.has("text"))
21356      res.setTextElement(parseString(json.get("text").getAsString()));
21357    if (json.has("_text"))
21358      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
21359    if (json.has("answer")) {
21360      JsonArray array = json.getAsJsonArray("answer");
21361      for (int i = 0; i < array.size(); i++) {
21362        res.getAnswer().add(parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(array.get(i).getAsJsonObject(), owner));
21363      }
21364    };
21365    if (json.has("item")) {
21366      JsonArray array = json.getAsJsonArray("item");
21367      for (int i = 0; i < array.size(); i++) {
21368        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
21369      }
21370    };
21371  }
21372
21373  protected QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
21374    QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res = new QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent();
21375    parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(json, owner, res);
21376    return res;
21377  }
21378
21379  protected void parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(JsonObject json, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res) throws IOException, FHIRFormatError {
21380    parseBackboneElementProperties(json, res);
21381    Type value = parseType("value", json);
21382    if (value != null)
21383      res.setValue(value);
21384    if (json.has("item")) {
21385      JsonArray array = json.getAsJsonArray("item");
21386      for (int i = 0; i < array.size(); i++) {
21387        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
21388      }
21389    };
21390  }
21391
21392  protected RelatedPerson parseRelatedPerson(JsonObject json) throws IOException, FHIRFormatError {
21393    RelatedPerson res = new RelatedPerson();
21394    parseRelatedPersonProperties(json, res);
21395    return res;
21396  }
21397
21398  protected void parseRelatedPersonProperties(JsonObject json, RelatedPerson res) throws IOException, FHIRFormatError {
21399    parseDomainResourceProperties(json, res);
21400    if (json.has("identifier")) {
21401      JsonArray array = json.getAsJsonArray("identifier");
21402      for (int i = 0; i < array.size(); i++) {
21403        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21404      }
21405    };
21406    if (json.has("active"))
21407      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
21408    if (json.has("_active"))
21409      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
21410    if (json.has("patient"))
21411      res.setPatient(parseReference(getJObject(json, "patient")));
21412    if (json.has("relationship")) {
21413      JsonArray array = json.getAsJsonArray("relationship");
21414      for (int i = 0; i < array.size(); i++) {
21415        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21416      }
21417    };
21418    if (json.has("name")) {
21419      JsonArray array = json.getAsJsonArray("name");
21420      for (int i = 0; i < array.size(); i++) {
21421        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
21422      }
21423    };
21424    if (json.has("telecom")) {
21425      JsonArray array = json.getAsJsonArray("telecom");
21426      for (int i = 0; i < array.size(); i++) {
21427        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
21428      }
21429    };
21430    if (json.has("gender"))
21431      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
21432    if (json.has("_gender"))
21433      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
21434    if (json.has("birthDate"))
21435      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
21436    if (json.has("_birthDate"))
21437      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
21438    if (json.has("address")) {
21439      JsonArray array = json.getAsJsonArray("address");
21440      for (int i = 0; i < array.size(); i++) {
21441        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
21442      }
21443    };
21444    if (json.has("photo")) {
21445      JsonArray array = json.getAsJsonArray("photo");
21446      for (int i = 0; i < array.size(); i++) {
21447        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
21448      }
21449    };
21450    if (json.has("period"))
21451      res.setPeriod(parsePeriod(getJObject(json, "period")));
21452    if (json.has("communication")) {
21453      JsonArray array = json.getAsJsonArray("communication");
21454      for (int i = 0; i < array.size(); i++) {
21455        res.getCommunication().add(parseRelatedPersonRelatedPersonCommunicationComponent(array.get(i).getAsJsonObject(), res));
21456      }
21457    };
21458  }
21459
21460  protected RelatedPerson.RelatedPersonCommunicationComponent parseRelatedPersonRelatedPersonCommunicationComponent(JsonObject json, RelatedPerson owner) throws IOException, FHIRFormatError {
21461    RelatedPerson.RelatedPersonCommunicationComponent res = new RelatedPerson.RelatedPersonCommunicationComponent();
21462    parseRelatedPersonRelatedPersonCommunicationComponentProperties(json, owner, res);
21463    return res;
21464  }
21465
21466  protected void parseRelatedPersonRelatedPersonCommunicationComponentProperties(JsonObject json, RelatedPerson owner, RelatedPerson.RelatedPersonCommunicationComponent res) throws IOException, FHIRFormatError {
21467    parseBackboneElementProperties(json, res);
21468    if (json.has("language"))
21469      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
21470    if (json.has("preferred"))
21471      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
21472    if (json.has("_preferred"))
21473      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
21474  }
21475
21476  protected RequestGroup parseRequestGroup(JsonObject json) throws IOException, FHIRFormatError {
21477    RequestGroup res = new RequestGroup();
21478    parseRequestGroupProperties(json, res);
21479    return res;
21480  }
21481
21482  protected void parseRequestGroupProperties(JsonObject json, RequestGroup res) throws IOException, FHIRFormatError {
21483    parseDomainResourceProperties(json, res);
21484    if (json.has("identifier")) {
21485      JsonArray array = json.getAsJsonArray("identifier");
21486      for (int i = 0; i < array.size(); i++) {
21487        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21488      }
21489    };
21490    if (json.has("instantiatesCanonical")) {
21491      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
21492      for (int i = 0; i < array.size(); i++) {
21493        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
21494      }
21495    };
21496    if (json.has("_instantiatesCanonical")) {
21497      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
21498      for (int i = 0; i < array.size(); i++) {
21499        if (i == res.getInstantiatesCanonical().size())
21500          res.getInstantiatesCanonical().add(parseCanonical(null));
21501        if (array.get(i) instanceof JsonObject) 
21502          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
21503      }
21504    };
21505    if (json.has("instantiatesUri")) {
21506      JsonArray array = json.getAsJsonArray("instantiatesUri");
21507      for (int i = 0; i < array.size(); i++) {
21508        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
21509      }
21510    };
21511    if (json.has("_instantiatesUri")) {
21512      JsonArray array = json.getAsJsonArray("_instantiatesUri");
21513      for (int i = 0; i < array.size(); i++) {
21514        if (i == res.getInstantiatesUri().size())
21515          res.getInstantiatesUri().add(parseUri(null));
21516        if (array.get(i) instanceof JsonObject) 
21517          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
21518      }
21519    };
21520    if (json.has("basedOn")) {
21521      JsonArray array = json.getAsJsonArray("basedOn");
21522      for (int i = 0; i < array.size(); i++) {
21523        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
21524      }
21525    };
21526    if (json.has("replaces")) {
21527      JsonArray array = json.getAsJsonArray("replaces");
21528      for (int i = 0; i < array.size(); i++) {
21529        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
21530      }
21531    };
21532    if (json.has("groupIdentifier"))
21533      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
21534    if (json.has("status"))
21535      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RequestGroup.RequestStatus.NULL, new RequestGroup.RequestStatusEnumFactory()));
21536    if (json.has("_status"))
21537      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
21538    if (json.has("intent"))
21539      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), RequestGroup.RequestIntent.NULL, new RequestGroup.RequestIntentEnumFactory()));
21540    if (json.has("_intent"))
21541      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
21542    if (json.has("priority"))
21543      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), RequestGroup.RequestPriority.NULL, new RequestGroup.RequestPriorityEnumFactory()));
21544    if (json.has("_priority"))
21545      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
21546    if (json.has("code"))
21547      res.setCode(parseCodeableConcept(getJObject(json, "code")));
21548    if (json.has("subject"))
21549      res.setSubject(parseReference(getJObject(json, "subject")));
21550    if (json.has("encounter"))
21551      res.setEncounter(parseReference(getJObject(json, "encounter")));
21552    if (json.has("authoredOn"))
21553      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
21554    if (json.has("_authoredOn"))
21555      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
21556    if (json.has("author"))
21557      res.setAuthor(parseReference(getJObject(json, "author")));
21558    if (json.has("reasonCode")) {
21559      JsonArray array = json.getAsJsonArray("reasonCode");
21560      for (int i = 0; i < array.size(); i++) {
21561        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21562      }
21563    };
21564    if (json.has("reasonReference")) {
21565      JsonArray array = json.getAsJsonArray("reasonReference");
21566      for (int i = 0; i < array.size(); i++) {
21567        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
21568      }
21569    };
21570    if (json.has("note")) {
21571      JsonArray array = json.getAsJsonArray("note");
21572      for (int i = 0; i < array.size(); i++) {
21573        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
21574      }
21575    };
21576    if (json.has("action")) {
21577      JsonArray array = json.getAsJsonArray("action");
21578      for (int i = 0; i < array.size(); i++) {
21579        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), res));
21580      }
21581    };
21582  }
21583
21584  protected RequestGroup.RequestGroupActionComponent parseRequestGroupRequestGroupActionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
21585    RequestGroup.RequestGroupActionComponent res = new RequestGroup.RequestGroupActionComponent();
21586    parseRequestGroupRequestGroupActionComponentProperties(json, owner, res);
21587    return res;
21588  }
21589
21590  protected void parseRequestGroupRequestGroupActionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionComponent res) throws IOException, FHIRFormatError {
21591    parseBackboneElementProperties(json, res);
21592    if (json.has("prefix"))
21593      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
21594    if (json.has("_prefix"))
21595      parseElementProperties(getJObject(json, "_prefix"), res.getPrefixElement());
21596    if (json.has("title"))
21597      res.setTitleElement(parseString(json.get("title").getAsString()));
21598    if (json.has("_title"))
21599      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
21600    if (json.has("description"))
21601      res.setDescriptionElement(parseString(json.get("description").getAsString()));
21602    if (json.has("_description"))
21603      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
21604    if (json.has("textEquivalent"))
21605      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
21606    if (json.has("_textEquivalent"))
21607      parseElementProperties(getJObject(json, "_textEquivalent"), res.getTextEquivalentElement());
21608    if (json.has("priority"))
21609      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), RequestGroup.RequestPriority.NULL, new RequestGroup.RequestPriorityEnumFactory()));
21610    if (json.has("_priority"))
21611      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
21612    if (json.has("code")) {
21613      JsonArray array = json.getAsJsonArray("code");
21614      for (int i = 0; i < array.size(); i++) {
21615        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21616      }
21617    };
21618    if (json.has("documentation")) {
21619      JsonArray array = json.getAsJsonArray("documentation");
21620      for (int i = 0; i < array.size(); i++) {
21621        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
21622      }
21623    };
21624    if (json.has("condition")) {
21625      JsonArray array = json.getAsJsonArray("condition");
21626      for (int i = 0; i < array.size(); i++) {
21627        res.getCondition().add(parseRequestGroupRequestGroupActionConditionComponent(array.get(i).getAsJsonObject(), owner));
21628      }
21629    };
21630    if (json.has("relatedAction")) {
21631      JsonArray array = json.getAsJsonArray("relatedAction");
21632      for (int i = 0; i < array.size(); i++) {
21633        res.getRelatedAction().add(parseRequestGroupRequestGroupActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
21634      }
21635    };
21636    Type timing = parseType("timing", json);
21637    if (timing != null)
21638      res.setTiming(timing);
21639    if (json.has("participant")) {
21640      JsonArray array = json.getAsJsonArray("participant");
21641      for (int i = 0; i < array.size(); i++) {
21642        res.getParticipant().add(parseReference(array.get(i).getAsJsonObject()));
21643      }
21644    };
21645    if (json.has("type"))
21646      res.setType(parseCodeableConcept(getJObject(json, "type")));
21647    if (json.has("groupingBehavior"))
21648      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), RequestGroup.ActionGroupingBehavior.NULL, new RequestGroup.ActionGroupingBehaviorEnumFactory()));
21649    if (json.has("_groupingBehavior"))
21650      parseElementProperties(getJObject(json, "_groupingBehavior"), res.getGroupingBehaviorElement());
21651    if (json.has("selectionBehavior"))
21652      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), RequestGroup.ActionSelectionBehavior.NULL, new RequestGroup.ActionSelectionBehaviorEnumFactory()));
21653    if (json.has("_selectionBehavior"))
21654      parseElementProperties(getJObject(json, "_selectionBehavior"), res.getSelectionBehaviorElement());
21655    if (json.has("requiredBehavior"))
21656      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), RequestGroup.ActionRequiredBehavior.NULL, new RequestGroup.ActionRequiredBehaviorEnumFactory()));
21657    if (json.has("_requiredBehavior"))
21658      parseElementProperties(getJObject(json, "_requiredBehavior"), res.getRequiredBehaviorElement());
21659    if (json.has("precheckBehavior"))
21660      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), RequestGroup.ActionPrecheckBehavior.NULL, new RequestGroup.ActionPrecheckBehaviorEnumFactory()));
21661    if (json.has("_precheckBehavior"))
21662      parseElementProperties(getJObject(json, "_precheckBehavior"), res.getPrecheckBehaviorElement());
21663    if (json.has("cardinalityBehavior"))
21664      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), RequestGroup.ActionCardinalityBehavior.NULL, new RequestGroup.ActionCardinalityBehaviorEnumFactory()));
21665    if (json.has("_cardinalityBehavior"))
21666      parseElementProperties(getJObject(json, "_cardinalityBehavior"), res.getCardinalityBehaviorElement());
21667    if (json.has("resource"))
21668      res.setResource(parseReference(getJObject(json, "resource")));
21669    if (json.has("action")) {
21670      JsonArray array = json.getAsJsonArray("action");
21671      for (int i = 0; i < array.size(); i++) {
21672        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), owner));
21673      }
21674    };
21675  }
21676
21677  protected RequestGroup.RequestGroupActionConditionComponent parseRequestGroupRequestGroupActionConditionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
21678    RequestGroup.RequestGroupActionConditionComponent res = new RequestGroup.RequestGroupActionConditionComponent();
21679    parseRequestGroupRequestGroupActionConditionComponentProperties(json, owner, res);
21680    return res;
21681  }
21682
21683  protected void parseRequestGroupRequestGroupActionConditionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionConditionComponent res) throws IOException, FHIRFormatError {
21684    parseBackboneElementProperties(json, res);
21685    if (json.has("kind"))
21686      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), RequestGroup.ActionConditionKind.NULL, new RequestGroup.ActionConditionKindEnumFactory()));
21687    if (json.has("_kind"))
21688      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
21689    if (json.has("expression"))
21690      res.setExpression(parseExpression(getJObject(json, "expression")));
21691  }
21692
21693  protected RequestGroup.RequestGroupActionRelatedActionComponent parseRequestGroupRequestGroupActionRelatedActionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
21694    RequestGroup.RequestGroupActionRelatedActionComponent res = new RequestGroup.RequestGroupActionRelatedActionComponent();
21695    parseRequestGroupRequestGroupActionRelatedActionComponentProperties(json, owner, res);
21696    return res;
21697  }
21698
21699  protected void parseRequestGroupRequestGroupActionRelatedActionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionRelatedActionComponent res) throws IOException, FHIRFormatError {
21700    parseBackboneElementProperties(json, res);
21701    if (json.has("actionId"))
21702      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
21703    if (json.has("_actionId"))
21704      parseElementProperties(getJObject(json, "_actionId"), res.getActionIdElement());
21705    if (json.has("relationship"))
21706      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), RequestGroup.ActionRelationshipType.NULL, new RequestGroup.ActionRelationshipTypeEnumFactory()));
21707    if (json.has("_relationship"))
21708      parseElementProperties(getJObject(json, "_relationship"), res.getRelationshipElement());
21709    Type offset = parseType("offset", json);
21710    if (offset != null)
21711      res.setOffset(offset);
21712  }
21713
21714  protected ResearchDefinition parseResearchDefinition(JsonObject json) throws IOException, FHIRFormatError {
21715    ResearchDefinition res = new ResearchDefinition();
21716    parseResearchDefinitionProperties(json, res);
21717    return res;
21718  }
21719
21720  protected void parseResearchDefinitionProperties(JsonObject json, ResearchDefinition res) throws IOException, FHIRFormatError {
21721    parseDomainResourceProperties(json, res);
21722    if (json.has("url"))
21723      res.setUrlElement(parseUri(json.get("url").getAsString()));
21724    if (json.has("_url"))
21725      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
21726    if (json.has("identifier")) {
21727      JsonArray array = json.getAsJsonArray("identifier");
21728      for (int i = 0; i < array.size(); i++) {
21729        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21730      }
21731    };
21732    if (json.has("version"))
21733      res.setVersionElement(parseString(json.get("version").getAsString()));
21734    if (json.has("_version"))
21735      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
21736    if (json.has("name"))
21737      res.setNameElement(parseString(json.get("name").getAsString()));
21738    if (json.has("_name"))
21739      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
21740    if (json.has("title"))
21741      res.setTitleElement(parseString(json.get("title").getAsString()));
21742    if (json.has("_title"))
21743      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
21744    if (json.has("shortTitle"))
21745      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
21746    if (json.has("_shortTitle"))
21747      parseElementProperties(getJObject(json, "_shortTitle"), res.getShortTitleElement());
21748    if (json.has("subtitle"))
21749      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
21750    if (json.has("_subtitle"))
21751      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
21752    if (json.has("status"))
21753      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
21754    if (json.has("_status"))
21755      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
21756    if (json.has("experimental"))
21757      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
21758    if (json.has("_experimental"))
21759      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
21760    Type subject = parseType("subject", json);
21761    if (subject != null)
21762      res.setSubject(subject);
21763    if (json.has("date"))
21764      res.setDateElement(parseDateTime(json.get("date").getAsString()));
21765    if (json.has("_date"))
21766      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
21767    if (json.has("publisher"))
21768      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
21769    if (json.has("_publisher"))
21770      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
21771    if (json.has("contact")) {
21772      JsonArray array = json.getAsJsonArray("contact");
21773      for (int i = 0; i < array.size(); i++) {
21774        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
21775      }
21776    };
21777    if (json.has("description"))
21778      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
21779    if (json.has("_description"))
21780      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
21781    if (json.has("comment")) {
21782      JsonArray array = json.getAsJsonArray("comment");
21783      for (int i = 0; i < array.size(); i++) {
21784        res.getComment().add(parseString(array.get(i).getAsString()));
21785      }
21786    };
21787    if (json.has("_comment")) {
21788      JsonArray array = json.getAsJsonArray("_comment");
21789      for (int i = 0; i < array.size(); i++) {
21790        if (i == res.getComment().size())
21791          res.getComment().add(parseString(null));
21792        if (array.get(i) instanceof JsonObject) 
21793          parseElementProperties(array.get(i).getAsJsonObject(), res.getComment().get(i));
21794      }
21795    };
21796    if (json.has("useContext")) {
21797      JsonArray array = json.getAsJsonArray("useContext");
21798      for (int i = 0; i < array.size(); i++) {
21799        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
21800      }
21801    };
21802    if (json.has("jurisdiction")) {
21803      JsonArray array = json.getAsJsonArray("jurisdiction");
21804      for (int i = 0; i < array.size(); i++) {
21805        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21806      }
21807    };
21808    if (json.has("purpose"))
21809      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
21810    if (json.has("_purpose"))
21811      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
21812    if (json.has("usage"))
21813      res.setUsageElement(parseString(json.get("usage").getAsString()));
21814    if (json.has("_usage"))
21815      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
21816    if (json.has("copyright"))
21817      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
21818    if (json.has("_copyright"))
21819      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
21820    if (json.has("approvalDate"))
21821      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
21822    if (json.has("_approvalDate"))
21823      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
21824    if (json.has("lastReviewDate"))
21825      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
21826    if (json.has("_lastReviewDate"))
21827      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
21828    if (json.has("effectivePeriod"))
21829      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
21830    if (json.has("topic")) {
21831      JsonArray array = json.getAsJsonArray("topic");
21832      for (int i = 0; i < array.size(); i++) {
21833        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21834      }
21835    };
21836    if (json.has("author")) {
21837      JsonArray array = json.getAsJsonArray("author");
21838      for (int i = 0; i < array.size(); i++) {
21839        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
21840      }
21841    };
21842    if (json.has("editor")) {
21843      JsonArray array = json.getAsJsonArray("editor");
21844      for (int i = 0; i < array.size(); i++) {
21845        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
21846      }
21847    };
21848    if (json.has("reviewer")) {
21849      JsonArray array = json.getAsJsonArray("reviewer");
21850      for (int i = 0; i < array.size(); i++) {
21851        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
21852      }
21853    };
21854    if (json.has("endorser")) {
21855      JsonArray array = json.getAsJsonArray("endorser");
21856      for (int i = 0; i < array.size(); i++) {
21857        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
21858      }
21859    };
21860    if (json.has("relatedArtifact")) {
21861      JsonArray array = json.getAsJsonArray("relatedArtifact");
21862      for (int i = 0; i < array.size(); i++) {
21863        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
21864      }
21865    };
21866    if (json.has("library")) {
21867      JsonArray array = json.getAsJsonArray("library");
21868      for (int i = 0; i < array.size(); i++) {
21869        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
21870      }
21871    };
21872    if (json.has("_library")) {
21873      JsonArray array = json.getAsJsonArray("_library");
21874      for (int i = 0; i < array.size(); i++) {
21875        if (i == res.getLibrary().size())
21876          res.getLibrary().add(parseCanonical(null));
21877        if (array.get(i) instanceof JsonObject) 
21878          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
21879      }
21880    };
21881    if (json.has("population"))
21882      res.setPopulation(parseReference(getJObject(json, "population")));
21883    if (json.has("exposure"))
21884      res.setExposure(parseReference(getJObject(json, "exposure")));
21885    if (json.has("exposureAlternative"))
21886      res.setExposureAlternative(parseReference(getJObject(json, "exposureAlternative")));
21887    if (json.has("outcome"))
21888      res.setOutcome(parseReference(getJObject(json, "outcome")));
21889  }
21890
21891  protected ResearchElementDefinition parseResearchElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
21892    ResearchElementDefinition res = new ResearchElementDefinition();
21893    parseResearchElementDefinitionProperties(json, res);
21894    return res;
21895  }
21896
21897  protected void parseResearchElementDefinitionProperties(JsonObject json, ResearchElementDefinition res) throws IOException, FHIRFormatError {
21898    parseDomainResourceProperties(json, res);
21899    if (json.has("url"))
21900      res.setUrlElement(parseUri(json.get("url").getAsString()));
21901    if (json.has("_url"))
21902      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
21903    if (json.has("identifier")) {
21904      JsonArray array = json.getAsJsonArray("identifier");
21905      for (int i = 0; i < array.size(); i++) {
21906        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21907      }
21908    };
21909    if (json.has("version"))
21910      res.setVersionElement(parseString(json.get("version").getAsString()));
21911    if (json.has("_version"))
21912      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
21913    if (json.has("name"))
21914      res.setNameElement(parseString(json.get("name").getAsString()));
21915    if (json.has("_name"))
21916      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
21917    if (json.has("title"))
21918      res.setTitleElement(parseString(json.get("title").getAsString()));
21919    if (json.has("_title"))
21920      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
21921    if (json.has("shortTitle"))
21922      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
21923    if (json.has("_shortTitle"))
21924      parseElementProperties(getJObject(json, "_shortTitle"), res.getShortTitleElement());
21925    if (json.has("subtitle"))
21926      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
21927    if (json.has("_subtitle"))
21928      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
21929    if (json.has("status"))
21930      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
21931    if (json.has("_status"))
21932      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
21933    if (json.has("experimental"))
21934      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
21935    if (json.has("_experimental"))
21936      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
21937    Type subject = parseType("subject", json);
21938    if (subject != null)
21939      res.setSubject(subject);
21940    if (json.has("date"))
21941      res.setDateElement(parseDateTime(json.get("date").getAsString()));
21942    if (json.has("_date"))
21943      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
21944    if (json.has("publisher"))
21945      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
21946    if (json.has("_publisher"))
21947      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
21948    if (json.has("contact")) {
21949      JsonArray array = json.getAsJsonArray("contact");
21950      for (int i = 0; i < array.size(); i++) {
21951        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
21952      }
21953    };
21954    if (json.has("description"))
21955      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
21956    if (json.has("_description"))
21957      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
21958    if (json.has("comment")) {
21959      JsonArray array = json.getAsJsonArray("comment");
21960      for (int i = 0; i < array.size(); i++) {
21961        res.getComment().add(parseString(array.get(i).getAsString()));
21962      }
21963    };
21964    if (json.has("_comment")) {
21965      JsonArray array = json.getAsJsonArray("_comment");
21966      for (int i = 0; i < array.size(); i++) {
21967        if (i == res.getComment().size())
21968          res.getComment().add(parseString(null));
21969        if (array.get(i) instanceof JsonObject) 
21970          parseElementProperties(array.get(i).getAsJsonObject(), res.getComment().get(i));
21971      }
21972    };
21973    if (json.has("useContext")) {
21974      JsonArray array = json.getAsJsonArray("useContext");
21975      for (int i = 0; i < array.size(); i++) {
21976        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
21977      }
21978    };
21979    if (json.has("jurisdiction")) {
21980      JsonArray array = json.getAsJsonArray("jurisdiction");
21981      for (int i = 0; i < array.size(); i++) {
21982        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21983      }
21984    };
21985    if (json.has("purpose"))
21986      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
21987    if (json.has("_purpose"))
21988      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
21989    if (json.has("usage"))
21990      res.setUsageElement(parseString(json.get("usage").getAsString()));
21991    if (json.has("_usage"))
21992      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
21993    if (json.has("copyright"))
21994      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
21995    if (json.has("_copyright"))
21996      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
21997    if (json.has("approvalDate"))
21998      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
21999    if (json.has("_approvalDate"))
22000      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
22001    if (json.has("lastReviewDate"))
22002      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
22003    if (json.has("_lastReviewDate"))
22004      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
22005    if (json.has("effectivePeriod"))
22006      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
22007    if (json.has("topic")) {
22008      JsonArray array = json.getAsJsonArray("topic");
22009      for (int i = 0; i < array.size(); i++) {
22010        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22011      }
22012    };
22013    if (json.has("author")) {
22014      JsonArray array = json.getAsJsonArray("author");
22015      for (int i = 0; i < array.size(); i++) {
22016        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
22017      }
22018    };
22019    if (json.has("editor")) {
22020      JsonArray array = json.getAsJsonArray("editor");
22021      for (int i = 0; i < array.size(); i++) {
22022        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
22023      }
22024    };
22025    if (json.has("reviewer")) {
22026      JsonArray array = json.getAsJsonArray("reviewer");
22027      for (int i = 0; i < array.size(); i++) {
22028        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
22029      }
22030    };
22031    if (json.has("endorser")) {
22032      JsonArray array = json.getAsJsonArray("endorser");
22033      for (int i = 0; i < array.size(); i++) {
22034        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
22035      }
22036    };
22037    if (json.has("relatedArtifact")) {
22038      JsonArray array = json.getAsJsonArray("relatedArtifact");
22039      for (int i = 0; i < array.size(); i++) {
22040        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
22041      }
22042    };
22043    if (json.has("library")) {
22044      JsonArray array = json.getAsJsonArray("library");
22045      for (int i = 0; i < array.size(); i++) {
22046        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
22047      }
22048    };
22049    if (json.has("_library")) {
22050      JsonArray array = json.getAsJsonArray("_library");
22051      for (int i = 0; i < array.size(); i++) {
22052        if (i == res.getLibrary().size())
22053          res.getLibrary().add(parseCanonical(null));
22054        if (array.get(i) instanceof JsonObject) 
22055          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
22056      }
22057    };
22058    if (json.has("type"))
22059      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ResearchElementDefinition.ResearchElementType.NULL, new ResearchElementDefinition.ResearchElementTypeEnumFactory()));
22060    if (json.has("_type"))
22061      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
22062    if (json.has("variableType"))
22063      res.setVariableTypeElement(parseEnumeration(json.get("variableType").getAsString(), ResearchElementDefinition.VariableType.NULL, new ResearchElementDefinition.VariableTypeEnumFactory()));
22064    if (json.has("_variableType"))
22065      parseElementProperties(getJObject(json, "_variableType"), res.getVariableTypeElement());
22066    if (json.has("characteristic")) {
22067      JsonArray array = json.getAsJsonArray("characteristic");
22068      for (int i = 0; i < array.size(); i++) {
22069        res.getCharacteristic().add(parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(array.get(i).getAsJsonObject(), res));
22070      }
22071    };
22072  }
22073
22074  protected ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(JsonObject json, ResearchElementDefinition owner) throws IOException, FHIRFormatError {
22075    ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent res = new ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent();
22076    parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponentProperties(json, owner, res);
22077    return res;
22078  }
22079
22080  protected void parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponentProperties(JsonObject json, ResearchElementDefinition owner, ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent res) throws IOException, FHIRFormatError {
22081    parseBackboneElementProperties(json, res);
22082    Type definition = parseType("definition", json);
22083    if (definition != null)
22084      res.setDefinition(definition);
22085    if (json.has("usageContext")) {
22086      JsonArray array = json.getAsJsonArray("usageContext");
22087      for (int i = 0; i < array.size(); i++) {
22088        res.getUsageContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
22089      }
22090    };
22091    if (json.has("exclude"))
22092      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
22093    if (json.has("_exclude"))
22094      parseElementProperties(getJObject(json, "_exclude"), res.getExcludeElement());
22095    if (json.has("unitOfMeasure"))
22096      res.setUnitOfMeasure(parseCodeableConcept(getJObject(json, "unitOfMeasure")));
22097    if (json.has("studyEffectiveDescription"))
22098      res.setStudyEffectiveDescriptionElement(parseString(json.get("studyEffectiveDescription").getAsString()));
22099    if (json.has("_studyEffectiveDescription"))
22100      parseElementProperties(getJObject(json, "_studyEffectiveDescription"), res.getStudyEffectiveDescriptionElement());
22101    Type studyEffective = parseType("studyEffective", json);
22102    if (studyEffective != null)
22103      res.setStudyEffective(studyEffective);
22104    if (json.has("studyEffectiveTimeFromStart"))
22105      res.setStudyEffectiveTimeFromStart(parseDuration(getJObject(json, "studyEffectiveTimeFromStart")));
22106    if (json.has("studyEffectiveGroupMeasure"))
22107      res.setStudyEffectiveGroupMeasureElement(parseEnumeration(json.get("studyEffectiveGroupMeasure").getAsString(), ResearchElementDefinition.GroupMeasure.NULL, new ResearchElementDefinition.GroupMeasureEnumFactory()));
22108    if (json.has("_studyEffectiveGroupMeasure"))
22109      parseElementProperties(getJObject(json, "_studyEffectiveGroupMeasure"), res.getStudyEffectiveGroupMeasureElement());
22110    if (json.has("participantEffectiveDescription"))
22111      res.setParticipantEffectiveDescriptionElement(parseString(json.get("participantEffectiveDescription").getAsString()));
22112    if (json.has("_participantEffectiveDescription"))
22113      parseElementProperties(getJObject(json, "_participantEffectiveDescription"), res.getParticipantEffectiveDescriptionElement());
22114    Type participantEffective = parseType("participantEffective", json);
22115    if (participantEffective != null)
22116      res.setParticipantEffective(participantEffective);
22117    if (json.has("participantEffectiveTimeFromStart"))
22118      res.setParticipantEffectiveTimeFromStart(parseDuration(getJObject(json, "participantEffectiveTimeFromStart")));
22119    if (json.has("participantEffectiveGroupMeasure"))
22120      res.setParticipantEffectiveGroupMeasureElement(parseEnumeration(json.get("participantEffectiveGroupMeasure").getAsString(), ResearchElementDefinition.GroupMeasure.NULL, new ResearchElementDefinition.GroupMeasureEnumFactory()));
22121    if (json.has("_participantEffectiveGroupMeasure"))
22122      parseElementProperties(getJObject(json, "_participantEffectiveGroupMeasure"), res.getParticipantEffectiveGroupMeasureElement());
22123  }
22124
22125  protected ResearchStudy parseResearchStudy(JsonObject json) throws IOException, FHIRFormatError {
22126    ResearchStudy res = new ResearchStudy();
22127    parseResearchStudyProperties(json, res);
22128    return res;
22129  }
22130
22131  protected void parseResearchStudyProperties(JsonObject json, ResearchStudy res) throws IOException, FHIRFormatError {
22132    parseDomainResourceProperties(json, res);
22133    if (json.has("identifier")) {
22134      JsonArray array = json.getAsJsonArray("identifier");
22135      for (int i = 0; i < array.size(); i++) {
22136        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22137      }
22138    };
22139    if (json.has("title"))
22140      res.setTitleElement(parseString(json.get("title").getAsString()));
22141    if (json.has("_title"))
22142      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
22143    if (json.has("protocol")) {
22144      JsonArray array = json.getAsJsonArray("protocol");
22145      for (int i = 0; i < array.size(); i++) {
22146        res.getProtocol().add(parseReference(array.get(i).getAsJsonObject()));
22147      }
22148    };
22149    if (json.has("partOf")) {
22150      JsonArray array = json.getAsJsonArray("partOf");
22151      for (int i = 0; i < array.size(); i++) {
22152        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
22153      }
22154    };
22155    if (json.has("status"))
22156      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchStudy.ResearchStudyStatus.NULL, new ResearchStudy.ResearchStudyStatusEnumFactory()));
22157    if (json.has("_status"))
22158      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
22159    if (json.has("primaryPurposeType"))
22160      res.setPrimaryPurposeType(parseCodeableConcept(getJObject(json, "primaryPurposeType")));
22161    if (json.has("phase"))
22162      res.setPhase(parseCodeableConcept(getJObject(json, "phase")));
22163    if (json.has("category")) {
22164      JsonArray array = json.getAsJsonArray("category");
22165      for (int i = 0; i < array.size(); i++) {
22166        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22167      }
22168    };
22169    if (json.has("focus")) {
22170      JsonArray array = json.getAsJsonArray("focus");
22171      for (int i = 0; i < array.size(); i++) {
22172        res.getFocus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22173      }
22174    };
22175    if (json.has("condition")) {
22176      JsonArray array = json.getAsJsonArray("condition");
22177      for (int i = 0; i < array.size(); i++) {
22178        res.getCondition().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22179      }
22180    };
22181    if (json.has("contact")) {
22182      JsonArray array = json.getAsJsonArray("contact");
22183      for (int i = 0; i < array.size(); i++) {
22184        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
22185      }
22186    };
22187    if (json.has("relatedArtifact")) {
22188      JsonArray array = json.getAsJsonArray("relatedArtifact");
22189      for (int i = 0; i < array.size(); i++) {
22190        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
22191      }
22192    };
22193    if (json.has("keyword")) {
22194      JsonArray array = json.getAsJsonArray("keyword");
22195      for (int i = 0; i < array.size(); i++) {
22196        res.getKeyword().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22197      }
22198    };
22199    if (json.has("location")) {
22200      JsonArray array = json.getAsJsonArray("location");
22201      for (int i = 0; i < array.size(); i++) {
22202        res.getLocation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22203      }
22204    };
22205    if (json.has("description"))
22206      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22207    if (json.has("_description"))
22208      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
22209    if (json.has("enrollment")) {
22210      JsonArray array = json.getAsJsonArray("enrollment");
22211      for (int i = 0; i < array.size(); i++) {
22212        res.getEnrollment().add(parseReference(array.get(i).getAsJsonObject()));
22213      }
22214    };
22215    if (json.has("period"))
22216      res.setPeriod(parsePeriod(getJObject(json, "period")));
22217    if (json.has("sponsor"))
22218      res.setSponsor(parseReference(getJObject(json, "sponsor")));
22219    if (json.has("principalInvestigator"))
22220      res.setPrincipalInvestigator(parseReference(getJObject(json, "principalInvestigator")));
22221    if (json.has("site")) {
22222      JsonArray array = json.getAsJsonArray("site");
22223      for (int i = 0; i < array.size(); i++) {
22224        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
22225      }
22226    };
22227    if (json.has("reasonStopped"))
22228      res.setReasonStopped(parseCodeableConcept(getJObject(json, "reasonStopped")));
22229    if (json.has("note")) {
22230      JsonArray array = json.getAsJsonArray("note");
22231      for (int i = 0; i < array.size(); i++) {
22232        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22233      }
22234    };
22235    if (json.has("arm")) {
22236      JsonArray array = json.getAsJsonArray("arm");
22237      for (int i = 0; i < array.size(); i++) {
22238        res.getArm().add(parseResearchStudyResearchStudyArmComponent(array.get(i).getAsJsonObject(), res));
22239      }
22240    };
22241    if (json.has("objective")) {
22242      JsonArray array = json.getAsJsonArray("objective");
22243      for (int i = 0; i < array.size(); i++) {
22244        res.getObjective().add(parseResearchStudyResearchStudyObjectiveComponent(array.get(i).getAsJsonObject(), res));
22245      }
22246    };
22247  }
22248
22249  protected ResearchStudy.ResearchStudyArmComponent parseResearchStudyResearchStudyArmComponent(JsonObject json, ResearchStudy owner) throws IOException, FHIRFormatError {
22250    ResearchStudy.ResearchStudyArmComponent res = new ResearchStudy.ResearchStudyArmComponent();
22251    parseResearchStudyResearchStudyArmComponentProperties(json, owner, res);
22252    return res;
22253  }
22254
22255  protected void parseResearchStudyResearchStudyArmComponentProperties(JsonObject json, ResearchStudy owner, ResearchStudy.ResearchStudyArmComponent res) throws IOException, FHIRFormatError {
22256    parseBackboneElementProperties(json, res);
22257    if (json.has("name"))
22258      res.setNameElement(parseString(json.get("name").getAsString()));
22259    if (json.has("_name"))
22260      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
22261    if (json.has("type"))
22262      res.setType(parseCodeableConcept(getJObject(json, "type")));
22263    if (json.has("description"))
22264      res.setDescriptionElement(parseString(json.get("description").getAsString()));
22265    if (json.has("_description"))
22266      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
22267  }
22268
22269  protected ResearchStudy.ResearchStudyObjectiveComponent parseResearchStudyResearchStudyObjectiveComponent(JsonObject json, ResearchStudy owner) throws IOException, FHIRFormatError {
22270    ResearchStudy.ResearchStudyObjectiveComponent res = new ResearchStudy.ResearchStudyObjectiveComponent();
22271    parseResearchStudyResearchStudyObjectiveComponentProperties(json, owner, res);
22272    return res;
22273  }
22274
22275  protected void parseResearchStudyResearchStudyObjectiveComponentProperties(JsonObject json, ResearchStudy owner, ResearchStudy.ResearchStudyObjectiveComponent res) throws IOException, FHIRFormatError {
22276    parseBackboneElementProperties(json, res);
22277    if (json.has("name"))
22278      res.setNameElement(parseString(json.get("name").getAsString()));
22279    if (json.has("_name"))
22280      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
22281    if (json.has("type"))
22282      res.setType(parseCodeableConcept(getJObject(json, "type")));
22283  }
22284
22285  protected ResearchSubject parseResearchSubject(JsonObject json) throws IOException, FHIRFormatError {
22286    ResearchSubject res = new ResearchSubject();
22287    parseResearchSubjectProperties(json, res);
22288    return res;
22289  }
22290
22291  protected void parseResearchSubjectProperties(JsonObject json, ResearchSubject res) throws IOException, FHIRFormatError {
22292    parseDomainResourceProperties(json, res);
22293    if (json.has("identifier")) {
22294      JsonArray array = json.getAsJsonArray("identifier");
22295      for (int i = 0; i < array.size(); i++) {
22296        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22297      }
22298    };
22299    if (json.has("status"))
22300      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchSubject.ResearchSubjectStatus.NULL, new ResearchSubject.ResearchSubjectStatusEnumFactory()));
22301    if (json.has("_status"))
22302      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
22303    if (json.has("period"))
22304      res.setPeriod(parsePeriod(getJObject(json, "period")));
22305    if (json.has("study"))
22306      res.setStudy(parseReference(getJObject(json, "study")));
22307    if (json.has("individual"))
22308      res.setIndividual(parseReference(getJObject(json, "individual")));
22309    if (json.has("assignedArm"))
22310      res.setAssignedArmElement(parseString(json.get("assignedArm").getAsString()));
22311    if (json.has("_assignedArm"))
22312      parseElementProperties(getJObject(json, "_assignedArm"), res.getAssignedArmElement());
22313    if (json.has("actualArm"))
22314      res.setActualArmElement(parseString(json.get("actualArm").getAsString()));
22315    if (json.has("_actualArm"))
22316      parseElementProperties(getJObject(json, "_actualArm"), res.getActualArmElement());
22317    if (json.has("consent"))
22318      res.setConsent(parseReference(getJObject(json, "consent")));
22319  }
22320
22321  protected RiskAssessment parseRiskAssessment(JsonObject json) throws IOException, FHIRFormatError {
22322    RiskAssessment res = new RiskAssessment();
22323    parseRiskAssessmentProperties(json, res);
22324    return res;
22325  }
22326
22327  protected void parseRiskAssessmentProperties(JsonObject json, RiskAssessment res) throws IOException, FHIRFormatError {
22328    parseDomainResourceProperties(json, res);
22329    if (json.has("identifier")) {
22330      JsonArray array = json.getAsJsonArray("identifier");
22331      for (int i = 0; i < array.size(); i++) {
22332        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22333      }
22334    };
22335    if (json.has("basedOn"))
22336      res.setBasedOn(parseReference(getJObject(json, "basedOn")));
22337    if (json.has("parent"))
22338      res.setParent(parseReference(getJObject(json, "parent")));
22339    if (json.has("status"))
22340      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RiskAssessment.RiskAssessmentStatus.NULL, new RiskAssessment.RiskAssessmentStatusEnumFactory()));
22341    if (json.has("_status"))
22342      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
22343    if (json.has("method"))
22344      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
22345    if (json.has("code"))
22346      res.setCode(parseCodeableConcept(getJObject(json, "code")));
22347    if (json.has("subject"))
22348      res.setSubject(parseReference(getJObject(json, "subject")));
22349    if (json.has("encounter"))
22350      res.setEncounter(parseReference(getJObject(json, "encounter")));
22351    Type occurrence = parseType("occurrence", json);
22352    if (occurrence != null)
22353      res.setOccurrence(occurrence);
22354    if (json.has("condition"))
22355      res.setCondition(parseReference(getJObject(json, "condition")));
22356    if (json.has("performer"))
22357      res.setPerformer(parseReference(getJObject(json, "performer")));
22358    if (json.has("reasonCode")) {
22359      JsonArray array = json.getAsJsonArray("reasonCode");
22360      for (int i = 0; i < array.size(); i++) {
22361        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22362      }
22363    };
22364    if (json.has("reasonReference")) {
22365      JsonArray array = json.getAsJsonArray("reasonReference");
22366      for (int i = 0; i < array.size(); i++) {
22367        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
22368      }
22369    };
22370    if (json.has("basis")) {
22371      JsonArray array = json.getAsJsonArray("basis");
22372      for (int i = 0; i < array.size(); i++) {
22373        res.getBasis().add(parseReference(array.get(i).getAsJsonObject()));
22374      }
22375    };
22376    if (json.has("prediction")) {
22377      JsonArray array = json.getAsJsonArray("prediction");
22378      for (int i = 0; i < array.size(); i++) {
22379        res.getPrediction().add(parseRiskAssessmentRiskAssessmentPredictionComponent(array.get(i).getAsJsonObject(), res));
22380      }
22381    };
22382    if (json.has("mitigation"))
22383      res.setMitigationElement(parseString(json.get("mitigation").getAsString()));
22384    if (json.has("_mitigation"))
22385      parseElementProperties(getJObject(json, "_mitigation"), res.getMitigationElement());
22386    if (json.has("note")) {
22387      JsonArray array = json.getAsJsonArray("note");
22388      for (int i = 0; i < array.size(); i++) {
22389        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22390      }
22391    };
22392  }
22393
22394  protected RiskAssessment.RiskAssessmentPredictionComponent parseRiskAssessmentRiskAssessmentPredictionComponent(JsonObject json, RiskAssessment owner) throws IOException, FHIRFormatError {
22395    RiskAssessment.RiskAssessmentPredictionComponent res = new RiskAssessment.RiskAssessmentPredictionComponent();
22396    parseRiskAssessmentRiskAssessmentPredictionComponentProperties(json, owner, res);
22397    return res;
22398  }
22399
22400  protected void parseRiskAssessmentRiskAssessmentPredictionComponentProperties(JsonObject json, RiskAssessment owner, RiskAssessment.RiskAssessmentPredictionComponent res) throws IOException, FHIRFormatError {
22401    parseBackboneElementProperties(json, res);
22402    if (json.has("outcome"))
22403      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
22404    Type probability = parseType("probability", json);
22405    if (probability != null)
22406      res.setProbability(probability);
22407    if (json.has("qualitativeRisk"))
22408      res.setQualitativeRisk(parseCodeableConcept(getJObject(json, "qualitativeRisk")));
22409    if (json.has("relativeRisk"))
22410      res.setRelativeRiskElement(parseDecimal(json.get("relativeRisk").getAsBigDecimal()));
22411    if (json.has("_relativeRisk"))
22412      parseElementProperties(getJObject(json, "_relativeRisk"), res.getRelativeRiskElement());
22413    Type when = parseType("when", json);
22414    if (when != null)
22415      res.setWhen(when);
22416    if (json.has("rationale"))
22417      res.setRationaleElement(parseString(json.get("rationale").getAsString()));
22418    if (json.has("_rationale"))
22419      parseElementProperties(getJObject(json, "_rationale"), res.getRationaleElement());
22420  }
22421
22422  protected RiskEvidenceSynthesis parseRiskEvidenceSynthesis(JsonObject json) throws IOException, FHIRFormatError {
22423    RiskEvidenceSynthesis res = new RiskEvidenceSynthesis();
22424    parseRiskEvidenceSynthesisProperties(json, res);
22425    return res;
22426  }
22427
22428  protected void parseRiskEvidenceSynthesisProperties(JsonObject json, RiskEvidenceSynthesis res) throws IOException, FHIRFormatError {
22429    parseDomainResourceProperties(json, res);
22430    if (json.has("url"))
22431      res.setUrlElement(parseUri(json.get("url").getAsString()));
22432    if (json.has("_url"))
22433      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
22434    if (json.has("identifier")) {
22435      JsonArray array = json.getAsJsonArray("identifier");
22436      for (int i = 0; i < array.size(); i++) {
22437        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22438      }
22439    };
22440    if (json.has("version"))
22441      res.setVersionElement(parseString(json.get("version").getAsString()));
22442    if (json.has("_version"))
22443      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
22444    if (json.has("name"))
22445      res.setNameElement(parseString(json.get("name").getAsString()));
22446    if (json.has("_name"))
22447      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
22448    if (json.has("title"))
22449      res.setTitleElement(parseString(json.get("title").getAsString()));
22450    if (json.has("_title"))
22451      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
22452    if (json.has("status"))
22453      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
22454    if (json.has("_status"))
22455      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
22456    if (json.has("date"))
22457      res.setDateElement(parseDateTime(json.get("date").getAsString()));
22458    if (json.has("_date"))
22459      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
22460    if (json.has("publisher"))
22461      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
22462    if (json.has("_publisher"))
22463      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
22464    if (json.has("contact")) {
22465      JsonArray array = json.getAsJsonArray("contact");
22466      for (int i = 0; i < array.size(); i++) {
22467        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
22468      }
22469    };
22470    if (json.has("description"))
22471      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22472    if (json.has("_description"))
22473      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
22474    if (json.has("note")) {
22475      JsonArray array = json.getAsJsonArray("note");
22476      for (int i = 0; i < array.size(); i++) {
22477        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22478      }
22479    };
22480    if (json.has("useContext")) {
22481      JsonArray array = json.getAsJsonArray("useContext");
22482      for (int i = 0; i < array.size(); i++) {
22483        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
22484      }
22485    };
22486    if (json.has("jurisdiction")) {
22487      JsonArray array = json.getAsJsonArray("jurisdiction");
22488      for (int i = 0; i < array.size(); i++) {
22489        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22490      }
22491    };
22492    if (json.has("copyright"))
22493      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
22494    if (json.has("_copyright"))
22495      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
22496    if (json.has("approvalDate"))
22497      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
22498    if (json.has("_approvalDate"))
22499      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
22500    if (json.has("lastReviewDate"))
22501      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
22502    if (json.has("_lastReviewDate"))
22503      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
22504    if (json.has("effectivePeriod"))
22505      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
22506    if (json.has("topic")) {
22507      JsonArray array = json.getAsJsonArray("topic");
22508      for (int i = 0; i < array.size(); i++) {
22509        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22510      }
22511    };
22512    if (json.has("author")) {
22513      JsonArray array = json.getAsJsonArray("author");
22514      for (int i = 0; i < array.size(); i++) {
22515        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
22516      }
22517    };
22518    if (json.has("editor")) {
22519      JsonArray array = json.getAsJsonArray("editor");
22520      for (int i = 0; i < array.size(); i++) {
22521        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
22522      }
22523    };
22524    if (json.has("reviewer")) {
22525      JsonArray array = json.getAsJsonArray("reviewer");
22526      for (int i = 0; i < array.size(); i++) {
22527        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
22528      }
22529    };
22530    if (json.has("endorser")) {
22531      JsonArray array = json.getAsJsonArray("endorser");
22532      for (int i = 0; i < array.size(); i++) {
22533        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
22534      }
22535    };
22536    if (json.has("relatedArtifact")) {
22537      JsonArray array = json.getAsJsonArray("relatedArtifact");
22538      for (int i = 0; i < array.size(); i++) {
22539        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
22540      }
22541    };
22542    if (json.has("synthesisType"))
22543      res.setSynthesisType(parseCodeableConcept(getJObject(json, "synthesisType")));
22544    if (json.has("studyType"))
22545      res.setStudyType(parseCodeableConcept(getJObject(json, "studyType")));
22546    if (json.has("population"))
22547      res.setPopulation(parseReference(getJObject(json, "population")));
22548    if (json.has("exposure"))
22549      res.setExposure(parseReference(getJObject(json, "exposure")));
22550    if (json.has("outcome"))
22551      res.setOutcome(parseReference(getJObject(json, "outcome")));
22552    if (json.has("sampleSize"))
22553      res.setSampleSize(parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent(getJObject(json, "sampleSize"), res));
22554    if (json.has("riskEstimate"))
22555      res.setRiskEstimate(parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent(getJObject(json, "riskEstimate"), res));
22556    if (json.has("certainty")) {
22557      JsonArray array = json.getAsJsonArray("certainty");
22558      for (int i = 0; i < array.size(); i++) {
22559        res.getCertainty().add(parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(array.get(i).getAsJsonObject(), res));
22560      }
22561    };
22562  }
22563
22564  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent(JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
22565    RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent();
22566    parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentProperties(json, owner, res);
22567    return res;
22568  }
22569
22570  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentProperties(JsonObject json, RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent res) throws IOException, FHIRFormatError {
22571    parseBackboneElementProperties(json, res);
22572    if (json.has("description"))
22573      res.setDescriptionElement(parseString(json.get("description").getAsString()));
22574    if (json.has("_description"))
22575      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
22576    if (json.has("numberOfStudies"))
22577      res.setNumberOfStudiesElement(parseInteger(json.get("numberOfStudies").getAsLong()));
22578    if (json.has("_numberOfStudies"))
22579      parseElementProperties(getJObject(json, "_numberOfStudies"), res.getNumberOfStudiesElement());
22580    if (json.has("numberOfParticipants"))
22581      res.setNumberOfParticipantsElement(parseInteger(json.get("numberOfParticipants").getAsLong()));
22582    if (json.has("_numberOfParticipants"))
22583      parseElementProperties(getJObject(json, "_numberOfParticipants"), res.getNumberOfParticipantsElement());
22584  }
22585
22586  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent(JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
22587    RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent();
22588    parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentProperties(json, owner, res);
22589    return res;
22590  }
22591
22592  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentProperties(JsonObject json, RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent res) throws IOException, FHIRFormatError {
22593    parseBackboneElementProperties(json, res);
22594    if (json.has("description"))
22595      res.setDescriptionElement(parseString(json.get("description").getAsString()));
22596    if (json.has("_description"))
22597      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
22598    if (json.has("type"))
22599      res.setType(parseCodeableConcept(getJObject(json, "type")));
22600    if (json.has("value"))
22601      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
22602    if (json.has("_value"))
22603      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
22604    if (json.has("unitOfMeasure"))
22605      res.setUnitOfMeasure(parseCodeableConcept(getJObject(json, "unitOfMeasure")));
22606    if (json.has("denominatorCount"))
22607      res.setDenominatorCountElement(parseInteger(json.get("denominatorCount").getAsLong()));
22608    if (json.has("_denominatorCount"))
22609      parseElementProperties(getJObject(json, "_denominatorCount"), res.getDenominatorCountElement());
22610    if (json.has("numeratorCount"))
22611      res.setNumeratorCountElement(parseInteger(json.get("numeratorCount").getAsLong()));
22612    if (json.has("_numeratorCount"))
22613      parseElementProperties(getJObject(json, "_numeratorCount"), res.getNumeratorCountElement());
22614    if (json.has("precisionEstimate")) {
22615      JsonArray array = json.getAsJsonArray("precisionEstimate");
22616      for (int i = 0; i < array.size(); i++) {
22617        res.getPrecisionEstimate().add(parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(array.get(i).getAsJsonObject(), owner));
22618      }
22619    };
22620  }
22621
22622  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
22623    RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent();
22624    parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentProperties(json, owner, res);
22625    return res;
22626  }
22627
22628  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentProperties(JsonObject json, RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent res) throws IOException, FHIRFormatError {
22629    parseBackboneElementProperties(json, res);
22630    if (json.has("type"))
22631      res.setType(parseCodeableConcept(getJObject(json, "type")));
22632    if (json.has("level"))
22633      res.setLevelElement(parseDecimal(json.get("level").getAsBigDecimal()));
22634    if (json.has("_level"))
22635      parseElementProperties(getJObject(json, "_level"), res.getLevelElement());
22636    if (json.has("from"))
22637      res.setFromElement(parseDecimal(json.get("from").getAsBigDecimal()));
22638    if (json.has("_from"))
22639      parseElementProperties(getJObject(json, "_from"), res.getFromElement());
22640    if (json.has("to"))
22641      res.setToElement(parseDecimal(json.get("to").getAsBigDecimal()));
22642    if (json.has("_to"))
22643      parseElementProperties(getJObject(json, "_to"), res.getToElement());
22644  }
22645
22646  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
22647    RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent();
22648    parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentProperties(json, owner, res);
22649    return res;
22650  }
22651
22652  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentProperties(JsonObject json, RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent res) throws IOException, FHIRFormatError {
22653    parseBackboneElementProperties(json, res);
22654    if (json.has("rating")) {
22655      JsonArray array = json.getAsJsonArray("rating");
22656      for (int i = 0; i < array.size(); i++) {
22657        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22658      }
22659    };
22660    if (json.has("note")) {
22661      JsonArray array = json.getAsJsonArray("note");
22662      for (int i = 0; i < array.size(); i++) {
22663        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22664      }
22665    };
22666    if (json.has("certaintySubcomponent")) {
22667      JsonArray array = json.getAsJsonArray("certaintySubcomponent");
22668      for (int i = 0; i < array.size(); i++) {
22669        res.getCertaintySubcomponent().add(parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(array.get(i).getAsJsonObject(), owner));
22670      }
22671    };
22672  }
22673
22674  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
22675    RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent();
22676    parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentProperties(json, owner, res);
22677    return res;
22678  }
22679
22680  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentProperties(JsonObject json, RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent res) throws IOException, FHIRFormatError {
22681    parseBackboneElementProperties(json, res);
22682    if (json.has("type"))
22683      res.setType(parseCodeableConcept(getJObject(json, "type")));
22684    if (json.has("rating")) {
22685      JsonArray array = json.getAsJsonArray("rating");
22686      for (int i = 0; i < array.size(); i++) {
22687        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22688      }
22689    };
22690    if (json.has("note")) {
22691      JsonArray array = json.getAsJsonArray("note");
22692      for (int i = 0; i < array.size(); i++) {
22693        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22694      }
22695    };
22696  }
22697
22698  protected Schedule parseSchedule(JsonObject json) throws IOException, FHIRFormatError {
22699    Schedule res = new Schedule();
22700    parseScheduleProperties(json, res);
22701    return res;
22702  }
22703
22704  protected void parseScheduleProperties(JsonObject json, Schedule res) throws IOException, FHIRFormatError {
22705    parseDomainResourceProperties(json, res);
22706    if (json.has("identifier")) {
22707      JsonArray array = json.getAsJsonArray("identifier");
22708      for (int i = 0; i < array.size(); i++) {
22709        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22710      }
22711    };
22712    if (json.has("active"))
22713      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
22714    if (json.has("_active"))
22715      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
22716    if (json.has("serviceCategory")) {
22717      JsonArray array = json.getAsJsonArray("serviceCategory");
22718      for (int i = 0; i < array.size(); i++) {
22719        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22720      }
22721    };
22722    if (json.has("serviceType")) {
22723      JsonArray array = json.getAsJsonArray("serviceType");
22724      for (int i = 0; i < array.size(); i++) {
22725        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22726      }
22727    };
22728    if (json.has("specialty")) {
22729      JsonArray array = json.getAsJsonArray("specialty");
22730      for (int i = 0; i < array.size(); i++) {
22731        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22732      }
22733    };
22734    if (json.has("actor")) {
22735      JsonArray array = json.getAsJsonArray("actor");
22736      for (int i = 0; i < array.size(); i++) {
22737        res.getActor().add(parseReference(array.get(i).getAsJsonObject()));
22738      }
22739    };
22740    if (json.has("planningHorizon"))
22741      res.setPlanningHorizon(parsePeriod(getJObject(json, "planningHorizon")));
22742    if (json.has("comment"))
22743      res.setCommentElement(parseString(json.get("comment").getAsString()));
22744    if (json.has("_comment"))
22745      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
22746  }
22747
22748  protected SearchParameter parseSearchParameter(JsonObject json) throws IOException, FHIRFormatError {
22749    SearchParameter res = new SearchParameter();
22750    parseSearchParameterProperties(json, res);
22751    return res;
22752  }
22753
22754  protected void parseSearchParameterProperties(JsonObject json, SearchParameter res) throws IOException, FHIRFormatError {
22755    parseDomainResourceProperties(json, res);
22756    if (json.has("url"))
22757      res.setUrlElement(parseUri(json.get("url").getAsString()));
22758    if (json.has("_url"))
22759      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
22760    if (json.has("version"))
22761      res.setVersionElement(parseString(json.get("version").getAsString()));
22762    if (json.has("_version"))
22763      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
22764    if (json.has("name"))
22765      res.setNameElement(parseString(json.get("name").getAsString()));
22766    if (json.has("_name"))
22767      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
22768    if (json.has("derivedFrom"))
22769      res.setDerivedFromElement(parseCanonical(json.get("derivedFrom").getAsString()));
22770    if (json.has("_derivedFrom"))
22771      parseElementProperties(getJObject(json, "_derivedFrom"), res.getDerivedFromElement());
22772    if (json.has("status"))
22773      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
22774    if (json.has("_status"))
22775      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
22776    if (json.has("experimental"))
22777      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
22778    if (json.has("_experimental"))
22779      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
22780    if (json.has("date"))
22781      res.setDateElement(parseDateTime(json.get("date").getAsString()));
22782    if (json.has("_date"))
22783      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
22784    if (json.has("publisher"))
22785      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
22786    if (json.has("_publisher"))
22787      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
22788    if (json.has("contact")) {
22789      JsonArray array = json.getAsJsonArray("contact");
22790      for (int i = 0; i < array.size(); i++) {
22791        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
22792      }
22793    };
22794    if (json.has("description"))
22795      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22796    if (json.has("_description"))
22797      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
22798    if (json.has("useContext")) {
22799      JsonArray array = json.getAsJsonArray("useContext");
22800      for (int i = 0; i < array.size(); i++) {
22801        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
22802      }
22803    };
22804    if (json.has("jurisdiction")) {
22805      JsonArray array = json.getAsJsonArray("jurisdiction");
22806      for (int i = 0; i < array.size(); i++) {
22807        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22808      }
22809    };
22810    if (json.has("purpose"))
22811      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
22812    if (json.has("_purpose"))
22813      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
22814    if (json.has("code"))
22815      res.setCodeElement(parseCode(json.get("code").getAsString()));
22816    if (json.has("_code"))
22817      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
22818    if (json.has("base")) {
22819      JsonArray array = json.getAsJsonArray("base");
22820      for (int i = 0; i < array.size(); i++) {
22821        res.getBase().add(parseCode(array.get(i).getAsString()));
22822      }
22823    };
22824    if (json.has("_base")) {
22825      JsonArray array = json.getAsJsonArray("_base");
22826      for (int i = 0; i < array.size(); i++) {
22827        if (i == res.getBase().size())
22828          res.getBase().add(parseCode(null));
22829        if (array.get(i) instanceof JsonObject) 
22830          parseElementProperties(array.get(i).getAsJsonObject(), res.getBase().get(i));
22831      }
22832    };
22833    if (json.has("type"))
22834      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
22835    if (json.has("_type"))
22836      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
22837    if (json.has("expression"))
22838      res.setExpressionElement(parseString(json.get("expression").getAsString()));
22839    if (json.has("_expression"))
22840      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
22841    if (json.has("xpath"))
22842      res.setXpathElement(parseString(json.get("xpath").getAsString()));
22843    if (json.has("_xpath"))
22844      parseElementProperties(getJObject(json, "_xpath"), res.getXpathElement());
22845    if (json.has("xpathUsage"))
22846      res.setXpathUsageElement(parseEnumeration(json.get("xpathUsage").getAsString(), SearchParameter.XPathUsageType.NULL, new SearchParameter.XPathUsageTypeEnumFactory()));
22847    if (json.has("_xpathUsage"))
22848      parseElementProperties(getJObject(json, "_xpathUsage"), res.getXpathUsageElement());
22849    if (json.has("target")) {
22850      JsonArray array = json.getAsJsonArray("target");
22851      for (int i = 0; i < array.size(); i++) {
22852        res.getTarget().add(parseCode(array.get(i).getAsString()));
22853      }
22854    };
22855    if (json.has("_target")) {
22856      JsonArray array = json.getAsJsonArray("_target");
22857      for (int i = 0; i < array.size(); i++) {
22858        if (i == res.getTarget().size())
22859          res.getTarget().add(parseCode(null));
22860        if (array.get(i) instanceof JsonObject) 
22861          parseElementProperties(array.get(i).getAsJsonObject(), res.getTarget().get(i));
22862      }
22863    };
22864    if (json.has("multipleOr"))
22865      res.setMultipleOrElement(parseBoolean(json.get("multipleOr").getAsBoolean()));
22866    if (json.has("_multipleOr"))
22867      parseElementProperties(getJObject(json, "_multipleOr"), res.getMultipleOrElement());
22868    if (json.has("multipleAnd"))
22869      res.setMultipleAndElement(parseBoolean(json.get("multipleAnd").getAsBoolean()));
22870    if (json.has("_multipleAnd"))
22871      parseElementProperties(getJObject(json, "_multipleAnd"), res.getMultipleAndElement());
22872    if (json.has("comparator")) {
22873      JsonArray array = json.getAsJsonArray("comparator");
22874      for (int i = 0; i < array.size(); i++) {
22875        res.getComparator().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
22876      }
22877    };
22878    if (json.has("_comparator")) {
22879      JsonArray array = json.getAsJsonArray("_comparator");
22880      for (int i = 0; i < array.size(); i++) {
22881        if (i == res.getComparator().size())
22882          res.getComparator().add(parseEnumeration(null, SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
22883        if (array.get(i) instanceof JsonObject) 
22884          parseElementProperties(array.get(i).getAsJsonObject(), res.getComparator().get(i));
22885      }
22886    };
22887    if (json.has("modifier")) {
22888      JsonArray array = json.getAsJsonArray("modifier");
22889      for (int i = 0; i < array.size(); i++) {
22890        res.getModifier().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
22891      }
22892    };
22893    if (json.has("_modifier")) {
22894      JsonArray array = json.getAsJsonArray("_modifier");
22895      for (int i = 0; i < array.size(); i++) {
22896        if (i == res.getModifier().size())
22897          res.getModifier().add(parseEnumeration(null, SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
22898        if (array.get(i) instanceof JsonObject) 
22899          parseElementProperties(array.get(i).getAsJsonObject(), res.getModifier().get(i));
22900      }
22901    };
22902    if (json.has("chain")) {
22903      JsonArray array = json.getAsJsonArray("chain");
22904      for (int i = 0; i < array.size(); i++) {
22905        res.getChain().add(parseString(array.get(i).getAsString()));
22906      }
22907    };
22908    if (json.has("_chain")) {
22909      JsonArray array = json.getAsJsonArray("_chain");
22910      for (int i = 0; i < array.size(); i++) {
22911        if (i == res.getChain().size())
22912          res.getChain().add(parseString(null));
22913        if (array.get(i) instanceof JsonObject) 
22914          parseElementProperties(array.get(i).getAsJsonObject(), res.getChain().get(i));
22915      }
22916    };
22917    if (json.has("component")) {
22918      JsonArray array = json.getAsJsonArray("component");
22919      for (int i = 0; i < array.size(); i++) {
22920        res.getComponent().add(parseSearchParameterSearchParameterComponentComponent(array.get(i).getAsJsonObject(), res));
22921      }
22922    };
22923  }
22924
22925  protected SearchParameter.SearchParameterComponentComponent parseSearchParameterSearchParameterComponentComponent(JsonObject json, SearchParameter owner) throws IOException, FHIRFormatError {
22926    SearchParameter.SearchParameterComponentComponent res = new SearchParameter.SearchParameterComponentComponent();
22927    parseSearchParameterSearchParameterComponentComponentProperties(json, owner, res);
22928    return res;
22929  }
22930
22931  protected void parseSearchParameterSearchParameterComponentComponentProperties(JsonObject json, SearchParameter owner, SearchParameter.SearchParameterComponentComponent res) throws IOException, FHIRFormatError {
22932    parseBackboneElementProperties(json, res);
22933    if (json.has("definition"))
22934      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
22935    if (json.has("_definition"))
22936      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
22937    if (json.has("expression"))
22938      res.setExpressionElement(parseString(json.get("expression").getAsString()));
22939    if (json.has("_expression"))
22940      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
22941  }
22942
22943  protected ServiceRequest parseServiceRequest(JsonObject json) throws IOException, FHIRFormatError {
22944    ServiceRequest res = new ServiceRequest();
22945    parseServiceRequestProperties(json, res);
22946    return res;
22947  }
22948
22949  protected void parseServiceRequestProperties(JsonObject json, ServiceRequest res) throws IOException, FHIRFormatError {
22950    parseDomainResourceProperties(json, res);
22951    if (json.has("identifier")) {
22952      JsonArray array = json.getAsJsonArray("identifier");
22953      for (int i = 0; i < array.size(); i++) {
22954        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22955      }
22956    };
22957    if (json.has("instantiatesCanonical")) {
22958      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
22959      for (int i = 0; i < array.size(); i++) {
22960        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
22961      }
22962    };
22963    if (json.has("_instantiatesCanonical")) {
22964      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
22965      for (int i = 0; i < array.size(); i++) {
22966        if (i == res.getInstantiatesCanonical().size())
22967          res.getInstantiatesCanonical().add(parseCanonical(null));
22968        if (array.get(i) instanceof JsonObject) 
22969          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
22970      }
22971    };
22972    if (json.has("instantiatesUri")) {
22973      JsonArray array = json.getAsJsonArray("instantiatesUri");
22974      for (int i = 0; i < array.size(); i++) {
22975        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
22976      }
22977    };
22978    if (json.has("_instantiatesUri")) {
22979      JsonArray array = json.getAsJsonArray("_instantiatesUri");
22980      for (int i = 0; i < array.size(); i++) {
22981        if (i == res.getInstantiatesUri().size())
22982          res.getInstantiatesUri().add(parseUri(null));
22983        if (array.get(i) instanceof JsonObject) 
22984          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
22985      }
22986    };
22987    if (json.has("basedOn")) {
22988      JsonArray array = json.getAsJsonArray("basedOn");
22989      for (int i = 0; i < array.size(); i++) {
22990        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
22991      }
22992    };
22993    if (json.has("replaces")) {
22994      JsonArray array = json.getAsJsonArray("replaces");
22995      for (int i = 0; i < array.size(); i++) {
22996        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
22997      }
22998    };
22999    if (json.has("requisition"))
23000      res.setRequisition(parseIdentifier(getJObject(json, "requisition")));
23001    if (json.has("status"))
23002      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ServiceRequest.ServiceRequestStatus.NULL, new ServiceRequest.ServiceRequestStatusEnumFactory()));
23003    if (json.has("_status"))
23004      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
23005    if (json.has("intent"))
23006      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), ServiceRequest.ServiceRequestIntent.NULL, new ServiceRequest.ServiceRequestIntentEnumFactory()));
23007    if (json.has("_intent"))
23008      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
23009    if (json.has("category")) {
23010      JsonArray array = json.getAsJsonArray("category");
23011      for (int i = 0; i < array.size(); i++) {
23012        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23013      }
23014    };
23015    if (json.has("priority"))
23016      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ServiceRequest.ServiceRequestPriority.NULL, new ServiceRequest.ServiceRequestPriorityEnumFactory()));
23017    if (json.has("_priority"))
23018      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
23019    if (json.has("doNotPerform"))
23020      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
23021    if (json.has("_doNotPerform"))
23022      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
23023    if (json.has("code"))
23024      res.setCode(parseCodeableConcept(getJObject(json, "code")));
23025    if (json.has("orderDetail")) {
23026      JsonArray array = json.getAsJsonArray("orderDetail");
23027      for (int i = 0; i < array.size(); i++) {
23028        res.getOrderDetail().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23029      }
23030    };
23031    Type quantity = parseType("quantity", json);
23032    if (quantity != null)
23033      res.setQuantity(quantity);
23034    if (json.has("subject"))
23035      res.setSubject(parseReference(getJObject(json, "subject")));
23036    if (json.has("encounter"))
23037      res.setEncounter(parseReference(getJObject(json, "encounter")));
23038    Type occurrence = parseType("occurrence", json);
23039    if (occurrence != null)
23040      res.setOccurrence(occurrence);
23041    Type asNeeded = parseType("asNeeded", json);
23042    if (asNeeded != null)
23043      res.setAsNeeded(asNeeded);
23044    if (json.has("authoredOn"))
23045      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
23046    if (json.has("_authoredOn"))
23047      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
23048    if (json.has("requester"))
23049      res.setRequester(parseReference(getJObject(json, "requester")));
23050    if (json.has("performerType"))
23051      res.setPerformerType(parseCodeableConcept(getJObject(json, "performerType")));
23052    if (json.has("performer")) {
23053      JsonArray array = json.getAsJsonArray("performer");
23054      for (int i = 0; i < array.size(); i++) {
23055        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
23056      }
23057    };
23058    if (json.has("locationCode")) {
23059      JsonArray array = json.getAsJsonArray("locationCode");
23060      for (int i = 0; i < array.size(); i++) {
23061        res.getLocationCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23062      }
23063    };
23064    if (json.has("locationReference")) {
23065      JsonArray array = json.getAsJsonArray("locationReference");
23066      for (int i = 0; i < array.size(); i++) {
23067        res.getLocationReference().add(parseReference(array.get(i).getAsJsonObject()));
23068      }
23069    };
23070    if (json.has("reasonCode")) {
23071      JsonArray array = json.getAsJsonArray("reasonCode");
23072      for (int i = 0; i < array.size(); i++) {
23073        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23074      }
23075    };
23076    if (json.has("reasonReference")) {
23077      JsonArray array = json.getAsJsonArray("reasonReference");
23078      for (int i = 0; i < array.size(); i++) {
23079        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
23080      }
23081    };
23082    if (json.has("insurance")) {
23083      JsonArray array = json.getAsJsonArray("insurance");
23084      for (int i = 0; i < array.size(); i++) {
23085        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
23086      }
23087    };
23088    if (json.has("supportingInfo")) {
23089      JsonArray array = json.getAsJsonArray("supportingInfo");
23090      for (int i = 0; i < array.size(); i++) {
23091        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
23092      }
23093    };
23094    if (json.has("specimen")) {
23095      JsonArray array = json.getAsJsonArray("specimen");
23096      for (int i = 0; i < array.size(); i++) {
23097        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
23098      }
23099    };
23100    if (json.has("bodySite")) {
23101      JsonArray array = json.getAsJsonArray("bodySite");
23102      for (int i = 0; i < array.size(); i++) {
23103        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23104      }
23105    };
23106    if (json.has("note")) {
23107      JsonArray array = json.getAsJsonArray("note");
23108      for (int i = 0; i < array.size(); i++) {
23109        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
23110      }
23111    };
23112    if (json.has("patientInstruction"))
23113      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
23114    if (json.has("_patientInstruction"))
23115      parseElementProperties(getJObject(json, "_patientInstruction"), res.getPatientInstructionElement());
23116    if (json.has("relevantHistory")) {
23117      JsonArray array = json.getAsJsonArray("relevantHistory");
23118      for (int i = 0; i < array.size(); i++) {
23119        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
23120      }
23121    };
23122  }
23123
23124  protected Slot parseSlot(JsonObject json) throws IOException, FHIRFormatError {
23125    Slot res = new Slot();
23126    parseSlotProperties(json, res);
23127    return res;
23128  }
23129
23130  protected void parseSlotProperties(JsonObject json, Slot res) throws IOException, FHIRFormatError {
23131    parseDomainResourceProperties(json, res);
23132    if (json.has("identifier")) {
23133      JsonArray array = json.getAsJsonArray("identifier");
23134      for (int i = 0; i < array.size(); i++) {
23135        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23136      }
23137    };
23138    if (json.has("serviceCategory")) {
23139      JsonArray array = json.getAsJsonArray("serviceCategory");
23140      for (int i = 0; i < array.size(); i++) {
23141        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23142      }
23143    };
23144    if (json.has("serviceType")) {
23145      JsonArray array = json.getAsJsonArray("serviceType");
23146      for (int i = 0; i < array.size(); i++) {
23147        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23148      }
23149    };
23150    if (json.has("specialty")) {
23151      JsonArray array = json.getAsJsonArray("specialty");
23152      for (int i = 0; i < array.size(); i++) {
23153        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23154      }
23155    };
23156    if (json.has("appointmentType"))
23157      res.setAppointmentType(parseCodeableConcept(getJObject(json, "appointmentType")));
23158    if (json.has("schedule"))
23159      res.setSchedule(parseReference(getJObject(json, "schedule")));
23160    if (json.has("status"))
23161      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Slot.SlotStatus.NULL, new Slot.SlotStatusEnumFactory()));
23162    if (json.has("_status"))
23163      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
23164    if (json.has("start"))
23165      res.setStartElement(parseInstant(json.get("start").getAsString()));
23166    if (json.has("_start"))
23167      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
23168    if (json.has("end"))
23169      res.setEndElement(parseInstant(json.get("end").getAsString()));
23170    if (json.has("_end"))
23171      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
23172    if (json.has("overbooked"))
23173      res.setOverbookedElement(parseBoolean(json.get("overbooked").getAsBoolean()));
23174    if (json.has("_overbooked"))
23175      parseElementProperties(getJObject(json, "_overbooked"), res.getOverbookedElement());
23176    if (json.has("comment"))
23177      res.setCommentElement(parseString(json.get("comment").getAsString()));
23178    if (json.has("_comment"))
23179      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
23180  }
23181
23182  protected Specimen parseSpecimen(JsonObject json) throws IOException, FHIRFormatError {
23183    Specimen res = new Specimen();
23184    parseSpecimenProperties(json, res);
23185    return res;
23186  }
23187
23188  protected void parseSpecimenProperties(JsonObject json, Specimen res) throws IOException, FHIRFormatError {
23189    parseDomainResourceProperties(json, res);
23190    if (json.has("identifier")) {
23191      JsonArray array = json.getAsJsonArray("identifier");
23192      for (int i = 0; i < array.size(); i++) {
23193        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23194      }
23195    };
23196    if (json.has("accessionIdentifier"))
23197      res.setAccessionIdentifier(parseIdentifier(getJObject(json, "accessionIdentifier")));
23198    if (json.has("status"))
23199      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Specimen.SpecimenStatus.NULL, new Specimen.SpecimenStatusEnumFactory()));
23200    if (json.has("_status"))
23201      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
23202    if (json.has("type"))
23203      res.setType(parseCodeableConcept(getJObject(json, "type")));
23204    if (json.has("subject"))
23205      res.setSubject(parseReference(getJObject(json, "subject")));
23206    if (json.has("receivedTime"))
23207      res.setReceivedTimeElement(parseDateTime(json.get("receivedTime").getAsString()));
23208    if (json.has("_receivedTime"))
23209      parseElementProperties(getJObject(json, "_receivedTime"), res.getReceivedTimeElement());
23210    if (json.has("parent")) {
23211      JsonArray array = json.getAsJsonArray("parent");
23212      for (int i = 0; i < array.size(); i++) {
23213        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
23214      }
23215    };
23216    if (json.has("request")) {
23217      JsonArray array = json.getAsJsonArray("request");
23218      for (int i = 0; i < array.size(); i++) {
23219        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
23220      }
23221    };
23222    if (json.has("collection"))
23223      res.setCollection(parseSpecimenSpecimenCollectionComponent(getJObject(json, "collection"), res));
23224    if (json.has("processing")) {
23225      JsonArray array = json.getAsJsonArray("processing");
23226      for (int i = 0; i < array.size(); i++) {
23227        res.getProcessing().add(parseSpecimenSpecimenProcessingComponent(array.get(i).getAsJsonObject(), res));
23228      }
23229    };
23230    if (json.has("container")) {
23231      JsonArray array = json.getAsJsonArray("container");
23232      for (int i = 0; i < array.size(); i++) {
23233        res.getContainer().add(parseSpecimenSpecimenContainerComponent(array.get(i).getAsJsonObject(), res));
23234      }
23235    };
23236    if (json.has("condition")) {
23237      JsonArray array = json.getAsJsonArray("condition");
23238      for (int i = 0; i < array.size(); i++) {
23239        res.getCondition().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23240      }
23241    };
23242    if (json.has("note")) {
23243      JsonArray array = json.getAsJsonArray("note");
23244      for (int i = 0; i < array.size(); i++) {
23245        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
23246      }
23247    };
23248  }
23249
23250  protected Specimen.SpecimenCollectionComponent parseSpecimenSpecimenCollectionComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
23251    Specimen.SpecimenCollectionComponent res = new Specimen.SpecimenCollectionComponent();
23252    parseSpecimenSpecimenCollectionComponentProperties(json, owner, res);
23253    return res;
23254  }
23255
23256  protected void parseSpecimenSpecimenCollectionComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenCollectionComponent res) throws IOException, FHIRFormatError {
23257    parseBackboneElementProperties(json, res);
23258    if (json.has("collector"))
23259      res.setCollector(parseReference(getJObject(json, "collector")));
23260    Type collected = parseType("collected", json);
23261    if (collected != null)
23262      res.setCollected(collected);
23263    if (json.has("duration"))
23264      res.setDuration(parseDuration(getJObject(json, "duration")));
23265    if (json.has("quantity"))
23266      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
23267    if (json.has("method"))
23268      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
23269    if (json.has("bodySite"))
23270      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
23271    Type fastingStatus = parseType("fastingStatus", json);
23272    if (fastingStatus != null)
23273      res.setFastingStatus(fastingStatus);
23274  }
23275
23276  protected Specimen.SpecimenProcessingComponent parseSpecimenSpecimenProcessingComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
23277    Specimen.SpecimenProcessingComponent res = new Specimen.SpecimenProcessingComponent();
23278    parseSpecimenSpecimenProcessingComponentProperties(json, owner, res);
23279    return res;
23280  }
23281
23282  protected void parseSpecimenSpecimenProcessingComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenProcessingComponent res) throws IOException, FHIRFormatError {
23283    parseBackboneElementProperties(json, res);
23284    if (json.has("description"))
23285      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23286    if (json.has("_description"))
23287      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
23288    if (json.has("procedure"))
23289      res.setProcedure(parseCodeableConcept(getJObject(json, "procedure")));
23290    if (json.has("additive")) {
23291      JsonArray array = json.getAsJsonArray("additive");
23292      for (int i = 0; i < array.size(); i++) {
23293        res.getAdditive().add(parseReference(array.get(i).getAsJsonObject()));
23294      }
23295    };
23296    Type time = parseType("time", json);
23297    if (time != null)
23298      res.setTime(time);
23299  }
23300
23301  protected Specimen.SpecimenContainerComponent parseSpecimenSpecimenContainerComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
23302    Specimen.SpecimenContainerComponent res = new Specimen.SpecimenContainerComponent();
23303    parseSpecimenSpecimenContainerComponentProperties(json, owner, res);
23304    return res;
23305  }
23306
23307  protected void parseSpecimenSpecimenContainerComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenContainerComponent res) throws IOException, FHIRFormatError {
23308    parseBackboneElementProperties(json, res);
23309    if (json.has("identifier")) {
23310      JsonArray array = json.getAsJsonArray("identifier");
23311      for (int i = 0; i < array.size(); i++) {
23312        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23313      }
23314    };
23315    if (json.has("description"))
23316      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23317    if (json.has("_description"))
23318      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
23319    if (json.has("type"))
23320      res.setType(parseCodeableConcept(getJObject(json, "type")));
23321    if (json.has("capacity"))
23322      res.setCapacity(parseQuantity(getJObject(json, "capacity")));
23323    if (json.has("specimenQuantity"))
23324      res.setSpecimenQuantity(parseQuantity(getJObject(json, "specimenQuantity")));
23325    Type additive = parseType("additive", json);
23326    if (additive != null)
23327      res.setAdditive(additive);
23328  }
23329
23330  protected SpecimenDefinition parseSpecimenDefinition(JsonObject json) throws IOException, FHIRFormatError {
23331    SpecimenDefinition res = new SpecimenDefinition();
23332    parseSpecimenDefinitionProperties(json, res);
23333    return res;
23334  }
23335
23336  protected void parseSpecimenDefinitionProperties(JsonObject json, SpecimenDefinition res) throws IOException, FHIRFormatError {
23337    parseDomainResourceProperties(json, res);
23338    if (json.has("identifier"))
23339      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
23340    if (json.has("typeCollected"))
23341      res.setTypeCollected(parseCodeableConcept(getJObject(json, "typeCollected")));
23342    if (json.has("patientPreparation")) {
23343      JsonArray array = json.getAsJsonArray("patientPreparation");
23344      for (int i = 0; i < array.size(); i++) {
23345        res.getPatientPreparation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23346      }
23347    };
23348    if (json.has("timeAspect"))
23349      res.setTimeAspectElement(parseString(json.get("timeAspect").getAsString()));
23350    if (json.has("_timeAspect"))
23351      parseElementProperties(getJObject(json, "_timeAspect"), res.getTimeAspectElement());
23352    if (json.has("collection")) {
23353      JsonArray array = json.getAsJsonArray("collection");
23354      for (int i = 0; i < array.size(); i++) {
23355        res.getCollection().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23356      }
23357    };
23358    if (json.has("typeTested")) {
23359      JsonArray array = json.getAsJsonArray("typeTested");
23360      for (int i = 0; i < array.size(); i++) {
23361        res.getTypeTested().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(array.get(i).getAsJsonObject(), res));
23362      }
23363    };
23364  }
23365
23366  protected SpecimenDefinition.SpecimenDefinitionTypeTestedComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
23367    SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedComponent();
23368    parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponentProperties(json, owner, res);
23369    return res;
23370  }
23371
23372  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res) throws IOException, FHIRFormatError {
23373    parseBackboneElementProperties(json, res);
23374    if (json.has("isDerived"))
23375      res.setIsDerivedElement(parseBoolean(json.get("isDerived").getAsBoolean()));
23376    if (json.has("_isDerived"))
23377      parseElementProperties(getJObject(json, "_isDerived"), res.getIsDerivedElement());
23378    if (json.has("type"))
23379      res.setType(parseCodeableConcept(getJObject(json, "type")));
23380    if (json.has("preference"))
23381      res.setPreferenceElement(parseEnumeration(json.get("preference").getAsString(), SpecimenDefinition.SpecimenContainedPreference.NULL, new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory()));
23382    if (json.has("_preference"))
23383      parseElementProperties(getJObject(json, "_preference"), res.getPreferenceElement());
23384    if (json.has("container"))
23385      res.setContainer(parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(getJObject(json, "container"), owner));
23386    if (json.has("requirement"))
23387      res.setRequirementElement(parseString(json.get("requirement").getAsString()));
23388    if (json.has("_requirement"))
23389      parseElementProperties(getJObject(json, "_requirement"), res.getRequirementElement());
23390    if (json.has("retentionTime"))
23391      res.setRetentionTime(parseDuration(getJObject(json, "retentionTime")));
23392    if (json.has("rejectionCriterion")) {
23393      JsonArray array = json.getAsJsonArray("rejectionCriterion");
23394      for (int i = 0; i < array.size(); i++) {
23395        res.getRejectionCriterion().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23396      }
23397    };
23398    if (json.has("handling")) {
23399      JsonArray array = json.getAsJsonArray("handling");
23400      for (int i = 0; i < array.size(); i++) {
23401        res.getHandling().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(array.get(i).getAsJsonObject(), owner));
23402      }
23403    };
23404  }
23405
23406  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
23407    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent();
23408    parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentProperties(json, owner, res);
23409    return res;
23410  }
23411
23412  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res) throws IOException, FHIRFormatError {
23413    parseBackboneElementProperties(json, res);
23414    if (json.has("material"))
23415      res.setMaterial(parseCodeableConcept(getJObject(json, "material")));
23416    if (json.has("type"))
23417      res.setType(parseCodeableConcept(getJObject(json, "type")));
23418    if (json.has("cap"))
23419      res.setCap(parseCodeableConcept(getJObject(json, "cap")));
23420    if (json.has("description"))
23421      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23422    if (json.has("_description"))
23423      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
23424    if (json.has("capacity"))
23425      res.setCapacity(parseQuantity(getJObject(json, "capacity")));
23426    Type minimumVolume = parseType("minimumVolume", json);
23427    if (minimumVolume != null)
23428      res.setMinimumVolume(minimumVolume);
23429    if (json.has("additive")) {
23430      JsonArray array = json.getAsJsonArray("additive");
23431      for (int i = 0; i < array.size(); i++) {
23432        res.getAdditive().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(array.get(i).getAsJsonObject(), owner));
23433      }
23434    };
23435    if (json.has("preparation"))
23436      res.setPreparationElement(parseString(json.get("preparation").getAsString()));
23437    if (json.has("_preparation"))
23438      parseElementProperties(getJObject(json, "_preparation"), res.getPreparationElement());
23439  }
23440
23441  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
23442    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent();
23443    parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(json, owner, res);
23444    return res;
23445  }
23446
23447  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res) throws IOException, FHIRFormatError {
23448    parseBackboneElementProperties(json, res);
23449    Type additive = parseType("additive", json);
23450    if (additive != null)
23451      res.setAdditive(additive);
23452  }
23453
23454  protected SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
23455    SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent();
23456    parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentProperties(json, owner, res);
23457    return res;
23458  }
23459
23460  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res) throws IOException, FHIRFormatError {
23461    parseBackboneElementProperties(json, res);
23462    if (json.has("temperatureQualifier"))
23463      res.setTemperatureQualifier(parseCodeableConcept(getJObject(json, "temperatureQualifier")));
23464    if (json.has("temperatureRange"))
23465      res.setTemperatureRange(parseRange(getJObject(json, "temperatureRange")));
23466    if (json.has("maxDuration"))
23467      res.setMaxDuration(parseDuration(getJObject(json, "maxDuration")));
23468    if (json.has("instruction"))
23469      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
23470    if (json.has("_instruction"))
23471      parseElementProperties(getJObject(json, "_instruction"), res.getInstructionElement());
23472  }
23473
23474  protected StructureDefinition parseStructureDefinition(JsonObject json) throws IOException, FHIRFormatError {
23475    StructureDefinition res = new StructureDefinition();
23476    parseStructureDefinitionProperties(json, res);
23477    return res;
23478  }
23479
23480  protected void parseStructureDefinitionProperties(JsonObject json, StructureDefinition res) throws IOException, FHIRFormatError {
23481    parseDomainResourceProperties(json, res);
23482    if (json.has("url"))
23483      res.setUrlElement(parseUri(json.get("url").getAsString()));
23484    if (json.has("_url"))
23485      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
23486    if (json.has("identifier")) {
23487      JsonArray array = json.getAsJsonArray("identifier");
23488      for (int i = 0; i < array.size(); i++) {
23489        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23490      }
23491    };
23492    if (json.has("version"))
23493      res.setVersionElement(parseString(json.get("version").getAsString()));
23494    if (json.has("_version"))
23495      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
23496    if (json.has("name"))
23497      res.setNameElement(parseString(json.get("name").getAsString()));
23498    if (json.has("_name"))
23499      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
23500    if (json.has("title"))
23501      res.setTitleElement(parseString(json.get("title").getAsString()));
23502    if (json.has("_title"))
23503      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
23504    if (json.has("status"))
23505      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
23506    if (json.has("_status"))
23507      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
23508    if (json.has("experimental"))
23509      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
23510    if (json.has("_experimental"))
23511      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
23512    if (json.has("date"))
23513      res.setDateElement(parseDateTime(json.get("date").getAsString()));
23514    if (json.has("_date"))
23515      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
23516    if (json.has("publisher"))
23517      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
23518    if (json.has("_publisher"))
23519      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
23520    if (json.has("contact")) {
23521      JsonArray array = json.getAsJsonArray("contact");
23522      for (int i = 0; i < array.size(); i++) {
23523        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
23524      }
23525    };
23526    if (json.has("description"))
23527      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
23528    if (json.has("_description"))
23529      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
23530    if (json.has("useContext")) {
23531      JsonArray array = json.getAsJsonArray("useContext");
23532      for (int i = 0; i < array.size(); i++) {
23533        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
23534      }
23535    };
23536    if (json.has("jurisdiction")) {
23537      JsonArray array = json.getAsJsonArray("jurisdiction");
23538      for (int i = 0; i < array.size(); i++) {
23539        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23540      }
23541    };
23542    if (json.has("purpose"))
23543      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
23544    if (json.has("_purpose"))
23545      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
23546    if (json.has("copyright"))
23547      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
23548    if (json.has("_copyright"))
23549      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
23550    if (json.has("keyword")) {
23551      JsonArray array = json.getAsJsonArray("keyword");
23552      for (int i = 0; i < array.size(); i++) {
23553        res.getKeyword().add(parseCoding(array.get(i).getAsJsonObject()));
23554      }
23555    };
23556    if (json.has("fhirVersion"))
23557      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
23558    if (json.has("_fhirVersion"))
23559      parseElementProperties(getJObject(json, "_fhirVersion"), res.getFhirVersionElement());
23560    if (json.has("mapping")) {
23561      JsonArray array = json.getAsJsonArray("mapping");
23562      for (int i = 0; i < array.size(); i++) {
23563        res.getMapping().add(parseStructureDefinitionStructureDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
23564      }
23565    };
23566    if (json.has("kind"))
23567      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), StructureDefinition.StructureDefinitionKind.NULL, new StructureDefinition.StructureDefinitionKindEnumFactory()));
23568    if (json.has("_kind"))
23569      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
23570    if (json.has("abstract"))
23571      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
23572    if (json.has("_abstract"))
23573      parseElementProperties(getJObject(json, "_abstract"), res.getAbstractElement());
23574    if (json.has("context")) {
23575      JsonArray array = json.getAsJsonArray("context");
23576      for (int i = 0; i < array.size(); i++) {
23577        res.getContext().add(parseStructureDefinitionStructureDefinitionContextComponent(array.get(i).getAsJsonObject(), res));
23578      }
23579    };
23580    if (json.has("contextInvariant")) {
23581      JsonArray array = json.getAsJsonArray("contextInvariant");
23582      for (int i = 0; i < array.size(); i++) {
23583        res.getContextInvariant().add(parseString(array.get(i).getAsString()));
23584      }
23585    };
23586    if (json.has("_contextInvariant")) {
23587      JsonArray array = json.getAsJsonArray("_contextInvariant");
23588      for (int i = 0; i < array.size(); i++) {
23589        if (i == res.getContextInvariant().size())
23590          res.getContextInvariant().add(parseString(null));
23591        if (array.get(i) instanceof JsonObject) 
23592          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextInvariant().get(i));
23593      }
23594    };
23595    if (json.has("type"))
23596      res.setTypeElement(parseUri(json.get("type").getAsString()));
23597    if (json.has("_type"))
23598      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
23599    if (json.has("baseDefinition"))
23600      res.setBaseDefinitionElement(parseCanonical(json.get("baseDefinition").getAsString()));
23601    if (json.has("_baseDefinition"))
23602      parseElementProperties(getJObject(json, "_baseDefinition"), res.getBaseDefinitionElement());
23603    if (json.has("derivation"))
23604      res.setDerivationElement(parseEnumeration(json.get("derivation").getAsString(), StructureDefinition.TypeDerivationRule.NULL, new StructureDefinition.TypeDerivationRuleEnumFactory()));
23605    if (json.has("_derivation"))
23606      parseElementProperties(getJObject(json, "_derivation"), res.getDerivationElement());
23607    if (json.has("snapshot"))
23608      res.setSnapshot(parseStructureDefinitionStructureDefinitionSnapshotComponent(getJObject(json, "snapshot"), res));
23609    if (json.has("differential"))
23610      res.setDifferential(parseStructureDefinitionStructureDefinitionDifferentialComponent(getJObject(json, "differential"), res));
23611  }
23612
23613  protected StructureDefinition.StructureDefinitionMappingComponent parseStructureDefinitionStructureDefinitionMappingComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
23614    StructureDefinition.StructureDefinitionMappingComponent res = new StructureDefinition.StructureDefinitionMappingComponent();
23615    parseStructureDefinitionStructureDefinitionMappingComponentProperties(json, owner, res);
23616    return res;
23617  }
23618
23619  protected void parseStructureDefinitionStructureDefinitionMappingComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionMappingComponent res) throws IOException, FHIRFormatError {
23620    parseBackboneElementProperties(json, res);
23621    if (json.has("identity"))
23622      res.setIdentityElement(parseId(json.get("identity").getAsString()));
23623    if (json.has("_identity"))
23624      parseElementProperties(getJObject(json, "_identity"), res.getIdentityElement());
23625    if (json.has("uri"))
23626      res.setUriElement(parseUri(json.get("uri").getAsString()));
23627    if (json.has("_uri"))
23628      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
23629    if (json.has("name"))
23630      res.setNameElement(parseString(json.get("name").getAsString()));
23631    if (json.has("_name"))
23632      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
23633    if (json.has("comment"))
23634      res.setCommentElement(parseString(json.get("comment").getAsString()));
23635    if (json.has("_comment"))
23636      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
23637  }
23638
23639  protected StructureDefinition.StructureDefinitionContextComponent parseStructureDefinitionStructureDefinitionContextComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
23640    StructureDefinition.StructureDefinitionContextComponent res = new StructureDefinition.StructureDefinitionContextComponent();
23641    parseStructureDefinitionStructureDefinitionContextComponentProperties(json, owner, res);
23642    return res;
23643  }
23644
23645  protected void parseStructureDefinitionStructureDefinitionContextComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionContextComponent res) throws IOException, FHIRFormatError {
23646    parseBackboneElementProperties(json, res);
23647    if (json.has("type"))
23648      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), StructureDefinition.ExtensionContextType.NULL, new StructureDefinition.ExtensionContextTypeEnumFactory()));
23649    if (json.has("_type"))
23650      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
23651    if (json.has("expression"))
23652      res.setExpressionElement(parseString(json.get("expression").getAsString()));
23653    if (json.has("_expression"))
23654      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
23655  }
23656
23657  protected StructureDefinition.StructureDefinitionSnapshotComponent parseStructureDefinitionStructureDefinitionSnapshotComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
23658    StructureDefinition.StructureDefinitionSnapshotComponent res = new StructureDefinition.StructureDefinitionSnapshotComponent();
23659    parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(json, owner, res);
23660    return res;
23661  }
23662
23663  protected void parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionSnapshotComponent res) throws IOException, FHIRFormatError {
23664    parseBackboneElementProperties(json, res);
23665    if (json.has("element")) {
23666      JsonArray array = json.getAsJsonArray("element");
23667      for (int i = 0; i < array.size(); i++) {
23668        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
23669      }
23670    };
23671  }
23672
23673  protected StructureDefinition.StructureDefinitionDifferentialComponent parseStructureDefinitionStructureDefinitionDifferentialComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
23674    StructureDefinition.StructureDefinitionDifferentialComponent res = new StructureDefinition.StructureDefinitionDifferentialComponent();
23675    parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(json, owner, res);
23676    return res;
23677  }
23678
23679  protected void parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionDifferentialComponent res) throws IOException, FHIRFormatError {
23680    parseBackboneElementProperties(json, res);
23681    if (json.has("element")) {
23682      JsonArray array = json.getAsJsonArray("element");
23683      for (int i = 0; i < array.size(); i++) {
23684        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
23685      }
23686    };
23687  }
23688
23689  protected StructureMap parseStructureMap(JsonObject json) throws IOException, FHIRFormatError {
23690    StructureMap res = new StructureMap();
23691    parseStructureMapProperties(json, res);
23692    return res;
23693  }
23694
23695  protected void parseStructureMapProperties(JsonObject json, StructureMap res) throws IOException, FHIRFormatError {
23696    parseDomainResourceProperties(json, res);
23697    if (json.has("url"))
23698      res.setUrlElement(parseUri(json.get("url").getAsString()));
23699    if (json.has("_url"))
23700      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
23701    if (json.has("identifier")) {
23702      JsonArray array = json.getAsJsonArray("identifier");
23703      for (int i = 0; i < array.size(); i++) {
23704        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23705      }
23706    };
23707    if (json.has("version"))
23708      res.setVersionElement(parseString(json.get("version").getAsString()));
23709    if (json.has("_version"))
23710      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
23711    if (json.has("name"))
23712      res.setNameElement(parseString(json.get("name").getAsString()));
23713    if (json.has("_name"))
23714      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
23715    if (json.has("title"))
23716      res.setTitleElement(parseString(json.get("title").getAsString()));
23717    if (json.has("_title"))
23718      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
23719    if (json.has("status"))
23720      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
23721    if (json.has("_status"))
23722      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
23723    if (json.has("experimental"))
23724      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
23725    if (json.has("_experimental"))
23726      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
23727    if (json.has("date"))
23728      res.setDateElement(parseDateTime(json.get("date").getAsString()));
23729    if (json.has("_date"))
23730      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
23731    if (json.has("publisher"))
23732      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
23733    if (json.has("_publisher"))
23734      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
23735    if (json.has("contact")) {
23736      JsonArray array = json.getAsJsonArray("contact");
23737      for (int i = 0; i < array.size(); i++) {
23738        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
23739      }
23740    };
23741    if (json.has("description"))
23742      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
23743    if (json.has("_description"))
23744      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
23745    if (json.has("useContext")) {
23746      JsonArray array = json.getAsJsonArray("useContext");
23747      for (int i = 0; i < array.size(); i++) {
23748        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
23749      }
23750    };
23751    if (json.has("jurisdiction")) {
23752      JsonArray array = json.getAsJsonArray("jurisdiction");
23753      for (int i = 0; i < array.size(); i++) {
23754        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23755      }
23756    };
23757    if (json.has("purpose"))
23758      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
23759    if (json.has("_purpose"))
23760      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
23761    if (json.has("copyright"))
23762      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
23763    if (json.has("_copyright"))
23764      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
23765    if (json.has("structure")) {
23766      JsonArray array = json.getAsJsonArray("structure");
23767      for (int i = 0; i < array.size(); i++) {
23768        res.getStructure().add(parseStructureMapStructureMapStructureComponent(array.get(i).getAsJsonObject(), res));
23769      }
23770    };
23771    if (json.has("import")) {
23772      JsonArray array = json.getAsJsonArray("import");
23773      for (int i = 0; i < array.size(); i++) {
23774        res.getImport().add(parseCanonical(array.get(i).getAsString()));
23775      }
23776    };
23777    if (json.has("_import")) {
23778      JsonArray array = json.getAsJsonArray("_import");
23779      for (int i = 0; i < array.size(); i++) {
23780        if (i == res.getImport().size())
23781          res.getImport().add(parseCanonical(null));
23782        if (array.get(i) instanceof JsonObject) 
23783          parseElementProperties(array.get(i).getAsJsonObject(), res.getImport().get(i));
23784      }
23785    };
23786    if (json.has("group")) {
23787      JsonArray array = json.getAsJsonArray("group");
23788      for (int i = 0; i < array.size(); i++) {
23789        res.getGroup().add(parseStructureMapStructureMapGroupComponent(array.get(i).getAsJsonObject(), res));
23790      }
23791    };
23792  }
23793
23794  protected StructureMap.StructureMapStructureComponent parseStructureMapStructureMapStructureComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
23795    StructureMap.StructureMapStructureComponent res = new StructureMap.StructureMapStructureComponent();
23796    parseStructureMapStructureMapStructureComponentProperties(json, owner, res);
23797    return res;
23798  }
23799
23800  protected void parseStructureMapStructureMapStructureComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapStructureComponent res) throws IOException, FHIRFormatError {
23801    parseBackboneElementProperties(json, res);
23802    if (json.has("url"))
23803      res.setUrlElement(parseCanonical(json.get("url").getAsString()));
23804    if (json.has("_url"))
23805      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
23806    if (json.has("mode"))
23807      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapModelMode.NULL, new StructureMap.StructureMapModelModeEnumFactory()));
23808    if (json.has("_mode"))
23809      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
23810    if (json.has("alias"))
23811      res.setAliasElement(parseString(json.get("alias").getAsString()));
23812    if (json.has("_alias"))
23813      parseElementProperties(getJObject(json, "_alias"), res.getAliasElement());
23814    if (json.has("documentation"))
23815      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
23816    if (json.has("_documentation"))
23817      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
23818  }
23819
23820  protected StructureMap.StructureMapGroupComponent parseStructureMapStructureMapGroupComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
23821    StructureMap.StructureMapGroupComponent res = new StructureMap.StructureMapGroupComponent();
23822    parseStructureMapStructureMapGroupComponentProperties(json, owner, res);
23823    return res;
23824  }
23825
23826  protected void parseStructureMapStructureMapGroupComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupComponent res) throws IOException, FHIRFormatError {
23827    parseBackboneElementProperties(json, res);
23828    if (json.has("name"))
23829      res.setNameElement(parseId(json.get("name").getAsString()));
23830    if (json.has("_name"))
23831      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
23832    if (json.has("extends"))
23833      res.setExtendsElement(parseId(json.get("extends").getAsString()));
23834    if (json.has("_extends"))
23835      parseElementProperties(getJObject(json, "_extends"), res.getExtendsElement());
23836    if (json.has("typeMode"))
23837      res.setTypeModeElement(parseEnumeration(json.get("typeMode").getAsString(), StructureMap.StructureMapGroupTypeMode.NULL, new StructureMap.StructureMapGroupTypeModeEnumFactory()));
23838    if (json.has("_typeMode"))
23839      parseElementProperties(getJObject(json, "_typeMode"), res.getTypeModeElement());
23840    if (json.has("documentation"))
23841      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
23842    if (json.has("_documentation"))
23843      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
23844    if (json.has("input")) {
23845      JsonArray array = json.getAsJsonArray("input");
23846      for (int i = 0; i < array.size(); i++) {
23847        res.getInput().add(parseStructureMapStructureMapGroupInputComponent(array.get(i).getAsJsonObject(), owner));
23848      }
23849    };
23850    if (json.has("rule")) {
23851      JsonArray array = json.getAsJsonArray("rule");
23852      for (int i = 0; i < array.size(); i++) {
23853        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
23854      }
23855    };
23856  }
23857
23858  protected StructureMap.StructureMapGroupInputComponent parseStructureMapStructureMapGroupInputComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
23859    StructureMap.StructureMapGroupInputComponent res = new StructureMap.StructureMapGroupInputComponent();
23860    parseStructureMapStructureMapGroupInputComponentProperties(json, owner, res);
23861    return res;
23862  }
23863
23864  protected void parseStructureMapStructureMapGroupInputComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupInputComponent res) throws IOException, FHIRFormatError {
23865    parseBackboneElementProperties(json, res);
23866    if (json.has("name"))
23867      res.setNameElement(parseId(json.get("name").getAsString()));
23868    if (json.has("_name"))
23869      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
23870    if (json.has("type"))
23871      res.setTypeElement(parseString(json.get("type").getAsString()));
23872    if (json.has("_type"))
23873      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
23874    if (json.has("mode"))
23875      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapInputMode.NULL, new StructureMap.StructureMapInputModeEnumFactory()));
23876    if (json.has("_mode"))
23877      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
23878    if (json.has("documentation"))
23879      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
23880    if (json.has("_documentation"))
23881      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
23882  }
23883
23884  protected StructureMap.StructureMapGroupRuleComponent parseStructureMapStructureMapGroupRuleComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
23885    StructureMap.StructureMapGroupRuleComponent res = new StructureMap.StructureMapGroupRuleComponent();
23886    parseStructureMapStructureMapGroupRuleComponentProperties(json, owner, res);
23887    return res;
23888  }
23889
23890  protected void parseStructureMapStructureMapGroupRuleComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleComponent res) throws IOException, FHIRFormatError {
23891    parseBackboneElementProperties(json, res);
23892    if (json.has("name"))
23893      res.setNameElement(parseId(json.get("name").getAsString()));
23894    if (json.has("_name"))
23895      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
23896    if (json.has("source")) {
23897      JsonArray array = json.getAsJsonArray("source");
23898      for (int i = 0; i < array.size(); i++) {
23899        res.getSource().add(parseStructureMapStructureMapGroupRuleSourceComponent(array.get(i).getAsJsonObject(), owner));
23900      }
23901    };
23902    if (json.has("target")) {
23903      JsonArray array = json.getAsJsonArray("target");
23904      for (int i = 0; i < array.size(); i++) {
23905        res.getTarget().add(parseStructureMapStructureMapGroupRuleTargetComponent(array.get(i).getAsJsonObject(), owner));
23906      }
23907    };
23908    if (json.has("rule")) {
23909      JsonArray array = json.getAsJsonArray("rule");
23910      for (int i = 0; i < array.size(); i++) {
23911        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
23912      }
23913    };
23914    if (json.has("dependent")) {
23915      JsonArray array = json.getAsJsonArray("dependent");
23916      for (int i = 0; i < array.size(); i++) {
23917        res.getDependent().add(parseStructureMapStructureMapGroupRuleDependentComponent(array.get(i).getAsJsonObject(), owner));
23918      }
23919    };
23920    if (json.has("documentation"))
23921      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
23922    if (json.has("_documentation"))
23923      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
23924  }
23925
23926  protected StructureMap.StructureMapGroupRuleSourceComponent parseStructureMapStructureMapGroupRuleSourceComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
23927    StructureMap.StructureMapGroupRuleSourceComponent res = new StructureMap.StructureMapGroupRuleSourceComponent();
23928    parseStructureMapStructureMapGroupRuleSourceComponentProperties(json, owner, res);
23929    return res;
23930  }
23931
23932  protected void parseStructureMapStructureMapGroupRuleSourceComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleSourceComponent res) throws IOException, FHIRFormatError {
23933    parseBackboneElementProperties(json, res);
23934    if (json.has("context"))
23935      res.setContextElement(parseId(json.get("context").getAsString()));
23936    if (json.has("_context"))
23937      parseElementProperties(getJObject(json, "_context"), res.getContextElement());
23938    if (json.has("min"))
23939      res.setMinElement(parseInteger(json.get("min").getAsLong()));
23940    if (json.has("_min"))
23941      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
23942    if (json.has("max"))
23943      res.setMaxElement(parseString(json.get("max").getAsString()));
23944    if (json.has("_max"))
23945      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
23946    if (json.has("type"))
23947      res.setTypeElement(parseString(json.get("type").getAsString()));
23948    if (json.has("_type"))
23949      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
23950    Type defaultValue = parseType("defaultValue", json);
23951    if (defaultValue != null)
23952      res.setDefaultValue(defaultValue);
23953    if (json.has("element"))
23954      res.setElementElement(parseString(json.get("element").getAsString()));
23955    if (json.has("_element"))
23956      parseElementProperties(getJObject(json, "_element"), res.getElementElement());
23957    if (json.has("listMode"))
23958      res.setListModeElement(parseEnumeration(json.get("listMode").getAsString(), StructureMap.StructureMapSourceListMode.NULL, new StructureMap.StructureMapSourceListModeEnumFactory()));
23959    if (json.has("_listMode"))
23960      parseElementProperties(getJObject(json, "_listMode"), res.getListModeElement());
23961    if (json.has("variable"))
23962      res.setVariableElement(parseId(json.get("variable").getAsString()));
23963    if (json.has("_variable"))
23964      parseElementProperties(getJObject(json, "_variable"), res.getVariableElement());
23965    if (json.has("condition"))
23966      res.setConditionElement(parseString(json.get("condition").getAsString()));
23967    if (json.has("_condition"))
23968      parseElementProperties(getJObject(json, "_condition"), res.getConditionElement());
23969    if (json.has("check"))
23970      res.setCheckElement(parseString(json.get("check").getAsString()));
23971    if (json.has("_check"))
23972      parseElementProperties(getJObject(json, "_check"), res.getCheckElement());
23973    if (json.has("logMessage"))
23974      res.setLogMessageElement(parseString(json.get("logMessage").getAsString()));
23975    if (json.has("_logMessage"))
23976      parseElementProperties(getJObject(json, "_logMessage"), res.getLogMessageElement());
23977  }
23978
23979  protected StructureMap.StructureMapGroupRuleTargetComponent parseStructureMapStructureMapGroupRuleTargetComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
23980    StructureMap.StructureMapGroupRuleTargetComponent res = new StructureMap.StructureMapGroupRuleTargetComponent();
23981    parseStructureMapStructureMapGroupRuleTargetComponentProperties(json, owner, res);
23982    return res;
23983  }
23984
23985  protected void parseStructureMapStructureMapGroupRuleTargetComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleTargetComponent res) throws IOException, FHIRFormatError {
23986    parseBackboneElementProperties(json, res);
23987    if (json.has("context"))
23988      res.setContextElement(parseId(json.get("context").getAsString()));
23989    if (json.has("_context"))
23990      parseElementProperties(getJObject(json, "_context"), res.getContextElement());
23991    if (json.has("contextType"))
23992      res.setContextTypeElement(parseEnumeration(json.get("contextType").getAsString(), StructureMap.StructureMapContextType.NULL, new StructureMap.StructureMapContextTypeEnumFactory()));
23993    if (json.has("_contextType"))
23994      parseElementProperties(getJObject(json, "_contextType"), res.getContextTypeElement());
23995    if (json.has("element"))
23996      res.setElementElement(parseString(json.get("element").getAsString()));
23997    if (json.has("_element"))
23998      parseElementProperties(getJObject(json, "_element"), res.getElementElement());
23999    if (json.has("variable"))
24000      res.setVariableElement(parseId(json.get("variable").getAsString()));
24001    if (json.has("_variable"))
24002      parseElementProperties(getJObject(json, "_variable"), res.getVariableElement());
24003    if (json.has("listMode")) {
24004      JsonArray array = json.getAsJsonArray("listMode");
24005      for (int i = 0; i < array.size(); i++) {
24006        res.getListMode().add(parseEnumeration(array.get(i).getAsString(), StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
24007      }
24008    };
24009    if (json.has("_listMode")) {
24010      JsonArray array = json.getAsJsonArray("_listMode");
24011      for (int i = 0; i < array.size(); i++) {
24012        if (i == res.getListMode().size())
24013          res.getListMode().add(parseEnumeration(null, StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
24014        if (array.get(i) instanceof JsonObject) 
24015          parseElementProperties(array.get(i).getAsJsonObject(), res.getListMode().get(i));
24016      }
24017    };
24018    if (json.has("listRuleId"))
24019      res.setListRuleIdElement(parseId(json.get("listRuleId").getAsString()));
24020    if (json.has("_listRuleId"))
24021      parseElementProperties(getJObject(json, "_listRuleId"), res.getListRuleIdElement());
24022    if (json.has("transform"))
24023      res.setTransformElement(parseEnumeration(json.get("transform").getAsString(), StructureMap.StructureMapTransform.NULL, new StructureMap.StructureMapTransformEnumFactory()));
24024    if (json.has("_transform"))
24025      parseElementProperties(getJObject(json, "_transform"), res.getTransformElement());
24026    if (json.has("parameter")) {
24027      JsonArray array = json.getAsJsonArray("parameter");
24028      for (int i = 0; i < array.size(); i++) {
24029        res.getParameter().add(parseStructureMapStructureMapGroupRuleTargetParameterComponent(array.get(i).getAsJsonObject(), owner));
24030      }
24031    };
24032  }
24033
24034  protected StructureMap.StructureMapGroupRuleTargetParameterComponent parseStructureMapStructureMapGroupRuleTargetParameterComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24035    StructureMap.StructureMapGroupRuleTargetParameterComponent res = new StructureMap.StructureMapGroupRuleTargetParameterComponent();
24036    parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(json, owner, res);
24037    return res;
24038  }
24039
24040  protected void parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleTargetParameterComponent res) throws IOException, FHIRFormatError {
24041    parseBackboneElementProperties(json, res);
24042    Type value = parseType("value", json);
24043    if (value != null)
24044      res.setValue(value);
24045  }
24046
24047  protected StructureMap.StructureMapGroupRuleDependentComponent parseStructureMapStructureMapGroupRuleDependentComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24048    StructureMap.StructureMapGroupRuleDependentComponent res = new StructureMap.StructureMapGroupRuleDependentComponent();
24049    parseStructureMapStructureMapGroupRuleDependentComponentProperties(json, owner, res);
24050    return res;
24051  }
24052
24053  protected void parseStructureMapStructureMapGroupRuleDependentComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleDependentComponent res) throws IOException, FHIRFormatError {
24054    parseBackboneElementProperties(json, res);
24055    if (json.has("name"))
24056      res.setNameElement(parseId(json.get("name").getAsString()));
24057    if (json.has("_name"))
24058      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
24059    if (json.has("variable")) {
24060      JsonArray array = json.getAsJsonArray("variable");
24061      for (int i = 0; i < array.size(); i++) {
24062        res.getVariable().add(parseString(array.get(i).getAsString()));
24063      }
24064    };
24065    if (json.has("_variable")) {
24066      JsonArray array = json.getAsJsonArray("_variable");
24067      for (int i = 0; i < array.size(); i++) {
24068        if (i == res.getVariable().size())
24069          res.getVariable().add(parseString(null));
24070        if (array.get(i) instanceof JsonObject) 
24071          parseElementProperties(array.get(i).getAsJsonObject(), res.getVariable().get(i));
24072      }
24073    };
24074  }
24075
24076  protected Subscription parseSubscription(JsonObject json) throws IOException, FHIRFormatError {
24077    Subscription res = new Subscription();
24078    parseSubscriptionProperties(json, res);
24079    return res;
24080  }
24081
24082  protected void parseSubscriptionProperties(JsonObject json, Subscription res) throws IOException, FHIRFormatError {
24083    parseDomainResourceProperties(json, res);
24084    if (json.has("status"))
24085      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Subscription.SubscriptionStatus.NULL, new Subscription.SubscriptionStatusEnumFactory()));
24086    if (json.has("_status"))
24087      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
24088    if (json.has("contact")) {
24089      JsonArray array = json.getAsJsonArray("contact");
24090      for (int i = 0; i < array.size(); i++) {
24091        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
24092      }
24093    };
24094    if (json.has("end"))
24095      res.setEndElement(parseInstant(json.get("end").getAsString()));
24096    if (json.has("_end"))
24097      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
24098    if (json.has("reason"))
24099      res.setReasonElement(parseString(json.get("reason").getAsString()));
24100    if (json.has("_reason"))
24101      parseElementProperties(getJObject(json, "_reason"), res.getReasonElement());
24102    if (json.has("criteria"))
24103      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
24104    if (json.has("_criteria"))
24105      parseElementProperties(getJObject(json, "_criteria"), res.getCriteriaElement());
24106    if (json.has("error"))
24107      res.setErrorElement(parseString(json.get("error").getAsString()));
24108    if (json.has("_error"))
24109      parseElementProperties(getJObject(json, "_error"), res.getErrorElement());
24110    if (json.has("channel"))
24111      res.setChannel(parseSubscriptionSubscriptionChannelComponent(getJObject(json, "channel"), res));
24112  }
24113
24114  protected Subscription.SubscriptionChannelComponent parseSubscriptionSubscriptionChannelComponent(JsonObject json, Subscription owner) throws IOException, FHIRFormatError {
24115    Subscription.SubscriptionChannelComponent res = new Subscription.SubscriptionChannelComponent();
24116    parseSubscriptionSubscriptionChannelComponentProperties(json, owner, res);
24117    return res;
24118  }
24119
24120  protected void parseSubscriptionSubscriptionChannelComponentProperties(JsonObject json, Subscription owner, Subscription.SubscriptionChannelComponent res) throws IOException, FHIRFormatError {
24121    parseBackboneElementProperties(json, res);
24122    if (json.has("type"))
24123      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Subscription.SubscriptionChannelType.NULL, new Subscription.SubscriptionChannelTypeEnumFactory()));
24124    if (json.has("_type"))
24125      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
24126    if (json.has("endpoint"))
24127      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
24128    if (json.has("_endpoint"))
24129      parseElementProperties(getJObject(json, "_endpoint"), res.getEndpointElement());
24130    if (json.has("payload"))
24131      res.setPayloadElement(parseCode(json.get("payload").getAsString()));
24132    if (json.has("_payload"))
24133      parseElementProperties(getJObject(json, "_payload"), res.getPayloadElement());
24134    if (json.has("header")) {
24135      JsonArray array = json.getAsJsonArray("header");
24136      for (int i = 0; i < array.size(); i++) {
24137        res.getHeader().add(parseString(array.get(i).getAsString()));
24138      }
24139    };
24140    if (json.has("_header")) {
24141      JsonArray array = json.getAsJsonArray("_header");
24142      for (int i = 0; i < array.size(); i++) {
24143        if (i == res.getHeader().size())
24144          res.getHeader().add(parseString(null));
24145        if (array.get(i) instanceof JsonObject) 
24146          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
24147      }
24148    };
24149  }
24150
24151  protected Substance parseSubstance(JsonObject json) throws IOException, FHIRFormatError {
24152    Substance res = new Substance();
24153    parseSubstanceProperties(json, res);
24154    return res;
24155  }
24156
24157  protected void parseSubstanceProperties(JsonObject json, Substance res) throws IOException, FHIRFormatError {
24158    parseDomainResourceProperties(json, res);
24159    if (json.has("identifier")) {
24160      JsonArray array = json.getAsJsonArray("identifier");
24161      for (int i = 0; i < array.size(); i++) {
24162        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24163      }
24164    };
24165    if (json.has("status"))
24166      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Substance.FHIRSubstanceStatus.NULL, new Substance.FHIRSubstanceStatusEnumFactory()));
24167    if (json.has("_status"))
24168      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
24169    if (json.has("category")) {
24170      JsonArray array = json.getAsJsonArray("category");
24171      for (int i = 0; i < array.size(); i++) {
24172        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24173      }
24174    };
24175    if (json.has("code"))
24176      res.setCode(parseCodeableConcept(getJObject(json, "code")));
24177    if (json.has("description"))
24178      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24179    if (json.has("_description"))
24180      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
24181    if (json.has("instance")) {
24182      JsonArray array = json.getAsJsonArray("instance");
24183      for (int i = 0; i < array.size(); i++) {
24184        res.getInstance().add(parseSubstanceSubstanceInstanceComponent(array.get(i).getAsJsonObject(), res));
24185      }
24186    };
24187    if (json.has("ingredient")) {
24188      JsonArray array = json.getAsJsonArray("ingredient");
24189      for (int i = 0; i < array.size(); i++) {
24190        res.getIngredient().add(parseSubstanceSubstanceIngredientComponent(array.get(i).getAsJsonObject(), res));
24191      }
24192    };
24193  }
24194
24195  protected Substance.SubstanceInstanceComponent parseSubstanceSubstanceInstanceComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
24196    Substance.SubstanceInstanceComponent res = new Substance.SubstanceInstanceComponent();
24197    parseSubstanceSubstanceInstanceComponentProperties(json, owner, res);
24198    return res;
24199  }
24200
24201  protected void parseSubstanceSubstanceInstanceComponentProperties(JsonObject json, Substance owner, Substance.SubstanceInstanceComponent res) throws IOException, FHIRFormatError {
24202    parseBackboneElementProperties(json, res);
24203    if (json.has("identifier"))
24204      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
24205    if (json.has("expiry"))
24206      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
24207    if (json.has("_expiry"))
24208      parseElementProperties(getJObject(json, "_expiry"), res.getExpiryElement());
24209    if (json.has("quantity"))
24210      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
24211  }
24212
24213  protected Substance.SubstanceIngredientComponent parseSubstanceSubstanceIngredientComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
24214    Substance.SubstanceIngredientComponent res = new Substance.SubstanceIngredientComponent();
24215    parseSubstanceSubstanceIngredientComponentProperties(json, owner, res);
24216    return res;
24217  }
24218
24219  protected void parseSubstanceSubstanceIngredientComponentProperties(JsonObject json, Substance owner, Substance.SubstanceIngredientComponent res) throws IOException, FHIRFormatError {
24220    parseBackboneElementProperties(json, res);
24221    if (json.has("quantity"))
24222      res.setQuantity(parseRatio(getJObject(json, "quantity")));
24223    Type substance = parseType("substance", json);
24224    if (substance != null)
24225      res.setSubstance(substance);
24226  }
24227
24228  protected SubstanceNucleicAcid parseSubstanceNucleicAcid(JsonObject json) throws IOException, FHIRFormatError {
24229    SubstanceNucleicAcid res = new SubstanceNucleicAcid();
24230    parseSubstanceNucleicAcidProperties(json, res);
24231    return res;
24232  }
24233
24234  protected void parseSubstanceNucleicAcidProperties(JsonObject json, SubstanceNucleicAcid res) throws IOException, FHIRFormatError {
24235    parseDomainResourceProperties(json, res);
24236    if (json.has("sequenceType"))
24237      res.setSequenceType(parseCodeableConcept(getJObject(json, "sequenceType")));
24238    if (json.has("numberOfSubunits"))
24239      res.setNumberOfSubunitsElement(parseInteger(json.get("numberOfSubunits").getAsLong()));
24240    if (json.has("_numberOfSubunits"))
24241      parseElementProperties(getJObject(json, "_numberOfSubunits"), res.getNumberOfSubunitsElement());
24242    if (json.has("areaOfHybridisation"))
24243      res.setAreaOfHybridisationElement(parseString(json.get("areaOfHybridisation").getAsString()));
24244    if (json.has("_areaOfHybridisation"))
24245      parseElementProperties(getJObject(json, "_areaOfHybridisation"), res.getAreaOfHybridisationElement());
24246    if (json.has("oligoNucleotideType"))
24247      res.setOligoNucleotideType(parseCodeableConcept(getJObject(json, "oligoNucleotideType")));
24248    if (json.has("subunit")) {
24249      JsonArray array = json.getAsJsonArray("subunit");
24250      for (int i = 0; i < array.size(); i++) {
24251        res.getSubunit().add(parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(array.get(i).getAsJsonObject(), res));
24252      }
24253    };
24254  }
24255
24256  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(JsonObject json, SubstanceNucleicAcid owner) throws IOException, FHIRFormatError {
24257    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent();
24258    parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentProperties(json, owner, res);
24259    return res;
24260  }
24261
24262  protected void parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentProperties(JsonObject json, SubstanceNucleicAcid owner, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent res) throws IOException, FHIRFormatError {
24263    parseBackboneElementProperties(json, res);
24264    if (json.has("subunit"))
24265      res.setSubunitElement(parseInteger(json.get("subunit").getAsLong()));
24266    if (json.has("_subunit"))
24267      parseElementProperties(getJObject(json, "_subunit"), res.getSubunitElement());
24268    if (json.has("sequence"))
24269      res.setSequenceElement(parseString(json.get("sequence").getAsString()));
24270    if (json.has("_sequence"))
24271      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
24272    if (json.has("length"))
24273      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
24274    if (json.has("_length"))
24275      parseElementProperties(getJObject(json, "_length"), res.getLengthElement());
24276    if (json.has("sequenceAttachment"))
24277      res.setSequenceAttachment(parseAttachment(getJObject(json, "sequenceAttachment")));
24278    if (json.has("fivePrime"))
24279      res.setFivePrime(parseCodeableConcept(getJObject(json, "fivePrime")));
24280    if (json.has("threePrime"))
24281      res.setThreePrime(parseCodeableConcept(getJObject(json, "threePrime")));
24282    if (json.has("linkage")) {
24283      JsonArray array = json.getAsJsonArray("linkage");
24284      for (int i = 0; i < array.size(); i++) {
24285        res.getLinkage().add(parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(array.get(i).getAsJsonObject(), owner));
24286      }
24287    };
24288    if (json.has("sugar")) {
24289      JsonArray array = json.getAsJsonArray("sugar");
24290      for (int i = 0; i < array.size(); i++) {
24291        res.getSugar().add(parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(array.get(i).getAsJsonObject(), owner));
24292      }
24293    };
24294  }
24295
24296  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(JsonObject json, SubstanceNucleicAcid owner) throws IOException, FHIRFormatError {
24297    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent();
24298    parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentProperties(json, owner, res);
24299    return res;
24300  }
24301
24302  protected void parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentProperties(JsonObject json, SubstanceNucleicAcid owner, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent res) throws IOException, FHIRFormatError {
24303    parseBackboneElementProperties(json, res);
24304    if (json.has("connectivity"))
24305      res.setConnectivityElement(parseString(json.get("connectivity").getAsString()));
24306    if (json.has("_connectivity"))
24307      parseElementProperties(getJObject(json, "_connectivity"), res.getConnectivityElement());
24308    if (json.has("identifier"))
24309      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
24310    if (json.has("name"))
24311      res.setNameElement(parseString(json.get("name").getAsString()));
24312    if (json.has("_name"))
24313      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
24314    if (json.has("residueSite"))
24315      res.setResidueSiteElement(parseString(json.get("residueSite").getAsString()));
24316    if (json.has("_residueSite"))
24317      parseElementProperties(getJObject(json, "_residueSite"), res.getResidueSiteElement());
24318  }
24319
24320  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(JsonObject json, SubstanceNucleicAcid owner) throws IOException, FHIRFormatError {
24321    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent();
24322    parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentProperties(json, owner, res);
24323    return res;
24324  }
24325
24326  protected void parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentProperties(JsonObject json, SubstanceNucleicAcid owner, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent res) throws IOException, FHIRFormatError {
24327    parseBackboneElementProperties(json, res);
24328    if (json.has("identifier"))
24329      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
24330    if (json.has("name"))
24331      res.setNameElement(parseString(json.get("name").getAsString()));
24332    if (json.has("_name"))
24333      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
24334    if (json.has("residueSite"))
24335      res.setResidueSiteElement(parseString(json.get("residueSite").getAsString()));
24336    if (json.has("_residueSite"))
24337      parseElementProperties(getJObject(json, "_residueSite"), res.getResidueSiteElement());
24338  }
24339
24340  protected SubstancePolymer parseSubstancePolymer(JsonObject json) throws IOException, FHIRFormatError {
24341    SubstancePolymer res = new SubstancePolymer();
24342    parseSubstancePolymerProperties(json, res);
24343    return res;
24344  }
24345
24346  protected void parseSubstancePolymerProperties(JsonObject json, SubstancePolymer res) throws IOException, FHIRFormatError {
24347    parseDomainResourceProperties(json, res);
24348    if (json.has("class"))
24349      res.setClass_(parseCodeableConcept(getJObject(json, "class")));
24350    if (json.has("geometry"))
24351      res.setGeometry(parseCodeableConcept(getJObject(json, "geometry")));
24352    if (json.has("copolymerConnectivity")) {
24353      JsonArray array = json.getAsJsonArray("copolymerConnectivity");
24354      for (int i = 0; i < array.size(); i++) {
24355        res.getCopolymerConnectivity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24356      }
24357    };
24358    if (json.has("modification")) {
24359      JsonArray array = json.getAsJsonArray("modification");
24360      for (int i = 0; i < array.size(); i++) {
24361        res.getModification().add(parseString(array.get(i).getAsString()));
24362      }
24363    };
24364    if (json.has("_modification")) {
24365      JsonArray array = json.getAsJsonArray("_modification");
24366      for (int i = 0; i < array.size(); i++) {
24367        if (i == res.getModification().size())
24368          res.getModification().add(parseString(null));
24369        if (array.get(i) instanceof JsonObject) 
24370          parseElementProperties(array.get(i).getAsJsonObject(), res.getModification().get(i));
24371      }
24372    };
24373    if (json.has("monomerSet")) {
24374      JsonArray array = json.getAsJsonArray("monomerSet");
24375      for (int i = 0; i < array.size(); i++) {
24376        res.getMonomerSet().add(parseSubstancePolymerSubstancePolymerMonomerSetComponent(array.get(i).getAsJsonObject(), res));
24377      }
24378    };
24379    if (json.has("repeat")) {
24380      JsonArray array = json.getAsJsonArray("repeat");
24381      for (int i = 0; i < array.size(); i++) {
24382        res.getRepeat().add(parseSubstancePolymerSubstancePolymerRepeatComponent(array.get(i).getAsJsonObject(), res));
24383      }
24384    };
24385  }
24386
24387  protected SubstancePolymer.SubstancePolymerMonomerSetComponent parseSubstancePolymerSubstancePolymerMonomerSetComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
24388    SubstancePolymer.SubstancePolymerMonomerSetComponent res = new SubstancePolymer.SubstancePolymerMonomerSetComponent();
24389    parseSubstancePolymerSubstancePolymerMonomerSetComponentProperties(json, owner, res);
24390    return res;
24391  }
24392
24393  protected void parseSubstancePolymerSubstancePolymerMonomerSetComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerMonomerSetComponent res) throws IOException, FHIRFormatError {
24394    parseBackboneElementProperties(json, res);
24395    if (json.has("ratioType"))
24396      res.setRatioType(parseCodeableConcept(getJObject(json, "ratioType")));
24397    if (json.has("startingMaterial")) {
24398      JsonArray array = json.getAsJsonArray("startingMaterial");
24399      for (int i = 0; i < array.size(); i++) {
24400        res.getStartingMaterial().add(parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(array.get(i).getAsJsonObject(), owner));
24401      }
24402    };
24403  }
24404
24405  protected SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
24406    SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res = new SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent();
24407    parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentProperties(json, owner, res);
24408    return res;
24409  }
24410
24411  protected void parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res) throws IOException, FHIRFormatError {
24412    parseBackboneElementProperties(json, res);
24413    if (json.has("material"))
24414      res.setMaterial(parseCodeableConcept(getJObject(json, "material")));
24415    if (json.has("type"))
24416      res.setType(parseCodeableConcept(getJObject(json, "type")));
24417    if (json.has("isDefining"))
24418      res.setIsDefiningElement(parseBoolean(json.get("isDefining").getAsBoolean()));
24419    if (json.has("_isDefining"))
24420      parseElementProperties(getJObject(json, "_isDefining"), res.getIsDefiningElement());
24421    if (json.has("amount"))
24422      res.setAmount(parseSubstanceAmount(getJObject(json, "amount")));
24423  }
24424
24425  protected SubstancePolymer.SubstancePolymerRepeatComponent parseSubstancePolymerSubstancePolymerRepeatComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
24426    SubstancePolymer.SubstancePolymerRepeatComponent res = new SubstancePolymer.SubstancePolymerRepeatComponent();
24427    parseSubstancePolymerSubstancePolymerRepeatComponentProperties(json, owner, res);
24428    return res;
24429  }
24430
24431  protected void parseSubstancePolymerSubstancePolymerRepeatComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatComponent res) throws IOException, FHIRFormatError {
24432    parseBackboneElementProperties(json, res);
24433    if (json.has("numberOfUnits"))
24434      res.setNumberOfUnitsElement(parseInteger(json.get("numberOfUnits").getAsLong()));
24435    if (json.has("_numberOfUnits"))
24436      parseElementProperties(getJObject(json, "_numberOfUnits"), res.getNumberOfUnitsElement());
24437    if (json.has("averageMolecularFormula"))
24438      res.setAverageMolecularFormulaElement(parseString(json.get("averageMolecularFormula").getAsString()));
24439    if (json.has("_averageMolecularFormula"))
24440      parseElementProperties(getJObject(json, "_averageMolecularFormula"), res.getAverageMolecularFormulaElement());
24441    if (json.has("repeatUnitAmountType"))
24442      res.setRepeatUnitAmountType(parseCodeableConcept(getJObject(json, "repeatUnitAmountType")));
24443    if (json.has("repeatUnit")) {
24444      JsonArray array = json.getAsJsonArray("repeatUnit");
24445      for (int i = 0; i < array.size(); i++) {
24446        res.getRepeatUnit().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(array.get(i).getAsJsonObject(), owner));
24447      }
24448    };
24449  }
24450
24451  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
24452    SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent();
24453    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentProperties(json, owner, res);
24454    return res;
24455  }
24456
24457  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res) throws IOException, FHIRFormatError {
24458    parseBackboneElementProperties(json, res);
24459    if (json.has("orientationOfPolymerisation"))
24460      res.setOrientationOfPolymerisation(parseCodeableConcept(getJObject(json, "orientationOfPolymerisation")));
24461    if (json.has("repeatUnit"))
24462      res.setRepeatUnitElement(parseString(json.get("repeatUnit").getAsString()));
24463    if (json.has("_repeatUnit"))
24464      parseElementProperties(getJObject(json, "_repeatUnit"), res.getRepeatUnitElement());
24465    if (json.has("amount"))
24466      res.setAmount(parseSubstanceAmount(getJObject(json, "amount")));
24467    if (json.has("degreeOfPolymerisation")) {
24468      JsonArray array = json.getAsJsonArray("degreeOfPolymerisation");
24469      for (int i = 0; i < array.size(); i++) {
24470        res.getDegreeOfPolymerisation().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(array.get(i).getAsJsonObject(), owner));
24471      }
24472    };
24473    if (json.has("structuralRepresentation")) {
24474      JsonArray array = json.getAsJsonArray("structuralRepresentation");
24475      for (int i = 0; i < array.size(); i++) {
24476        res.getStructuralRepresentation().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(array.get(i).getAsJsonObject(), owner));
24477      }
24478    };
24479  }
24480
24481  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
24482    SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent();
24483    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(json, owner, res);
24484    return res;
24485  }
24486
24487  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res) throws IOException, FHIRFormatError {
24488    parseBackboneElementProperties(json, res);
24489    if (json.has("degree"))
24490      res.setDegree(parseCodeableConcept(getJObject(json, "degree")));
24491    if (json.has("amount"))
24492      res.setAmount(parseSubstanceAmount(getJObject(json, "amount")));
24493  }
24494
24495  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
24496    SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent();
24497    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(json, owner, res);
24498    return res;
24499  }
24500
24501  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res) throws IOException, FHIRFormatError {
24502    parseBackboneElementProperties(json, res);
24503    if (json.has("type"))
24504      res.setType(parseCodeableConcept(getJObject(json, "type")));
24505    if (json.has("representation"))
24506      res.setRepresentationElement(parseString(json.get("representation").getAsString()));
24507    if (json.has("_representation"))
24508      parseElementProperties(getJObject(json, "_representation"), res.getRepresentationElement());
24509    if (json.has("attachment"))
24510      res.setAttachment(parseAttachment(getJObject(json, "attachment")));
24511  }
24512
24513  protected SubstanceProtein parseSubstanceProtein(JsonObject json) throws IOException, FHIRFormatError {
24514    SubstanceProtein res = new SubstanceProtein();
24515    parseSubstanceProteinProperties(json, res);
24516    return res;
24517  }
24518
24519  protected void parseSubstanceProteinProperties(JsonObject json, SubstanceProtein res) throws IOException, FHIRFormatError {
24520    parseDomainResourceProperties(json, res);
24521    if (json.has("sequenceType"))
24522      res.setSequenceType(parseCodeableConcept(getJObject(json, "sequenceType")));
24523    if (json.has("numberOfSubunits"))
24524      res.setNumberOfSubunitsElement(parseInteger(json.get("numberOfSubunits").getAsLong()));
24525    if (json.has("_numberOfSubunits"))
24526      parseElementProperties(getJObject(json, "_numberOfSubunits"), res.getNumberOfSubunitsElement());
24527    if (json.has("disulfideLinkage")) {
24528      JsonArray array = json.getAsJsonArray("disulfideLinkage");
24529      for (int i = 0; i < array.size(); i++) {
24530        res.getDisulfideLinkage().add(parseString(array.get(i).getAsString()));
24531      }
24532    };
24533    if (json.has("_disulfideLinkage")) {
24534      JsonArray array = json.getAsJsonArray("_disulfideLinkage");
24535      for (int i = 0; i < array.size(); i++) {
24536        if (i == res.getDisulfideLinkage().size())
24537          res.getDisulfideLinkage().add(parseString(null));
24538        if (array.get(i) instanceof JsonObject) 
24539          parseElementProperties(array.get(i).getAsJsonObject(), res.getDisulfideLinkage().get(i));
24540      }
24541    };
24542    if (json.has("subunit")) {
24543      JsonArray array = json.getAsJsonArray("subunit");
24544      for (int i = 0; i < array.size(); i++) {
24545        res.getSubunit().add(parseSubstanceProteinSubstanceProteinSubunitComponent(array.get(i).getAsJsonObject(), res));
24546      }
24547    };
24548  }
24549
24550  protected SubstanceProtein.SubstanceProteinSubunitComponent parseSubstanceProteinSubstanceProteinSubunitComponent(JsonObject json, SubstanceProtein owner) throws IOException, FHIRFormatError {
24551    SubstanceProtein.SubstanceProteinSubunitComponent res = new SubstanceProtein.SubstanceProteinSubunitComponent();
24552    parseSubstanceProteinSubstanceProteinSubunitComponentProperties(json, owner, res);
24553    return res;
24554  }
24555
24556  protected void parseSubstanceProteinSubstanceProteinSubunitComponentProperties(JsonObject json, SubstanceProtein owner, SubstanceProtein.SubstanceProteinSubunitComponent res) throws IOException, FHIRFormatError {
24557    parseBackboneElementProperties(json, res);
24558    if (json.has("subunit"))
24559      res.setSubunitElement(parseInteger(json.get("subunit").getAsLong()));
24560    if (json.has("_subunit"))
24561      parseElementProperties(getJObject(json, "_subunit"), res.getSubunitElement());
24562    if (json.has("sequence"))
24563      res.setSequenceElement(parseString(json.get("sequence").getAsString()));
24564    if (json.has("_sequence"))
24565      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
24566    if (json.has("length"))
24567      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
24568    if (json.has("_length"))
24569      parseElementProperties(getJObject(json, "_length"), res.getLengthElement());
24570    if (json.has("sequenceAttachment"))
24571      res.setSequenceAttachment(parseAttachment(getJObject(json, "sequenceAttachment")));
24572    if (json.has("nTerminalModificationId"))
24573      res.setNTerminalModificationId(parseIdentifier(getJObject(json, "nTerminalModificationId")));
24574    if (json.has("nTerminalModification"))
24575      res.setNTerminalModificationElement(parseString(json.get("nTerminalModification").getAsString()));
24576    if (json.has("_nTerminalModification"))
24577      parseElementProperties(getJObject(json, "_nTerminalModification"), res.getNTerminalModificationElement());
24578    if (json.has("cTerminalModificationId"))
24579      res.setCTerminalModificationId(parseIdentifier(getJObject(json, "cTerminalModificationId")));
24580    if (json.has("cTerminalModification"))
24581      res.setCTerminalModificationElement(parseString(json.get("cTerminalModification").getAsString()));
24582    if (json.has("_cTerminalModification"))
24583      parseElementProperties(getJObject(json, "_cTerminalModification"), res.getCTerminalModificationElement());
24584  }
24585
24586  protected SubstanceReferenceInformation parseSubstanceReferenceInformation(JsonObject json) throws IOException, FHIRFormatError {
24587    SubstanceReferenceInformation res = new SubstanceReferenceInformation();
24588    parseSubstanceReferenceInformationProperties(json, res);
24589    return res;
24590  }
24591
24592  protected void parseSubstanceReferenceInformationProperties(JsonObject json, SubstanceReferenceInformation res) throws IOException, FHIRFormatError {
24593    parseDomainResourceProperties(json, res);
24594    if (json.has("comment"))
24595      res.setCommentElement(parseString(json.get("comment").getAsString()));
24596    if (json.has("_comment"))
24597      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
24598    if (json.has("gene")) {
24599      JsonArray array = json.getAsJsonArray("gene");
24600      for (int i = 0; i < array.size(); i++) {
24601        res.getGene().add(parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(array.get(i).getAsJsonObject(), res));
24602      }
24603    };
24604    if (json.has("geneElement")) {
24605      JsonArray array = json.getAsJsonArray("geneElement");
24606      for (int i = 0; i < array.size(); i++) {
24607        res.getGeneElement().add(parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(array.get(i).getAsJsonObject(), res));
24608      }
24609    };
24610    if (json.has("classification")) {
24611      JsonArray array = json.getAsJsonArray("classification");
24612      for (int i = 0; i < array.size(); i++) {
24613        res.getClassification().add(parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(array.get(i).getAsJsonObject(), res));
24614      }
24615    };
24616    if (json.has("target")) {
24617      JsonArray array = json.getAsJsonArray("target");
24618      for (int i = 0; i < array.size(); i++) {
24619        res.getTarget().add(parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(array.get(i).getAsJsonObject(), res));
24620      }
24621    };
24622  }
24623
24624  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
24625    SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent();
24626    parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentProperties(json, owner, res);
24627    return res;
24628  }
24629
24630  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res) throws IOException, FHIRFormatError {
24631    parseBackboneElementProperties(json, res);
24632    if (json.has("geneSequenceOrigin"))
24633      res.setGeneSequenceOrigin(parseCodeableConcept(getJObject(json, "geneSequenceOrigin")));
24634    if (json.has("gene"))
24635      res.setGene(parseCodeableConcept(getJObject(json, "gene")));
24636    if (json.has("source")) {
24637      JsonArray array = json.getAsJsonArray("source");
24638      for (int i = 0; i < array.size(); i++) {
24639        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
24640      }
24641    };
24642  }
24643
24644  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
24645    SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent();
24646    parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentProperties(json, owner, res);
24647    return res;
24648  }
24649
24650  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res) throws IOException, FHIRFormatError {
24651    parseBackboneElementProperties(json, res);
24652    if (json.has("type"))
24653      res.setType(parseCodeableConcept(getJObject(json, "type")));
24654    if (json.has("element"))
24655      res.setElement(parseIdentifier(getJObject(json, "element")));
24656    if (json.has("source")) {
24657      JsonArray array = json.getAsJsonArray("source");
24658      for (int i = 0; i < array.size(); i++) {
24659        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
24660      }
24661    };
24662  }
24663
24664  protected SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
24665    SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent();
24666    parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentProperties(json, owner, res);
24667    return res;
24668  }
24669
24670  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent res) throws IOException, FHIRFormatError {
24671    parseBackboneElementProperties(json, res);
24672    if (json.has("domain"))
24673      res.setDomain(parseCodeableConcept(getJObject(json, "domain")));
24674    if (json.has("classification"))
24675      res.setClassification(parseCodeableConcept(getJObject(json, "classification")));
24676    if (json.has("subtype")) {
24677      JsonArray array = json.getAsJsonArray("subtype");
24678      for (int i = 0; i < array.size(); i++) {
24679        res.getSubtype().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24680      }
24681    };
24682    if (json.has("source")) {
24683      JsonArray array = json.getAsJsonArray("source");
24684      for (int i = 0; i < array.size(); i++) {
24685        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
24686      }
24687    };
24688  }
24689
24690  protected SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
24691    SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent();
24692    parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentProperties(json, owner, res);
24693    return res;
24694  }
24695
24696  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res) throws IOException, FHIRFormatError {
24697    parseBackboneElementProperties(json, res);
24698    if (json.has("target"))
24699      res.setTarget(parseIdentifier(getJObject(json, "target")));
24700    if (json.has("type"))
24701      res.setType(parseCodeableConcept(getJObject(json, "type")));
24702    if (json.has("interaction"))
24703      res.setInteraction(parseCodeableConcept(getJObject(json, "interaction")));
24704    if (json.has("organism"))
24705      res.setOrganism(parseCodeableConcept(getJObject(json, "organism")));
24706    if (json.has("organismType"))
24707      res.setOrganismType(parseCodeableConcept(getJObject(json, "organismType")));
24708    Type amount = parseType("amount", json);
24709    if (amount != null)
24710      res.setAmount(amount);
24711    if (json.has("amountType"))
24712      res.setAmountType(parseCodeableConcept(getJObject(json, "amountType")));
24713    if (json.has("source")) {
24714      JsonArray array = json.getAsJsonArray("source");
24715      for (int i = 0; i < array.size(); i++) {
24716        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
24717      }
24718    };
24719  }
24720
24721  protected SubstanceSourceMaterial parseSubstanceSourceMaterial(JsonObject json) throws IOException, FHIRFormatError {
24722    SubstanceSourceMaterial res = new SubstanceSourceMaterial();
24723    parseSubstanceSourceMaterialProperties(json, res);
24724    return res;
24725  }
24726
24727  protected void parseSubstanceSourceMaterialProperties(JsonObject json, SubstanceSourceMaterial res) throws IOException, FHIRFormatError {
24728    parseDomainResourceProperties(json, res);
24729    if (json.has("sourceMaterialClass"))
24730      res.setSourceMaterialClass(parseCodeableConcept(getJObject(json, "sourceMaterialClass")));
24731    if (json.has("sourceMaterialType"))
24732      res.setSourceMaterialType(parseCodeableConcept(getJObject(json, "sourceMaterialType")));
24733    if (json.has("sourceMaterialState"))
24734      res.setSourceMaterialState(parseCodeableConcept(getJObject(json, "sourceMaterialState")));
24735    if (json.has("organismId"))
24736      res.setOrganismId(parseIdentifier(getJObject(json, "organismId")));
24737    if (json.has("organismName"))
24738      res.setOrganismNameElement(parseString(json.get("organismName").getAsString()));
24739    if (json.has("_organismName"))
24740      parseElementProperties(getJObject(json, "_organismName"), res.getOrganismNameElement());
24741    if (json.has("parentSubstanceId")) {
24742      JsonArray array = json.getAsJsonArray("parentSubstanceId");
24743      for (int i = 0; i < array.size(); i++) {
24744        res.getParentSubstanceId().add(parseIdentifier(array.get(i).getAsJsonObject()));
24745      }
24746    };
24747    if (json.has("parentSubstanceName")) {
24748      JsonArray array = json.getAsJsonArray("parentSubstanceName");
24749      for (int i = 0; i < array.size(); i++) {
24750        res.getParentSubstanceName().add(parseString(array.get(i).getAsString()));
24751      }
24752    };
24753    if (json.has("_parentSubstanceName")) {
24754      JsonArray array = json.getAsJsonArray("_parentSubstanceName");
24755      for (int i = 0; i < array.size(); i++) {
24756        if (i == res.getParentSubstanceName().size())
24757          res.getParentSubstanceName().add(parseString(null));
24758        if (array.get(i) instanceof JsonObject) 
24759          parseElementProperties(array.get(i).getAsJsonObject(), res.getParentSubstanceName().get(i));
24760      }
24761    };
24762    if (json.has("countryOfOrigin")) {
24763      JsonArray array = json.getAsJsonArray("countryOfOrigin");
24764      for (int i = 0; i < array.size(); i++) {
24765        res.getCountryOfOrigin().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24766      }
24767    };
24768    if (json.has("geographicalLocation")) {
24769      JsonArray array = json.getAsJsonArray("geographicalLocation");
24770      for (int i = 0; i < array.size(); i++) {
24771        res.getGeographicalLocation().add(parseString(array.get(i).getAsString()));
24772      }
24773    };
24774    if (json.has("_geographicalLocation")) {
24775      JsonArray array = json.getAsJsonArray("_geographicalLocation");
24776      for (int i = 0; i < array.size(); i++) {
24777        if (i == res.getGeographicalLocation().size())
24778          res.getGeographicalLocation().add(parseString(null));
24779        if (array.get(i) instanceof JsonObject) 
24780          parseElementProperties(array.get(i).getAsJsonObject(), res.getGeographicalLocation().get(i));
24781      }
24782    };
24783    if (json.has("developmentStage"))
24784      res.setDevelopmentStage(parseCodeableConcept(getJObject(json, "developmentStage")));
24785    if (json.has("fractionDescription")) {
24786      JsonArray array = json.getAsJsonArray("fractionDescription");
24787      for (int i = 0; i < array.size(); i++) {
24788        res.getFractionDescription().add(parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(array.get(i).getAsJsonObject(), res));
24789      }
24790    };
24791    if (json.has("organism"))
24792      res.setOrganism(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent(getJObject(json, "organism"), res));
24793    if (json.has("partDescription")) {
24794      JsonArray array = json.getAsJsonArray("partDescription");
24795      for (int i = 0; i < array.size(); i++) {
24796        res.getPartDescription().add(parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(array.get(i).getAsJsonObject(), res));
24797      }
24798    };
24799  }
24800
24801  protected SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
24802    SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent();
24803    parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentProperties(json, owner, res);
24804    return res;
24805  }
24806
24807  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent res) throws IOException, FHIRFormatError {
24808    parseBackboneElementProperties(json, res);
24809    if (json.has("fraction"))
24810      res.setFractionElement(parseString(json.get("fraction").getAsString()));
24811    if (json.has("_fraction"))
24812      parseElementProperties(getJObject(json, "_fraction"), res.getFractionElement());
24813    if (json.has("materialType"))
24814      res.setMaterialType(parseCodeableConcept(getJObject(json, "materialType")));
24815  }
24816
24817  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
24818    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent();
24819    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentProperties(json, owner, res);
24820    return res;
24821  }
24822
24823  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent res) throws IOException, FHIRFormatError {
24824    parseBackboneElementProperties(json, res);
24825    if (json.has("family"))
24826      res.setFamily(parseCodeableConcept(getJObject(json, "family")));
24827    if (json.has("genus"))
24828      res.setGenus(parseCodeableConcept(getJObject(json, "genus")));
24829    if (json.has("species"))
24830      res.setSpecies(parseCodeableConcept(getJObject(json, "species")));
24831    if (json.has("intraspecificType"))
24832      res.setIntraspecificType(parseCodeableConcept(getJObject(json, "intraspecificType")));
24833    if (json.has("intraspecificDescription"))
24834      res.setIntraspecificDescriptionElement(parseString(json.get("intraspecificDescription").getAsString()));
24835    if (json.has("_intraspecificDescription"))
24836      parseElementProperties(getJObject(json, "_intraspecificDescription"), res.getIntraspecificDescriptionElement());
24837    if (json.has("author")) {
24838      JsonArray array = json.getAsJsonArray("author");
24839      for (int i = 0; i < array.size(); i++) {
24840        res.getAuthor().add(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(array.get(i).getAsJsonObject(), owner));
24841      }
24842    };
24843    if (json.has("hybrid"))
24844      res.setHybrid(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent(getJObject(json, "hybrid"), owner));
24845    if (json.has("organismGeneral"))
24846      res.setOrganismGeneral(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent(getJObject(json, "organismGeneral"), owner));
24847  }
24848
24849  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
24850    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent();
24851    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentProperties(json, owner, res);
24852    return res;
24853  }
24854
24855  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent res) throws IOException, FHIRFormatError {
24856    parseBackboneElementProperties(json, res);
24857    if (json.has("authorType"))
24858      res.setAuthorType(parseCodeableConcept(getJObject(json, "authorType")));
24859    if (json.has("authorDescription"))
24860      res.setAuthorDescriptionElement(parseString(json.get("authorDescription").getAsString()));
24861    if (json.has("_authorDescription"))
24862      parseElementProperties(getJObject(json, "_authorDescription"), res.getAuthorDescriptionElement());
24863  }
24864
24865  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
24866    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent();
24867    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentProperties(json, owner, res);
24868    return res;
24869  }
24870
24871  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent res) throws IOException, FHIRFormatError {
24872    parseBackboneElementProperties(json, res);
24873    if (json.has("maternalOrganismId"))
24874      res.setMaternalOrganismIdElement(parseString(json.get("maternalOrganismId").getAsString()));
24875    if (json.has("_maternalOrganismId"))
24876      parseElementProperties(getJObject(json, "_maternalOrganismId"), res.getMaternalOrganismIdElement());
24877    if (json.has("maternalOrganismName"))
24878      res.setMaternalOrganismNameElement(parseString(json.get("maternalOrganismName").getAsString()));
24879    if (json.has("_maternalOrganismName"))
24880      parseElementProperties(getJObject(json, "_maternalOrganismName"), res.getMaternalOrganismNameElement());
24881    if (json.has("paternalOrganismId"))
24882      res.setPaternalOrganismIdElement(parseString(json.get("paternalOrganismId").getAsString()));
24883    if (json.has("_paternalOrganismId"))
24884      parseElementProperties(getJObject(json, "_paternalOrganismId"), res.getPaternalOrganismIdElement());
24885    if (json.has("paternalOrganismName"))
24886      res.setPaternalOrganismNameElement(parseString(json.get("paternalOrganismName").getAsString()));
24887    if (json.has("_paternalOrganismName"))
24888      parseElementProperties(getJObject(json, "_paternalOrganismName"), res.getPaternalOrganismNameElement());
24889    if (json.has("hybridType"))
24890      res.setHybridType(parseCodeableConcept(getJObject(json, "hybridType")));
24891  }
24892
24893  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
24894    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent();
24895    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(json, owner, res);
24896    return res;
24897  }
24898
24899  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent res) throws IOException, FHIRFormatError {
24900    parseBackboneElementProperties(json, res);
24901    if (json.has("kingdom"))
24902      res.setKingdom(parseCodeableConcept(getJObject(json, "kingdom")));
24903    if (json.has("phylum"))
24904      res.setPhylum(parseCodeableConcept(getJObject(json, "phylum")));
24905    if (json.has("class"))
24906      res.setClass_(parseCodeableConcept(getJObject(json, "class")));
24907    if (json.has("order"))
24908      res.setOrder(parseCodeableConcept(getJObject(json, "order")));
24909  }
24910
24911  protected SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
24912    SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent();
24913    parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentProperties(json, owner, res);
24914    return res;
24915  }
24916
24917  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent res) throws IOException, FHIRFormatError {
24918    parseBackboneElementProperties(json, res);
24919    if (json.has("part"))
24920      res.setPart(parseCodeableConcept(getJObject(json, "part")));
24921    if (json.has("partLocation"))
24922      res.setPartLocation(parseCodeableConcept(getJObject(json, "partLocation")));
24923  }
24924
24925  protected SubstanceSpecification parseSubstanceSpecification(JsonObject json) throws IOException, FHIRFormatError {
24926    SubstanceSpecification res = new SubstanceSpecification();
24927    parseSubstanceSpecificationProperties(json, res);
24928    return res;
24929  }
24930
24931  protected void parseSubstanceSpecificationProperties(JsonObject json, SubstanceSpecification res) throws IOException, FHIRFormatError {
24932    parseDomainResourceProperties(json, res);
24933    if (json.has("identifier"))
24934      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
24935    if (json.has("type"))
24936      res.setType(parseCodeableConcept(getJObject(json, "type")));
24937    if (json.has("status"))
24938      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
24939    if (json.has("domain"))
24940      res.setDomain(parseCodeableConcept(getJObject(json, "domain")));
24941    if (json.has("description"))
24942      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24943    if (json.has("_description"))
24944      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
24945    if (json.has("source")) {
24946      JsonArray array = json.getAsJsonArray("source");
24947      for (int i = 0; i < array.size(); i++) {
24948        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
24949      }
24950    };
24951    if (json.has("comment"))
24952      res.setCommentElement(parseString(json.get("comment").getAsString()));
24953    if (json.has("_comment"))
24954      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
24955    if (json.has("moiety")) {
24956      JsonArray array = json.getAsJsonArray("moiety");
24957      for (int i = 0; i < array.size(); i++) {
24958        res.getMoiety().add(parseSubstanceSpecificationSubstanceSpecificationMoietyComponent(array.get(i).getAsJsonObject(), res));
24959      }
24960    };
24961    if (json.has("property")) {
24962      JsonArray array = json.getAsJsonArray("property");
24963      for (int i = 0; i < array.size(); i++) {
24964        res.getProperty().add(parseSubstanceSpecificationSubstanceSpecificationPropertyComponent(array.get(i).getAsJsonObject(), res));
24965      }
24966    };
24967    if (json.has("referenceInformation"))
24968      res.setReferenceInformation(parseReference(getJObject(json, "referenceInformation")));
24969    if (json.has("structure"))
24970      res.setStructure(parseSubstanceSpecificationSubstanceSpecificationStructureComponent(getJObject(json, "structure"), res));
24971    if (json.has("code")) {
24972      JsonArray array = json.getAsJsonArray("code");
24973      for (int i = 0; i < array.size(); i++) {
24974        res.getCode().add(parseSubstanceSpecificationSubstanceSpecificationCodeComponent(array.get(i).getAsJsonObject(), res));
24975      }
24976    };
24977    if (json.has("name")) {
24978      JsonArray array = json.getAsJsonArray("name");
24979      for (int i = 0; i < array.size(); i++) {
24980        res.getName().add(parseSubstanceSpecificationSubstanceSpecificationNameComponent(array.get(i).getAsJsonObject(), res));
24981      }
24982    };
24983    if (json.has("molecularWeight")) {
24984      JsonArray array = json.getAsJsonArray("molecularWeight");
24985      for (int i = 0; i < array.size(); i++) {
24986        res.getMolecularWeight().add(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(array.get(i).getAsJsonObject(), res));
24987      }
24988    };
24989    if (json.has("relationship")) {
24990      JsonArray array = json.getAsJsonArray("relationship");
24991      for (int i = 0; i < array.size(); i++) {
24992        res.getRelationship().add(parseSubstanceSpecificationSubstanceSpecificationRelationshipComponent(array.get(i).getAsJsonObject(), res));
24993      }
24994    };
24995    if (json.has("nucleicAcid"))
24996      res.setNucleicAcid(parseReference(getJObject(json, "nucleicAcid")));
24997    if (json.has("polymer"))
24998      res.setPolymer(parseReference(getJObject(json, "polymer")));
24999    if (json.has("protein"))
25000      res.setProtein(parseReference(getJObject(json, "protein")));
25001    if (json.has("sourceMaterial"))
25002      res.setSourceMaterial(parseReference(getJObject(json, "sourceMaterial")));
25003  }
25004
25005  protected SubstanceSpecification.SubstanceSpecificationMoietyComponent parseSubstanceSpecificationSubstanceSpecificationMoietyComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25006    SubstanceSpecification.SubstanceSpecificationMoietyComponent res = new SubstanceSpecification.SubstanceSpecificationMoietyComponent();
25007    parseSubstanceSpecificationSubstanceSpecificationMoietyComponentProperties(json, owner, res);
25008    return res;
25009  }
25010
25011  protected void parseSubstanceSpecificationSubstanceSpecificationMoietyComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationMoietyComponent res) throws IOException, FHIRFormatError {
25012    parseBackboneElementProperties(json, res);
25013    if (json.has("role"))
25014      res.setRole(parseCodeableConcept(getJObject(json, "role")));
25015    if (json.has("identifier"))
25016      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
25017    if (json.has("name"))
25018      res.setNameElement(parseString(json.get("name").getAsString()));
25019    if (json.has("_name"))
25020      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25021    if (json.has("stereochemistry"))
25022      res.setStereochemistry(parseCodeableConcept(getJObject(json, "stereochemistry")));
25023    if (json.has("opticalActivity"))
25024      res.setOpticalActivity(parseCodeableConcept(getJObject(json, "opticalActivity")));
25025    if (json.has("molecularFormula"))
25026      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
25027    if (json.has("_molecularFormula"))
25028      parseElementProperties(getJObject(json, "_molecularFormula"), res.getMolecularFormulaElement());
25029    Type amount = parseType("amount", json);
25030    if (amount != null)
25031      res.setAmount(amount);
25032  }
25033
25034  protected SubstanceSpecification.SubstanceSpecificationPropertyComponent parseSubstanceSpecificationSubstanceSpecificationPropertyComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25035    SubstanceSpecification.SubstanceSpecificationPropertyComponent res = new SubstanceSpecification.SubstanceSpecificationPropertyComponent();
25036    parseSubstanceSpecificationSubstanceSpecificationPropertyComponentProperties(json, owner, res);
25037    return res;
25038  }
25039
25040  protected void parseSubstanceSpecificationSubstanceSpecificationPropertyComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationPropertyComponent res) throws IOException, FHIRFormatError {
25041    parseBackboneElementProperties(json, res);
25042    if (json.has("category"))
25043      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
25044    if (json.has("code"))
25045      res.setCode(parseCodeableConcept(getJObject(json, "code")));
25046    if (json.has("parameters"))
25047      res.setParametersElement(parseString(json.get("parameters").getAsString()));
25048    if (json.has("_parameters"))
25049      parseElementProperties(getJObject(json, "_parameters"), res.getParametersElement());
25050    Type definingSubstance = parseType("definingSubstance", json);
25051    if (definingSubstance != null)
25052      res.setDefiningSubstance(definingSubstance);
25053    Type amount = parseType("amount", json);
25054    if (amount != null)
25055      res.setAmount(amount);
25056  }
25057
25058  protected SubstanceSpecification.SubstanceSpecificationStructureComponent parseSubstanceSpecificationSubstanceSpecificationStructureComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25059    SubstanceSpecification.SubstanceSpecificationStructureComponent res = new SubstanceSpecification.SubstanceSpecificationStructureComponent();
25060    parseSubstanceSpecificationSubstanceSpecificationStructureComponentProperties(json, owner, res);
25061    return res;
25062  }
25063
25064  protected void parseSubstanceSpecificationSubstanceSpecificationStructureComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureComponent res) throws IOException, FHIRFormatError {
25065    parseBackboneElementProperties(json, res);
25066    if (json.has("stereochemistry"))
25067      res.setStereochemistry(parseCodeableConcept(getJObject(json, "stereochemistry")));
25068    if (json.has("opticalActivity"))
25069      res.setOpticalActivity(parseCodeableConcept(getJObject(json, "opticalActivity")));
25070    if (json.has("molecularFormula"))
25071      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
25072    if (json.has("_molecularFormula"))
25073      parseElementProperties(getJObject(json, "_molecularFormula"), res.getMolecularFormulaElement());
25074    if (json.has("molecularFormulaByMoiety"))
25075      res.setMolecularFormulaByMoietyElement(parseString(json.get("molecularFormulaByMoiety").getAsString()));
25076    if (json.has("_molecularFormulaByMoiety"))
25077      parseElementProperties(getJObject(json, "_molecularFormulaByMoiety"), res.getMolecularFormulaByMoietyElement());
25078    if (json.has("isotope")) {
25079      JsonArray array = json.getAsJsonArray("isotope");
25080      for (int i = 0; i < array.size(); i++) {
25081        res.getIsotope().add(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(array.get(i).getAsJsonObject(), owner));
25082      }
25083    };
25084    if (json.has("molecularWeight"))
25085      res.setMolecularWeight(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(getJObject(json, "molecularWeight"), owner));
25086    if (json.has("source")) {
25087      JsonArray array = json.getAsJsonArray("source");
25088      for (int i = 0; i < array.size(); i++) {
25089        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25090      }
25091    };
25092    if (json.has("representation")) {
25093      JsonArray array = json.getAsJsonArray("representation");
25094      for (int i = 0; i < array.size(); i++) {
25095        res.getRepresentation().add(parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(array.get(i).getAsJsonObject(), owner));
25096      }
25097    };
25098  }
25099
25100  protected SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25101    SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent res = new SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent();
25102    parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentProperties(json, owner, res);
25103    return res;
25104  }
25105
25106  protected void parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent res) throws IOException, FHIRFormatError {
25107    parseBackboneElementProperties(json, res);
25108    if (json.has("identifier"))
25109      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
25110    if (json.has("name"))
25111      res.setName(parseCodeableConcept(getJObject(json, "name")));
25112    if (json.has("substitution"))
25113      res.setSubstitution(parseCodeableConcept(getJObject(json, "substitution")));
25114    if (json.has("halfLife"))
25115      res.setHalfLife(parseQuantity(getJObject(json, "halfLife")));
25116    if (json.has("molecularWeight"))
25117      res.setMolecularWeight(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(getJObject(json, "molecularWeight"), owner));
25118  }
25119
25120  protected SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25121    SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent res = new SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent();
25122    parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentProperties(json, owner, res);
25123    return res;
25124  }
25125
25126  protected void parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent res) throws IOException, FHIRFormatError {
25127    parseBackboneElementProperties(json, res);
25128    if (json.has("method"))
25129      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
25130    if (json.has("type"))
25131      res.setType(parseCodeableConcept(getJObject(json, "type")));
25132    if (json.has("amount"))
25133      res.setAmount(parseQuantity(getJObject(json, "amount")));
25134  }
25135
25136  protected SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25137    SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent res = new SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent();
25138    parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentProperties(json, owner, res);
25139    return res;
25140  }
25141
25142  protected void parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent res) throws IOException, FHIRFormatError {
25143    parseBackboneElementProperties(json, res);
25144    if (json.has("type"))
25145      res.setType(parseCodeableConcept(getJObject(json, "type")));
25146    if (json.has("representation"))
25147      res.setRepresentationElement(parseString(json.get("representation").getAsString()));
25148    if (json.has("_representation"))
25149      parseElementProperties(getJObject(json, "_representation"), res.getRepresentationElement());
25150    if (json.has("attachment"))
25151      res.setAttachment(parseAttachment(getJObject(json, "attachment")));
25152  }
25153
25154  protected SubstanceSpecification.SubstanceSpecificationCodeComponent parseSubstanceSpecificationSubstanceSpecificationCodeComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25155    SubstanceSpecification.SubstanceSpecificationCodeComponent res = new SubstanceSpecification.SubstanceSpecificationCodeComponent();
25156    parseSubstanceSpecificationSubstanceSpecificationCodeComponentProperties(json, owner, res);
25157    return res;
25158  }
25159
25160  protected void parseSubstanceSpecificationSubstanceSpecificationCodeComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationCodeComponent res) throws IOException, FHIRFormatError {
25161    parseBackboneElementProperties(json, res);
25162    if (json.has("code"))
25163      res.setCode(parseCodeableConcept(getJObject(json, "code")));
25164    if (json.has("status"))
25165      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
25166    if (json.has("statusDate"))
25167      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
25168    if (json.has("_statusDate"))
25169      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
25170    if (json.has("comment"))
25171      res.setCommentElement(parseString(json.get("comment").getAsString()));
25172    if (json.has("_comment"))
25173      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
25174    if (json.has("source")) {
25175      JsonArray array = json.getAsJsonArray("source");
25176      for (int i = 0; i < array.size(); i++) {
25177        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25178      }
25179    };
25180  }
25181
25182  protected SubstanceSpecification.SubstanceSpecificationNameComponent parseSubstanceSpecificationSubstanceSpecificationNameComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25183    SubstanceSpecification.SubstanceSpecificationNameComponent res = new SubstanceSpecification.SubstanceSpecificationNameComponent();
25184    parseSubstanceSpecificationSubstanceSpecificationNameComponentProperties(json, owner, res);
25185    return res;
25186  }
25187
25188  protected void parseSubstanceSpecificationSubstanceSpecificationNameComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationNameComponent res) throws IOException, FHIRFormatError {
25189    parseBackboneElementProperties(json, res);
25190    if (json.has("name"))
25191      res.setNameElement(parseString(json.get("name").getAsString()));
25192    if (json.has("_name"))
25193      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25194    if (json.has("type"))
25195      res.setType(parseCodeableConcept(getJObject(json, "type")));
25196    if (json.has("status"))
25197      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
25198    if (json.has("preferred"))
25199      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
25200    if (json.has("_preferred"))
25201      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
25202    if (json.has("language")) {
25203      JsonArray array = json.getAsJsonArray("language");
25204      for (int i = 0; i < array.size(); i++) {
25205        res.getLanguage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25206      }
25207    };
25208    if (json.has("domain")) {
25209      JsonArray array = json.getAsJsonArray("domain");
25210      for (int i = 0; i < array.size(); i++) {
25211        res.getDomain().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25212      }
25213    };
25214    if (json.has("jurisdiction")) {
25215      JsonArray array = json.getAsJsonArray("jurisdiction");
25216      for (int i = 0; i < array.size(); i++) {
25217        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25218      }
25219    };
25220    if (json.has("synonym")) {
25221      JsonArray array = json.getAsJsonArray("synonym");
25222      for (int i = 0; i < array.size(); i++) {
25223        res.getSynonym().add(parseSubstanceSpecificationSubstanceSpecificationNameComponent(array.get(i).getAsJsonObject(), owner));
25224      }
25225    };
25226    if (json.has("translation")) {
25227      JsonArray array = json.getAsJsonArray("translation");
25228      for (int i = 0; i < array.size(); i++) {
25229        res.getTranslation().add(parseSubstanceSpecificationSubstanceSpecificationNameComponent(array.get(i).getAsJsonObject(), owner));
25230      }
25231    };
25232    if (json.has("official")) {
25233      JsonArray array = json.getAsJsonArray("official");
25234      for (int i = 0; i < array.size(); i++) {
25235        res.getOfficial().add(parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(array.get(i).getAsJsonObject(), owner));
25236      }
25237    };
25238    if (json.has("source")) {
25239      JsonArray array = json.getAsJsonArray("source");
25240      for (int i = 0; i < array.size(); i++) {
25241        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25242      }
25243    };
25244  }
25245
25246  protected SubstanceSpecification.SubstanceSpecificationNameOfficialComponent parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25247    SubstanceSpecification.SubstanceSpecificationNameOfficialComponent res = new SubstanceSpecification.SubstanceSpecificationNameOfficialComponent();
25248    parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponentProperties(json, owner, res);
25249    return res;
25250  }
25251
25252  protected void parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationNameOfficialComponent res) throws IOException, FHIRFormatError {
25253    parseBackboneElementProperties(json, res);
25254    if (json.has("authority"))
25255      res.setAuthority(parseCodeableConcept(getJObject(json, "authority")));
25256    if (json.has("status"))
25257      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
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  }
25263
25264  protected SubstanceSpecification.SubstanceSpecificationRelationshipComponent parseSubstanceSpecificationSubstanceSpecificationRelationshipComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25265    SubstanceSpecification.SubstanceSpecificationRelationshipComponent res = new SubstanceSpecification.SubstanceSpecificationRelationshipComponent();
25266    parseSubstanceSpecificationSubstanceSpecificationRelationshipComponentProperties(json, owner, res);
25267    return res;
25268  }
25269
25270  protected void parseSubstanceSpecificationSubstanceSpecificationRelationshipComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationRelationshipComponent res) throws IOException, FHIRFormatError {
25271    parseBackboneElementProperties(json, res);
25272    Type substance = parseType("substance", json);
25273    if (substance != null)
25274      res.setSubstance(substance);
25275    if (json.has("relationship"))
25276      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
25277    if (json.has("isDefining"))
25278      res.setIsDefiningElement(parseBoolean(json.get("isDefining").getAsBoolean()));
25279    if (json.has("_isDefining"))
25280      parseElementProperties(getJObject(json, "_isDefining"), res.getIsDefiningElement());
25281    Type amount = parseType("amount", json);
25282    if (amount != null)
25283      res.setAmount(amount);
25284    if (json.has("amountRatioLowLimit"))
25285      res.setAmountRatioLowLimit(parseRatio(getJObject(json, "amountRatioLowLimit")));
25286    if (json.has("amountType"))
25287      res.setAmountType(parseCodeableConcept(getJObject(json, "amountType")));
25288    if (json.has("source")) {
25289      JsonArray array = json.getAsJsonArray("source");
25290      for (int i = 0; i < array.size(); i++) {
25291        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25292      }
25293    };
25294  }
25295
25296  protected SupplyDelivery parseSupplyDelivery(JsonObject json) throws IOException, FHIRFormatError {
25297    SupplyDelivery res = new SupplyDelivery();
25298    parseSupplyDeliveryProperties(json, res);
25299    return res;
25300  }
25301
25302  protected void parseSupplyDeliveryProperties(JsonObject json, SupplyDelivery res) throws IOException, FHIRFormatError {
25303    parseDomainResourceProperties(json, res);
25304    if (json.has("identifier")) {
25305      JsonArray array = json.getAsJsonArray("identifier");
25306      for (int i = 0; i < array.size(); i++) {
25307        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25308      }
25309    };
25310    if (json.has("basedOn")) {
25311      JsonArray array = json.getAsJsonArray("basedOn");
25312      for (int i = 0; i < array.size(); i++) {
25313        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
25314      }
25315    };
25316    if (json.has("partOf")) {
25317      JsonArray array = json.getAsJsonArray("partOf");
25318      for (int i = 0; i < array.size(); i++) {
25319        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
25320      }
25321    };
25322    if (json.has("status"))
25323      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyDelivery.SupplyDeliveryStatus.NULL, new SupplyDelivery.SupplyDeliveryStatusEnumFactory()));
25324    if (json.has("_status"))
25325      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
25326    if (json.has("patient"))
25327      res.setPatient(parseReference(getJObject(json, "patient")));
25328    if (json.has("type"))
25329      res.setType(parseCodeableConcept(getJObject(json, "type")));
25330    if (json.has("suppliedItem"))
25331      res.setSuppliedItem(parseSupplyDeliverySupplyDeliverySuppliedItemComponent(getJObject(json, "suppliedItem"), res));
25332    Type occurrence = parseType("occurrence", json);
25333    if (occurrence != null)
25334      res.setOccurrence(occurrence);
25335    if (json.has("supplier"))
25336      res.setSupplier(parseReference(getJObject(json, "supplier")));
25337    if (json.has("destination"))
25338      res.setDestination(parseReference(getJObject(json, "destination")));
25339    if (json.has("receiver")) {
25340      JsonArray array = json.getAsJsonArray("receiver");
25341      for (int i = 0; i < array.size(); i++) {
25342        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
25343      }
25344    };
25345  }
25346
25347  protected SupplyDelivery.SupplyDeliverySuppliedItemComponent parseSupplyDeliverySupplyDeliverySuppliedItemComponent(JsonObject json, SupplyDelivery owner) throws IOException, FHIRFormatError {
25348    SupplyDelivery.SupplyDeliverySuppliedItemComponent res = new SupplyDelivery.SupplyDeliverySuppliedItemComponent();
25349    parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(json, owner, res);
25350    return res;
25351  }
25352
25353  protected void parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(JsonObject json, SupplyDelivery owner, SupplyDelivery.SupplyDeliverySuppliedItemComponent res) throws IOException, FHIRFormatError {
25354    parseBackboneElementProperties(json, res);
25355    if (json.has("quantity"))
25356      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
25357    Type item = parseType("item", json);
25358    if (item != null)
25359      res.setItem(item);
25360  }
25361
25362  protected SupplyRequest parseSupplyRequest(JsonObject json) throws IOException, FHIRFormatError {
25363    SupplyRequest res = new SupplyRequest();
25364    parseSupplyRequestProperties(json, res);
25365    return res;
25366  }
25367
25368  protected void parseSupplyRequestProperties(JsonObject json, SupplyRequest res) throws IOException, FHIRFormatError {
25369    parseDomainResourceProperties(json, res);
25370    if (json.has("identifier")) {
25371      JsonArray array = json.getAsJsonArray("identifier");
25372      for (int i = 0; i < array.size(); i++) {
25373        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25374      }
25375    };
25376    if (json.has("status"))
25377      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyRequest.SupplyRequestStatus.NULL, new SupplyRequest.SupplyRequestStatusEnumFactory()));
25378    if (json.has("_status"))
25379      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
25380    if (json.has("category"))
25381      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
25382    if (json.has("priority"))
25383      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), SupplyRequest.RequestPriority.NULL, new SupplyRequest.RequestPriorityEnumFactory()));
25384    if (json.has("_priority"))
25385      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
25386    Type item = parseType("item", json);
25387    if (item != null)
25388      res.setItem(item);
25389    if (json.has("quantity"))
25390      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
25391    if (json.has("parameter")) {
25392      JsonArray array = json.getAsJsonArray("parameter");
25393      for (int i = 0; i < array.size(); i++) {
25394        res.getParameter().add(parseSupplyRequestSupplyRequestParameterComponent(array.get(i).getAsJsonObject(), res));
25395      }
25396    };
25397    Type occurrence = parseType("occurrence", json);
25398    if (occurrence != null)
25399      res.setOccurrence(occurrence);
25400    if (json.has("authoredOn"))
25401      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
25402    if (json.has("_authoredOn"))
25403      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
25404    if (json.has("requester"))
25405      res.setRequester(parseReference(getJObject(json, "requester")));
25406    if (json.has("supplier")) {
25407      JsonArray array = json.getAsJsonArray("supplier");
25408      for (int i = 0; i < array.size(); i++) {
25409        res.getSupplier().add(parseReference(array.get(i).getAsJsonObject()));
25410      }
25411    };
25412    if (json.has("reasonCode")) {
25413      JsonArray array = json.getAsJsonArray("reasonCode");
25414      for (int i = 0; i < array.size(); i++) {
25415        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25416      }
25417    };
25418    if (json.has("reasonReference")) {
25419      JsonArray array = json.getAsJsonArray("reasonReference");
25420      for (int i = 0; i < array.size(); i++) {
25421        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
25422      }
25423    };
25424    if (json.has("deliverFrom"))
25425      res.setDeliverFrom(parseReference(getJObject(json, "deliverFrom")));
25426    if (json.has("deliverTo"))
25427      res.setDeliverTo(parseReference(getJObject(json, "deliverTo")));
25428  }
25429
25430  protected SupplyRequest.SupplyRequestParameterComponent parseSupplyRequestSupplyRequestParameterComponent(JsonObject json, SupplyRequest owner) throws IOException, FHIRFormatError {
25431    SupplyRequest.SupplyRequestParameterComponent res = new SupplyRequest.SupplyRequestParameterComponent();
25432    parseSupplyRequestSupplyRequestParameterComponentProperties(json, owner, res);
25433    return res;
25434  }
25435
25436  protected void parseSupplyRequestSupplyRequestParameterComponentProperties(JsonObject json, SupplyRequest owner, SupplyRequest.SupplyRequestParameterComponent res) throws IOException, FHIRFormatError {
25437    parseBackboneElementProperties(json, res);
25438    if (json.has("code"))
25439      res.setCode(parseCodeableConcept(getJObject(json, "code")));
25440    Type value = parseType("value", json);
25441    if (value != null)
25442      res.setValue(value);
25443  }
25444
25445  protected Task parseTask(JsonObject json) throws IOException, FHIRFormatError {
25446    Task res = new Task();
25447    parseTaskProperties(json, res);
25448    return res;
25449  }
25450
25451  protected void parseTaskProperties(JsonObject json, Task res) throws IOException, FHIRFormatError {
25452    parseDomainResourceProperties(json, res);
25453    if (json.has("identifier")) {
25454      JsonArray array = json.getAsJsonArray("identifier");
25455      for (int i = 0; i < array.size(); i++) {
25456        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25457      }
25458    };
25459    if (json.has("instantiatesCanonical"))
25460      res.setInstantiatesCanonicalElement(parseCanonical(json.get("instantiatesCanonical").getAsString()));
25461    if (json.has("_instantiatesCanonical"))
25462      parseElementProperties(getJObject(json, "_instantiatesCanonical"), res.getInstantiatesCanonicalElement());
25463    if (json.has("instantiatesUri"))
25464      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
25465    if (json.has("_instantiatesUri"))
25466      parseElementProperties(getJObject(json, "_instantiatesUri"), res.getInstantiatesUriElement());
25467    if (json.has("basedOn")) {
25468      JsonArray array = json.getAsJsonArray("basedOn");
25469      for (int i = 0; i < array.size(); i++) {
25470        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
25471      }
25472    };
25473    if (json.has("groupIdentifier"))
25474      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
25475    if (json.has("partOf")) {
25476      JsonArray array = json.getAsJsonArray("partOf");
25477      for (int i = 0; i < array.size(); i++) {
25478        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
25479      }
25480    };
25481    if (json.has("status"))
25482      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Task.TaskStatus.NULL, new Task.TaskStatusEnumFactory()));
25483    if (json.has("_status"))
25484      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
25485    if (json.has("statusReason"))
25486      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
25487    if (json.has("businessStatus"))
25488      res.setBusinessStatus(parseCodeableConcept(getJObject(json, "businessStatus")));
25489    if (json.has("intent"))
25490      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Task.TaskIntent.NULL, new Task.TaskIntentEnumFactory()));
25491    if (json.has("_intent"))
25492      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
25493    if (json.has("priority"))
25494      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Task.TaskPriority.NULL, new Task.TaskPriorityEnumFactory()));
25495    if (json.has("_priority"))
25496      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
25497    if (json.has("code"))
25498      res.setCode(parseCodeableConcept(getJObject(json, "code")));
25499    if (json.has("description"))
25500      res.setDescriptionElement(parseString(json.get("description").getAsString()));
25501    if (json.has("_description"))
25502      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
25503    if (json.has("focus"))
25504      res.setFocus(parseReference(getJObject(json, "focus")));
25505    if (json.has("for"))
25506      res.setFor(parseReference(getJObject(json, "for")));
25507    if (json.has("encounter"))
25508      res.setEncounter(parseReference(getJObject(json, "encounter")));
25509    if (json.has("executionPeriod"))
25510      res.setExecutionPeriod(parsePeriod(getJObject(json, "executionPeriod")));
25511    if (json.has("authoredOn"))
25512      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
25513    if (json.has("_authoredOn"))
25514      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
25515    if (json.has("lastModified"))
25516      res.setLastModifiedElement(parseDateTime(json.get("lastModified").getAsString()));
25517    if (json.has("_lastModified"))
25518      parseElementProperties(getJObject(json, "_lastModified"), res.getLastModifiedElement());
25519    if (json.has("requester"))
25520      res.setRequester(parseReference(getJObject(json, "requester")));
25521    if (json.has("performerType")) {
25522      JsonArray array = json.getAsJsonArray("performerType");
25523      for (int i = 0; i < array.size(); i++) {
25524        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25525      }
25526    };
25527    if (json.has("owner"))
25528      res.setOwner(parseReference(getJObject(json, "owner")));
25529    if (json.has("location"))
25530      res.setLocation(parseReference(getJObject(json, "location")));
25531    if (json.has("reasonCode"))
25532      res.setReasonCode(parseCodeableConcept(getJObject(json, "reasonCode")));
25533    if (json.has("reasonReference"))
25534      res.setReasonReference(parseReference(getJObject(json, "reasonReference")));
25535    if (json.has("insurance")) {
25536      JsonArray array = json.getAsJsonArray("insurance");
25537      for (int i = 0; i < array.size(); i++) {
25538        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
25539      }
25540    };
25541    if (json.has("note")) {
25542      JsonArray array = json.getAsJsonArray("note");
25543      for (int i = 0; i < array.size(); i++) {
25544        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
25545      }
25546    };
25547    if (json.has("relevantHistory")) {
25548      JsonArray array = json.getAsJsonArray("relevantHistory");
25549      for (int i = 0; i < array.size(); i++) {
25550        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
25551      }
25552    };
25553    if (json.has("restriction"))
25554      res.setRestriction(parseTaskTaskRestrictionComponent(getJObject(json, "restriction"), res));
25555    if (json.has("input")) {
25556      JsonArray array = json.getAsJsonArray("input");
25557      for (int i = 0; i < array.size(); i++) {
25558        res.getInput().add(parseTaskParameterComponent(array.get(i).getAsJsonObject(), res));
25559      }
25560    };
25561    if (json.has("output")) {
25562      JsonArray array = json.getAsJsonArray("output");
25563      for (int i = 0; i < array.size(); i++) {
25564        res.getOutput().add(parseTaskTaskOutputComponent(array.get(i).getAsJsonObject(), res));
25565      }
25566    };
25567  }
25568
25569  protected Task.TaskRestrictionComponent parseTaskTaskRestrictionComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
25570    Task.TaskRestrictionComponent res = new Task.TaskRestrictionComponent();
25571    parseTaskTaskRestrictionComponentProperties(json, owner, res);
25572    return res;
25573  }
25574
25575  protected void parseTaskTaskRestrictionComponentProperties(JsonObject json, Task owner, Task.TaskRestrictionComponent res) throws IOException, FHIRFormatError {
25576    parseBackboneElementProperties(json, res);
25577    if (json.has("repetitions"))
25578      res.setRepetitionsElement(parsePositiveInt(json.get("repetitions").getAsString()));
25579    if (json.has("_repetitions"))
25580      parseElementProperties(getJObject(json, "_repetitions"), res.getRepetitionsElement());
25581    if (json.has("period"))
25582      res.setPeriod(parsePeriod(getJObject(json, "period")));
25583    if (json.has("recipient")) {
25584      JsonArray array = json.getAsJsonArray("recipient");
25585      for (int i = 0; i < array.size(); i++) {
25586        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
25587      }
25588    };
25589  }
25590
25591  protected Task.ParameterComponent parseTaskParameterComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
25592    Task.ParameterComponent res = new Task.ParameterComponent();
25593    parseTaskParameterComponentProperties(json, owner, res);
25594    return res;
25595  }
25596
25597  protected void parseTaskParameterComponentProperties(JsonObject json, Task owner, Task.ParameterComponent res) throws IOException, FHIRFormatError {
25598    parseBackboneElementProperties(json, res);
25599    if (json.has("type"))
25600      res.setType(parseCodeableConcept(getJObject(json, "type")));
25601    Type value = parseType("value", json);
25602    if (value != null)
25603      res.setValue(value);
25604  }
25605
25606  protected Task.TaskOutputComponent parseTaskTaskOutputComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
25607    Task.TaskOutputComponent res = new Task.TaskOutputComponent();
25608    parseTaskTaskOutputComponentProperties(json, owner, res);
25609    return res;
25610  }
25611
25612  protected void parseTaskTaskOutputComponentProperties(JsonObject json, Task owner, Task.TaskOutputComponent res) throws IOException, FHIRFormatError {
25613    parseBackboneElementProperties(json, res);
25614    if (json.has("type"))
25615      res.setType(parseCodeableConcept(getJObject(json, "type")));
25616    Type value = parseType("value", json);
25617    if (value != null)
25618      res.setValue(value);
25619  }
25620
25621  protected TerminologyCapabilities parseTerminologyCapabilities(JsonObject json) throws IOException, FHIRFormatError {
25622    TerminologyCapabilities res = new TerminologyCapabilities();
25623    parseTerminologyCapabilitiesProperties(json, res);
25624    return res;
25625  }
25626
25627  protected void parseTerminologyCapabilitiesProperties(JsonObject json, TerminologyCapabilities res) throws IOException, FHIRFormatError {
25628    parseDomainResourceProperties(json, res);
25629    if (json.has("url"))
25630      res.setUrlElement(parseUri(json.get("url").getAsString()));
25631    if (json.has("_url"))
25632      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
25633    if (json.has("version"))
25634      res.setVersionElement(parseString(json.get("version").getAsString()));
25635    if (json.has("_version"))
25636      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
25637    if (json.has("name"))
25638      res.setNameElement(parseString(json.get("name").getAsString()));
25639    if (json.has("_name"))
25640      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25641    if (json.has("title"))
25642      res.setTitleElement(parseString(json.get("title").getAsString()));
25643    if (json.has("_title"))
25644      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
25645    if (json.has("status"))
25646      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
25647    if (json.has("_status"))
25648      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
25649    if (json.has("experimental"))
25650      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
25651    if (json.has("_experimental"))
25652      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
25653    if (json.has("date"))
25654      res.setDateElement(parseDateTime(json.get("date").getAsString()));
25655    if (json.has("_date"))
25656      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
25657    if (json.has("publisher"))
25658      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
25659    if (json.has("_publisher"))
25660      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
25661    if (json.has("contact")) {
25662      JsonArray array = json.getAsJsonArray("contact");
25663      for (int i = 0; i < array.size(); i++) {
25664        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
25665      }
25666    };
25667    if (json.has("description"))
25668      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
25669    if (json.has("_description"))
25670      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
25671    if (json.has("useContext")) {
25672      JsonArray array = json.getAsJsonArray("useContext");
25673      for (int i = 0; i < array.size(); i++) {
25674        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
25675      }
25676    };
25677    if (json.has("jurisdiction")) {
25678      JsonArray array = json.getAsJsonArray("jurisdiction");
25679      for (int i = 0; i < array.size(); i++) {
25680        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25681      }
25682    };
25683    if (json.has("purpose"))
25684      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
25685    if (json.has("_purpose"))
25686      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
25687    if (json.has("copyright"))
25688      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
25689    if (json.has("_copyright"))
25690      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
25691    if (json.has("kind"))
25692      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), TerminologyCapabilities.CapabilityStatementKind.NULL, new TerminologyCapabilities.CapabilityStatementKindEnumFactory()));
25693    if (json.has("_kind"))
25694      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
25695    if (json.has("software"))
25696      res.setSoftware(parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(getJObject(json, "software"), res));
25697    if (json.has("implementation"))
25698      res.setImplementation(parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(getJObject(json, "implementation"), res));
25699    if (json.has("lockedDate"))
25700      res.setLockedDateElement(parseBoolean(json.get("lockedDate").getAsBoolean()));
25701    if (json.has("_lockedDate"))
25702      parseElementProperties(getJObject(json, "_lockedDate"), res.getLockedDateElement());
25703    if (json.has("codeSystem")) {
25704      JsonArray array = json.getAsJsonArray("codeSystem");
25705      for (int i = 0; i < array.size(); i++) {
25706        res.getCodeSystem().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(array.get(i).getAsJsonObject(), res));
25707      }
25708    };
25709    if (json.has("expansion"))
25710      res.setExpansion(parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(getJObject(json, "expansion"), res));
25711    if (json.has("codeSearch"))
25712      res.setCodeSearchElement(parseEnumeration(json.get("codeSearch").getAsString(), TerminologyCapabilities.CodeSearchSupport.NULL, new TerminologyCapabilities.CodeSearchSupportEnumFactory()));
25713    if (json.has("_codeSearch"))
25714      parseElementProperties(getJObject(json, "_codeSearch"), res.getCodeSearchElement());
25715    if (json.has("validateCode"))
25716      res.setValidateCode(parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(getJObject(json, "validateCode"), res));
25717    if (json.has("translation"))
25718      res.setTranslation(parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(getJObject(json, "translation"), res));
25719    if (json.has("closure"))
25720      res.setClosure(parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(getJObject(json, "closure"), res));
25721  }
25722
25723  protected TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25724    TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent res = new TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent();
25725    parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentProperties(json, owner, res);
25726    return res;
25727  }
25728
25729  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent res) throws IOException, FHIRFormatError {
25730    parseBackboneElementProperties(json, res);
25731    if (json.has("name"))
25732      res.setNameElement(parseString(json.get("name").getAsString()));
25733    if (json.has("_name"))
25734      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25735    if (json.has("version"))
25736      res.setVersionElement(parseString(json.get("version").getAsString()));
25737    if (json.has("_version"))
25738      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
25739  }
25740
25741  protected TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25742    TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent();
25743    parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentProperties(json, owner, res);
25744    return res;
25745  }
25746
25747  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res) throws IOException, FHIRFormatError {
25748    parseBackboneElementProperties(json, res);
25749    if (json.has("description"))
25750      res.setDescriptionElement(parseString(json.get("description").getAsString()));
25751    if (json.has("_description"))
25752      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
25753    if (json.has("url"))
25754      res.setUrlElement(parseUrl(json.get("url").getAsString()));
25755    if (json.has("_url"))
25756      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
25757  }
25758
25759  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25760    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent();
25761    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentProperties(json, owner, res);
25762    return res;
25763  }
25764
25765  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res) throws IOException, FHIRFormatError {
25766    parseBackboneElementProperties(json, res);
25767    if (json.has("uri"))
25768      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
25769    if (json.has("_uri"))
25770      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
25771    if (json.has("version")) {
25772      JsonArray array = json.getAsJsonArray("version");
25773      for (int i = 0; i < array.size(); i++) {
25774        res.getVersion().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(array.get(i).getAsJsonObject(), owner));
25775      }
25776    };
25777    if (json.has("subsumption"))
25778      res.setSubsumptionElement(parseBoolean(json.get("subsumption").getAsBoolean()));
25779    if (json.has("_subsumption"))
25780      parseElementProperties(getJObject(json, "_subsumption"), res.getSubsumptionElement());
25781  }
25782
25783  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25784    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent();
25785    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentProperties(json, owner, res);
25786    return res;
25787  }
25788
25789  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res) throws IOException, FHIRFormatError {
25790    parseBackboneElementProperties(json, res);
25791    if (json.has("code"))
25792      res.setCodeElement(parseString(json.get("code").getAsString()));
25793    if (json.has("_code"))
25794      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
25795    if (json.has("isDefault"))
25796      res.setIsDefaultElement(parseBoolean(json.get("isDefault").getAsBoolean()));
25797    if (json.has("_isDefault"))
25798      parseElementProperties(getJObject(json, "_isDefault"), res.getIsDefaultElement());
25799    if (json.has("compositional"))
25800      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
25801    if (json.has("_compositional"))
25802      parseElementProperties(getJObject(json, "_compositional"), res.getCompositionalElement());
25803    if (json.has("language")) {
25804      JsonArray array = json.getAsJsonArray("language");
25805      for (int i = 0; i < array.size(); i++) {
25806        res.getLanguage().add(parseCode(array.get(i).getAsString()));
25807      }
25808    };
25809    if (json.has("_language")) {
25810      JsonArray array = json.getAsJsonArray("_language");
25811      for (int i = 0; i < array.size(); i++) {
25812        if (i == res.getLanguage().size())
25813          res.getLanguage().add(parseCode(null));
25814        if (array.get(i) instanceof JsonObject) 
25815          parseElementProperties(array.get(i).getAsJsonObject(), res.getLanguage().get(i));
25816      }
25817    };
25818    if (json.has("filter")) {
25819      JsonArray array = json.getAsJsonArray("filter");
25820      for (int i = 0; i < array.size(); i++) {
25821        res.getFilter().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(array.get(i).getAsJsonObject(), owner));
25822      }
25823    };
25824    if (json.has("property")) {
25825      JsonArray array = json.getAsJsonArray("property");
25826      for (int i = 0; i < array.size(); i++) {
25827        res.getProperty().add(parseCode(array.get(i).getAsString()));
25828      }
25829    };
25830    if (json.has("_property")) {
25831      JsonArray array = json.getAsJsonArray("_property");
25832      for (int i = 0; i < array.size(); i++) {
25833        if (i == res.getProperty().size())
25834          res.getProperty().add(parseCode(null));
25835        if (array.get(i) instanceof JsonObject) 
25836          parseElementProperties(array.get(i).getAsJsonObject(), res.getProperty().get(i));
25837      }
25838    };
25839  }
25840
25841  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25842    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent();
25843    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(json, owner, res);
25844    return res;
25845  }
25846
25847  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res) throws IOException, FHIRFormatError {
25848    parseBackboneElementProperties(json, res);
25849    if (json.has("code"))
25850      res.setCodeElement(parseCode(json.get("code").getAsString()));
25851    if (json.has("_code"))
25852      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
25853    if (json.has("op")) {
25854      JsonArray array = json.getAsJsonArray("op");
25855      for (int i = 0; i < array.size(); i++) {
25856        res.getOp().add(parseCode(array.get(i).getAsString()));
25857      }
25858    };
25859    if (json.has("_op")) {
25860      JsonArray array = json.getAsJsonArray("_op");
25861      for (int i = 0; i < array.size(); i++) {
25862        if (i == res.getOp().size())
25863          res.getOp().add(parseCode(null));
25864        if (array.get(i) instanceof JsonObject) 
25865          parseElementProperties(array.get(i).getAsJsonObject(), res.getOp().get(i));
25866      }
25867    };
25868  }
25869
25870  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25871    TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent();
25872    parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentProperties(json, owner, res);
25873    return res;
25874  }
25875
25876  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res) throws IOException, FHIRFormatError {
25877    parseBackboneElementProperties(json, res);
25878    if (json.has("hierarchical"))
25879      res.setHierarchicalElement(parseBoolean(json.get("hierarchical").getAsBoolean()));
25880    if (json.has("_hierarchical"))
25881      parseElementProperties(getJObject(json, "_hierarchical"), res.getHierarchicalElement());
25882    if (json.has("paging"))
25883      res.setPagingElement(parseBoolean(json.get("paging").getAsBoolean()));
25884    if (json.has("_paging"))
25885      parseElementProperties(getJObject(json, "_paging"), res.getPagingElement());
25886    if (json.has("incomplete"))
25887      res.setIncompleteElement(parseBoolean(json.get("incomplete").getAsBoolean()));
25888    if (json.has("_incomplete"))
25889      parseElementProperties(getJObject(json, "_incomplete"), res.getIncompleteElement());
25890    if (json.has("parameter")) {
25891      JsonArray array = json.getAsJsonArray("parameter");
25892      for (int i = 0; i < array.size(); i++) {
25893        res.getParameter().add(parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(array.get(i).getAsJsonObject(), owner));
25894      }
25895    };
25896    if (json.has("textFilter"))
25897      res.setTextFilterElement(parseMarkdown(json.get("textFilter").getAsString()));
25898    if (json.has("_textFilter"))
25899      parseElementProperties(getJObject(json, "_textFilter"), res.getTextFilterElement());
25900  }
25901
25902  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25903    TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent();
25904    parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentProperties(json, owner, res);
25905    return res;
25906  }
25907
25908  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res) throws IOException, FHIRFormatError {
25909    parseBackboneElementProperties(json, res);
25910    if (json.has("name"))
25911      res.setNameElement(parseCode(json.get("name").getAsString()));
25912    if (json.has("_name"))
25913      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25914    if (json.has("documentation"))
25915      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
25916    if (json.has("_documentation"))
25917      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
25918  }
25919
25920  protected TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25921    TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res = new TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent();
25922    parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentProperties(json, owner, res);
25923    return res;
25924  }
25925
25926  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res) throws IOException, FHIRFormatError {
25927    parseBackboneElementProperties(json, res);
25928    if (json.has("translations"))
25929      res.setTranslationsElement(parseBoolean(json.get("translations").getAsBoolean()));
25930    if (json.has("_translations"))
25931      parseElementProperties(getJObject(json, "_translations"), res.getTranslationsElement());
25932  }
25933
25934  protected TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25935    TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent();
25936    parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentProperties(json, owner, res);
25937    return res;
25938  }
25939
25940  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res) throws IOException, FHIRFormatError {
25941    parseBackboneElementProperties(json, res);
25942    if (json.has("needsMap"))
25943      res.setNeedsMapElement(parseBoolean(json.get("needsMap").getAsBoolean()));
25944    if (json.has("_needsMap"))
25945      parseElementProperties(getJObject(json, "_needsMap"), res.getNeedsMapElement());
25946  }
25947
25948  protected TerminologyCapabilities.TerminologyCapabilitiesClosureComponent parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25949    TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res = new TerminologyCapabilities.TerminologyCapabilitiesClosureComponent();
25950    parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentProperties(json, owner, res);
25951    return res;
25952  }
25953
25954  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res) throws IOException, FHIRFormatError {
25955    parseBackboneElementProperties(json, res);
25956    if (json.has("translation"))
25957      res.setTranslationElement(parseBoolean(json.get("translation").getAsBoolean()));
25958    if (json.has("_translation"))
25959      parseElementProperties(getJObject(json, "_translation"), res.getTranslationElement());
25960  }
25961
25962  protected TestReport parseTestReport(JsonObject json) throws IOException, FHIRFormatError {
25963    TestReport res = new TestReport();
25964    parseTestReportProperties(json, res);
25965    return res;
25966  }
25967
25968  protected void parseTestReportProperties(JsonObject json, TestReport res) throws IOException, FHIRFormatError {
25969    parseDomainResourceProperties(json, res);
25970    if (json.has("identifier"))
25971      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
25972    if (json.has("name"))
25973      res.setNameElement(parseString(json.get("name").getAsString()));
25974    if (json.has("_name"))
25975      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25976    if (json.has("status"))
25977      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), TestReport.TestReportStatus.NULL, new TestReport.TestReportStatusEnumFactory()));
25978    if (json.has("_status"))
25979      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
25980    if (json.has("testScript"))
25981      res.setTestScript(parseReference(getJObject(json, "testScript")));
25982    if (json.has("result"))
25983      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportResult.NULL, new TestReport.TestReportResultEnumFactory()));
25984    if (json.has("_result"))
25985      parseElementProperties(getJObject(json, "_result"), res.getResultElement());
25986    if (json.has("score"))
25987      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
25988    if (json.has("_score"))
25989      parseElementProperties(getJObject(json, "_score"), res.getScoreElement());
25990    if (json.has("tester"))
25991      res.setTesterElement(parseString(json.get("tester").getAsString()));
25992    if (json.has("_tester"))
25993      parseElementProperties(getJObject(json, "_tester"), res.getTesterElement());
25994    if (json.has("issued"))
25995      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
25996    if (json.has("_issued"))
25997      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
25998    if (json.has("participant")) {
25999      JsonArray array = json.getAsJsonArray("participant");
26000      for (int i = 0; i < array.size(); i++) {
26001        res.getParticipant().add(parseTestReportTestReportParticipantComponent(array.get(i).getAsJsonObject(), res));
26002      }
26003    };
26004    if (json.has("setup"))
26005      res.setSetup(parseTestReportTestReportSetupComponent(getJObject(json, "setup"), res));
26006    if (json.has("test")) {
26007      JsonArray array = json.getAsJsonArray("test");
26008      for (int i = 0; i < array.size(); i++) {
26009        res.getTest().add(parseTestReportTestReportTestComponent(array.get(i).getAsJsonObject(), res));
26010      }
26011    };
26012    if (json.has("teardown"))
26013      res.setTeardown(parseTestReportTestReportTeardownComponent(getJObject(json, "teardown"), res));
26014  }
26015
26016  protected TestReport.TestReportParticipantComponent parseTestReportTestReportParticipantComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26017    TestReport.TestReportParticipantComponent res = new TestReport.TestReportParticipantComponent();
26018    parseTestReportTestReportParticipantComponentProperties(json, owner, res);
26019    return res;
26020  }
26021
26022  protected void parseTestReportTestReportParticipantComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportParticipantComponent res) throws IOException, FHIRFormatError {
26023    parseBackboneElementProperties(json, res);
26024    if (json.has("type"))
26025      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TestReport.TestReportParticipantType.NULL, new TestReport.TestReportParticipantTypeEnumFactory()));
26026    if (json.has("_type"))
26027      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
26028    if (json.has("uri"))
26029      res.setUriElement(parseUri(json.get("uri").getAsString()));
26030    if (json.has("_uri"))
26031      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
26032    if (json.has("display"))
26033      res.setDisplayElement(parseString(json.get("display").getAsString()));
26034    if (json.has("_display"))
26035      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
26036  }
26037
26038  protected TestReport.TestReportSetupComponent parseTestReportTestReportSetupComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26039    TestReport.TestReportSetupComponent res = new TestReport.TestReportSetupComponent();
26040    parseTestReportTestReportSetupComponentProperties(json, owner, res);
26041    return res;
26042  }
26043
26044  protected void parseTestReportTestReportSetupComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportSetupComponent res) throws IOException, FHIRFormatError {
26045    parseBackboneElementProperties(json, res);
26046    if (json.has("action")) {
26047      JsonArray array = json.getAsJsonArray("action");
26048      for (int i = 0; i < array.size(); i++) {
26049        res.getAction().add(parseTestReportSetupActionComponent(array.get(i).getAsJsonObject(), owner));
26050      }
26051    };
26052  }
26053
26054  protected TestReport.SetupActionComponent parseTestReportSetupActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26055    TestReport.SetupActionComponent res = new TestReport.SetupActionComponent();
26056    parseTestReportSetupActionComponentProperties(json, owner, res);
26057    return res;
26058  }
26059
26060  protected void parseTestReportSetupActionComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionComponent res) throws IOException, FHIRFormatError {
26061    parseBackboneElementProperties(json, res);
26062    if (json.has("operation"))
26063      res.setOperation(parseTestReportSetupActionOperationComponent(getJObject(json, "operation"), owner));
26064    if (json.has("assert"))
26065      res.setAssert(parseTestReportSetupActionAssertComponent(getJObject(json, "assert"), owner));
26066  }
26067
26068  protected TestReport.SetupActionOperationComponent parseTestReportSetupActionOperationComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26069    TestReport.SetupActionOperationComponent res = new TestReport.SetupActionOperationComponent();
26070    parseTestReportSetupActionOperationComponentProperties(json, owner, res);
26071    return res;
26072  }
26073
26074  protected void parseTestReportSetupActionOperationComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
26075    parseBackboneElementProperties(json, res);
26076    if (json.has("result"))
26077      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
26078    if (json.has("_result"))
26079      parseElementProperties(getJObject(json, "_result"), res.getResultElement());
26080    if (json.has("message"))
26081      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
26082    if (json.has("_message"))
26083      parseElementProperties(getJObject(json, "_message"), res.getMessageElement());
26084    if (json.has("detail"))
26085      res.setDetailElement(parseUri(json.get("detail").getAsString()));
26086    if (json.has("_detail"))
26087      parseElementProperties(getJObject(json, "_detail"), res.getDetailElement());
26088  }
26089
26090  protected TestReport.SetupActionAssertComponent parseTestReportSetupActionAssertComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26091    TestReport.SetupActionAssertComponent res = new TestReport.SetupActionAssertComponent();
26092    parseTestReportSetupActionAssertComponentProperties(json, owner, res);
26093    return res;
26094  }
26095
26096  protected void parseTestReportSetupActionAssertComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
26097    parseBackboneElementProperties(json, res);
26098    if (json.has("result"))
26099      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
26100    if (json.has("_result"))
26101      parseElementProperties(getJObject(json, "_result"), res.getResultElement());
26102    if (json.has("message"))
26103      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
26104    if (json.has("_message"))
26105      parseElementProperties(getJObject(json, "_message"), res.getMessageElement());
26106    if (json.has("detail"))
26107      res.setDetailElement(parseString(json.get("detail").getAsString()));
26108    if (json.has("_detail"))
26109      parseElementProperties(getJObject(json, "_detail"), res.getDetailElement());
26110  }
26111
26112  protected TestReport.TestReportTestComponent parseTestReportTestReportTestComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26113    TestReport.TestReportTestComponent res = new TestReport.TestReportTestComponent();
26114    parseTestReportTestReportTestComponentProperties(json, owner, res);
26115    return res;
26116  }
26117
26118  protected void parseTestReportTestReportTestComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportTestComponent res) throws IOException, FHIRFormatError {
26119    parseBackboneElementProperties(json, res);
26120    if (json.has("name"))
26121      res.setNameElement(parseString(json.get("name").getAsString()));
26122    if (json.has("_name"))
26123      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
26124    if (json.has("description"))
26125      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26126    if (json.has("_description"))
26127      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26128    if (json.has("action")) {
26129      JsonArray array = json.getAsJsonArray("action");
26130      for (int i = 0; i < array.size(); i++) {
26131        res.getAction().add(parseTestReportTestActionComponent(array.get(i).getAsJsonObject(), owner));
26132      }
26133    };
26134  }
26135
26136  protected TestReport.TestActionComponent parseTestReportTestActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26137    TestReport.TestActionComponent res = new TestReport.TestActionComponent();
26138    parseTestReportTestActionComponentProperties(json, owner, res);
26139    return res;
26140  }
26141
26142  protected void parseTestReportTestActionComponentProperties(JsonObject json, TestReport owner, TestReport.TestActionComponent res) throws IOException, FHIRFormatError {
26143    parseBackboneElementProperties(json, res);
26144    if (json.has("operation"))
26145      res.setOperation(parseTestReportSetupActionOperationComponent(getJObject(json, "operation"), owner));
26146    if (json.has("assert"))
26147      res.setAssert(parseTestReportSetupActionAssertComponent(getJObject(json, "assert"), owner));
26148  }
26149
26150  protected TestReport.TestReportTeardownComponent parseTestReportTestReportTeardownComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26151    TestReport.TestReportTeardownComponent res = new TestReport.TestReportTeardownComponent();
26152    parseTestReportTestReportTeardownComponentProperties(json, owner, res);
26153    return res;
26154  }
26155
26156  protected void parseTestReportTestReportTeardownComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportTeardownComponent res) throws IOException, FHIRFormatError {
26157    parseBackboneElementProperties(json, res);
26158    if (json.has("action")) {
26159      JsonArray array = json.getAsJsonArray("action");
26160      for (int i = 0; i < array.size(); i++) {
26161        res.getAction().add(parseTestReportTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
26162      }
26163    };
26164  }
26165
26166  protected TestReport.TeardownActionComponent parseTestReportTeardownActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26167    TestReport.TeardownActionComponent res = new TestReport.TeardownActionComponent();
26168    parseTestReportTeardownActionComponentProperties(json, owner, res);
26169    return res;
26170  }
26171
26172  protected void parseTestReportTeardownActionComponentProperties(JsonObject json, TestReport owner, TestReport.TeardownActionComponent res) throws IOException, FHIRFormatError {
26173    parseBackboneElementProperties(json, res);
26174    if (json.has("operation"))
26175      res.setOperation(parseTestReportSetupActionOperationComponent(getJObject(json, "operation"), owner));
26176  }
26177
26178  protected TestScript parseTestScript(JsonObject json) throws IOException, FHIRFormatError {
26179    TestScript res = new TestScript();
26180    parseTestScriptProperties(json, res);
26181    return res;
26182  }
26183
26184  protected void parseTestScriptProperties(JsonObject json, TestScript res) throws IOException, FHIRFormatError {
26185    parseDomainResourceProperties(json, res);
26186    if (json.has("url"))
26187      res.setUrlElement(parseUri(json.get("url").getAsString()));
26188    if (json.has("_url"))
26189      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
26190    if (json.has("identifier"))
26191      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
26192    if (json.has("version"))
26193      res.setVersionElement(parseString(json.get("version").getAsString()));
26194    if (json.has("_version"))
26195      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
26196    if (json.has("name"))
26197      res.setNameElement(parseString(json.get("name").getAsString()));
26198    if (json.has("_name"))
26199      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
26200    if (json.has("title"))
26201      res.setTitleElement(parseString(json.get("title").getAsString()));
26202    if (json.has("_title"))
26203      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
26204    if (json.has("status"))
26205      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
26206    if (json.has("_status"))
26207      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
26208    if (json.has("experimental"))
26209      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
26210    if (json.has("_experimental"))
26211      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
26212    if (json.has("date"))
26213      res.setDateElement(parseDateTime(json.get("date").getAsString()));
26214    if (json.has("_date"))
26215      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
26216    if (json.has("publisher"))
26217      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
26218    if (json.has("_publisher"))
26219      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
26220    if (json.has("contact")) {
26221      JsonArray array = json.getAsJsonArray("contact");
26222      for (int i = 0; i < array.size(); i++) {
26223        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
26224      }
26225    };
26226    if (json.has("description"))
26227      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
26228    if (json.has("_description"))
26229      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26230    if (json.has("useContext")) {
26231      JsonArray array = json.getAsJsonArray("useContext");
26232      for (int i = 0; i < array.size(); i++) {
26233        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
26234      }
26235    };
26236    if (json.has("jurisdiction")) {
26237      JsonArray array = json.getAsJsonArray("jurisdiction");
26238      for (int i = 0; i < array.size(); i++) {
26239        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26240      }
26241    };
26242    if (json.has("purpose"))
26243      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
26244    if (json.has("_purpose"))
26245      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
26246    if (json.has("copyright"))
26247      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
26248    if (json.has("_copyright"))
26249      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
26250    if (json.has("origin")) {
26251      JsonArray array = json.getAsJsonArray("origin");
26252      for (int i = 0; i < array.size(); i++) {
26253        res.getOrigin().add(parseTestScriptTestScriptOriginComponent(array.get(i).getAsJsonObject(), res));
26254      }
26255    };
26256    if (json.has("destination")) {
26257      JsonArray array = json.getAsJsonArray("destination");
26258      for (int i = 0; i < array.size(); i++) {
26259        res.getDestination().add(parseTestScriptTestScriptDestinationComponent(array.get(i).getAsJsonObject(), res));
26260      }
26261    };
26262    if (json.has("metadata"))
26263      res.setMetadata(parseTestScriptTestScriptMetadataComponent(getJObject(json, "metadata"), res));
26264    if (json.has("fixture")) {
26265      JsonArray array = json.getAsJsonArray("fixture");
26266      for (int i = 0; i < array.size(); i++) {
26267        res.getFixture().add(parseTestScriptTestScriptFixtureComponent(array.get(i).getAsJsonObject(), res));
26268      }
26269    };
26270    if (json.has("profile")) {
26271      JsonArray array = json.getAsJsonArray("profile");
26272      for (int i = 0; i < array.size(); i++) {
26273        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
26274      }
26275    };
26276    if (json.has("variable")) {
26277      JsonArray array = json.getAsJsonArray("variable");
26278      for (int i = 0; i < array.size(); i++) {
26279        res.getVariable().add(parseTestScriptTestScriptVariableComponent(array.get(i).getAsJsonObject(), res));
26280      }
26281    };
26282    if (json.has("setup"))
26283      res.setSetup(parseTestScriptTestScriptSetupComponent(getJObject(json, "setup"), res));
26284    if (json.has("test")) {
26285      JsonArray array = json.getAsJsonArray("test");
26286      for (int i = 0; i < array.size(); i++) {
26287        res.getTest().add(parseTestScriptTestScriptTestComponent(array.get(i).getAsJsonObject(), res));
26288      }
26289    };
26290    if (json.has("teardown"))
26291      res.setTeardown(parseTestScriptTestScriptTeardownComponent(getJObject(json, "teardown"), res));
26292  }
26293
26294  protected TestScript.TestScriptOriginComponent parseTestScriptTestScriptOriginComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26295    TestScript.TestScriptOriginComponent res = new TestScript.TestScriptOriginComponent();
26296    parseTestScriptTestScriptOriginComponentProperties(json, owner, res);
26297    return res;
26298  }
26299
26300  protected void parseTestScriptTestScriptOriginComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptOriginComponent res) throws IOException, FHIRFormatError {
26301    parseBackboneElementProperties(json, res);
26302    if (json.has("index"))
26303      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
26304    if (json.has("_index"))
26305      parseElementProperties(getJObject(json, "_index"), res.getIndexElement());
26306    if (json.has("profile"))
26307      res.setProfile(parseCoding(getJObject(json, "profile")));
26308  }
26309
26310  protected TestScript.TestScriptDestinationComponent parseTestScriptTestScriptDestinationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26311    TestScript.TestScriptDestinationComponent res = new TestScript.TestScriptDestinationComponent();
26312    parseTestScriptTestScriptDestinationComponentProperties(json, owner, res);
26313    return res;
26314  }
26315
26316  protected void parseTestScriptTestScriptDestinationComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptDestinationComponent res) throws IOException, FHIRFormatError {
26317    parseBackboneElementProperties(json, res);
26318    if (json.has("index"))
26319      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
26320    if (json.has("_index"))
26321      parseElementProperties(getJObject(json, "_index"), res.getIndexElement());
26322    if (json.has("profile"))
26323      res.setProfile(parseCoding(getJObject(json, "profile")));
26324  }
26325
26326  protected TestScript.TestScriptMetadataComponent parseTestScriptTestScriptMetadataComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26327    TestScript.TestScriptMetadataComponent res = new TestScript.TestScriptMetadataComponent();
26328    parseTestScriptTestScriptMetadataComponentProperties(json, owner, res);
26329    return res;
26330  }
26331
26332  protected void parseTestScriptTestScriptMetadataComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataComponent res) throws IOException, FHIRFormatError {
26333    parseBackboneElementProperties(json, res);
26334    if (json.has("link")) {
26335      JsonArray array = json.getAsJsonArray("link");
26336      for (int i = 0; i < array.size(); i++) {
26337        res.getLink().add(parseTestScriptTestScriptMetadataLinkComponent(array.get(i).getAsJsonObject(), owner));
26338      }
26339    };
26340    if (json.has("capability")) {
26341      JsonArray array = json.getAsJsonArray("capability");
26342      for (int i = 0; i < array.size(); i++) {
26343        res.getCapability().add(parseTestScriptTestScriptMetadataCapabilityComponent(array.get(i).getAsJsonObject(), owner));
26344      }
26345    };
26346  }
26347
26348  protected TestScript.TestScriptMetadataLinkComponent parseTestScriptTestScriptMetadataLinkComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26349    TestScript.TestScriptMetadataLinkComponent res = new TestScript.TestScriptMetadataLinkComponent();
26350    parseTestScriptTestScriptMetadataLinkComponentProperties(json, owner, res);
26351    return res;
26352  }
26353
26354  protected void parseTestScriptTestScriptMetadataLinkComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataLinkComponent res) throws IOException, FHIRFormatError {
26355    parseBackboneElementProperties(json, res);
26356    if (json.has("url"))
26357      res.setUrlElement(parseUri(json.get("url").getAsString()));
26358    if (json.has("_url"))
26359      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
26360    if (json.has("description"))
26361      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26362    if (json.has("_description"))
26363      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26364  }
26365
26366  protected TestScript.TestScriptMetadataCapabilityComponent parseTestScriptTestScriptMetadataCapabilityComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26367    TestScript.TestScriptMetadataCapabilityComponent res = new TestScript.TestScriptMetadataCapabilityComponent();
26368    parseTestScriptTestScriptMetadataCapabilityComponentProperties(json, owner, res);
26369    return res;
26370  }
26371
26372  protected void parseTestScriptTestScriptMetadataCapabilityComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataCapabilityComponent res) throws IOException, FHIRFormatError {
26373    parseBackboneElementProperties(json, res);
26374    if (json.has("required"))
26375      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
26376    if (json.has("_required"))
26377      parseElementProperties(getJObject(json, "_required"), res.getRequiredElement());
26378    if (json.has("validated"))
26379      res.setValidatedElement(parseBoolean(json.get("validated").getAsBoolean()));
26380    if (json.has("_validated"))
26381      parseElementProperties(getJObject(json, "_validated"), res.getValidatedElement());
26382    if (json.has("description"))
26383      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26384    if (json.has("_description"))
26385      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26386    if (json.has("origin")) {
26387      JsonArray array = json.getAsJsonArray("origin");
26388      for (int i = 0; i < array.size(); i++) {
26389        res.getOrigin().add(parseInteger(array.get(i).getAsLong()));
26390      }
26391    };
26392    if (json.has("_origin")) {
26393      JsonArray array = json.getAsJsonArray("_origin");
26394      for (int i = 0; i < array.size(); i++) {
26395        if (i == res.getOrigin().size())
26396          res.getOrigin().add(parseInteger(null));
26397        if (array.get(i) instanceof JsonObject) 
26398          parseElementProperties(array.get(i).getAsJsonObject(), res.getOrigin().get(i));
26399      }
26400    };
26401    if (json.has("destination"))
26402      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
26403    if (json.has("_destination"))
26404      parseElementProperties(getJObject(json, "_destination"), res.getDestinationElement());
26405    if (json.has("link")) {
26406      JsonArray array = json.getAsJsonArray("link");
26407      for (int i = 0; i < array.size(); i++) {
26408        res.getLink().add(parseUri(array.get(i).getAsString()));
26409      }
26410    };
26411    if (json.has("_link")) {
26412      JsonArray array = json.getAsJsonArray("_link");
26413      for (int i = 0; i < array.size(); i++) {
26414        if (i == res.getLink().size())
26415          res.getLink().add(parseUri(null));
26416        if (array.get(i) instanceof JsonObject) 
26417          parseElementProperties(array.get(i).getAsJsonObject(), res.getLink().get(i));
26418      }
26419    };
26420    if (json.has("capabilities"))
26421      res.setCapabilitiesElement(parseCanonical(json.get("capabilities").getAsString()));
26422    if (json.has("_capabilities"))
26423      parseElementProperties(getJObject(json, "_capabilities"), res.getCapabilitiesElement());
26424  }
26425
26426  protected TestScript.TestScriptFixtureComponent parseTestScriptTestScriptFixtureComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26427    TestScript.TestScriptFixtureComponent res = new TestScript.TestScriptFixtureComponent();
26428    parseTestScriptTestScriptFixtureComponentProperties(json, owner, res);
26429    return res;
26430  }
26431
26432  protected void parseTestScriptTestScriptFixtureComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptFixtureComponent res) throws IOException, FHIRFormatError {
26433    parseBackboneElementProperties(json, res);
26434    if (json.has("autocreate"))
26435      res.setAutocreateElement(parseBoolean(json.get("autocreate").getAsBoolean()));
26436    if (json.has("_autocreate"))
26437      parseElementProperties(getJObject(json, "_autocreate"), res.getAutocreateElement());
26438    if (json.has("autodelete"))
26439      res.setAutodeleteElement(parseBoolean(json.get("autodelete").getAsBoolean()));
26440    if (json.has("_autodelete"))
26441      parseElementProperties(getJObject(json, "_autodelete"), res.getAutodeleteElement());
26442    if (json.has("resource"))
26443      res.setResource(parseReference(getJObject(json, "resource")));
26444  }
26445
26446  protected TestScript.TestScriptVariableComponent parseTestScriptTestScriptVariableComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26447    TestScript.TestScriptVariableComponent res = new TestScript.TestScriptVariableComponent();
26448    parseTestScriptTestScriptVariableComponentProperties(json, owner, res);
26449    return res;
26450  }
26451
26452  protected void parseTestScriptTestScriptVariableComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptVariableComponent res) throws IOException, FHIRFormatError {
26453    parseBackboneElementProperties(json, res);
26454    if (json.has("name"))
26455      res.setNameElement(parseString(json.get("name").getAsString()));
26456    if (json.has("_name"))
26457      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
26458    if (json.has("defaultValue"))
26459      res.setDefaultValueElement(parseString(json.get("defaultValue").getAsString()));
26460    if (json.has("_defaultValue"))
26461      parseElementProperties(getJObject(json, "_defaultValue"), res.getDefaultValueElement());
26462    if (json.has("description"))
26463      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26464    if (json.has("_description"))
26465      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26466    if (json.has("expression"))
26467      res.setExpressionElement(parseString(json.get("expression").getAsString()));
26468    if (json.has("_expression"))
26469      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
26470    if (json.has("headerField"))
26471      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
26472    if (json.has("_headerField"))
26473      parseElementProperties(getJObject(json, "_headerField"), res.getHeaderFieldElement());
26474    if (json.has("hint"))
26475      res.setHintElement(parseString(json.get("hint").getAsString()));
26476    if (json.has("_hint"))
26477      parseElementProperties(getJObject(json, "_hint"), res.getHintElement());
26478    if (json.has("path"))
26479      res.setPathElement(parseString(json.get("path").getAsString()));
26480    if (json.has("_path"))
26481      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
26482    if (json.has("sourceId"))
26483      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
26484    if (json.has("_sourceId"))
26485      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
26486  }
26487
26488  protected TestScript.TestScriptSetupComponent parseTestScriptTestScriptSetupComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26489    TestScript.TestScriptSetupComponent res = new TestScript.TestScriptSetupComponent();
26490    parseTestScriptTestScriptSetupComponentProperties(json, owner, res);
26491    return res;
26492  }
26493
26494  protected void parseTestScriptTestScriptSetupComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptSetupComponent res) throws IOException, FHIRFormatError {
26495    parseBackboneElementProperties(json, res);
26496    if (json.has("action")) {
26497      JsonArray array = json.getAsJsonArray("action");
26498      for (int i = 0; i < array.size(); i++) {
26499        res.getAction().add(parseTestScriptSetupActionComponent(array.get(i).getAsJsonObject(), owner));
26500      }
26501    };
26502  }
26503
26504  protected TestScript.SetupActionComponent parseTestScriptSetupActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26505    TestScript.SetupActionComponent res = new TestScript.SetupActionComponent();
26506    parseTestScriptSetupActionComponentProperties(json, owner, res);
26507    return res;
26508  }
26509
26510  protected void parseTestScriptSetupActionComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionComponent res) throws IOException, FHIRFormatError {
26511    parseBackboneElementProperties(json, res);
26512    if (json.has("operation"))
26513      res.setOperation(parseTestScriptSetupActionOperationComponent(getJObject(json, "operation"), owner));
26514    if (json.has("assert"))
26515      res.setAssert(parseTestScriptSetupActionAssertComponent(getJObject(json, "assert"), owner));
26516  }
26517
26518  protected TestScript.SetupActionOperationComponent parseTestScriptSetupActionOperationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26519    TestScript.SetupActionOperationComponent res = new TestScript.SetupActionOperationComponent();
26520    parseTestScriptSetupActionOperationComponentProperties(json, owner, res);
26521    return res;
26522  }
26523
26524  protected void parseTestScriptSetupActionOperationComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
26525    parseBackboneElementProperties(json, res);
26526    if (json.has("type"))
26527      res.setType(parseCoding(getJObject(json, "type")));
26528    if (json.has("resource"))
26529      res.setResourceElement(parseCode(json.get("resource").getAsString()));
26530    if (json.has("_resource"))
26531      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
26532    if (json.has("label"))
26533      res.setLabelElement(parseString(json.get("label").getAsString()));
26534    if (json.has("_label"))
26535      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
26536    if (json.has("description"))
26537      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26538    if (json.has("_description"))
26539      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26540    if (json.has("accept"))
26541      res.setAcceptElement(parseCode(json.get("accept").getAsString()));
26542    if (json.has("_accept"))
26543      parseElementProperties(getJObject(json, "_accept"), res.getAcceptElement());
26544    if (json.has("contentType"))
26545      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
26546    if (json.has("_contentType"))
26547      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
26548    if (json.has("destination"))
26549      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
26550    if (json.has("_destination"))
26551      parseElementProperties(getJObject(json, "_destination"), res.getDestinationElement());
26552    if (json.has("encodeRequestUrl"))
26553      res.setEncodeRequestUrlElement(parseBoolean(json.get("encodeRequestUrl").getAsBoolean()));
26554    if (json.has("_encodeRequestUrl"))
26555      parseElementProperties(getJObject(json, "_encodeRequestUrl"), res.getEncodeRequestUrlElement());
26556    if (json.has("method"))
26557      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
26558    if (json.has("_method"))
26559      parseElementProperties(getJObject(json, "_method"), res.getMethodElement());
26560    if (json.has("origin"))
26561      res.setOriginElement(parseInteger(json.get("origin").getAsLong()));
26562    if (json.has("_origin"))
26563      parseElementProperties(getJObject(json, "_origin"), res.getOriginElement());
26564    if (json.has("params"))
26565      res.setParamsElement(parseString(json.get("params").getAsString()));
26566    if (json.has("_params"))
26567      parseElementProperties(getJObject(json, "_params"), res.getParamsElement());
26568    if (json.has("requestHeader")) {
26569      JsonArray array = json.getAsJsonArray("requestHeader");
26570      for (int i = 0; i < array.size(); i++) {
26571        res.getRequestHeader().add(parseTestScriptSetupActionOperationRequestHeaderComponent(array.get(i).getAsJsonObject(), owner));
26572      }
26573    };
26574    if (json.has("requestId"))
26575      res.setRequestIdElement(parseId(json.get("requestId").getAsString()));
26576    if (json.has("_requestId"))
26577      parseElementProperties(getJObject(json, "_requestId"), res.getRequestIdElement());
26578    if (json.has("responseId"))
26579      res.setResponseIdElement(parseId(json.get("responseId").getAsString()));
26580    if (json.has("_responseId"))
26581      parseElementProperties(getJObject(json, "_responseId"), res.getResponseIdElement());
26582    if (json.has("sourceId"))
26583      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
26584    if (json.has("_sourceId"))
26585      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
26586    if (json.has("targetId"))
26587      res.setTargetIdElement(parseId(json.get("targetId").getAsString()));
26588    if (json.has("_targetId"))
26589      parseElementProperties(getJObject(json, "_targetId"), res.getTargetIdElement());
26590    if (json.has("url"))
26591      res.setUrlElement(parseString(json.get("url").getAsString()));
26592    if (json.has("_url"))
26593      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
26594  }
26595
26596  protected TestScript.SetupActionOperationRequestHeaderComponent parseTestScriptSetupActionOperationRequestHeaderComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26597    TestScript.SetupActionOperationRequestHeaderComponent res = new TestScript.SetupActionOperationRequestHeaderComponent();
26598    parseTestScriptSetupActionOperationRequestHeaderComponentProperties(json, owner, res);
26599    return res;
26600  }
26601
26602  protected void parseTestScriptSetupActionOperationRequestHeaderComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionOperationRequestHeaderComponent res) throws IOException, FHIRFormatError {
26603    parseBackboneElementProperties(json, res);
26604    if (json.has("field"))
26605      res.setFieldElement(parseString(json.get("field").getAsString()));
26606    if (json.has("_field"))
26607      parseElementProperties(getJObject(json, "_field"), res.getFieldElement());
26608    if (json.has("value"))
26609      res.setValueElement(parseString(json.get("value").getAsString()));
26610    if (json.has("_value"))
26611      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
26612  }
26613
26614  protected TestScript.SetupActionAssertComponent parseTestScriptSetupActionAssertComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26615    TestScript.SetupActionAssertComponent res = new TestScript.SetupActionAssertComponent();
26616    parseTestScriptSetupActionAssertComponentProperties(json, owner, res);
26617    return res;
26618  }
26619
26620  protected void parseTestScriptSetupActionAssertComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
26621    parseBackboneElementProperties(json, res);
26622    if (json.has("label"))
26623      res.setLabelElement(parseString(json.get("label").getAsString()));
26624    if (json.has("_label"))
26625      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
26626    if (json.has("description"))
26627      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26628    if (json.has("_description"))
26629      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26630    if (json.has("direction"))
26631      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), TestScript.AssertionDirectionType.NULL, new TestScript.AssertionDirectionTypeEnumFactory()));
26632    if (json.has("_direction"))
26633      parseElementProperties(getJObject(json, "_direction"), res.getDirectionElement());
26634    if (json.has("compareToSourceId"))
26635      res.setCompareToSourceIdElement(parseString(json.get("compareToSourceId").getAsString()));
26636    if (json.has("_compareToSourceId"))
26637      parseElementProperties(getJObject(json, "_compareToSourceId"), res.getCompareToSourceIdElement());
26638    if (json.has("compareToSourceExpression"))
26639      res.setCompareToSourceExpressionElement(parseString(json.get("compareToSourceExpression").getAsString()));
26640    if (json.has("_compareToSourceExpression"))
26641      parseElementProperties(getJObject(json, "_compareToSourceExpression"), res.getCompareToSourceExpressionElement());
26642    if (json.has("compareToSourcePath"))
26643      res.setCompareToSourcePathElement(parseString(json.get("compareToSourcePath").getAsString()));
26644    if (json.has("_compareToSourcePath"))
26645      parseElementProperties(getJObject(json, "_compareToSourcePath"), res.getCompareToSourcePathElement());
26646    if (json.has("contentType"))
26647      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
26648    if (json.has("_contentType"))
26649      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
26650    if (json.has("expression"))
26651      res.setExpressionElement(parseString(json.get("expression").getAsString()));
26652    if (json.has("_expression"))
26653      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
26654    if (json.has("headerField"))
26655      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
26656    if (json.has("_headerField"))
26657      parseElementProperties(getJObject(json, "_headerField"), res.getHeaderFieldElement());
26658    if (json.has("minimumId"))
26659      res.setMinimumIdElement(parseString(json.get("minimumId").getAsString()));
26660    if (json.has("_minimumId"))
26661      parseElementProperties(getJObject(json, "_minimumId"), res.getMinimumIdElement());
26662    if (json.has("navigationLinks"))
26663      res.setNavigationLinksElement(parseBoolean(json.get("navigationLinks").getAsBoolean()));
26664    if (json.has("_navigationLinks"))
26665      parseElementProperties(getJObject(json, "_navigationLinks"), res.getNavigationLinksElement());
26666    if (json.has("operator"))
26667      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), TestScript.AssertionOperatorType.NULL, new TestScript.AssertionOperatorTypeEnumFactory()));
26668    if (json.has("_operator"))
26669      parseElementProperties(getJObject(json, "_operator"), res.getOperatorElement());
26670    if (json.has("path"))
26671      res.setPathElement(parseString(json.get("path").getAsString()));
26672    if (json.has("_path"))
26673      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
26674    if (json.has("requestMethod"))
26675      res.setRequestMethodElement(parseEnumeration(json.get("requestMethod").getAsString(), TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
26676    if (json.has("_requestMethod"))
26677      parseElementProperties(getJObject(json, "_requestMethod"), res.getRequestMethodElement());
26678    if (json.has("requestURL"))
26679      res.setRequestURLElement(parseString(json.get("requestURL").getAsString()));
26680    if (json.has("_requestURL"))
26681      parseElementProperties(getJObject(json, "_requestURL"), res.getRequestURLElement());
26682    if (json.has("resource"))
26683      res.setResourceElement(parseCode(json.get("resource").getAsString()));
26684    if (json.has("_resource"))
26685      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
26686    if (json.has("response"))
26687      res.setResponseElement(parseEnumeration(json.get("response").getAsString(), TestScript.AssertionResponseTypes.NULL, new TestScript.AssertionResponseTypesEnumFactory()));
26688    if (json.has("_response"))
26689      parseElementProperties(getJObject(json, "_response"), res.getResponseElement());
26690    if (json.has("responseCode"))
26691      res.setResponseCodeElement(parseString(json.get("responseCode").getAsString()));
26692    if (json.has("_responseCode"))
26693      parseElementProperties(getJObject(json, "_responseCode"), res.getResponseCodeElement());
26694    if (json.has("sourceId"))
26695      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
26696    if (json.has("_sourceId"))
26697      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
26698    if (json.has("validateProfileId"))
26699      res.setValidateProfileIdElement(parseId(json.get("validateProfileId").getAsString()));
26700    if (json.has("_validateProfileId"))
26701      parseElementProperties(getJObject(json, "_validateProfileId"), res.getValidateProfileIdElement());
26702    if (json.has("value"))
26703      res.setValueElement(parseString(json.get("value").getAsString()));
26704    if (json.has("_value"))
26705      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
26706    if (json.has("warningOnly"))
26707      res.setWarningOnlyElement(parseBoolean(json.get("warningOnly").getAsBoolean()));
26708    if (json.has("_warningOnly"))
26709      parseElementProperties(getJObject(json, "_warningOnly"), res.getWarningOnlyElement());
26710  }
26711
26712  protected TestScript.TestScriptTestComponent parseTestScriptTestScriptTestComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26713    TestScript.TestScriptTestComponent res = new TestScript.TestScriptTestComponent();
26714    parseTestScriptTestScriptTestComponentProperties(json, owner, res);
26715    return res;
26716  }
26717
26718  protected void parseTestScriptTestScriptTestComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptTestComponent res) throws IOException, FHIRFormatError {
26719    parseBackboneElementProperties(json, res);
26720    if (json.has("name"))
26721      res.setNameElement(parseString(json.get("name").getAsString()));
26722    if (json.has("_name"))
26723      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
26724    if (json.has("description"))
26725      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26726    if (json.has("_description"))
26727      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26728    if (json.has("action")) {
26729      JsonArray array = json.getAsJsonArray("action");
26730      for (int i = 0; i < array.size(); i++) {
26731        res.getAction().add(parseTestScriptTestActionComponent(array.get(i).getAsJsonObject(), owner));
26732      }
26733    };
26734  }
26735
26736  protected TestScript.TestActionComponent parseTestScriptTestActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26737    TestScript.TestActionComponent res = new TestScript.TestActionComponent();
26738    parseTestScriptTestActionComponentProperties(json, owner, res);
26739    return res;
26740  }
26741
26742  protected void parseTestScriptTestActionComponentProperties(JsonObject json, TestScript owner, TestScript.TestActionComponent res) throws IOException, FHIRFormatError {
26743    parseBackboneElementProperties(json, res);
26744    if (json.has("operation"))
26745      res.setOperation(parseTestScriptSetupActionOperationComponent(getJObject(json, "operation"), owner));
26746    if (json.has("assert"))
26747      res.setAssert(parseTestScriptSetupActionAssertComponent(getJObject(json, "assert"), owner));
26748  }
26749
26750  protected TestScript.TestScriptTeardownComponent parseTestScriptTestScriptTeardownComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26751    TestScript.TestScriptTeardownComponent res = new TestScript.TestScriptTeardownComponent();
26752    parseTestScriptTestScriptTeardownComponentProperties(json, owner, res);
26753    return res;
26754  }
26755
26756  protected void parseTestScriptTestScriptTeardownComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptTeardownComponent res) throws IOException, FHIRFormatError {
26757    parseBackboneElementProperties(json, res);
26758    if (json.has("action")) {
26759      JsonArray array = json.getAsJsonArray("action");
26760      for (int i = 0; i < array.size(); i++) {
26761        res.getAction().add(parseTestScriptTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
26762      }
26763    };
26764  }
26765
26766  protected TestScript.TeardownActionComponent parseTestScriptTeardownActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26767    TestScript.TeardownActionComponent res = new TestScript.TeardownActionComponent();
26768    parseTestScriptTeardownActionComponentProperties(json, owner, res);
26769    return res;
26770  }
26771
26772  protected void parseTestScriptTeardownActionComponentProperties(JsonObject json, TestScript owner, TestScript.TeardownActionComponent res) throws IOException, FHIRFormatError {
26773    parseBackboneElementProperties(json, res);
26774    if (json.has("operation"))
26775      res.setOperation(parseTestScriptSetupActionOperationComponent(getJObject(json, "operation"), owner));
26776  }
26777
26778  protected ValueSet parseValueSet(JsonObject json) throws IOException, FHIRFormatError {
26779    ValueSet res = new ValueSet();
26780    parseValueSetProperties(json, res);
26781    return res;
26782  }
26783
26784  protected void parseValueSetProperties(JsonObject json, ValueSet res) throws IOException, FHIRFormatError {
26785    parseDomainResourceProperties(json, res);
26786    if (json.has("url"))
26787      res.setUrlElement(parseUri(json.get("url").getAsString()));
26788    if (json.has("_url"))
26789      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
26790    if (json.has("identifier")) {
26791      JsonArray array = json.getAsJsonArray("identifier");
26792      for (int i = 0; i < array.size(); i++) {
26793        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26794      }
26795    };
26796    if (json.has("version"))
26797      res.setVersionElement(parseString(json.get("version").getAsString()));
26798    if (json.has("_version"))
26799      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
26800    if (json.has("name"))
26801      res.setNameElement(parseString(json.get("name").getAsString()));
26802    if (json.has("_name"))
26803      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
26804    if (json.has("title"))
26805      res.setTitleElement(parseString(json.get("title").getAsString()));
26806    if (json.has("_title"))
26807      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
26808    if (json.has("status"))
26809      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
26810    if (json.has("_status"))
26811      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
26812    if (json.has("experimental"))
26813      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
26814    if (json.has("_experimental"))
26815      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
26816    if (json.has("date"))
26817      res.setDateElement(parseDateTime(json.get("date").getAsString()));
26818    if (json.has("_date"))
26819      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
26820    if (json.has("publisher"))
26821      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
26822    if (json.has("_publisher"))
26823      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
26824    if (json.has("contact")) {
26825      JsonArray array = json.getAsJsonArray("contact");
26826      for (int i = 0; i < array.size(); i++) {
26827        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
26828      }
26829    };
26830    if (json.has("description"))
26831      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
26832    if (json.has("_description"))
26833      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26834    if (json.has("useContext")) {
26835      JsonArray array = json.getAsJsonArray("useContext");
26836      for (int i = 0; i < array.size(); i++) {
26837        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
26838      }
26839    };
26840    if (json.has("jurisdiction")) {
26841      JsonArray array = json.getAsJsonArray("jurisdiction");
26842      for (int i = 0; i < array.size(); i++) {
26843        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26844      }
26845    };
26846    if (json.has("immutable"))
26847      res.setImmutableElement(parseBoolean(json.get("immutable").getAsBoolean()));
26848    if (json.has("_immutable"))
26849      parseElementProperties(getJObject(json, "_immutable"), res.getImmutableElement());
26850    if (json.has("purpose"))
26851      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
26852    if (json.has("_purpose"))
26853      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
26854    if (json.has("copyright"))
26855      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
26856    if (json.has("_copyright"))
26857      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
26858    if (json.has("compose"))
26859      res.setCompose(parseValueSetValueSetComposeComponent(getJObject(json, "compose"), res));
26860    if (json.has("expansion"))
26861      res.setExpansion(parseValueSetValueSetExpansionComponent(getJObject(json, "expansion"), res));
26862  }
26863
26864  protected ValueSet.ValueSetComposeComponent parseValueSetValueSetComposeComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
26865    ValueSet.ValueSetComposeComponent res = new ValueSet.ValueSetComposeComponent();
26866    parseValueSetValueSetComposeComponentProperties(json, owner, res);
26867    return res;
26868  }
26869
26870  protected void parseValueSetValueSetComposeComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetComposeComponent res) throws IOException, FHIRFormatError {
26871    parseBackboneElementProperties(json, res);
26872    if (json.has("lockedDate"))
26873      res.setLockedDateElement(parseDate(json.get("lockedDate").getAsString()));
26874    if (json.has("_lockedDate"))
26875      parseElementProperties(getJObject(json, "_lockedDate"), res.getLockedDateElement());
26876    if (json.has("inactive"))
26877      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
26878    if (json.has("_inactive"))
26879      parseElementProperties(getJObject(json, "_inactive"), res.getInactiveElement());
26880    if (json.has("include")) {
26881      JsonArray array = json.getAsJsonArray("include");
26882      for (int i = 0; i < array.size(); i++) {
26883        res.getInclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
26884      }
26885    };
26886    if (json.has("exclude")) {
26887      JsonArray array = json.getAsJsonArray("exclude");
26888      for (int i = 0; i < array.size(); i++) {
26889        res.getExclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
26890      }
26891    };
26892  }
26893
26894  protected ValueSet.ConceptSetComponent parseValueSetConceptSetComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
26895    ValueSet.ConceptSetComponent res = new ValueSet.ConceptSetComponent();
26896    parseValueSetConceptSetComponentProperties(json, owner, res);
26897    return res;
26898  }
26899
26900  protected void parseValueSetConceptSetComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptSetComponent res) throws IOException, FHIRFormatError {
26901    parseBackboneElementProperties(json, res);
26902    if (json.has("system"))
26903      res.setSystemElement(parseUri(json.get("system").getAsString()));
26904    if (json.has("_system"))
26905      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
26906    if (json.has("version"))
26907      res.setVersionElement(parseString(json.get("version").getAsString()));
26908    if (json.has("_version"))
26909      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
26910    if (json.has("concept")) {
26911      JsonArray array = json.getAsJsonArray("concept");
26912      for (int i = 0; i < array.size(); i++) {
26913        res.getConcept().add(parseValueSetConceptReferenceComponent(array.get(i).getAsJsonObject(), owner));
26914      }
26915    };
26916    if (json.has("filter")) {
26917      JsonArray array = json.getAsJsonArray("filter");
26918      for (int i = 0; i < array.size(); i++) {
26919        res.getFilter().add(parseValueSetConceptSetFilterComponent(array.get(i).getAsJsonObject(), owner));
26920      }
26921    };
26922    if (json.has("valueSet")) {
26923      JsonArray array = json.getAsJsonArray("valueSet");
26924      for (int i = 0; i < array.size(); i++) {
26925        res.getValueSet().add(parseCanonical(array.get(i).getAsString()));
26926      }
26927    };
26928    if (json.has("_valueSet")) {
26929      JsonArray array = json.getAsJsonArray("_valueSet");
26930      for (int i = 0; i < array.size(); i++) {
26931        if (i == res.getValueSet().size())
26932          res.getValueSet().add(parseCanonical(null));
26933        if (array.get(i) instanceof JsonObject) 
26934          parseElementProperties(array.get(i).getAsJsonObject(), res.getValueSet().get(i));
26935      }
26936    };
26937  }
26938
26939  protected ValueSet.ConceptReferenceComponent parseValueSetConceptReferenceComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
26940    ValueSet.ConceptReferenceComponent res = new ValueSet.ConceptReferenceComponent();
26941    parseValueSetConceptReferenceComponentProperties(json, owner, res);
26942    return res;
26943  }
26944
26945  protected void parseValueSetConceptReferenceComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptReferenceComponent res) throws IOException, FHIRFormatError {
26946    parseBackboneElementProperties(json, res);
26947    if (json.has("code"))
26948      res.setCodeElement(parseCode(json.get("code").getAsString()));
26949    if (json.has("_code"))
26950      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
26951    if (json.has("display"))
26952      res.setDisplayElement(parseString(json.get("display").getAsString()));
26953    if (json.has("_display"))
26954      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
26955    if (json.has("designation")) {
26956      JsonArray array = json.getAsJsonArray("designation");
26957      for (int i = 0; i < array.size(); i++) {
26958        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
26959      }
26960    };
26961  }
26962
26963  protected ValueSet.ConceptReferenceDesignationComponent parseValueSetConceptReferenceDesignationComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
26964    ValueSet.ConceptReferenceDesignationComponent res = new ValueSet.ConceptReferenceDesignationComponent();
26965    parseValueSetConceptReferenceDesignationComponentProperties(json, owner, res);
26966    return res;
26967  }
26968
26969  protected void parseValueSetConceptReferenceDesignationComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptReferenceDesignationComponent res) throws IOException, FHIRFormatError {
26970    parseBackboneElementProperties(json, res);
26971    if (json.has("language"))
26972      res.setLanguageElement(parseCode(json.get("language").getAsString()));
26973    if (json.has("_language"))
26974      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
26975    if (json.has("use"))
26976      res.setUse(parseCoding(getJObject(json, "use")));
26977    if (json.has("value"))
26978      res.setValueElement(parseString(json.get("value").getAsString()));
26979    if (json.has("_value"))
26980      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
26981  }
26982
26983  protected ValueSet.ConceptSetFilterComponent parseValueSetConceptSetFilterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
26984    ValueSet.ConceptSetFilterComponent res = new ValueSet.ConceptSetFilterComponent();
26985    parseValueSetConceptSetFilterComponentProperties(json, owner, res);
26986    return res;
26987  }
26988
26989  protected void parseValueSetConceptSetFilterComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptSetFilterComponent res) throws IOException, FHIRFormatError {
26990    parseBackboneElementProperties(json, res);
26991    if (json.has("property"))
26992      res.setPropertyElement(parseCode(json.get("property").getAsString()));
26993    if (json.has("_property"))
26994      parseElementProperties(getJObject(json, "_property"), res.getPropertyElement());
26995    if (json.has("op"))
26996      res.setOpElement(parseEnumeration(json.get("op").getAsString(), ValueSet.FilterOperator.NULL, new ValueSet.FilterOperatorEnumFactory()));
26997    if (json.has("_op"))
26998      parseElementProperties(getJObject(json, "_op"), res.getOpElement());
26999    if (json.has("value"))
27000      res.setValueElement(parseString(json.get("value").getAsString()));
27001    if (json.has("_value"))
27002      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
27003  }
27004
27005  protected ValueSet.ValueSetExpansionComponent parseValueSetValueSetExpansionComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27006    ValueSet.ValueSetExpansionComponent res = new ValueSet.ValueSetExpansionComponent();
27007    parseValueSetValueSetExpansionComponentProperties(json, owner, res);
27008    return res;
27009  }
27010
27011  protected void parseValueSetValueSetExpansionComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionComponent res) throws IOException, FHIRFormatError {
27012    parseBackboneElementProperties(json, res);
27013    if (json.has("identifier"))
27014      res.setIdentifierElement(parseUri(json.get("identifier").getAsString()));
27015    if (json.has("_identifier"))
27016      parseElementProperties(getJObject(json, "_identifier"), res.getIdentifierElement());
27017    if (json.has("timestamp"))
27018      res.setTimestampElement(parseDateTime(json.get("timestamp").getAsString()));
27019    if (json.has("_timestamp"))
27020      parseElementProperties(getJObject(json, "_timestamp"), res.getTimestampElement());
27021    if (json.has("total"))
27022      res.setTotalElement(parseInteger(json.get("total").getAsLong()));
27023    if (json.has("_total"))
27024      parseElementProperties(getJObject(json, "_total"), res.getTotalElement());
27025    if (json.has("offset"))
27026      res.setOffsetElement(parseInteger(json.get("offset").getAsLong()));
27027    if (json.has("_offset"))
27028      parseElementProperties(getJObject(json, "_offset"), res.getOffsetElement());
27029    if (json.has("parameter")) {
27030      JsonArray array = json.getAsJsonArray("parameter");
27031      for (int i = 0; i < array.size(); i++) {
27032        res.getParameter().add(parseValueSetValueSetExpansionParameterComponent(array.get(i).getAsJsonObject(), owner));
27033      }
27034    };
27035    if (json.has("contains")) {
27036      JsonArray array = json.getAsJsonArray("contains");
27037      for (int i = 0; i < array.size(); i++) {
27038        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
27039      }
27040    };
27041  }
27042
27043  protected ValueSet.ValueSetExpansionParameterComponent parseValueSetValueSetExpansionParameterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27044    ValueSet.ValueSetExpansionParameterComponent res = new ValueSet.ValueSetExpansionParameterComponent();
27045    parseValueSetValueSetExpansionParameterComponentProperties(json, owner, res);
27046    return res;
27047  }
27048
27049  protected void parseValueSetValueSetExpansionParameterComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionParameterComponent res) throws IOException, FHIRFormatError {
27050    parseBackboneElementProperties(json, res);
27051    if (json.has("name"))
27052      res.setNameElement(parseString(json.get("name").getAsString()));
27053    if (json.has("_name"))
27054      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
27055    Type value = parseType("value", json);
27056    if (value != null)
27057      res.setValue(value);
27058  }
27059
27060  protected ValueSet.ValueSetExpansionContainsComponent parseValueSetValueSetExpansionContainsComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27061    ValueSet.ValueSetExpansionContainsComponent res = new ValueSet.ValueSetExpansionContainsComponent();
27062    parseValueSetValueSetExpansionContainsComponentProperties(json, owner, res);
27063    return res;
27064  }
27065
27066  protected void parseValueSetValueSetExpansionContainsComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionContainsComponent res) throws IOException, FHIRFormatError {
27067    parseBackboneElementProperties(json, res);
27068    if (json.has("system"))
27069      res.setSystemElement(parseUri(json.get("system").getAsString()));
27070    if (json.has("_system"))
27071      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
27072    if (json.has("abstract"))
27073      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
27074    if (json.has("_abstract"))
27075      parseElementProperties(getJObject(json, "_abstract"), res.getAbstractElement());
27076    if (json.has("inactive"))
27077      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
27078    if (json.has("_inactive"))
27079      parseElementProperties(getJObject(json, "_inactive"), res.getInactiveElement());
27080    if (json.has("version"))
27081      res.setVersionElement(parseString(json.get("version").getAsString()));
27082    if (json.has("_version"))
27083      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
27084    if (json.has("code"))
27085      res.setCodeElement(parseCode(json.get("code").getAsString()));
27086    if (json.has("_code"))
27087      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
27088    if (json.has("display"))
27089      res.setDisplayElement(parseString(json.get("display").getAsString()));
27090    if (json.has("_display"))
27091      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
27092    if (json.has("designation")) {
27093      JsonArray array = json.getAsJsonArray("designation");
27094      for (int i = 0; i < array.size(); i++) {
27095        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
27096      }
27097    };
27098    if (json.has("contains")) {
27099      JsonArray array = json.getAsJsonArray("contains");
27100      for (int i = 0; i < array.size(); i++) {
27101        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
27102      }
27103    };
27104  }
27105
27106  protected VerificationResult parseVerificationResult(JsonObject json) throws IOException, FHIRFormatError {
27107    VerificationResult res = new VerificationResult();
27108    parseVerificationResultProperties(json, res);
27109    return res;
27110  }
27111
27112  protected void parseVerificationResultProperties(JsonObject json, VerificationResult res) throws IOException, FHIRFormatError {
27113    parseDomainResourceProperties(json, res);
27114    if (json.has("target")) {
27115      JsonArray array = json.getAsJsonArray("target");
27116      for (int i = 0; i < array.size(); i++) {
27117        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
27118      }
27119    };
27120    if (json.has("targetLocation")) {
27121      JsonArray array = json.getAsJsonArray("targetLocation");
27122      for (int i = 0; i < array.size(); i++) {
27123        res.getTargetLocation().add(parseString(array.get(i).getAsString()));
27124      }
27125    };
27126    if (json.has("_targetLocation")) {
27127      JsonArray array = json.getAsJsonArray("_targetLocation");
27128      for (int i = 0; i < array.size(); i++) {
27129        if (i == res.getTargetLocation().size())
27130          res.getTargetLocation().add(parseString(null));
27131        if (array.get(i) instanceof JsonObject) 
27132          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetLocation().get(i));
27133      }
27134    };
27135    if (json.has("need"))
27136      res.setNeed(parseCodeableConcept(getJObject(json, "need")));
27137    if (json.has("status"))
27138      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VerificationResult.Status.NULL, new VerificationResult.StatusEnumFactory()));
27139    if (json.has("_status"))
27140      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
27141    if (json.has("statusDate"))
27142      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
27143    if (json.has("_statusDate"))
27144      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
27145    if (json.has("validationType"))
27146      res.setValidationType(parseCodeableConcept(getJObject(json, "validationType")));
27147    if (json.has("validationProcess")) {
27148      JsonArray array = json.getAsJsonArray("validationProcess");
27149      for (int i = 0; i < array.size(); i++) {
27150        res.getValidationProcess().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27151      }
27152    };
27153    if (json.has("frequency"))
27154      res.setFrequency(parseTiming(getJObject(json, "frequency")));
27155    if (json.has("lastPerformed"))
27156      res.setLastPerformedElement(parseDateTime(json.get("lastPerformed").getAsString()));
27157    if (json.has("_lastPerformed"))
27158      parseElementProperties(getJObject(json, "_lastPerformed"), res.getLastPerformedElement());
27159    if (json.has("nextScheduled"))
27160      res.setNextScheduledElement(parseDate(json.get("nextScheduled").getAsString()));
27161    if (json.has("_nextScheduled"))
27162      parseElementProperties(getJObject(json, "_nextScheduled"), res.getNextScheduledElement());
27163    if (json.has("failureAction"))
27164      res.setFailureAction(parseCodeableConcept(getJObject(json, "failureAction")));
27165    if (json.has("primarySource")) {
27166      JsonArray array = json.getAsJsonArray("primarySource");
27167      for (int i = 0; i < array.size(); i++) {
27168        res.getPrimarySource().add(parseVerificationResultVerificationResultPrimarySourceComponent(array.get(i).getAsJsonObject(), res));
27169      }
27170    };
27171    if (json.has("attestation"))
27172      res.setAttestation(parseVerificationResultVerificationResultAttestationComponent(getJObject(json, "attestation"), res));
27173    if (json.has("validator")) {
27174      JsonArray array = json.getAsJsonArray("validator");
27175      for (int i = 0; i < array.size(); i++) {
27176        res.getValidator().add(parseVerificationResultVerificationResultValidatorComponent(array.get(i).getAsJsonObject(), res));
27177      }
27178    };
27179  }
27180
27181  protected VerificationResult.VerificationResultPrimarySourceComponent parseVerificationResultVerificationResultPrimarySourceComponent(JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
27182    VerificationResult.VerificationResultPrimarySourceComponent res = new VerificationResult.VerificationResultPrimarySourceComponent();
27183    parseVerificationResultVerificationResultPrimarySourceComponentProperties(json, owner, res);
27184    return res;
27185  }
27186
27187  protected void parseVerificationResultVerificationResultPrimarySourceComponentProperties(JsonObject json, VerificationResult owner, VerificationResult.VerificationResultPrimarySourceComponent res) throws IOException, FHIRFormatError {
27188    parseBackboneElementProperties(json, res);
27189    if (json.has("who"))
27190      res.setWho(parseReference(getJObject(json, "who")));
27191    if (json.has("type")) {
27192      JsonArray array = json.getAsJsonArray("type");
27193      for (int i = 0; i < array.size(); i++) {
27194        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27195      }
27196    };
27197    if (json.has("communicationMethod")) {
27198      JsonArray array = json.getAsJsonArray("communicationMethod");
27199      for (int i = 0; i < array.size(); i++) {
27200        res.getCommunicationMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27201      }
27202    };
27203    if (json.has("validationStatus"))
27204      res.setValidationStatus(parseCodeableConcept(getJObject(json, "validationStatus")));
27205    if (json.has("validationDate"))
27206      res.setValidationDateElement(parseDateTime(json.get("validationDate").getAsString()));
27207    if (json.has("_validationDate"))
27208      parseElementProperties(getJObject(json, "_validationDate"), res.getValidationDateElement());
27209    if (json.has("canPushUpdates"))
27210      res.setCanPushUpdates(parseCodeableConcept(getJObject(json, "canPushUpdates")));
27211    if (json.has("pushTypeAvailable")) {
27212      JsonArray array = json.getAsJsonArray("pushTypeAvailable");
27213      for (int i = 0; i < array.size(); i++) {
27214        res.getPushTypeAvailable().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27215      }
27216    };
27217  }
27218
27219  protected VerificationResult.VerificationResultAttestationComponent parseVerificationResultVerificationResultAttestationComponent(JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
27220    VerificationResult.VerificationResultAttestationComponent res = new VerificationResult.VerificationResultAttestationComponent();
27221    parseVerificationResultVerificationResultAttestationComponentProperties(json, owner, res);
27222    return res;
27223  }
27224
27225  protected void parseVerificationResultVerificationResultAttestationComponentProperties(JsonObject json, VerificationResult owner, VerificationResult.VerificationResultAttestationComponent res) throws IOException, FHIRFormatError {
27226    parseBackboneElementProperties(json, res);
27227    if (json.has("who"))
27228      res.setWho(parseReference(getJObject(json, "who")));
27229    if (json.has("onBehalfOf"))
27230      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
27231    if (json.has("communicationMethod"))
27232      res.setCommunicationMethod(parseCodeableConcept(getJObject(json, "communicationMethod")));
27233    if (json.has("date"))
27234      res.setDateElement(parseDate(json.get("date").getAsString()));
27235    if (json.has("_date"))
27236      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
27237    if (json.has("sourceIdentityCertificate"))
27238      res.setSourceIdentityCertificateElement(parseString(json.get("sourceIdentityCertificate").getAsString()));
27239    if (json.has("_sourceIdentityCertificate"))
27240      parseElementProperties(getJObject(json, "_sourceIdentityCertificate"), res.getSourceIdentityCertificateElement());
27241    if (json.has("proxyIdentityCertificate"))
27242      res.setProxyIdentityCertificateElement(parseString(json.get("proxyIdentityCertificate").getAsString()));
27243    if (json.has("_proxyIdentityCertificate"))
27244      parseElementProperties(getJObject(json, "_proxyIdentityCertificate"), res.getProxyIdentityCertificateElement());
27245    if (json.has("proxySignature"))
27246      res.setProxySignature(parseSignature(getJObject(json, "proxySignature")));
27247    if (json.has("sourceSignature"))
27248      res.setSourceSignature(parseSignature(getJObject(json, "sourceSignature")));
27249  }
27250
27251  protected VerificationResult.VerificationResultValidatorComponent parseVerificationResultVerificationResultValidatorComponent(JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
27252    VerificationResult.VerificationResultValidatorComponent res = new VerificationResult.VerificationResultValidatorComponent();
27253    parseVerificationResultVerificationResultValidatorComponentProperties(json, owner, res);
27254    return res;
27255  }
27256
27257  protected void parseVerificationResultVerificationResultValidatorComponentProperties(JsonObject json, VerificationResult owner, VerificationResult.VerificationResultValidatorComponent res) throws IOException, FHIRFormatError {
27258    parseBackboneElementProperties(json, res);
27259    if (json.has("organization"))
27260      res.setOrganization(parseReference(getJObject(json, "organization")));
27261    if (json.has("identityCertificate"))
27262      res.setIdentityCertificateElement(parseString(json.get("identityCertificate").getAsString()));
27263    if (json.has("_identityCertificate"))
27264      parseElementProperties(getJObject(json, "_identityCertificate"), res.getIdentityCertificateElement());
27265    if (json.has("attestationSignature"))
27266      res.setAttestationSignature(parseSignature(getJObject(json, "attestationSignature")));
27267  }
27268
27269  protected VisionPrescription parseVisionPrescription(JsonObject json) throws IOException, FHIRFormatError {
27270    VisionPrescription res = new VisionPrescription();
27271    parseVisionPrescriptionProperties(json, res);
27272    return res;
27273  }
27274
27275  protected void parseVisionPrescriptionProperties(JsonObject json, VisionPrescription res) throws IOException, FHIRFormatError {
27276    parseDomainResourceProperties(json, res);
27277    if (json.has("identifier")) {
27278      JsonArray array = json.getAsJsonArray("identifier");
27279      for (int i = 0; i < array.size(); i++) {
27280        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
27281      }
27282    };
27283    if (json.has("status"))
27284      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VisionPrescription.VisionStatus.NULL, new VisionPrescription.VisionStatusEnumFactory()));
27285    if (json.has("_status"))
27286      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
27287    if (json.has("created"))
27288      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
27289    if (json.has("_created"))
27290      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
27291    if (json.has("patient"))
27292      res.setPatient(parseReference(getJObject(json, "patient")));
27293    if (json.has("encounter"))
27294      res.setEncounter(parseReference(getJObject(json, "encounter")));
27295    if (json.has("dateWritten"))
27296      res.setDateWrittenElement(parseDateTime(json.get("dateWritten").getAsString()));
27297    if (json.has("_dateWritten"))
27298      parseElementProperties(getJObject(json, "_dateWritten"), res.getDateWrittenElement());
27299    if (json.has("prescriber"))
27300      res.setPrescriber(parseReference(getJObject(json, "prescriber")));
27301    if (json.has("lensSpecification")) {
27302      JsonArray array = json.getAsJsonArray("lensSpecification");
27303      for (int i = 0; i < array.size(); i++) {
27304        res.getLensSpecification().add(parseVisionPrescriptionVisionPrescriptionLensSpecificationComponent(array.get(i).getAsJsonObject(), res));
27305      }
27306    };
27307  }
27308
27309  protected VisionPrescription.VisionPrescriptionLensSpecificationComponent parseVisionPrescriptionVisionPrescriptionLensSpecificationComponent(JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
27310    VisionPrescription.VisionPrescriptionLensSpecificationComponent res = new VisionPrescription.VisionPrescriptionLensSpecificationComponent();
27311    parseVisionPrescriptionVisionPrescriptionLensSpecificationComponentProperties(json, owner, res);
27312    return res;
27313  }
27314
27315  protected void parseVisionPrescriptionVisionPrescriptionLensSpecificationComponentProperties(JsonObject json, VisionPrescription owner, VisionPrescription.VisionPrescriptionLensSpecificationComponent res) throws IOException, FHIRFormatError {
27316    parseBackboneElementProperties(json, res);
27317    if (json.has("product"))
27318      res.setProduct(parseCodeableConcept(getJObject(json, "product")));
27319    if (json.has("eye"))
27320      res.setEyeElement(parseEnumeration(json.get("eye").getAsString(), VisionPrescription.VisionEyes.NULL, new VisionPrescription.VisionEyesEnumFactory()));
27321    if (json.has("_eye"))
27322      parseElementProperties(getJObject(json, "_eye"), res.getEyeElement());
27323    if (json.has("sphere"))
27324      res.setSphereElement(parseDecimal(json.get("sphere").getAsBigDecimal()));
27325    if (json.has("_sphere"))
27326      parseElementProperties(getJObject(json, "_sphere"), res.getSphereElement());
27327    if (json.has("cylinder"))
27328      res.setCylinderElement(parseDecimal(json.get("cylinder").getAsBigDecimal()));
27329    if (json.has("_cylinder"))
27330      parseElementProperties(getJObject(json, "_cylinder"), res.getCylinderElement());
27331    if (json.has("axis"))
27332      res.setAxisElement(parseInteger(json.get("axis").getAsLong()));
27333    if (json.has("_axis"))
27334      parseElementProperties(getJObject(json, "_axis"), res.getAxisElement());
27335    if (json.has("prism")) {
27336      JsonArray array = json.getAsJsonArray("prism");
27337      for (int i = 0; i < array.size(); i++) {
27338        res.getPrism().add(parseVisionPrescriptionPrismComponent(array.get(i).getAsJsonObject(), owner));
27339      }
27340    };
27341    if (json.has("add"))
27342      res.setAddElement(parseDecimal(json.get("add").getAsBigDecimal()));
27343    if (json.has("_add"))
27344      parseElementProperties(getJObject(json, "_add"), res.getAddElement());
27345    if (json.has("power"))
27346      res.setPowerElement(parseDecimal(json.get("power").getAsBigDecimal()));
27347    if (json.has("_power"))
27348      parseElementProperties(getJObject(json, "_power"), res.getPowerElement());
27349    if (json.has("backCurve"))
27350      res.setBackCurveElement(parseDecimal(json.get("backCurve").getAsBigDecimal()));
27351    if (json.has("_backCurve"))
27352      parseElementProperties(getJObject(json, "_backCurve"), res.getBackCurveElement());
27353    if (json.has("diameter"))
27354      res.setDiameterElement(parseDecimal(json.get("diameter").getAsBigDecimal()));
27355    if (json.has("_diameter"))
27356      parseElementProperties(getJObject(json, "_diameter"), res.getDiameterElement());
27357    if (json.has("duration"))
27358      res.setDuration(parseQuantity(getJObject(json, "duration")));
27359    if (json.has("color"))
27360      res.setColorElement(parseString(json.get("color").getAsString()));
27361    if (json.has("_color"))
27362      parseElementProperties(getJObject(json, "_color"), res.getColorElement());
27363    if (json.has("brand"))
27364      res.setBrandElement(parseString(json.get("brand").getAsString()));
27365    if (json.has("_brand"))
27366      parseElementProperties(getJObject(json, "_brand"), res.getBrandElement());
27367    if (json.has("note")) {
27368      JsonArray array = json.getAsJsonArray("note");
27369      for (int i = 0; i < array.size(); i++) {
27370        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
27371      }
27372    };
27373  }
27374
27375  protected VisionPrescription.PrismComponent parseVisionPrescriptionPrismComponent(JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
27376    VisionPrescription.PrismComponent res = new VisionPrescription.PrismComponent();
27377    parseVisionPrescriptionPrismComponentProperties(json, owner, res);
27378    return res;
27379  }
27380
27381  protected void parseVisionPrescriptionPrismComponentProperties(JsonObject json, VisionPrescription owner, VisionPrescription.PrismComponent res) throws IOException, FHIRFormatError {
27382    parseBackboneElementProperties(json, res);
27383    if (json.has("amount"))
27384      res.setAmountElement(parseDecimal(json.get("amount").getAsBigDecimal()));
27385    if (json.has("_amount"))
27386      parseElementProperties(getJObject(json, "_amount"), res.getAmountElement());
27387    if (json.has("base"))
27388      res.setBaseElement(parseEnumeration(json.get("base").getAsString(), VisionPrescription.VisionBase.NULL, new VisionPrescription.VisionBaseEnumFactory()));
27389    if (json.has("_base"))
27390      parseElementProperties(getJObject(json, "_base"), res.getBaseElement());
27391  }
27392
27393  @Override
27394  protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
27395    if (!json.has("resourceType")) {
27396      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
27397    }
27398    String t = json.get("resourceType").getAsString();
27399    if (Utilities.noString(t))
27400      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
27401    if (t.equals("Parameters"))
27402      return parseParameters(json);
27403    else if (t.equals("Account"))
27404      return parseAccount(json);
27405    else if (t.equals("ActivityDefinition"))
27406      return parseActivityDefinition(json);
27407    else if (t.equals("AdverseEvent"))
27408      return parseAdverseEvent(json);
27409    else if (t.equals("AllergyIntolerance"))
27410      return parseAllergyIntolerance(json);
27411    else if (t.equals("Appointment"))
27412      return parseAppointment(json);
27413    else if (t.equals("AppointmentResponse"))
27414      return parseAppointmentResponse(json);
27415    else if (t.equals("AuditEvent"))
27416      return parseAuditEvent(json);
27417    else if (t.equals("Basic"))
27418      return parseBasic(json);
27419    else if (t.equals("Binary"))
27420      return parseBinary(json);
27421    else if (t.equals("BiologicallyDerivedProduct"))
27422      return parseBiologicallyDerivedProduct(json);
27423    else if (t.equals("BodyStructure"))
27424      return parseBodyStructure(json);
27425    else if (t.equals("Bundle"))
27426      return parseBundle(json);
27427    else if (t.equals("CapabilityStatement"))
27428      return parseCapabilityStatement(json);
27429    else if (t.equals("CarePlan"))
27430      return parseCarePlan(json);
27431    else if (t.equals("CareTeam"))
27432      return parseCareTeam(json);
27433    else if (t.equals("CatalogEntry"))
27434      return parseCatalogEntry(json);
27435    else if (t.equals("ChargeItem"))
27436      return parseChargeItem(json);
27437    else if (t.equals("ChargeItemDefinition"))
27438      return parseChargeItemDefinition(json);
27439    else if (t.equals("Claim"))
27440      return parseClaim(json);
27441    else if (t.equals("ClaimResponse"))
27442      return parseClaimResponse(json);
27443    else if (t.equals("ClinicalImpression"))
27444      return parseClinicalImpression(json);
27445    else if (t.equals("CodeSystem"))
27446      return parseCodeSystem(json);
27447    else if (t.equals("Communication"))
27448      return parseCommunication(json);
27449    else if (t.equals("CommunicationRequest"))
27450      return parseCommunicationRequest(json);
27451    else if (t.equals("CompartmentDefinition"))
27452      return parseCompartmentDefinition(json);
27453    else if (t.equals("Composition"))
27454      return parseComposition(json);
27455    else if (t.equals("ConceptMap"))
27456      return parseConceptMap(json);
27457    else if (t.equals("Condition"))
27458      return parseCondition(json);
27459    else if (t.equals("Consent"))
27460      return parseConsent(json);
27461    else if (t.equals("Contract"))
27462      return parseContract(json);
27463    else if (t.equals("Coverage"))
27464      return parseCoverage(json);
27465    else if (t.equals("CoverageEligibilityRequest"))
27466      return parseCoverageEligibilityRequest(json);
27467    else if (t.equals("CoverageEligibilityResponse"))
27468      return parseCoverageEligibilityResponse(json);
27469    else if (t.equals("DetectedIssue"))
27470      return parseDetectedIssue(json);
27471    else if (t.equals("Device"))
27472      return parseDevice(json);
27473    else if (t.equals("DeviceDefinition"))
27474      return parseDeviceDefinition(json);
27475    else if (t.equals("DeviceMetric"))
27476      return parseDeviceMetric(json);
27477    else if (t.equals("DeviceRequest"))
27478      return parseDeviceRequest(json);
27479    else if (t.equals("DeviceUseStatement"))
27480      return parseDeviceUseStatement(json);
27481    else if (t.equals("DiagnosticReport"))
27482      return parseDiagnosticReport(json);
27483    else if (t.equals("DocumentManifest"))
27484      return parseDocumentManifest(json);
27485    else if (t.equals("DocumentReference"))
27486      return parseDocumentReference(json);
27487    else if (t.equals("EffectEvidenceSynthesis"))
27488      return parseEffectEvidenceSynthesis(json);
27489    else if (t.equals("Encounter"))
27490      return parseEncounter(json);
27491    else if (t.equals("Endpoint"))
27492      return parseEndpoint(json);
27493    else if (t.equals("EnrollmentRequest"))
27494      return parseEnrollmentRequest(json);
27495    else if (t.equals("EnrollmentResponse"))
27496      return parseEnrollmentResponse(json);
27497    else if (t.equals("EpisodeOfCare"))
27498      return parseEpisodeOfCare(json);
27499    else if (t.equals("EventDefinition"))
27500      return parseEventDefinition(json);
27501    else if (t.equals("Evidence"))
27502      return parseEvidence(json);
27503    else if (t.equals("EvidenceVariable"))
27504      return parseEvidenceVariable(json);
27505    else if (t.equals("ExampleScenario"))
27506      return parseExampleScenario(json);
27507    else if (t.equals("ExplanationOfBenefit"))
27508      return parseExplanationOfBenefit(json);
27509    else if (t.equals("FamilyMemberHistory"))
27510      return parseFamilyMemberHistory(json);
27511    else if (t.equals("Flag"))
27512      return parseFlag(json);
27513    else if (t.equals("Goal"))
27514      return parseGoal(json);
27515    else if (t.equals("GraphDefinition"))
27516      return parseGraphDefinition(json);
27517    else if (t.equals("Group"))
27518      return parseGroup(json);
27519    else if (t.equals("GuidanceResponse"))
27520      return parseGuidanceResponse(json);
27521    else if (t.equals("HealthcareService"))
27522      return parseHealthcareService(json);
27523    else if (t.equals("ImagingStudy"))
27524      return parseImagingStudy(json);
27525    else if (t.equals("Immunization"))
27526      return parseImmunization(json);
27527    else if (t.equals("ImmunizationEvaluation"))
27528      return parseImmunizationEvaluation(json);
27529    else if (t.equals("ImmunizationRecommendation"))
27530      return parseImmunizationRecommendation(json);
27531    else if (t.equals("ImplementationGuide"))
27532      return parseImplementationGuide(json);
27533    else if (t.equals("InsurancePlan"))
27534      return parseInsurancePlan(json);
27535    else if (t.equals("Invoice"))
27536      return parseInvoice(json);
27537    else if (t.equals("Library"))
27538      return parseLibrary(json);
27539    else if (t.equals("Linkage"))
27540      return parseLinkage(json);
27541    else if (t.equals("List"))
27542      return parseListResource(json);
27543    else if (t.equals("Location"))
27544      return parseLocation(json);
27545    else if (t.equals("Measure"))
27546      return parseMeasure(json);
27547    else if (t.equals("MeasureReport"))
27548      return parseMeasureReport(json);
27549    else if (t.equals("Media"))
27550      return parseMedia(json);
27551    else if (t.equals("Medication"))
27552      return parseMedication(json);
27553    else if (t.equals("MedicationAdministration"))
27554      return parseMedicationAdministration(json);
27555    else if (t.equals("MedicationDispense"))
27556      return parseMedicationDispense(json);
27557    else if (t.equals("MedicationKnowledge"))
27558      return parseMedicationKnowledge(json);
27559    else if (t.equals("MedicationRequest"))
27560      return parseMedicationRequest(json);
27561    else if (t.equals("MedicationStatement"))
27562      return parseMedicationStatement(json);
27563    else if (t.equals("MedicinalProduct"))
27564      return parseMedicinalProduct(json);
27565    else if (t.equals("MedicinalProductAuthorization"))
27566      return parseMedicinalProductAuthorization(json);
27567    else if (t.equals("MedicinalProductContraindication"))
27568      return parseMedicinalProductContraindication(json);
27569    else if (t.equals("MedicinalProductIndication"))
27570      return parseMedicinalProductIndication(json);
27571    else if (t.equals("MedicinalProductIngredient"))
27572      return parseMedicinalProductIngredient(json);
27573    else if (t.equals("MedicinalProductInteraction"))
27574      return parseMedicinalProductInteraction(json);
27575    else if (t.equals("MedicinalProductManufactured"))
27576      return parseMedicinalProductManufactured(json);
27577    else if (t.equals("MedicinalProductPackaged"))
27578      return parseMedicinalProductPackaged(json);
27579    else if (t.equals("MedicinalProductPharmaceutical"))
27580      return parseMedicinalProductPharmaceutical(json);
27581    else if (t.equals("MedicinalProductUndesirableEffect"))
27582      return parseMedicinalProductUndesirableEffect(json);
27583    else if (t.equals("MessageDefinition"))
27584      return parseMessageDefinition(json);
27585    else if (t.equals("MessageHeader"))
27586      return parseMessageHeader(json);
27587    else if (t.equals("MolecularSequence"))
27588      return parseMolecularSequence(json);
27589    else if (t.equals("NamingSystem"))
27590      return parseNamingSystem(json);
27591    else if (t.equals("NutritionOrder"))
27592      return parseNutritionOrder(json);
27593    else if (t.equals("Observation"))
27594      return parseObservation(json);
27595    else if (t.equals("ObservationDefinition"))
27596      return parseObservationDefinition(json);
27597    else if (t.equals("OperationDefinition"))
27598      return parseOperationDefinition(json);
27599    else if (t.equals("OperationOutcome"))
27600      return parseOperationOutcome(json);
27601    else if (t.equals("Organization"))
27602      return parseOrganization(json);
27603    else if (t.equals("OrganizationAffiliation"))
27604      return parseOrganizationAffiliation(json);
27605    else if (t.equals("Patient"))
27606      return parsePatient(json);
27607    else if (t.equals("PaymentNotice"))
27608      return parsePaymentNotice(json);
27609    else if (t.equals("PaymentReconciliation"))
27610      return parsePaymentReconciliation(json);
27611    else if (t.equals("Person"))
27612      return parsePerson(json);
27613    else if (t.equals("PlanDefinition"))
27614      return parsePlanDefinition(json);
27615    else if (t.equals("Practitioner"))
27616      return parsePractitioner(json);
27617    else if (t.equals("PractitionerRole"))
27618      return parsePractitionerRole(json);
27619    else if (t.equals("Procedure"))
27620      return parseProcedure(json);
27621    else if (t.equals("Provenance"))
27622      return parseProvenance(json);
27623    else if (t.equals("Questionnaire"))
27624      return parseQuestionnaire(json);
27625    else if (t.equals("QuestionnaireResponse"))
27626      return parseQuestionnaireResponse(json);
27627    else if (t.equals("RelatedPerson"))
27628      return parseRelatedPerson(json);
27629    else if (t.equals("RequestGroup"))
27630      return parseRequestGroup(json);
27631    else if (t.equals("ResearchDefinition"))
27632      return parseResearchDefinition(json);
27633    else if (t.equals("ResearchElementDefinition"))
27634      return parseResearchElementDefinition(json);
27635    else if (t.equals("ResearchStudy"))
27636      return parseResearchStudy(json);
27637    else if (t.equals("ResearchSubject"))
27638      return parseResearchSubject(json);
27639    else if (t.equals("RiskAssessment"))
27640      return parseRiskAssessment(json);
27641    else if (t.equals("RiskEvidenceSynthesis"))
27642      return parseRiskEvidenceSynthesis(json);
27643    else if (t.equals("Schedule"))
27644      return parseSchedule(json);
27645    else if (t.equals("SearchParameter"))
27646      return parseSearchParameter(json);
27647    else if (t.equals("ServiceRequest"))
27648      return parseServiceRequest(json);
27649    else if (t.equals("Slot"))
27650      return parseSlot(json);
27651    else if (t.equals("Specimen"))
27652      return parseSpecimen(json);
27653    else if (t.equals("SpecimenDefinition"))
27654      return parseSpecimenDefinition(json);
27655    else if (t.equals("StructureDefinition"))
27656      return parseStructureDefinition(json);
27657    else if (t.equals("StructureMap"))
27658      return parseStructureMap(json);
27659    else if (t.equals("Subscription"))
27660      return parseSubscription(json);
27661    else if (t.equals("Substance"))
27662      return parseSubstance(json);
27663    else if (t.equals("SubstanceNucleicAcid"))
27664      return parseSubstanceNucleicAcid(json);
27665    else if (t.equals("SubstancePolymer"))
27666      return parseSubstancePolymer(json);
27667    else if (t.equals("SubstanceProtein"))
27668      return parseSubstanceProtein(json);
27669    else if (t.equals("SubstanceReferenceInformation"))
27670      return parseSubstanceReferenceInformation(json);
27671    else if (t.equals("SubstanceSourceMaterial"))
27672      return parseSubstanceSourceMaterial(json);
27673    else if (t.equals("SubstanceSpecification"))
27674      return parseSubstanceSpecification(json);
27675    else if (t.equals("SupplyDelivery"))
27676      return parseSupplyDelivery(json);
27677    else if (t.equals("SupplyRequest"))
27678      return parseSupplyRequest(json);
27679    else if (t.equals("Task"))
27680      return parseTask(json);
27681    else if (t.equals("TerminologyCapabilities"))
27682      return parseTerminologyCapabilities(json);
27683    else if (t.equals("TestReport"))
27684      return parseTestReport(json);
27685    else if (t.equals("TestScript"))
27686      return parseTestScript(json);
27687    else if (t.equals("ValueSet"))
27688      return parseValueSet(json);
27689    else if (t.equals("VerificationResult"))
27690      return parseVerificationResult(json);
27691    else if (t.equals("VisionPrescription"))
27692      return parseVisionPrescription(json);
27693    else if (t.equals("Binary"))
27694      return parseBinary(json);
27695    throw new FHIRFormatError("Unknown.Unrecognised resource type '"+t+"' (in property 'resourceType')");
27696  }
27697
27698  protected Type parseType(String prefix, JsonObject json) throws IOException, FHIRFormatError {
27699    if (json.has(prefix+"Extension"))
27700      return parseExtension(getJObject(json, prefix+"Extension"));
27701    else if (json.has(prefix+"Narrative"))
27702      return parseNarrative(getJObject(json, prefix+"Narrative"));
27703    else if (json.has(prefix+"Meta"))
27704      return parseMeta(getJObject(json, prefix+"Meta"));
27705    else if (json.has(prefix+"Address"))
27706      return parseAddress(getJObject(json, prefix+"Address"));
27707    else if (json.has(prefix+"Contributor"))
27708      return parseContributor(getJObject(json, prefix+"Contributor"));
27709    else if (json.has(prefix+"Attachment"))
27710      return parseAttachment(getJObject(json, prefix+"Attachment"));
27711    else if (json.has(prefix+"Count"))
27712      return parseCount(getJObject(json, prefix+"Count"));
27713    else if (json.has(prefix+"DataRequirement"))
27714      return parseDataRequirement(getJObject(json, prefix+"DataRequirement"));
27715    else if (json.has(prefix+"Dosage"))
27716      return parseDosage(getJObject(json, prefix+"Dosage"));
27717    else if (json.has(prefix+"Money"))
27718      return parseMoney(getJObject(json, prefix+"Money"));
27719    else if (json.has(prefix+"HumanName"))
27720      return parseHumanName(getJObject(json, prefix+"HumanName"));
27721    else if (json.has(prefix+"ContactPoint"))
27722      return parseContactPoint(getJObject(json, prefix+"ContactPoint"));
27723    else if (json.has(prefix+"MarketingStatus"))
27724      return parseMarketingStatus(getJObject(json, prefix+"MarketingStatus"));
27725    else if (json.has(prefix+"Identifier"))
27726      return parseIdentifier(getJObject(json, prefix+"Identifier"));
27727    else if (json.has(prefix+"SubstanceAmount"))
27728      return parseSubstanceAmount(getJObject(json, prefix+"SubstanceAmount"));
27729    else if (json.has(prefix+"Coding"))
27730      return parseCoding(getJObject(json, prefix+"Coding"));
27731    else if (json.has(prefix+"SampledData"))
27732      return parseSampledData(getJObject(json, prefix+"SampledData"));
27733    else if (json.has(prefix+"Population"))
27734      return parsePopulation(getJObject(json, prefix+"Population"));
27735    else if (json.has(prefix+"Ratio"))
27736      return parseRatio(getJObject(json, prefix+"Ratio"));
27737    else if (json.has(prefix+"Distance"))
27738      return parseDistance(getJObject(json, prefix+"Distance"));
27739    else if (json.has(prefix+"Age"))
27740      return parseAge(getJObject(json, prefix+"Age"));
27741    else if (json.has(prefix+"Reference"))
27742      return parseReference(getJObject(json, prefix+"Reference"));
27743    else if (json.has(prefix+"TriggerDefinition"))
27744      return parseTriggerDefinition(getJObject(json, prefix+"TriggerDefinition"));
27745    else if (json.has(prefix+"Quantity"))
27746      return parseQuantity(getJObject(json, prefix+"Quantity"));
27747    else if (json.has(prefix+"Period"))
27748      return parsePeriod(getJObject(json, prefix+"Period"));
27749    else if (json.has(prefix+"Duration"))
27750      return parseDuration(getJObject(json, prefix+"Duration"));
27751    else if (json.has(prefix+"Range"))
27752      return parseRange(getJObject(json, prefix+"Range"));
27753    else if (json.has(prefix+"RelatedArtifact"))
27754      return parseRelatedArtifact(getJObject(json, prefix+"RelatedArtifact"));
27755    else if (json.has(prefix+"Annotation"))
27756      return parseAnnotation(getJObject(json, prefix+"Annotation"));
27757    else if (json.has(prefix+"ProductShelfLife"))
27758      return parseProductShelfLife(getJObject(json, prefix+"ProductShelfLife"));
27759    else if (json.has(prefix+"ContactDetail"))
27760      return parseContactDetail(getJObject(json, prefix+"ContactDetail"));
27761    else if (json.has(prefix+"UsageContext"))
27762      return parseUsageContext(getJObject(json, prefix+"UsageContext"));
27763    else if (json.has(prefix+"Expression"))
27764      return parseExpression(getJObject(json, prefix+"Expression"));
27765    else if (json.has(prefix+"Signature"))
27766      return parseSignature(getJObject(json, prefix+"Signature"));
27767    else if (json.has(prefix+"Timing"))
27768      return parseTiming(getJObject(json, prefix+"Timing"));
27769    else if (json.has(prefix+"ProdCharacteristic"))
27770      return parseProdCharacteristic(getJObject(json, prefix+"ProdCharacteristic"));
27771    else if (json.has(prefix+"CodeableConcept"))
27772      return parseCodeableConcept(getJObject(json, prefix+"CodeableConcept"));
27773    else if (json.has(prefix+"ParameterDefinition"))
27774      return parseParameterDefinition(getJObject(json, prefix+"ParameterDefinition"));
27775    else if (json.has(prefix+"Date") || json.has("_"+prefix+"Date")) {
27776      Type t = json.has(prefix+"Date") ? parseDate(json.get(prefix+"Date").getAsString()) : new DateType();
27777      if (json.has("_"+prefix+"Date"))
27778        parseElementProperties(getJObject(json, "_"+prefix+"Date"), t);
27779      return t;
27780    }
27781    else if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime")) {
27782      Type t = json.has(prefix+"DateTime") ? parseDateTime(json.get(prefix+"DateTime").getAsString()) : new DateTimeType();
27783      if (json.has("_"+prefix+"DateTime"))
27784        parseElementProperties(getJObject(json, "_"+prefix+"DateTime"), t);
27785      return t;
27786    }
27787    else if (json.has(prefix+"Code") || json.has("_"+prefix+"Code")) {
27788      Type t = json.has(prefix+"Code") ? parseCode(json.get(prefix+"Code").getAsString()) : new CodeType();
27789      if (json.has("_"+prefix+"Code"))
27790        parseElementProperties(getJObject(json, "_"+prefix+"Code"), t);
27791      return t;
27792    }
27793    else if (json.has(prefix+"String") || json.has("_"+prefix+"String")) {
27794      Type t = json.has(prefix+"String") ? parseString(json.get(prefix+"String").getAsString()) : new StringType();
27795      if (json.has("_"+prefix+"String"))
27796        parseElementProperties(getJObject(json, "_"+prefix+"String"), t);
27797      return t;
27798    }
27799    else if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer")) {
27800      Type t = json.has(prefix+"Integer") ? parseInteger(json.get(prefix+"Integer").getAsLong()) : new IntegerType();
27801      if (json.has("_"+prefix+"Integer"))
27802        parseElementProperties(getJObject(json, "_"+prefix+"Integer"), t);
27803      return t;
27804    }
27805    else if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid")) {
27806      Type t = json.has(prefix+"Oid") ? parseOid(json.get(prefix+"Oid").getAsString()) : new OidType();
27807      if (json.has("_"+prefix+"Oid"))
27808        parseElementProperties(getJObject(json, "_"+prefix+"Oid"), t);
27809      return t;
27810    }
27811    else if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical")) {
27812      Type t = json.has(prefix+"Canonical") ? parseCanonical(json.get(prefix+"Canonical").getAsString()) : new CanonicalType();
27813      if (json.has("_"+prefix+"Canonical"))
27814        parseElementProperties(getJObject(json, "_"+prefix+"Canonical"), t);
27815      return t;
27816    }
27817    else if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri")) {
27818      Type t = json.has(prefix+"Uri") ? parseUri(json.get(prefix+"Uri").getAsString()) : new UriType();
27819      if (json.has("_"+prefix+"Uri"))
27820        parseElementProperties(getJObject(json, "_"+prefix+"Uri"), t);
27821      return t;
27822    }
27823    else if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid")) {
27824      Type t = json.has(prefix+"Uuid") ? parseUuid(json.get(prefix+"Uuid").getAsString()) : new UuidType();
27825      if (json.has("_"+prefix+"Uuid"))
27826        parseElementProperties(getJObject(json, "_"+prefix+"Uuid"), t);
27827      return t;
27828    }
27829    else if (json.has(prefix+"Url") || json.has("_"+prefix+"Url")) {
27830      Type t = json.has(prefix+"Url") ? parseUrl(json.get(prefix+"Url").getAsString()) : new UrlType();
27831      if (json.has("_"+prefix+"Url"))
27832        parseElementProperties(getJObject(json, "_"+prefix+"Url"), t);
27833      return t;
27834    }
27835    else if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant")) {
27836      Type t = json.has(prefix+"Instant") ? parseInstant(json.get(prefix+"Instant").getAsString()) : new InstantType();
27837      if (json.has("_"+prefix+"Instant"))
27838        parseElementProperties(getJObject(json, "_"+prefix+"Instant"), t);
27839      return t;
27840    }
27841    else if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean")) {
27842      Type t = json.has(prefix+"Boolean") ? parseBoolean(json.get(prefix+"Boolean").getAsBoolean()) : new BooleanType();
27843      if (json.has("_"+prefix+"Boolean"))
27844        parseElementProperties(getJObject(json, "_"+prefix+"Boolean"), t);
27845      return t;
27846    }
27847    else if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary")) {
27848      Type t = json.has(prefix+"Base64Binary") ? parseBase64Binary(json.get(prefix+"Base64Binary").getAsString()) : new Base64BinaryType();
27849      if (json.has("_"+prefix+"Base64Binary"))
27850        parseElementProperties(getJObject(json, "_"+prefix+"Base64Binary"), t);
27851      return t;
27852    }
27853    else if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt")) {
27854      Type t = json.has(prefix+"UnsignedInt") ? parseUnsignedInt(json.get(prefix+"UnsignedInt").getAsString()) : new UnsignedIntType();
27855      if (json.has("_"+prefix+"UnsignedInt"))
27856        parseElementProperties(getJObject(json, "_"+prefix+"UnsignedInt"), t);
27857      return t;
27858    }
27859    else if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown")) {
27860      Type t = json.has(prefix+"Markdown") ? parseMarkdown(json.get(prefix+"Markdown").getAsString()) : new MarkdownType();
27861      if (json.has("_"+prefix+"Markdown"))
27862        parseElementProperties(getJObject(json, "_"+prefix+"Markdown"), t);
27863      return t;
27864    }
27865    else if (json.has(prefix+"Time") || json.has("_"+prefix+"Time")) {
27866      Type t = json.has(prefix+"Time") ? parseTime(json.get(prefix+"Time").getAsString()) : new TimeType();
27867      if (json.has("_"+prefix+"Time"))
27868        parseElementProperties(getJObject(json, "_"+prefix+"Time"), t);
27869      return t;
27870    }
27871    else if (json.has(prefix+"Id") || json.has("_"+prefix+"Id")) {
27872      Type t = json.has(prefix+"Id") ? parseId(json.get(prefix+"Id").getAsString()) : new IdType();
27873      if (json.has("_"+prefix+"Id"))
27874        parseElementProperties(getJObject(json, "_"+prefix+"Id"), t);
27875      return t;
27876    }
27877    else if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt")) {
27878      Type t = json.has(prefix+"PositiveInt") ? parsePositiveInt(json.get(prefix+"PositiveInt").getAsString()) : new PositiveIntType();
27879      if (json.has("_"+prefix+"PositiveInt"))
27880        parseElementProperties(getJObject(json, "_"+prefix+"PositiveInt"), t);
27881      return t;
27882    }
27883    else if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal")) {
27884      Type t = json.has(prefix+"Decimal") ? parseDecimal(json.get(prefix+"Decimal").getAsBigDecimal()) : new DecimalType();
27885      if (json.has("_"+prefix+"Decimal"))
27886        parseElementProperties(getJObject(json, "_"+prefix+"Decimal"), t);
27887      return t;
27888    }
27889    return null;
27890  }
27891
27892  protected Type parseType(JsonObject json, String type) throws IOException, FHIRFormatError {
27893    if (type.equals("Extension"))
27894      return parseExtension(json);
27895    else if (type.equals("Narrative"))
27896      return parseNarrative(json);
27897    else if (type.equals("Meta"))
27898      return parseMeta(json);
27899    else if (type.equals("Address"))
27900      return parseAddress(json);
27901    else if (type.equals("Contributor"))
27902      return parseContributor(json);
27903    else if (type.equals("Attachment"))
27904      return parseAttachment(json);
27905    else if (type.equals("Count"))
27906      return parseCount(json);
27907    else if (type.equals("DataRequirement"))
27908      return parseDataRequirement(json);
27909    else if (type.equals("Dosage"))
27910      return parseDosage(json);
27911    else if (type.equals("Money"))
27912      return parseMoney(json);
27913    else if (type.equals("HumanName"))
27914      return parseHumanName(json);
27915    else if (type.equals("ContactPoint"))
27916      return parseContactPoint(json);
27917    else if (type.equals("MarketingStatus"))
27918      return parseMarketingStatus(json);
27919    else if (type.equals("Identifier"))
27920      return parseIdentifier(json);
27921    else if (type.equals("SubstanceAmount"))
27922      return parseSubstanceAmount(json);
27923    else if (type.equals("Coding"))
27924      return parseCoding(json);
27925    else if (type.equals("SampledData"))
27926      return parseSampledData(json);
27927    else if (type.equals("Population"))
27928      return parsePopulation(json);
27929    else if (type.equals("Ratio"))
27930      return parseRatio(json);
27931    else if (type.equals("Distance"))
27932      return parseDistance(json);
27933    else if (type.equals("Age"))
27934      return parseAge(json);
27935    else if (type.equals("Reference"))
27936      return parseReference(json);
27937    else if (type.equals("TriggerDefinition"))
27938      return parseTriggerDefinition(json);
27939    else if (type.equals("Quantity"))
27940      return parseQuantity(json);
27941    else if (type.equals("Period"))
27942      return parsePeriod(json);
27943    else if (type.equals("Duration"))
27944      return parseDuration(json);
27945    else if (type.equals("Range"))
27946      return parseRange(json);
27947    else if (type.equals("RelatedArtifact"))
27948      return parseRelatedArtifact(json);
27949    else if (type.equals("Annotation"))
27950      return parseAnnotation(json);
27951    else if (type.equals("ProductShelfLife"))
27952      return parseProductShelfLife(json);
27953    else if (type.equals("ContactDetail"))
27954      return parseContactDetail(json);
27955    else if (type.equals("UsageContext"))
27956      return parseUsageContext(json);
27957    else if (type.equals("Expression"))
27958      return parseExpression(json);
27959    else if (type.equals("Signature"))
27960      return parseSignature(json);
27961    else if (type.equals("Timing"))
27962      return parseTiming(json);
27963    else if (type.equals("ProdCharacteristic"))
27964      return parseProdCharacteristic(json);
27965    else if (type.equals("CodeableConcept"))
27966      return parseCodeableConcept(json);
27967    else if (type.equals("ParameterDefinition"))
27968      return parseParameterDefinition(json);
27969    throw new FHIRFormatError("Unknown Type "+type);
27970  }
27971
27972  protected boolean hasTypeName(JsonObject json, String prefix) {
27973        if (json.has(prefix+"Extension"))
27974      return true;
27975    if (json.has(prefix+"Narrative"))
27976      return true;
27977    if (json.has(prefix+"Meta"))
27978      return true;
27979    if (json.has(prefix+"Address"))
27980      return true;
27981    if (json.has(prefix+"Contributor"))
27982      return true;
27983    if (json.has(prefix+"Attachment"))
27984      return true;
27985    if (json.has(prefix+"Count"))
27986      return true;
27987    if (json.has(prefix+"DataRequirement"))
27988      return true;
27989    if (json.has(prefix+"Dosage"))
27990      return true;
27991    if (json.has(prefix+"Money"))
27992      return true;
27993    if (json.has(prefix+"HumanName"))
27994      return true;
27995    if (json.has(prefix+"ContactPoint"))
27996      return true;
27997    if (json.has(prefix+"MarketingStatus"))
27998      return true;
27999    if (json.has(prefix+"Identifier"))
28000      return true;
28001    if (json.has(prefix+"SubstanceAmount"))
28002      return true;
28003    if (json.has(prefix+"Coding"))
28004      return true;
28005    if (json.has(prefix+"SampledData"))
28006      return true;
28007    if (json.has(prefix+"Population"))
28008      return true;
28009    if (json.has(prefix+"Ratio"))
28010      return true;
28011    if (json.has(prefix+"Distance"))
28012      return true;
28013    if (json.has(prefix+"Age"))
28014      return true;
28015    if (json.has(prefix+"Reference"))
28016      return true;
28017    if (json.has(prefix+"TriggerDefinition"))
28018      return true;
28019    if (json.has(prefix+"Quantity"))
28020      return true;
28021    if (json.has(prefix+"Period"))
28022      return true;
28023    if (json.has(prefix+"Duration"))
28024      return true;
28025    if (json.has(prefix+"Range"))
28026      return true;
28027    if (json.has(prefix+"RelatedArtifact"))
28028      return true;
28029    if (json.has(prefix+"Annotation"))
28030      return true;
28031    if (json.has(prefix+"ProductShelfLife"))
28032      return true;
28033    if (json.has(prefix+"ContactDetail"))
28034      return true;
28035    if (json.has(prefix+"UsageContext"))
28036      return true;
28037    if (json.has(prefix+"Expression"))
28038      return true;
28039    if (json.has(prefix+"Signature"))
28040      return true;
28041    if (json.has(prefix+"Timing"))
28042      return true;
28043    if (json.has(prefix+"ProdCharacteristic"))
28044      return true;
28045    if (json.has(prefix+"CodeableConcept"))
28046      return true;
28047    if (json.has(prefix+"ParameterDefinition"))
28048      return true;
28049    if (json.has(prefix+"Parameters"))
28050      return true;
28051    if (json.has(prefix+"Account"))
28052      return true;
28053    if (json.has(prefix+"ActivityDefinition"))
28054      return true;
28055    if (json.has(prefix+"AdverseEvent"))
28056      return true;
28057    if (json.has(prefix+"AllergyIntolerance"))
28058      return true;
28059    if (json.has(prefix+"Appointment"))
28060      return true;
28061    if (json.has(prefix+"AppointmentResponse"))
28062      return true;
28063    if (json.has(prefix+"AuditEvent"))
28064      return true;
28065    if (json.has(prefix+"Basic"))
28066      return true;
28067    if (json.has(prefix+"Binary"))
28068      return true;
28069    if (json.has(prefix+"BiologicallyDerivedProduct"))
28070      return true;
28071    if (json.has(prefix+"BodyStructure"))
28072      return true;
28073    if (json.has(prefix+"Bundle"))
28074      return true;
28075    if (json.has(prefix+"CapabilityStatement"))
28076      return true;
28077    if (json.has(prefix+"CarePlan"))
28078      return true;
28079    if (json.has(prefix+"CareTeam"))
28080      return true;
28081    if (json.has(prefix+"CatalogEntry"))
28082      return true;
28083    if (json.has(prefix+"ChargeItem"))
28084      return true;
28085    if (json.has(prefix+"ChargeItemDefinition"))
28086      return true;
28087    if (json.has(prefix+"Claim"))
28088      return true;
28089    if (json.has(prefix+"ClaimResponse"))
28090      return true;
28091    if (json.has(prefix+"ClinicalImpression"))
28092      return true;
28093    if (json.has(prefix+"CodeSystem"))
28094      return true;
28095    if (json.has(prefix+"Communication"))
28096      return true;
28097    if (json.has(prefix+"CommunicationRequest"))
28098      return true;
28099    if (json.has(prefix+"CompartmentDefinition"))
28100      return true;
28101    if (json.has(prefix+"Composition"))
28102      return true;
28103    if (json.has(prefix+"ConceptMap"))
28104      return true;
28105    if (json.has(prefix+"Condition"))
28106      return true;
28107    if (json.has(prefix+"Consent"))
28108      return true;
28109    if (json.has(prefix+"Contract"))
28110      return true;
28111    if (json.has(prefix+"Coverage"))
28112      return true;
28113    if (json.has(prefix+"CoverageEligibilityRequest"))
28114      return true;
28115    if (json.has(prefix+"CoverageEligibilityResponse"))
28116      return true;
28117    if (json.has(prefix+"DetectedIssue"))
28118      return true;
28119    if (json.has(prefix+"Device"))
28120      return true;
28121    if (json.has(prefix+"DeviceDefinition"))
28122      return true;
28123    if (json.has(prefix+"DeviceMetric"))
28124      return true;
28125    if (json.has(prefix+"DeviceRequest"))
28126      return true;
28127    if (json.has(prefix+"DeviceUseStatement"))
28128      return true;
28129    if (json.has(prefix+"DiagnosticReport"))
28130      return true;
28131    if (json.has(prefix+"DocumentManifest"))
28132      return true;
28133    if (json.has(prefix+"DocumentReference"))
28134      return true;
28135    if (json.has(prefix+"EffectEvidenceSynthesis"))
28136      return true;
28137    if (json.has(prefix+"Encounter"))
28138      return true;
28139    if (json.has(prefix+"Endpoint"))
28140      return true;
28141    if (json.has(prefix+"EnrollmentRequest"))
28142      return true;
28143    if (json.has(prefix+"EnrollmentResponse"))
28144      return true;
28145    if (json.has(prefix+"EpisodeOfCare"))
28146      return true;
28147    if (json.has(prefix+"EventDefinition"))
28148      return true;
28149    if (json.has(prefix+"Evidence"))
28150      return true;
28151    if (json.has(prefix+"EvidenceVariable"))
28152      return true;
28153    if (json.has(prefix+"ExampleScenario"))
28154      return true;
28155    if (json.has(prefix+"ExplanationOfBenefit"))
28156      return true;
28157    if (json.has(prefix+"FamilyMemberHistory"))
28158      return true;
28159    if (json.has(prefix+"Flag"))
28160      return true;
28161    if (json.has(prefix+"Goal"))
28162      return true;
28163    if (json.has(prefix+"GraphDefinition"))
28164      return true;
28165    if (json.has(prefix+"Group"))
28166      return true;
28167    if (json.has(prefix+"GuidanceResponse"))
28168      return true;
28169    if (json.has(prefix+"HealthcareService"))
28170      return true;
28171    if (json.has(prefix+"ImagingStudy"))
28172      return true;
28173    if (json.has(prefix+"Immunization"))
28174      return true;
28175    if (json.has(prefix+"ImmunizationEvaluation"))
28176      return true;
28177    if (json.has(prefix+"ImmunizationRecommendation"))
28178      return true;
28179    if (json.has(prefix+"ImplementationGuide"))
28180      return true;
28181    if (json.has(prefix+"InsurancePlan"))
28182      return true;
28183    if (json.has(prefix+"Invoice"))
28184      return true;
28185    if (json.has(prefix+"Library"))
28186      return true;
28187    if (json.has(prefix+"Linkage"))
28188      return true;
28189    if (json.has(prefix+"List"))
28190      return true;
28191    if (json.has(prefix+"Location"))
28192      return true;
28193    if (json.has(prefix+"Measure"))
28194      return true;
28195    if (json.has(prefix+"MeasureReport"))
28196      return true;
28197    if (json.has(prefix+"Media"))
28198      return true;
28199    if (json.has(prefix+"Medication"))
28200      return true;
28201    if (json.has(prefix+"MedicationAdministration"))
28202      return true;
28203    if (json.has(prefix+"MedicationDispense"))
28204      return true;
28205    if (json.has(prefix+"MedicationKnowledge"))
28206      return true;
28207    if (json.has(prefix+"MedicationRequest"))
28208      return true;
28209    if (json.has(prefix+"MedicationStatement"))
28210      return true;
28211    if (json.has(prefix+"MedicinalProduct"))
28212      return true;
28213    if (json.has(prefix+"MedicinalProductAuthorization"))
28214      return true;
28215    if (json.has(prefix+"MedicinalProductContraindication"))
28216      return true;
28217    if (json.has(prefix+"MedicinalProductIndication"))
28218      return true;
28219    if (json.has(prefix+"MedicinalProductIngredient"))
28220      return true;
28221    if (json.has(prefix+"MedicinalProductInteraction"))
28222      return true;
28223    if (json.has(prefix+"MedicinalProductManufactured"))
28224      return true;
28225    if (json.has(prefix+"MedicinalProductPackaged"))
28226      return true;
28227    if (json.has(prefix+"MedicinalProductPharmaceutical"))
28228      return true;
28229    if (json.has(prefix+"MedicinalProductUndesirableEffect"))
28230      return true;
28231    if (json.has(prefix+"MessageDefinition"))
28232      return true;
28233    if (json.has(prefix+"MessageHeader"))
28234      return true;
28235    if (json.has(prefix+"MolecularSequence"))
28236      return true;
28237    if (json.has(prefix+"NamingSystem"))
28238      return true;
28239    if (json.has(prefix+"NutritionOrder"))
28240      return true;
28241    if (json.has(prefix+"Observation"))
28242      return true;
28243    if (json.has(prefix+"ObservationDefinition"))
28244      return true;
28245    if (json.has(prefix+"OperationDefinition"))
28246      return true;
28247    if (json.has(prefix+"OperationOutcome"))
28248      return true;
28249    if (json.has(prefix+"Organization"))
28250      return true;
28251    if (json.has(prefix+"OrganizationAffiliation"))
28252      return true;
28253    if (json.has(prefix+"Patient"))
28254      return true;
28255    if (json.has(prefix+"PaymentNotice"))
28256      return true;
28257    if (json.has(prefix+"PaymentReconciliation"))
28258      return true;
28259    if (json.has(prefix+"Person"))
28260      return true;
28261    if (json.has(prefix+"PlanDefinition"))
28262      return true;
28263    if (json.has(prefix+"Practitioner"))
28264      return true;
28265    if (json.has(prefix+"PractitionerRole"))
28266      return true;
28267    if (json.has(prefix+"Procedure"))
28268      return true;
28269    if (json.has(prefix+"Provenance"))
28270      return true;
28271    if (json.has(prefix+"Questionnaire"))
28272      return true;
28273    if (json.has(prefix+"QuestionnaireResponse"))
28274      return true;
28275    if (json.has(prefix+"RelatedPerson"))
28276      return true;
28277    if (json.has(prefix+"RequestGroup"))
28278      return true;
28279    if (json.has(prefix+"ResearchDefinition"))
28280      return true;
28281    if (json.has(prefix+"ResearchElementDefinition"))
28282      return true;
28283    if (json.has(prefix+"ResearchStudy"))
28284      return true;
28285    if (json.has(prefix+"ResearchSubject"))
28286      return true;
28287    if (json.has(prefix+"RiskAssessment"))
28288      return true;
28289    if (json.has(prefix+"RiskEvidenceSynthesis"))
28290      return true;
28291    if (json.has(prefix+"Schedule"))
28292      return true;
28293    if (json.has(prefix+"SearchParameter"))
28294      return true;
28295    if (json.has(prefix+"ServiceRequest"))
28296      return true;
28297    if (json.has(prefix+"Slot"))
28298      return true;
28299    if (json.has(prefix+"Specimen"))
28300      return true;
28301    if (json.has(prefix+"SpecimenDefinition"))
28302      return true;
28303    if (json.has(prefix+"StructureDefinition"))
28304      return true;
28305    if (json.has(prefix+"StructureMap"))
28306      return true;
28307    if (json.has(prefix+"Subscription"))
28308      return true;
28309    if (json.has(prefix+"Substance"))
28310      return true;
28311    if (json.has(prefix+"SubstanceNucleicAcid"))
28312      return true;
28313    if (json.has(prefix+"SubstancePolymer"))
28314      return true;
28315    if (json.has(prefix+"SubstanceProtein"))
28316      return true;
28317    if (json.has(prefix+"SubstanceReferenceInformation"))
28318      return true;
28319    if (json.has(prefix+"SubstanceSourceMaterial"))
28320      return true;
28321    if (json.has(prefix+"SubstanceSpecification"))
28322      return true;
28323    if (json.has(prefix+"SupplyDelivery"))
28324      return true;
28325    if (json.has(prefix+"SupplyRequest"))
28326      return true;
28327    if (json.has(prefix+"Task"))
28328      return true;
28329    if (json.has(prefix+"TerminologyCapabilities"))
28330      return true;
28331    if (json.has(prefix+"TestReport"))
28332      return true;
28333    if (json.has(prefix+"TestScript"))
28334      return true;
28335    if (json.has(prefix+"ValueSet"))
28336      return true;
28337    if (json.has(prefix+"VerificationResult"))
28338      return true;
28339    if (json.has(prefix+"VisionPrescription"))
28340      return true;
28341    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date"))
28342      return true;
28343    if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime"))
28344      return true;
28345    if (json.has(prefix+"Code") || json.has("_"+prefix+"Code"))
28346      return true;
28347    if (json.has(prefix+"String") || json.has("_"+prefix+"String"))
28348      return true;
28349    if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer"))
28350      return true;
28351    if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid"))
28352      return true;
28353    if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical"))
28354      return true;
28355    if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri"))
28356      return true;
28357    if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid"))
28358      return true;
28359    if (json.has(prefix+"Url") || json.has("_"+prefix+"Url"))
28360      return true;
28361    if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant"))
28362      return true;
28363    if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean"))
28364      return true;
28365    if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary"))
28366      return true;
28367    if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt"))
28368      return true;
28369    if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown"))
28370      return true;
28371    if (json.has(prefix+"Time") || json.has("_"+prefix+"Time"))
28372      return true;
28373    if (json.has(prefix+"Id") || json.has("_"+prefix+"Id"))
28374      return true;
28375    if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt"))
28376      return true;
28377    if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal"))
28378      return true;
28379    return false;
28380  }
28381
28382  protected Type parseAnyType(JsonObject json, String type) throws IOException, FHIRFormatError {
28383    if (type.equals("ElementDefinition"))
28384      return parseElementDefinition(json);
28385    else if (type.equals("DataRequirement"))
28386      return parseDataRequirement(json);
28387    else
28388      return parseType(json, type);
28389  }
28390
28391  protected void composeElement(Element element) throws IOException {
28392    if (element.hasId())
28393      prop("id", element.getId());
28394      if (makeComments(element)) {
28395        openArray("fhir_comments");
28396        for (String s : element.getFormatCommentsPre())
28397          prop(null,  s);
28398        for (String s : element.getFormatCommentsPost())
28399          prop(null,  s);
28400         closeArray();
28401      }
28402    if (element.hasExtension()) {
28403      openArray("extension");
28404      for (Extension e : element.getExtension())
28405        composeExtension(null, e);
28406      closeArray();
28407    }
28408  }
28409
28410  protected void composeBackboneElementInner(BackboneElement element) throws IOException {
28411    composeBackbone(element);
28412  }
28413
28414  protected void composeBackbone(BackboneElement element) throws IOException {
28415    composeElement(element);
28416    if (element.hasModifierExtension()) {
28417      openArray("modifierExtension");
28418      for (Extension e : element.getModifierExtension())
28419        composeExtension(null, e);
28420      closeArray();
28421    }
28422  }
28423
28424  protected void composeBackbone(BackboneType element) throws IOException {
28425    composeElement(element);
28426    if (element.hasModifierExtension()) {
28427      openArray("modifierExtension");
28428      for (Extension e : element.getModifierExtension())
28429        composeExtension(null, e);
28430      closeArray();
28431    }
28432  }
28433
28434  protected <E extends Enum<E>> void composeEnumerationCore(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
28435    if (value != null && value.getValue() != null) {
28436      prop(name, e.toCode(value.getValue()));
28437    } else if (inArray)   
28438      writeNull(name);
28439  }    
28440
28441  protected <E extends Enum<E>> void composeEnumerationExtras(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
28442    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28443      open(inArray ? null : "_"+name);
28444      composeElement(value);
28445      close();
28446    } else if (inArray)   
28447      writeNull(name);
28448  }    
28449
28450  protected void composeDateCore(String name, DateType value, boolean inArray) throws IOException {
28451    if (value != null && value.hasValue()) {
28452        prop(name, value.asStringValue());
28453    }    
28454    else if (inArray) 
28455      writeNull(name); 
28456  }    
28457
28458  protected void composeDateExtras(String name, DateType value, boolean inArray) throws IOException {
28459    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28460      open(inArray ? null : "_"+name);
28461      composeElement(value);
28462      close();
28463    }
28464    else if (inArray) 
28465      writeNull(name); 
28466  }
28467
28468  protected void composeDateTimeCore(String name, DateTimeType value, boolean inArray) throws IOException {
28469    if (value != null && value.hasValue()) {
28470        prop(name, value.asStringValue());
28471    }    
28472    else if (inArray) 
28473      writeNull(name); 
28474  }    
28475
28476  protected void composeDateTimeExtras(String name, DateTimeType value, boolean inArray) throws IOException {
28477    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28478      open(inArray ? null : "_"+name);
28479      composeElement(value);
28480      close();
28481    }
28482    else if (inArray) 
28483      writeNull(name); 
28484  }
28485
28486  protected void composeCodeCore(String name, CodeType value, boolean inArray) throws IOException {
28487    if (value != null && value.hasValue()) {
28488        prop(name, toString(value.getValue()));
28489    }    
28490    else if (inArray) 
28491      writeNull(name); 
28492  }    
28493
28494  protected void composeCodeExtras(String name, CodeType value, boolean inArray) throws IOException {
28495    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28496      open(inArray ? null : "_"+name);
28497      composeElement(value);
28498      close();
28499    }
28500    else if (inArray) 
28501      writeNull(name); 
28502  }
28503
28504  protected void composeStringCore(String name, StringType value, boolean inArray) throws IOException {
28505    if (value != null && value.hasValue()) {
28506        prop(name, toString(value.getValue()));
28507    }    
28508    else if (inArray) 
28509      writeNull(name); 
28510  }    
28511
28512  protected void composeStringExtras(String name, StringType value, boolean inArray) throws IOException {
28513    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28514      open(inArray ? null : "_"+name);
28515      composeElement(value);
28516      close();
28517    }
28518    else if (inArray) 
28519      writeNull(name); 
28520  }
28521
28522  protected void composeIntegerCore(String name, IntegerType value, boolean inArray) throws IOException {
28523    if (value != null && value.hasValue()) {
28524        prop(name, Integer.valueOf(value.getValue()));
28525    }    
28526    else if (inArray) 
28527      writeNull(name); 
28528  }    
28529
28530  protected void composeIntegerExtras(String name, IntegerType value, boolean inArray) throws IOException {
28531    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28532      open(inArray ? null : "_"+name);
28533      composeElement(value);
28534      close();
28535    }
28536    else if (inArray) 
28537      writeNull(name); 
28538  }
28539
28540  protected void composeOidCore(String name, OidType value, boolean inArray) throws IOException {
28541    if (value != null && value.hasValue()) {
28542        prop(name, toString(value.getValue()));
28543    }    
28544    else if (inArray) 
28545      writeNull(name); 
28546  }    
28547
28548  protected void composeOidExtras(String name, OidType value, boolean inArray) throws IOException {
28549    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28550      open(inArray ? null : "_"+name);
28551      composeElement(value);
28552      close();
28553    }
28554    else if (inArray) 
28555      writeNull(name); 
28556  }
28557
28558  protected void composeCanonicalCore(String name, CanonicalType value, boolean inArray) throws IOException {
28559    if (value != null && value.hasValue()) {
28560        prop(name, toString(value.getValue()));
28561    }    
28562    else if (inArray) 
28563      writeNull(name); 
28564  }    
28565
28566  protected void composeCanonicalExtras(String name, CanonicalType value, boolean inArray) throws IOException {
28567    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28568      open(inArray ? null : "_"+name);
28569      composeElement(value);
28570      close();
28571    }
28572    else if (inArray) 
28573      writeNull(name); 
28574  }
28575
28576  protected void composeUriCore(String name, UriType value, boolean inArray) throws IOException {
28577    if (value != null && value.hasValue()) {
28578        prop(name, toString(value.getValue()));
28579    }    
28580    else if (inArray) 
28581      writeNull(name); 
28582  }    
28583
28584  protected void composeUriExtras(String name, UriType value, boolean inArray) throws IOException {
28585    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28586      open(inArray ? null : "_"+name);
28587      composeElement(value);
28588      close();
28589    }
28590    else if (inArray) 
28591      writeNull(name); 
28592  }
28593
28594  protected void composeUuidCore(String name, UuidType value, boolean inArray) throws IOException {
28595    if (value != null && value.hasValue()) {
28596        prop(name, toString(value.getValue()));
28597    }    
28598    else if (inArray) 
28599      writeNull(name); 
28600  }    
28601
28602  protected void composeUuidExtras(String name, UuidType value, boolean inArray) throws IOException {
28603    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28604      open(inArray ? null : "_"+name);
28605      composeElement(value);
28606      close();
28607    }
28608    else if (inArray) 
28609      writeNull(name); 
28610  }
28611
28612  protected void composeUrlCore(String name, UrlType value, boolean inArray) throws IOException {
28613    if (value != null && value.hasValue()) {
28614        prop(name, toString(value.getValue()));
28615    }    
28616    else if (inArray) 
28617      writeNull(name); 
28618  }    
28619
28620  protected void composeUrlExtras(String name, UrlType value, boolean inArray) throws IOException {
28621    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28622      open(inArray ? null : "_"+name);
28623      composeElement(value);
28624      close();
28625    }
28626    else if (inArray) 
28627      writeNull(name); 
28628  }
28629
28630  protected void composeInstantCore(String name, InstantType value, boolean inArray) throws IOException {
28631    if (value != null && value.hasValue()) {
28632        prop(name, value.asStringValue());
28633    }    
28634    else if (inArray) 
28635      writeNull(name); 
28636  }    
28637
28638  protected void composeInstantExtras(String name, InstantType value, boolean inArray) throws IOException {
28639    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28640      open(inArray ? null : "_"+name);
28641      composeElement(value);
28642      close();
28643    }
28644    else if (inArray) 
28645      writeNull(name); 
28646  }
28647
28648  protected void composeBooleanCore(String name, BooleanType value, boolean inArray) throws IOException {
28649    if (value != null && value.hasValue()) {
28650        prop(name, value.getValue());
28651    }    
28652    else if (inArray) 
28653      writeNull(name); 
28654  }    
28655
28656  protected void composeBooleanExtras(String name, BooleanType value, boolean inArray) throws IOException {
28657    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28658      open(inArray ? null : "_"+name);
28659      composeElement(value);
28660      close();
28661    }
28662    else if (inArray) 
28663      writeNull(name); 
28664  }
28665
28666  protected void composeBase64BinaryCore(String name, Base64BinaryType value, boolean inArray) throws IOException {
28667    if (value != null && value.hasValue()) {
28668        prop(name, toString(value.getValue()));
28669    }    
28670    else if (inArray) 
28671      writeNull(name); 
28672  }    
28673
28674  protected void composeBase64BinaryExtras(String name, Base64BinaryType value, boolean inArray) throws IOException {
28675    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28676      open(inArray ? null : "_"+name);
28677      composeElement(value);
28678      close();
28679    }
28680    else if (inArray) 
28681      writeNull(name); 
28682  }
28683
28684  protected void composeUnsignedIntCore(String name, UnsignedIntType value, boolean inArray) throws IOException {
28685    if (value != null && value.hasValue()) {
28686        prop(name, Integer.valueOf(value.getValue()));
28687    }    
28688    else if (inArray) 
28689      writeNull(name); 
28690  }    
28691
28692  protected void composeUnsignedIntExtras(String name, UnsignedIntType value, boolean inArray) throws IOException {
28693    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28694      open(inArray ? null : "_"+name);
28695      composeElement(value);
28696      close();
28697    }
28698    else if (inArray) 
28699      writeNull(name); 
28700  }
28701
28702  protected void composeMarkdownCore(String name, MarkdownType value, boolean inArray) throws IOException {
28703    if (value != null && value.hasValue()) {
28704        prop(name, toString(value.getValue()));
28705    }    
28706    else if (inArray) 
28707      writeNull(name); 
28708  }    
28709
28710  protected void composeMarkdownExtras(String name, MarkdownType value, boolean inArray) throws IOException {
28711    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28712      open(inArray ? null : "_"+name);
28713      composeElement(value);
28714      close();
28715    }
28716    else if (inArray) 
28717      writeNull(name); 
28718  }
28719
28720  protected void composeTimeCore(String name, TimeType value, boolean inArray) throws IOException {
28721    if (value != null && value.hasValue()) {
28722        prop(name, value.asStringValue());
28723    }    
28724    else if (inArray) 
28725      writeNull(name); 
28726  }    
28727
28728  protected void composeTimeExtras(String name, TimeType value, boolean inArray) throws IOException {
28729    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28730      open(inArray ? null : "_"+name);
28731      composeElement(value);
28732      close();
28733    }
28734    else if (inArray) 
28735      writeNull(name); 
28736  }
28737
28738  protected void composeIdCore(String name, IdType value, boolean inArray) throws IOException {
28739    if (value != null && value.hasValue()) {
28740        prop(name, toString(value.getValue()));
28741    }    
28742    else if (inArray) 
28743      writeNull(name); 
28744  }    
28745
28746  protected void composeIdExtras(String name, IdType value, boolean inArray) throws IOException {
28747    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28748      open(inArray ? null : "_"+name);
28749      composeElement(value);
28750      close();
28751    }
28752    else if (inArray) 
28753      writeNull(name); 
28754  }
28755
28756  protected void composePositiveIntCore(String name, PositiveIntType value, boolean inArray) throws IOException {
28757    if (value != null && value.hasValue()) {
28758        prop(name, Integer.valueOf(value.getValue()));
28759    }    
28760    else if (inArray) 
28761      writeNull(name); 
28762  }    
28763
28764  protected void composePositiveIntExtras(String name, PositiveIntType value, boolean inArray) throws IOException {
28765    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28766      open(inArray ? null : "_"+name);
28767      composeElement(value);
28768      close();
28769    }
28770    else if (inArray) 
28771      writeNull(name); 
28772  }
28773
28774  protected void composeDecimalCore(String name, DecimalType value, boolean inArray) throws IOException {
28775    if (value != null && value.hasValue()) {
28776        prop(name, value.getValue());
28777    }    
28778    else if (inArray) 
28779      writeNull(name); 
28780  }    
28781
28782  protected void composeDecimalExtras(String name, DecimalType value, boolean inArray) throws IOException {
28783    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28784      open(inArray ? null : "_"+name);
28785      composeElement(value);
28786      close();
28787    }
28788    else if (inArray) 
28789      writeNull(name); 
28790  }
28791
28792  protected void composeExtension(String name, Extension element) throws IOException {
28793    if (element != null) {
28794      open(name);
28795      composeExtensionInner(element);
28796      close();
28797    }
28798  }
28799
28800  protected void composeExtensionInner(Extension element) throws IOException {
28801      composeElement(element);
28802      if (element.hasUrlElement()) {
28803        composeUriCore("url", element.getUrlElement(), false);
28804        composeUriExtras("url", element.getUrlElement(), false);
28805      }
28806      if (element.hasValue()) {
28807        composeType("value", element.getValue());
28808      }
28809  }
28810
28811  protected void composeNarrative(String name, Narrative element) throws IOException {
28812    if (element != null) {
28813      open(name);
28814      composeNarrativeInner(element);
28815      close();
28816    }
28817  }
28818
28819  protected void composeNarrativeInner(Narrative element) throws IOException {
28820      composeElement(element);
28821      if (element.hasStatusElement()) {
28822        composeEnumerationCore("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
28823        composeEnumerationExtras("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
28824      }
28825      if (element.hasDiv()) {
28826        XhtmlNode node = element.getDiv();
28827        if (node.getNsDecl() == null) {
28828          node.attribute("xmlns", XHTML_NS);
28829        }
28830        composeXhtml("div", node);
28831      }
28832  }
28833
28834  protected void composeCount(String name, Count element) throws IOException {
28835    if (element != null) {
28836      open(name);
28837      composeCountInner(element);
28838      close();
28839    }
28840  }
28841
28842  protected void composeCountInner(Count element) throws IOException {
28843      composeQuantityInner(element);
28844  }
28845
28846  protected void composeDosage(String name, Dosage element) throws IOException {
28847    if (element != null) {
28848      open(name);
28849      composeDosageInner(element);
28850      close();
28851    }
28852  }
28853
28854  protected void composeDosageInner(Dosage element) throws IOException {
28855      composeBackbone(element);
28856      if (element.hasSequenceElement()) {
28857        composeIntegerCore("sequence", element.getSequenceElement(), false);
28858        composeIntegerExtras("sequence", element.getSequenceElement(), false);
28859      }
28860      if (element.hasTextElement()) {
28861        composeStringCore("text", element.getTextElement(), false);
28862        composeStringExtras("text", element.getTextElement(), false);
28863      }
28864      if (element.hasAdditionalInstruction()) {
28865        openArray("additionalInstruction");
28866        for (CodeableConcept e : element.getAdditionalInstruction()) 
28867          composeCodeableConcept(null, e);
28868        closeArray();
28869      };
28870      if (element.hasPatientInstructionElement()) {
28871        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
28872        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
28873      }
28874      if (element.hasTiming()) {
28875        composeTiming("timing", element.getTiming());
28876      }
28877      if (element.hasAsNeeded()) {
28878        composeType("asNeeded", element.getAsNeeded());
28879      }
28880      if (element.hasSite()) {
28881        composeCodeableConcept("site", element.getSite());
28882      }
28883      if (element.hasRoute()) {
28884        composeCodeableConcept("route", element.getRoute());
28885      }
28886      if (element.hasMethod()) {
28887        composeCodeableConcept("method", element.getMethod());
28888      }
28889      if (element.hasDoseAndRate()) {
28890        openArray("doseAndRate");
28891        for (Dosage.DosageDoseAndRateComponent e : element.getDoseAndRate()) 
28892          composeDosageDosageDoseAndRateComponent(null, e);
28893        closeArray();
28894      };
28895      if (element.hasMaxDosePerPeriod()) {
28896        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
28897      }
28898      if (element.hasMaxDosePerAdministration()) {
28899        composeQuantity("maxDosePerAdministration", element.getMaxDosePerAdministration());
28900      }
28901      if (element.hasMaxDosePerLifetime()) {
28902        composeQuantity("maxDosePerLifetime", element.getMaxDosePerLifetime());
28903      }
28904  }
28905
28906  protected void composeDosageDosageDoseAndRateComponent(String name, Dosage.DosageDoseAndRateComponent element) throws IOException {
28907    if (element != null) {
28908      open(name);
28909      composeDosageDosageDoseAndRateComponentInner(element);
28910      close();
28911    }
28912  }
28913
28914  protected void composeDosageDosageDoseAndRateComponentInner(Dosage.DosageDoseAndRateComponent element) throws IOException {
28915      composeElement(element);
28916      if (element.hasType()) {
28917        composeCodeableConcept("type", element.getType());
28918      }
28919      if (element.hasDose()) {
28920        composeType("dose", element.getDose());
28921      }
28922      if (element.hasRate()) {
28923        composeType("rate", element.getRate());
28924      }
28925  }
28926
28927  protected void composeMarketingStatus(String name, MarketingStatus element) throws IOException {
28928    if (element != null) {
28929      open(name);
28930      composeMarketingStatusInner(element);
28931      close();
28932    }
28933  }
28934
28935  protected void composeMarketingStatusInner(MarketingStatus element) throws IOException {
28936      composeBackbone(element);
28937      if (element.hasCountry()) {
28938        composeCodeableConcept("country", element.getCountry());
28939      }
28940      if (element.hasJurisdiction()) {
28941        composeCodeableConcept("jurisdiction", element.getJurisdiction());
28942      }
28943      if (element.hasStatus()) {
28944        composeCodeableConcept("status", element.getStatus());
28945      }
28946      if (element.hasDateRange()) {
28947        composePeriod("dateRange", element.getDateRange());
28948      }
28949      if (element.hasRestoreDateElement()) {
28950        composeDateTimeCore("restoreDate", element.getRestoreDateElement(), false);
28951        composeDateTimeExtras("restoreDate", element.getRestoreDateElement(), false);
28952      }
28953  }
28954
28955  protected void composeSubstanceAmount(String name, SubstanceAmount element) throws IOException {
28956    if (element != null) {
28957      open(name);
28958      composeSubstanceAmountInner(element);
28959      close();
28960    }
28961  }
28962
28963  protected void composeSubstanceAmountInner(SubstanceAmount element) throws IOException {
28964      composeBackbone(element);
28965      if (element.hasAmount()) {
28966        composeType("amount", element.getAmount());
28967      }
28968      if (element.hasAmountType()) {
28969        composeCodeableConcept("amountType", element.getAmountType());
28970      }
28971      if (element.hasAmountTextElement()) {
28972        composeStringCore("amountText", element.getAmountTextElement(), false);
28973        composeStringExtras("amountText", element.getAmountTextElement(), false);
28974      }
28975      if (element.hasReferenceRange()) {
28976        composeSubstanceAmountSubstanceAmountReferenceRangeComponent("referenceRange", element.getReferenceRange());
28977      }
28978  }
28979
28980  protected void composeSubstanceAmountSubstanceAmountReferenceRangeComponent(String name, SubstanceAmount.SubstanceAmountReferenceRangeComponent element) throws IOException {
28981    if (element != null) {
28982      open(name);
28983      composeSubstanceAmountSubstanceAmountReferenceRangeComponentInner(element);
28984      close();
28985    }
28986  }
28987
28988  protected void composeSubstanceAmountSubstanceAmountReferenceRangeComponentInner(SubstanceAmount.SubstanceAmountReferenceRangeComponent element) throws IOException {
28989      composeElement(element);
28990      if (element.hasLowLimit()) {
28991        composeQuantity("lowLimit", element.getLowLimit());
28992      }
28993      if (element.hasHighLimit()) {
28994        composeQuantity("highLimit", element.getHighLimit());
28995      }
28996  }
28997
28998  protected void composePopulation(String name, Population element) throws IOException {
28999    if (element != null) {
29000      open(name);
29001      composePopulationInner(element);
29002      close();
29003    }
29004  }
29005
29006  protected void composePopulationInner(Population element) throws IOException {
29007      composeBackbone(element);
29008      if (element.hasAge()) {
29009        composeType("age", element.getAge());
29010      }
29011      if (element.hasGender()) {
29012        composeCodeableConcept("gender", element.getGender());
29013      }
29014      if (element.hasRace()) {
29015        composeCodeableConcept("race", element.getRace());
29016      }
29017      if (element.hasPhysiologicalCondition()) {
29018        composeCodeableConcept("physiologicalCondition", element.getPhysiologicalCondition());
29019      }
29020  }
29021
29022  protected void composeDistance(String name, Distance element) throws IOException {
29023    if (element != null) {
29024      open(name);
29025      composeDistanceInner(element);
29026      close();
29027    }
29028  }
29029
29030  protected void composeDistanceInner(Distance element) throws IOException {
29031      composeQuantityInner(element);
29032  }
29033
29034  protected void composeAge(String name, Age element) throws IOException {
29035    if (element != null) {
29036      open(name);
29037      composeAgeInner(element);
29038      close();
29039    }
29040  }
29041
29042  protected void composeAgeInner(Age element) throws IOException {
29043      composeQuantityInner(element);
29044  }
29045
29046  protected void composeDuration(String name, Duration element) throws IOException {
29047    if (element != null) {
29048      open(name);
29049      composeDurationInner(element);
29050      close();
29051    }
29052  }
29053
29054  protected void composeDurationInner(Duration element) throws IOException {
29055      composeQuantityInner(element);
29056  }
29057
29058  protected void composeProductShelfLife(String name, ProductShelfLife element) throws IOException {
29059    if (element != null) {
29060      open(name);
29061      composeProductShelfLifeInner(element);
29062      close();
29063    }
29064  }
29065
29066  protected void composeProductShelfLifeInner(ProductShelfLife element) throws IOException {
29067      composeBackbone(element);
29068      if (element.hasIdentifier()) {
29069        composeIdentifier("identifier", element.getIdentifier());
29070      }
29071      if (element.hasType()) {
29072        composeCodeableConcept("type", element.getType());
29073      }
29074      if (element.hasPeriod()) {
29075        composeQuantity("period", element.getPeriod());
29076      }
29077      if (element.hasSpecialPrecautionsForStorage()) {
29078        openArray("specialPrecautionsForStorage");
29079        for (CodeableConcept e : element.getSpecialPrecautionsForStorage()) 
29080          composeCodeableConcept(null, e);
29081        closeArray();
29082      };
29083  }
29084
29085  protected void composeTiming(String name, Timing element) throws IOException {
29086    if (element != null) {
29087      open(name);
29088      composeTimingInner(element);
29089      close();
29090    }
29091  }
29092
29093  protected void composeTimingInner(Timing element) throws IOException {
29094      composeBackbone(element);
29095      if (element.hasEvent()) {
29096        openArray("event");
29097        for (DateTimeType e : element.getEvent()) 
29098          composeDateTimeCore(null, e, true);
29099        closeArray();
29100        if (anyHasExtras(element.getEvent())) {
29101          openArray("_event");
29102          for (DateTimeType e : element.getEvent()) 
29103            composeDateTimeExtras(null, e, true);
29104          closeArray();
29105        }
29106      };
29107      if (element.hasRepeat()) {
29108        composeTimingTimingRepeatComponent("repeat", element.getRepeat());
29109      }
29110      if (element.hasCode()) {
29111        composeCodeableConcept("code", element.getCode());
29112      }
29113  }
29114
29115  protected void composeTimingTimingRepeatComponent(String name, Timing.TimingRepeatComponent element) throws IOException {
29116    if (element != null) {
29117      open(name);
29118      composeTimingTimingRepeatComponentInner(element);
29119      close();
29120    }
29121  }
29122
29123  protected void composeTimingTimingRepeatComponentInner(Timing.TimingRepeatComponent element) throws IOException {
29124      composeElement(element);
29125      if (element.hasBounds()) {
29126        composeType("bounds", element.getBounds());
29127      }
29128      if (element.hasCountElement()) {
29129        composePositiveIntCore("count", element.getCountElement(), false);
29130        composePositiveIntExtras("count", element.getCountElement(), false);
29131      }
29132      if (element.hasCountMaxElement()) {
29133        composePositiveIntCore("countMax", element.getCountMaxElement(), false);
29134        composePositiveIntExtras("countMax", element.getCountMaxElement(), false);
29135      }
29136      if (element.hasDurationElement()) {
29137        composeDecimalCore("duration", element.getDurationElement(), false);
29138        composeDecimalExtras("duration", element.getDurationElement(), false);
29139      }
29140      if (element.hasDurationMaxElement()) {
29141        composeDecimalCore("durationMax", element.getDurationMaxElement(), false);
29142        composeDecimalExtras("durationMax", element.getDurationMaxElement(), false);
29143      }
29144      if (element.hasDurationUnitElement()) {
29145        composeEnumerationCore("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
29146        composeEnumerationExtras("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
29147      }
29148      if (element.hasFrequencyElement()) {
29149        composePositiveIntCore("frequency", element.getFrequencyElement(), false);
29150        composePositiveIntExtras("frequency", element.getFrequencyElement(), false);
29151      }
29152      if (element.hasFrequencyMaxElement()) {
29153        composePositiveIntCore("frequencyMax", element.getFrequencyMaxElement(), false);
29154        composePositiveIntExtras("frequencyMax", element.getFrequencyMaxElement(), false);
29155      }
29156      if (element.hasPeriodElement()) {
29157        composeDecimalCore("period", element.getPeriodElement(), false);
29158        composeDecimalExtras("period", element.getPeriodElement(), false);
29159      }
29160      if (element.hasPeriodMaxElement()) {
29161        composeDecimalCore("periodMax", element.getPeriodMaxElement(), false);
29162        composeDecimalExtras("periodMax", element.getPeriodMaxElement(), false);
29163      }
29164      if (element.hasPeriodUnitElement()) {
29165        composeEnumerationCore("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
29166        composeEnumerationExtras("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
29167      }
29168      if (element.hasDayOfWeek()) {
29169        openArray("dayOfWeek");
29170        for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek()) 
29171          composeEnumerationCore(null, e, new Timing.DayOfWeekEnumFactory(), true);
29172        closeArray();
29173        if (anyHasExtras(element.getDayOfWeek())) {
29174          openArray("_dayOfWeek");
29175          for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek()) 
29176            composeEnumerationExtras(null, e, new Timing.DayOfWeekEnumFactory(), true);
29177          closeArray();
29178        }
29179      };
29180      if (element.hasTimeOfDay()) {
29181        openArray("timeOfDay");
29182        for (TimeType e : element.getTimeOfDay()) 
29183          composeTimeCore(null, e, true);
29184        closeArray();
29185        if (anyHasExtras(element.getTimeOfDay())) {
29186          openArray("_timeOfDay");
29187          for (TimeType e : element.getTimeOfDay()) 
29188            composeTimeExtras(null, e, true);
29189          closeArray();
29190        }
29191      };
29192      if (element.hasWhen()) {
29193        openArray("when");
29194        for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
29195          composeEnumerationCore(null, e, new Timing.EventTimingEnumFactory(), true);
29196        closeArray();
29197        if (anyHasExtras(element.getWhen())) {
29198          openArray("_when");
29199          for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
29200            composeEnumerationExtras(null, e, new Timing.EventTimingEnumFactory(), true);
29201          closeArray();
29202        }
29203      };
29204      if (element.hasOffsetElement()) {
29205        composeUnsignedIntCore("offset", element.getOffsetElement(), false);
29206        composeUnsignedIntExtras("offset", element.getOffsetElement(), false);
29207      }
29208  }
29209
29210  protected void composeProdCharacteristic(String name, ProdCharacteristic element) throws IOException {
29211    if (element != null) {
29212      open(name);
29213      composeProdCharacteristicInner(element);
29214      close();
29215    }
29216  }
29217
29218  protected void composeProdCharacteristicInner(ProdCharacteristic element) throws IOException {
29219      composeBackbone(element);
29220      if (element.hasHeight()) {
29221        composeQuantity("height", element.getHeight());
29222      }
29223      if (element.hasWidth()) {
29224        composeQuantity("width", element.getWidth());
29225      }
29226      if (element.hasDepth()) {
29227        composeQuantity("depth", element.getDepth());
29228      }
29229      if (element.hasWeight()) {
29230        composeQuantity("weight", element.getWeight());
29231      }
29232      if (element.hasNominalVolume()) {
29233        composeQuantity("nominalVolume", element.getNominalVolume());
29234      }
29235      if (element.hasExternalDiameter()) {
29236        composeQuantity("externalDiameter", element.getExternalDiameter());
29237      }
29238      if (element.hasShapeElement()) {
29239        composeStringCore("shape", element.getShapeElement(), false);
29240        composeStringExtras("shape", element.getShapeElement(), false);
29241      }
29242      if (element.hasColor()) {
29243        openArray("color");
29244        for (StringType e : element.getColor()) 
29245          composeStringCore(null, e, true);
29246        closeArray();
29247        if (anyHasExtras(element.getColor())) {
29248          openArray("_color");
29249          for (StringType e : element.getColor()) 
29250            composeStringExtras(null, e, true);
29251          closeArray();
29252        }
29253      };
29254      if (element.hasImprint()) {
29255        openArray("imprint");
29256        for (StringType e : element.getImprint()) 
29257          composeStringCore(null, e, true);
29258        closeArray();
29259        if (anyHasExtras(element.getImprint())) {
29260          openArray("_imprint");
29261          for (StringType e : element.getImprint()) 
29262            composeStringExtras(null, e, true);
29263          closeArray();
29264        }
29265      };
29266      if (element.hasImage()) {
29267        openArray("image");
29268        for (Attachment e : element.getImage()) 
29269          composeAttachment(null, e);
29270        closeArray();
29271      };
29272      if (element.hasScoring()) {
29273        composeCodeableConcept("scoring", element.getScoring());
29274      }
29275  }
29276
29277  protected void composeMeta(String name, Meta element) throws IOException {
29278    if (element != null) {
29279      open(name);
29280      composeMetaInner(element);
29281      close();
29282    }
29283  }
29284
29285  protected void composeMetaInner(Meta element) throws IOException {
29286      composeElement(element);
29287      if (element.hasVersionIdElement()) {
29288        composeIdCore("versionId", element.getVersionIdElement(), false);
29289        composeIdExtras("versionId", element.getVersionIdElement(), false);
29290      }
29291      if (element.hasLastUpdatedElement()) {
29292        composeInstantCore("lastUpdated", element.getLastUpdatedElement(), false);
29293        composeInstantExtras("lastUpdated", element.getLastUpdatedElement(), false);
29294      }
29295      if (element.hasSourceElement()) {
29296        composeUriCore("source", element.getSourceElement(), false);
29297        composeUriExtras("source", element.getSourceElement(), false);
29298      }
29299      if (element.hasProfile()) {
29300        openArray("profile");
29301        for (CanonicalType e : element.getProfile()) 
29302          composeCanonicalCore(null, e, true);
29303        closeArray();
29304        if (anyHasExtras(element.getProfile())) {
29305          openArray("_profile");
29306          for (CanonicalType e : element.getProfile()) 
29307            composeCanonicalExtras(null, e, true);
29308          closeArray();
29309        }
29310      };
29311      if (element.hasSecurity()) {
29312        openArray("security");
29313        for (Coding e : element.getSecurity()) 
29314          composeCoding(null, e);
29315        closeArray();
29316      };
29317      if (element.hasTag()) {
29318        openArray("tag");
29319        for (Coding e : element.getTag()) 
29320          composeCoding(null, e);
29321        closeArray();
29322      };
29323  }
29324
29325  protected void composeAddress(String name, Address element) throws IOException {
29326    if (element != null) {
29327      open(name);
29328      composeAddressInner(element);
29329      close();
29330    }
29331  }
29332
29333  protected void composeAddressInner(Address element) throws IOException {
29334      composeElement(element);
29335      if (element.hasUseElement()) {
29336        composeEnumerationCore("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
29337        composeEnumerationExtras("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
29338      }
29339      if (element.hasTypeElement()) {
29340        composeEnumerationCore("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
29341        composeEnumerationExtras("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
29342      }
29343      if (element.hasTextElement()) {
29344        composeStringCore("text", element.getTextElement(), false);
29345        composeStringExtras("text", element.getTextElement(), false);
29346      }
29347      if (element.hasLine()) {
29348        openArray("line");
29349        for (StringType e : element.getLine()) 
29350          composeStringCore(null, e, true);
29351        closeArray();
29352        if (anyHasExtras(element.getLine())) {
29353          openArray("_line");
29354          for (StringType e : element.getLine()) 
29355            composeStringExtras(null, e, true);
29356          closeArray();
29357        }
29358      };
29359      if (element.hasCityElement()) {
29360        composeStringCore("city", element.getCityElement(), false);
29361        composeStringExtras("city", element.getCityElement(), false);
29362      }
29363      if (element.hasDistrictElement()) {
29364        composeStringCore("district", element.getDistrictElement(), false);
29365        composeStringExtras("district", element.getDistrictElement(), false);
29366      }
29367      if (element.hasStateElement()) {
29368        composeStringCore("state", element.getStateElement(), false);
29369        composeStringExtras("state", element.getStateElement(), false);
29370      }
29371      if (element.hasPostalCodeElement()) {
29372        composeStringCore("postalCode", element.getPostalCodeElement(), false);
29373        composeStringExtras("postalCode", element.getPostalCodeElement(), false);
29374      }
29375      if (element.hasCountryElement()) {
29376        composeStringCore("country", element.getCountryElement(), false);
29377        composeStringExtras("country", element.getCountryElement(), false);
29378      }
29379      if (element.hasPeriod()) {
29380        composePeriod("period", element.getPeriod());
29381      }
29382  }
29383
29384  protected void composeContributor(String name, Contributor element) throws IOException {
29385    if (element != null) {
29386      open(name);
29387      composeContributorInner(element);
29388      close();
29389    }
29390  }
29391
29392  protected void composeContributorInner(Contributor element) throws IOException {
29393      composeElement(element);
29394      if (element.hasTypeElement()) {
29395        composeEnumerationCore("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
29396        composeEnumerationExtras("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
29397      }
29398      if (element.hasNameElement()) {
29399        composeStringCore("name", element.getNameElement(), false);
29400        composeStringExtras("name", element.getNameElement(), false);
29401      }
29402      if (element.hasContact()) {
29403        openArray("contact");
29404        for (ContactDetail e : element.getContact()) 
29405          composeContactDetail(null, e);
29406        closeArray();
29407      };
29408  }
29409
29410  protected void composeAttachment(String name, Attachment element) throws IOException {
29411    if (element != null) {
29412      open(name);
29413      composeAttachmentInner(element);
29414      close();
29415    }
29416  }
29417
29418  protected void composeAttachmentInner(Attachment element) throws IOException {
29419      composeElement(element);
29420      if (element.hasContentTypeElement()) {
29421        composeCodeCore("contentType", element.getContentTypeElement(), false);
29422        composeCodeExtras("contentType", element.getContentTypeElement(), false);
29423      }
29424      if (element.hasLanguageElement()) {
29425        composeCodeCore("language", element.getLanguageElement(), false);
29426        composeCodeExtras("language", element.getLanguageElement(), false);
29427      }
29428      if (element.hasDataElement()) {
29429        composeBase64BinaryCore("data", element.getDataElement(), false);
29430        composeBase64BinaryExtras("data", element.getDataElement(), false);
29431      }
29432      if (element.hasUrlElement()) {
29433        composeUrlCore("url", element.getUrlElement(), false);
29434        composeUrlExtras("url", element.getUrlElement(), false);
29435      }
29436      if (element.hasSizeElement()) {
29437        composeUnsignedIntCore("size", element.getSizeElement(), false);
29438        composeUnsignedIntExtras("size", element.getSizeElement(), false);
29439      }
29440      if (element.hasHashElement()) {
29441        composeBase64BinaryCore("hash", element.getHashElement(), false);
29442        composeBase64BinaryExtras("hash", element.getHashElement(), false);
29443      }
29444      if (element.hasTitleElement()) {
29445        composeStringCore("title", element.getTitleElement(), false);
29446        composeStringExtras("title", element.getTitleElement(), false);
29447      }
29448      if (element.hasCreationElement()) {
29449        composeDateTimeCore("creation", element.getCreationElement(), false);
29450        composeDateTimeExtras("creation", element.getCreationElement(), false);
29451      }
29452  }
29453
29454  protected void composeDataRequirement(String name, DataRequirement element) throws IOException {
29455    if (element != null) {
29456      open(name);
29457      composeDataRequirementInner(element);
29458      close();
29459    }
29460  }
29461
29462  protected void composeDataRequirementInner(DataRequirement element) throws IOException {
29463      composeElement(element);
29464      if (element.hasTypeElement()) {
29465        composeCodeCore("type", element.getTypeElement(), false);
29466        composeCodeExtras("type", element.getTypeElement(), false);
29467      }
29468      if (element.hasProfile()) {
29469        openArray("profile");
29470        for (CanonicalType e : element.getProfile()) 
29471          composeCanonicalCore(null, e, true);
29472        closeArray();
29473        if (anyHasExtras(element.getProfile())) {
29474          openArray("_profile");
29475          for (CanonicalType e : element.getProfile()) 
29476            composeCanonicalExtras(null, e, true);
29477          closeArray();
29478        }
29479      };
29480      if (element.hasSubject()) {
29481        composeType("subject", element.getSubject());
29482      }
29483      if (element.hasMustSupport()) {
29484        openArray("mustSupport");
29485        for (StringType e : element.getMustSupport()) 
29486          composeStringCore(null, e, true);
29487        closeArray();
29488        if (anyHasExtras(element.getMustSupport())) {
29489          openArray("_mustSupport");
29490          for (StringType e : element.getMustSupport()) 
29491            composeStringExtras(null, e, true);
29492          closeArray();
29493        }
29494      };
29495      if (element.hasCodeFilter()) {
29496        openArray("codeFilter");
29497        for (DataRequirement.DataRequirementCodeFilterComponent e : element.getCodeFilter()) 
29498          composeDataRequirementDataRequirementCodeFilterComponent(null, e);
29499        closeArray();
29500      };
29501      if (element.hasDateFilter()) {
29502        openArray("dateFilter");
29503        for (DataRequirement.DataRequirementDateFilterComponent e : element.getDateFilter()) 
29504          composeDataRequirementDataRequirementDateFilterComponent(null, e);
29505        closeArray();
29506      };
29507      if (element.hasLimitElement()) {
29508        composePositiveIntCore("limit", element.getLimitElement(), false);
29509        composePositiveIntExtras("limit", element.getLimitElement(), false);
29510      }
29511      if (element.hasSort()) {
29512        openArray("sort");
29513        for (DataRequirement.DataRequirementSortComponent e : element.getSort()) 
29514          composeDataRequirementDataRequirementSortComponent(null, e);
29515        closeArray();
29516      };
29517  }
29518
29519  protected void composeDataRequirementDataRequirementCodeFilterComponent(String name, DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
29520    if (element != null) {
29521      open(name);
29522      composeDataRequirementDataRequirementCodeFilterComponentInner(element);
29523      close();
29524    }
29525  }
29526
29527  protected void composeDataRequirementDataRequirementCodeFilterComponentInner(DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
29528      composeElement(element);
29529      if (element.hasPathElement()) {
29530        composeStringCore("path", element.getPathElement(), false);
29531        composeStringExtras("path", element.getPathElement(), false);
29532      }
29533      if (element.hasSearchParamElement()) {
29534        composeStringCore("searchParam", element.getSearchParamElement(), false);
29535        composeStringExtras("searchParam", element.getSearchParamElement(), false);
29536      }
29537      if (element.hasValueSetElement()) {
29538        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
29539        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
29540      }
29541      if (element.hasCode()) {
29542        openArray("code");
29543        for (Coding e : element.getCode()) 
29544          composeCoding(null, e);
29545        closeArray();
29546      };
29547  }
29548
29549  protected void composeDataRequirementDataRequirementDateFilterComponent(String name, DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
29550    if (element != null) {
29551      open(name);
29552      composeDataRequirementDataRequirementDateFilterComponentInner(element);
29553      close();
29554    }
29555  }
29556
29557  protected void composeDataRequirementDataRequirementDateFilterComponentInner(DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
29558      composeElement(element);
29559      if (element.hasPathElement()) {
29560        composeStringCore("path", element.getPathElement(), false);
29561        composeStringExtras("path", element.getPathElement(), false);
29562      }
29563      if (element.hasSearchParamElement()) {
29564        composeStringCore("searchParam", element.getSearchParamElement(), false);
29565        composeStringExtras("searchParam", element.getSearchParamElement(), false);
29566      }
29567      if (element.hasValue()) {
29568        composeType("value", element.getValue());
29569      }
29570  }
29571
29572  protected void composeDataRequirementDataRequirementSortComponent(String name, DataRequirement.DataRequirementSortComponent element) throws IOException {
29573    if (element != null) {
29574      open(name);
29575      composeDataRequirementDataRequirementSortComponentInner(element);
29576      close();
29577    }
29578  }
29579
29580  protected void composeDataRequirementDataRequirementSortComponentInner(DataRequirement.DataRequirementSortComponent element) throws IOException {
29581      composeElement(element);
29582      if (element.hasPathElement()) {
29583        composeStringCore("path", element.getPathElement(), false);
29584        composeStringExtras("path", element.getPathElement(), false);
29585      }
29586      if (element.hasDirectionElement()) {
29587        composeEnumerationCore("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
29588        composeEnumerationExtras("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
29589      }
29590  }
29591
29592  protected void composeMoney(String name, Money element) throws IOException {
29593    if (element != null) {
29594      open(name);
29595      composeMoneyInner(element);
29596      close();
29597    }
29598  }
29599
29600  protected void composeMoneyInner(Money element) throws IOException {
29601      composeElement(element);
29602      if (element.hasValueElement()) {
29603        composeDecimalCore("value", element.getValueElement(), false);
29604        composeDecimalExtras("value", element.getValueElement(), false);
29605      }
29606      if (element.hasCurrencyElement()) {
29607        composeCodeCore("currency", element.getCurrencyElement(), false);
29608        composeCodeExtras("currency", element.getCurrencyElement(), false);
29609      }
29610  }
29611
29612  protected void composeHumanName(String name, HumanName element) throws IOException {
29613    if (element != null) {
29614      open(name);
29615      composeHumanNameInner(element);
29616      close();
29617    }
29618  }
29619
29620  protected void composeHumanNameInner(HumanName element) throws IOException {
29621      composeElement(element);
29622      if (element.hasUseElement()) {
29623        composeEnumerationCore("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
29624        composeEnumerationExtras("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
29625      }
29626      if (element.hasTextElement()) {
29627        composeStringCore("text", element.getTextElement(), false);
29628        composeStringExtras("text", element.getTextElement(), false);
29629      }
29630      if (element.hasFamilyElement()) {
29631        composeStringCore("family", element.getFamilyElement(), false);
29632        composeStringExtras("family", element.getFamilyElement(), false);
29633      }
29634      if (element.hasGiven()) {
29635        openArray("given");
29636        for (StringType e : element.getGiven()) 
29637          composeStringCore(null, e, true);
29638        closeArray();
29639        if (anyHasExtras(element.getGiven())) {
29640          openArray("_given");
29641          for (StringType e : element.getGiven()) 
29642            composeStringExtras(null, e, true);
29643          closeArray();
29644        }
29645      };
29646      if (element.hasPrefix()) {
29647        openArray("prefix");
29648        for (StringType e : element.getPrefix()) 
29649          composeStringCore(null, e, true);
29650        closeArray();
29651        if (anyHasExtras(element.getPrefix())) {
29652          openArray("_prefix");
29653          for (StringType e : element.getPrefix()) 
29654            composeStringExtras(null, e, true);
29655          closeArray();
29656        }
29657      };
29658      if (element.hasSuffix()) {
29659        openArray("suffix");
29660        for (StringType e : element.getSuffix()) 
29661          composeStringCore(null, e, true);
29662        closeArray();
29663        if (anyHasExtras(element.getSuffix())) {
29664          openArray("_suffix");
29665          for (StringType e : element.getSuffix()) 
29666            composeStringExtras(null, e, true);
29667          closeArray();
29668        }
29669      };
29670      if (element.hasPeriod()) {
29671        composePeriod("period", element.getPeriod());
29672      }
29673  }
29674
29675  protected void composeContactPoint(String name, ContactPoint element) throws IOException {
29676    if (element != null) {
29677      open(name);
29678      composeContactPointInner(element);
29679      close();
29680    }
29681  }
29682
29683  protected void composeContactPointInner(ContactPoint element) throws IOException {
29684      composeElement(element);
29685      if (element.hasSystemElement()) {
29686        composeEnumerationCore("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
29687        composeEnumerationExtras("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
29688      }
29689      if (element.hasValueElement()) {
29690        composeStringCore("value", element.getValueElement(), false);
29691        composeStringExtras("value", element.getValueElement(), false);
29692      }
29693      if (element.hasUseElement()) {
29694        composeEnumerationCore("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
29695        composeEnumerationExtras("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
29696      }
29697      if (element.hasRankElement()) {
29698        composePositiveIntCore("rank", element.getRankElement(), false);
29699        composePositiveIntExtras("rank", element.getRankElement(), false);
29700      }
29701      if (element.hasPeriod()) {
29702        composePeriod("period", element.getPeriod());
29703      }
29704  }
29705
29706  protected void composeIdentifier(String name, Identifier element) throws IOException {
29707    if (element != null) {
29708      open(name);
29709      composeIdentifierInner(element);
29710      close();
29711    }
29712  }
29713
29714  protected void composeIdentifierInner(Identifier element) throws IOException {
29715      composeElement(element);
29716      if (element.hasUseElement()) {
29717        composeEnumerationCore("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
29718        composeEnumerationExtras("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
29719      }
29720      if (element.hasType()) {
29721        composeCodeableConcept("type", element.getType());
29722      }
29723      if (element.hasSystemElement()) {
29724        composeUriCore("system", element.getSystemElement(), false);
29725        composeUriExtras("system", element.getSystemElement(), false);
29726      }
29727      if (element.hasValueElement()) {
29728        composeStringCore("value", element.getValueElement(), false);
29729        composeStringExtras("value", element.getValueElement(), false);
29730      }
29731      if (element.hasPeriod()) {
29732        composePeriod("period", element.getPeriod());
29733      }
29734      if (element.hasAssigner()) {
29735        composeReference("assigner", element.getAssigner());
29736      }
29737  }
29738
29739  protected void composeCoding(String name, Coding element) throws IOException {
29740    if (element != null) {
29741      open(name);
29742      composeCodingInner(element);
29743      close();
29744    }
29745  }
29746
29747  protected void composeCodingInner(Coding element) throws IOException {
29748      composeElement(element);
29749      if (element.hasSystemElement()) {
29750        composeUriCore("system", element.getSystemElement(), false);
29751        composeUriExtras("system", element.getSystemElement(), false);
29752      }
29753      if (element.hasVersionElement()) {
29754        composeStringCore("version", element.getVersionElement(), false);
29755        composeStringExtras("version", element.getVersionElement(), false);
29756      }
29757      if (element.hasCodeElement()) {
29758        composeCodeCore("code", element.getCodeElement(), false);
29759        composeCodeExtras("code", element.getCodeElement(), false);
29760      }
29761      if (element.hasDisplayElement()) {
29762        composeStringCore("display", element.getDisplayElement(), false);
29763        composeStringExtras("display", element.getDisplayElement(), false);
29764      }
29765      if (element.hasUserSelectedElement()) {
29766        composeBooleanCore("userSelected", element.getUserSelectedElement(), false);
29767        composeBooleanExtras("userSelected", element.getUserSelectedElement(), false);
29768      }
29769  }
29770
29771  protected void composeSampledData(String name, SampledData element) throws IOException {
29772    if (element != null) {
29773      open(name);
29774      composeSampledDataInner(element);
29775      close();
29776    }
29777  }
29778
29779  protected void composeSampledDataInner(SampledData element) throws IOException {
29780      composeElement(element);
29781      if (element.hasOrigin()) {
29782        composeQuantity("origin", element.getOrigin());
29783      }
29784      if (element.hasPeriodElement()) {
29785        composeDecimalCore("period", element.getPeriodElement(), false);
29786        composeDecimalExtras("period", element.getPeriodElement(), false);
29787      }
29788      if (element.hasFactorElement()) {
29789        composeDecimalCore("factor", element.getFactorElement(), false);
29790        composeDecimalExtras("factor", element.getFactorElement(), false);
29791      }
29792      if (element.hasLowerLimitElement()) {
29793        composeDecimalCore("lowerLimit", element.getLowerLimitElement(), false);
29794        composeDecimalExtras("lowerLimit", element.getLowerLimitElement(), false);
29795      }
29796      if (element.hasUpperLimitElement()) {
29797        composeDecimalCore("upperLimit", element.getUpperLimitElement(), false);
29798        composeDecimalExtras("upperLimit", element.getUpperLimitElement(), false);
29799      }
29800      if (element.hasDimensionsElement()) {
29801        composePositiveIntCore("dimensions", element.getDimensionsElement(), false);
29802        composePositiveIntExtras("dimensions", element.getDimensionsElement(), false);
29803      }
29804      if (element.hasDataElement()) {
29805        composeStringCore("data", element.getDataElement(), false);
29806        composeStringExtras("data", element.getDataElement(), false);
29807      }
29808  }
29809
29810  protected void composeRatio(String name, Ratio element) throws IOException {
29811    if (element != null) {
29812      open(name);
29813      composeRatioInner(element);
29814      close();
29815    }
29816  }
29817
29818  protected void composeRatioInner(Ratio element) throws IOException {
29819      composeElement(element);
29820      if (element.hasNumerator()) {
29821        composeQuantity("numerator", element.getNumerator());
29822      }
29823      if (element.hasDenominator()) {
29824        composeQuantity("denominator", element.getDenominator());
29825      }
29826  }
29827
29828  protected void composeReference(String name, Reference element) throws IOException {
29829    if (element != null) {
29830      open(name);
29831      composeReferenceInner(element);
29832      close();
29833    }
29834  }
29835
29836  protected void composeReferenceInner(Reference element) throws IOException {
29837      composeElement(element);
29838      if (element.hasReferenceElement()) {
29839        composeStringCore("reference", element.getReferenceElement(), false);
29840        composeStringExtras("reference", element.getReferenceElement(), false);
29841      }
29842      if (element.hasTypeElement()) {
29843        composeUriCore("type", element.getTypeElement(), false);
29844        composeUriExtras("type", element.getTypeElement(), false);
29845      }
29846      if (element.hasIdentifier()) {
29847        composeIdentifier("identifier", element.getIdentifier());
29848      }
29849      if (element.hasDisplayElement()) {
29850        composeStringCore("display", element.getDisplayElement(), false);
29851        composeStringExtras("display", element.getDisplayElement(), false);
29852      }
29853  }
29854
29855  protected void composeTriggerDefinition(String name, TriggerDefinition element) throws IOException {
29856    if (element != null) {
29857      open(name);
29858      composeTriggerDefinitionInner(element);
29859      close();
29860    }
29861  }
29862
29863  protected void composeTriggerDefinitionInner(TriggerDefinition element) throws IOException {
29864      composeElement(element);
29865      if (element.hasTypeElement()) {
29866        composeEnumerationCore("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
29867        composeEnumerationExtras("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
29868      }
29869      if (element.hasNameElement()) {
29870        composeStringCore("name", element.getNameElement(), false);
29871        composeStringExtras("name", element.getNameElement(), false);
29872      }
29873      if (element.hasTiming()) {
29874        composeType("timing", element.getTiming());
29875      }
29876      if (element.hasData()) {
29877        openArray("data");
29878        for (DataRequirement e : element.getData()) 
29879          composeDataRequirement(null, e);
29880        closeArray();
29881      };
29882      if (element.hasCondition()) {
29883        composeExpression("condition", element.getCondition());
29884      }
29885  }
29886
29887  protected void composeQuantity(String name, Quantity element) throws IOException {
29888    if (element != null) {
29889      open(name);
29890      composeQuantityInner(element);
29891      close();
29892    }
29893  }
29894
29895  protected void composeQuantityInner(Quantity element) throws IOException {
29896      composeElement(element);
29897      if (element.hasValueElement()) {
29898        composeDecimalCore("value", element.getValueElement(), false);
29899        composeDecimalExtras("value", element.getValueElement(), false);
29900      }
29901      if (element.hasComparatorElement()) {
29902        composeEnumerationCore("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
29903        composeEnumerationExtras("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
29904      }
29905      if (element.hasUnitElement()) {
29906        composeStringCore("unit", element.getUnitElement(), false);
29907        composeStringExtras("unit", element.getUnitElement(), false);
29908      }
29909      if (element.hasSystemElement()) {
29910        composeUriCore("system", element.getSystemElement(), false);
29911        composeUriExtras("system", element.getSystemElement(), false);
29912      }
29913      if (element.hasCodeElement()) {
29914        composeCodeCore("code", element.getCodeElement(), false);
29915        composeCodeExtras("code", element.getCodeElement(), false);
29916      }
29917  }
29918
29919  protected void composePeriod(String name, Period element) throws IOException {
29920    if (element != null) {
29921      open(name);
29922      composePeriodInner(element);
29923      close();
29924    }
29925  }
29926
29927  protected void composePeriodInner(Period element) throws IOException {
29928      composeElement(element);
29929      if (element.hasStartElement()) {
29930        composeDateTimeCore("start", element.getStartElement(), false);
29931        composeDateTimeExtras("start", element.getStartElement(), false);
29932      }
29933      if (element.hasEndElement()) {
29934        composeDateTimeCore("end", element.getEndElement(), false);
29935        composeDateTimeExtras("end", element.getEndElement(), false);
29936      }
29937  }
29938
29939  protected void composeRange(String name, Range element) throws IOException {
29940    if (element != null) {
29941      open(name);
29942      composeRangeInner(element);
29943      close();
29944    }
29945  }
29946
29947  protected void composeRangeInner(Range element) throws IOException {
29948      composeElement(element);
29949      if (element.hasLow()) {
29950        composeQuantity("low", element.getLow());
29951      }
29952      if (element.hasHigh()) {
29953        composeQuantity("high", element.getHigh());
29954      }
29955  }
29956
29957  protected void composeRelatedArtifact(String name, RelatedArtifact element) throws IOException {
29958    if (element != null) {
29959      open(name);
29960      composeRelatedArtifactInner(element);
29961      close();
29962    }
29963  }
29964
29965  protected void composeRelatedArtifactInner(RelatedArtifact element) throws IOException {
29966      composeElement(element);
29967      if (element.hasTypeElement()) {
29968        composeEnumerationCore("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
29969        composeEnumerationExtras("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
29970      }
29971      if (element.hasLabelElement()) {
29972        composeStringCore("label", element.getLabelElement(), false);
29973        composeStringExtras("label", element.getLabelElement(), false);
29974      }
29975      if (element.hasDisplayElement()) {
29976        composeStringCore("display", element.getDisplayElement(), false);
29977        composeStringExtras("display", element.getDisplayElement(), false);
29978      }
29979      if (element.hasCitationElement()) {
29980        composeMarkdownCore("citation", element.getCitationElement(), false);
29981        composeMarkdownExtras("citation", element.getCitationElement(), false);
29982      }
29983      if (element.hasUrlElement()) {
29984        composeUrlCore("url", element.getUrlElement(), false);
29985        composeUrlExtras("url", element.getUrlElement(), false);
29986      }
29987      if (element.hasDocument()) {
29988        composeAttachment("document", element.getDocument());
29989      }
29990      if (element.hasResourceElement()) {
29991        composeCanonicalCore("resource", element.getResourceElement(), false);
29992        composeCanonicalExtras("resource", element.getResourceElement(), false);
29993      }
29994  }
29995
29996  protected void composeAnnotation(String name, Annotation element) throws IOException {
29997    if (element != null) {
29998      open(name);
29999      composeAnnotationInner(element);
30000      close();
30001    }
30002  }
30003
30004  protected void composeAnnotationInner(Annotation element) throws IOException {
30005      composeElement(element);
30006      if (element.hasAuthor()) {
30007        composeType("author", element.getAuthor());
30008      }
30009      if (element.hasTimeElement()) {
30010        composeDateTimeCore("time", element.getTimeElement(), false);
30011        composeDateTimeExtras("time", element.getTimeElement(), false);
30012      }
30013      if (element.hasTextElement()) {
30014        composeMarkdownCore("text", element.getTextElement(), false);
30015        composeMarkdownExtras("text", element.getTextElement(), false);
30016      }
30017  }
30018
30019  protected void composeContactDetail(String name, ContactDetail element) throws IOException {
30020    if (element != null) {
30021      open(name);
30022      composeContactDetailInner(element);
30023      close();
30024    }
30025  }
30026
30027  protected void composeContactDetailInner(ContactDetail element) throws IOException {
30028      composeElement(element);
30029      if (element.hasNameElement()) {
30030        composeStringCore("name", element.getNameElement(), false);
30031        composeStringExtras("name", element.getNameElement(), false);
30032      }
30033      if (element.hasTelecom()) {
30034        openArray("telecom");
30035        for (ContactPoint e : element.getTelecom()) 
30036          composeContactPoint(null, e);
30037        closeArray();
30038      };
30039  }
30040
30041  protected void composeUsageContext(String name, UsageContext element) throws IOException {
30042    if (element != null) {
30043      open(name);
30044      composeUsageContextInner(element);
30045      close();
30046    }
30047  }
30048
30049  protected void composeUsageContextInner(UsageContext element) throws IOException {
30050      composeElement(element);
30051      if (element.hasCode()) {
30052        composeCoding("code", element.getCode());
30053      }
30054      if (element.hasValue()) {
30055        composeType("value", element.getValue());
30056      }
30057  }
30058
30059  protected void composeExpression(String name, Expression element) throws IOException {
30060    if (element != null) {
30061      open(name);
30062      composeExpressionInner(element);
30063      close();
30064    }
30065  }
30066
30067  protected void composeExpressionInner(Expression element) throws IOException {
30068      composeElement(element);
30069      if (element.hasDescriptionElement()) {
30070        composeStringCore("description", element.getDescriptionElement(), false);
30071        composeStringExtras("description", element.getDescriptionElement(), false);
30072      }
30073      if (element.hasNameElement()) {
30074        composeIdCore("name", element.getNameElement(), false);
30075        composeIdExtras("name", element.getNameElement(), false);
30076      }
30077      if (element.hasLanguageElement()) {
30078        composeCodeCore("language", element.getLanguageElement(), false);
30079        composeCodeExtras("language", element.getLanguageElement(), false);
30080      }
30081      if (element.hasExpressionElement()) {
30082        composeStringCore("expression", element.getExpressionElement(), false);
30083        composeStringExtras("expression", element.getExpressionElement(), false);
30084      }
30085      if (element.hasReferenceElement()) {
30086        composeUriCore("reference", element.getReferenceElement(), false);
30087        composeUriExtras("reference", element.getReferenceElement(), false);
30088      }
30089  }
30090
30091  protected void composeSignature(String name, Signature element) throws IOException {
30092    if (element != null) {
30093      open(name);
30094      composeSignatureInner(element);
30095      close();
30096    }
30097  }
30098
30099  protected void composeSignatureInner(Signature element) throws IOException {
30100      composeElement(element);
30101      if (element.hasType()) {
30102        openArray("type");
30103        for (Coding e : element.getType()) 
30104          composeCoding(null, e);
30105        closeArray();
30106      };
30107      if (element.hasWhenElement()) {
30108        composeInstantCore("when", element.getWhenElement(), false);
30109        composeInstantExtras("when", element.getWhenElement(), false);
30110      }
30111      if (element.hasWho()) {
30112        composeReference("who", element.getWho());
30113      }
30114      if (element.hasOnBehalfOf()) {
30115        composeReference("onBehalfOf", element.getOnBehalfOf());
30116      }
30117      if (element.hasTargetFormatElement()) {
30118        composeCodeCore("targetFormat", element.getTargetFormatElement(), false);
30119        composeCodeExtras("targetFormat", element.getTargetFormatElement(), false);
30120      }
30121      if (element.hasSigFormatElement()) {
30122        composeCodeCore("sigFormat", element.getSigFormatElement(), false);
30123        composeCodeExtras("sigFormat", element.getSigFormatElement(), false);
30124      }
30125      if (element.hasDataElement()) {
30126        composeBase64BinaryCore("data", element.getDataElement(), false);
30127        composeBase64BinaryExtras("data", element.getDataElement(), false);
30128      }
30129  }
30130
30131  protected void composeCodeableConcept(String name, CodeableConcept element) throws IOException {
30132    if (element != null) {
30133      open(name);
30134      composeCodeableConceptInner(element);
30135      close();
30136    }
30137  }
30138
30139  protected void composeCodeableConceptInner(CodeableConcept element) throws IOException {
30140      composeElement(element);
30141      if (element.hasCoding()) {
30142        openArray("coding");
30143        for (Coding e : element.getCoding()) 
30144          composeCoding(null, e);
30145        closeArray();
30146      };
30147      if (element.hasTextElement()) {
30148        composeStringCore("text", element.getTextElement(), false);
30149        composeStringExtras("text", element.getTextElement(), false);
30150      }
30151  }
30152
30153  protected void composeParameterDefinition(String name, ParameterDefinition element) throws IOException {
30154    if (element != null) {
30155      open(name);
30156      composeParameterDefinitionInner(element);
30157      close();
30158    }
30159  }
30160
30161  protected void composeParameterDefinitionInner(ParameterDefinition element) throws IOException {
30162      composeElement(element);
30163      if (element.hasNameElement()) {
30164        composeCodeCore("name", element.getNameElement(), false);
30165        composeCodeExtras("name", element.getNameElement(), false);
30166      }
30167      if (element.hasUseElement()) {
30168        composeEnumerationCore("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(), false);
30169        composeEnumerationExtras("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(), false);
30170      }
30171      if (element.hasMinElement()) {
30172        composeIntegerCore("min", element.getMinElement(), false);
30173        composeIntegerExtras("min", element.getMinElement(), false);
30174      }
30175      if (element.hasMaxElement()) {
30176        composeStringCore("max", element.getMaxElement(), false);
30177        composeStringExtras("max", element.getMaxElement(), false);
30178      }
30179      if (element.hasDocumentationElement()) {
30180        composeStringCore("documentation", element.getDocumentationElement(), false);
30181        composeStringExtras("documentation", element.getDocumentationElement(), false);
30182      }
30183      if (element.hasTypeElement()) {
30184        composeCodeCore("type", element.getTypeElement(), false);
30185        composeCodeExtras("type", element.getTypeElement(), false);
30186      }
30187      if (element.hasProfileElement()) {
30188        composeCanonicalCore("profile", element.getProfileElement(), false);
30189        composeCanonicalExtras("profile", element.getProfileElement(), false);
30190      }
30191  }
30192
30193  protected void composeElementDefinition(String name, ElementDefinition element) throws IOException {
30194    if (element != null) {
30195      open(name);
30196      composeElementDefinitionInner(element);
30197      close();
30198    }
30199  }
30200
30201  protected void composeElementDefinitionInner(ElementDefinition element) throws IOException {
30202      composeBackbone(element);
30203      if (element.hasPathElement()) {
30204        composeStringCore("path", element.getPathElement(), false);
30205        composeStringExtras("path", element.getPathElement(), false);
30206      }
30207      if (element.hasRepresentation()) {
30208        openArray("representation");
30209        for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
30210          composeEnumerationCore(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
30211        closeArray();
30212        if (anyHasExtras(element.getRepresentation())) {
30213          openArray("_representation");
30214          for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
30215            composeEnumerationExtras(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
30216          closeArray();
30217        }
30218      };
30219      if (element.hasSliceNameElement()) {
30220        composeStringCore("sliceName", element.getSliceNameElement(), false);
30221        composeStringExtras("sliceName", element.getSliceNameElement(), false);
30222      }
30223      if (element.hasSliceIsConstrainingElement()) {
30224        composeBooleanCore("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
30225        composeBooleanExtras("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
30226      }
30227      if (element.hasLabelElement()) {
30228        composeStringCore("label", element.getLabelElement(), false);
30229        composeStringExtras("label", element.getLabelElement(), false);
30230      }
30231      if (element.hasCode()) {
30232        openArray("code");
30233        for (Coding e : element.getCode()) 
30234          composeCoding(null, e);
30235        closeArray();
30236      };
30237      if (element.hasSlicing()) {
30238        composeElementDefinitionElementDefinitionSlicingComponent("slicing", element.getSlicing());
30239      }
30240      if (element.hasShortElement()) {
30241        composeStringCore("short", element.getShortElement(), false);
30242        composeStringExtras("short", element.getShortElement(), false);
30243      }
30244      if (element.hasDefinitionElement()) {
30245        composeMarkdownCore("definition", element.getDefinitionElement(), false);
30246        composeMarkdownExtras("definition", element.getDefinitionElement(), false);
30247      }
30248      if (element.hasCommentElement()) {
30249        composeMarkdownCore("comment", element.getCommentElement(), false);
30250        composeMarkdownExtras("comment", element.getCommentElement(), false);
30251      }
30252      if (element.hasRequirementsElement()) {
30253        composeMarkdownCore("requirements", element.getRequirementsElement(), false);
30254        composeMarkdownExtras("requirements", element.getRequirementsElement(), false);
30255      }
30256      if (element.hasAlias()) {
30257        openArray("alias");
30258        for (StringType e : element.getAlias()) 
30259          composeStringCore(null, e, true);
30260        closeArray();
30261        if (anyHasExtras(element.getAlias())) {
30262          openArray("_alias");
30263          for (StringType e : element.getAlias()) 
30264            composeStringExtras(null, e, true);
30265          closeArray();
30266        }
30267      };
30268      if (element.hasMinElement()) {
30269        composeUnsignedIntCore("min", element.getMinElement(), false);
30270        composeUnsignedIntExtras("min", element.getMinElement(), false);
30271      }
30272      if (element.hasMaxElement()) {
30273        composeStringCore("max", element.getMaxElement(), false);
30274        composeStringExtras("max", element.getMaxElement(), false);
30275      }
30276      if (element.hasBase()) {
30277        composeElementDefinitionElementDefinitionBaseComponent("base", element.getBase());
30278      }
30279      if (element.hasContentReferenceElement()) {
30280        composeUriCore("contentReference", element.getContentReferenceElement(), false);
30281        composeUriExtras("contentReference", element.getContentReferenceElement(), false);
30282      }
30283      if (element.hasType()) {
30284        openArray("type");
30285        for (ElementDefinition.TypeRefComponent e : element.getType()) 
30286          composeElementDefinitionTypeRefComponent(null, e);
30287        closeArray();
30288      };
30289      if (element.hasDefaultValue()) {
30290        composeType("defaultValue", element.getDefaultValue());
30291      }
30292      if (element.hasMeaningWhenMissingElement()) {
30293        composeMarkdownCore("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
30294        composeMarkdownExtras("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
30295      }
30296      if (element.hasOrderMeaningElement()) {
30297        composeStringCore("orderMeaning", element.getOrderMeaningElement(), false);
30298        composeStringExtras("orderMeaning", element.getOrderMeaningElement(), false);
30299      }
30300      if (element.hasFixed()) {
30301        composeType("fixed", element.getFixed());
30302      }
30303      if (element.hasPattern()) {
30304        composeType("pattern", element.getPattern());
30305      }
30306      if (element.hasExample()) {
30307        openArray("example");
30308        for (ElementDefinition.ElementDefinitionExampleComponent e : element.getExample()) 
30309          composeElementDefinitionElementDefinitionExampleComponent(null, e);
30310        closeArray();
30311      };
30312      if (element.hasMinValue()) {
30313        composeType("minValue", element.getMinValue());
30314      }
30315      if (element.hasMaxValue()) {
30316        composeType("maxValue", element.getMaxValue());
30317      }
30318      if (element.hasMaxLengthElement()) {
30319        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
30320        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
30321      }
30322      if (element.hasCondition()) {
30323        openArray("condition");
30324        for (IdType e : element.getCondition()) 
30325          composeIdCore(null, e, true);
30326        closeArray();
30327        if (anyHasExtras(element.getCondition())) {
30328          openArray("_condition");
30329          for (IdType e : element.getCondition()) 
30330            composeIdExtras(null, e, true);
30331          closeArray();
30332        }
30333      };
30334      if (element.hasConstraint()) {
30335        openArray("constraint");
30336        for (ElementDefinition.ElementDefinitionConstraintComponent e : element.getConstraint()) 
30337          composeElementDefinitionElementDefinitionConstraintComponent(null, e);
30338        closeArray();
30339      };
30340      if (element.hasMustSupportElement()) {
30341        composeBooleanCore("mustSupport", element.getMustSupportElement(), false);
30342        composeBooleanExtras("mustSupport", element.getMustSupportElement(), false);
30343      }
30344      if (element.hasIsModifierElement()) {
30345        composeBooleanCore("isModifier", element.getIsModifierElement(), false);
30346        composeBooleanExtras("isModifier", element.getIsModifierElement(), false);
30347      }
30348      if (element.hasIsModifierReasonElement()) {
30349        composeStringCore("isModifierReason", element.getIsModifierReasonElement(), false);
30350        composeStringExtras("isModifierReason", element.getIsModifierReasonElement(), false);
30351      }
30352      if (element.hasIsSummaryElement()) {
30353        composeBooleanCore("isSummary", element.getIsSummaryElement(), false);
30354        composeBooleanExtras("isSummary", element.getIsSummaryElement(), false);
30355      }
30356      if (element.hasBinding()) {
30357        composeElementDefinitionElementDefinitionBindingComponent("binding", element.getBinding());
30358      }
30359      if (element.hasMapping()) {
30360        openArray("mapping");
30361        for (ElementDefinition.ElementDefinitionMappingComponent e : element.getMapping()) 
30362          composeElementDefinitionElementDefinitionMappingComponent(null, e);
30363        closeArray();
30364      };
30365  }
30366
30367  protected void composeElementDefinitionElementDefinitionSlicingComponent(String name, ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
30368    if (element != null) {
30369      open(name);
30370      composeElementDefinitionElementDefinitionSlicingComponentInner(element);
30371      close();
30372    }
30373  }
30374
30375  protected void composeElementDefinitionElementDefinitionSlicingComponentInner(ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
30376      composeElement(element);
30377      if (element.hasDiscriminator()) {
30378        openArray("discriminator");
30379        for (ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent e : element.getDiscriminator()) 
30380          composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(null, e);
30381        closeArray();
30382      };
30383      if (element.hasDescriptionElement()) {
30384        composeStringCore("description", element.getDescriptionElement(), false);
30385        composeStringExtras("description", element.getDescriptionElement(), false);
30386      }
30387      if (element.hasOrderedElement()) {
30388        composeBooleanCore("ordered", element.getOrderedElement(), false);
30389        composeBooleanExtras("ordered", element.getOrderedElement(), false);
30390      }
30391      if (element.hasRulesElement()) {
30392        composeEnumerationCore("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
30393        composeEnumerationExtras("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
30394      }
30395  }
30396
30397  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(String name, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
30398    if (element != null) {
30399      open(name);
30400      composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(element);
30401      close();
30402    }
30403  }
30404
30405  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
30406      composeElement(element);
30407      if (element.hasTypeElement()) {
30408        composeEnumerationCore("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
30409        composeEnumerationExtras("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
30410      }
30411      if (element.hasPathElement()) {
30412        composeStringCore("path", element.getPathElement(), false);
30413        composeStringExtras("path", element.getPathElement(), false);
30414      }
30415  }
30416
30417  protected void composeElementDefinitionElementDefinitionBaseComponent(String name, ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
30418    if (element != null) {
30419      open(name);
30420      composeElementDefinitionElementDefinitionBaseComponentInner(element);
30421      close();
30422    }
30423  }
30424
30425  protected void composeElementDefinitionElementDefinitionBaseComponentInner(ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
30426      composeElement(element);
30427      if (element.hasPathElement()) {
30428        composeStringCore("path", element.getPathElement(), false);
30429        composeStringExtras("path", element.getPathElement(), false);
30430      }
30431      if (element.hasMinElement()) {
30432        composeUnsignedIntCore("min", element.getMinElement(), false);
30433        composeUnsignedIntExtras("min", element.getMinElement(), false);
30434      }
30435      if (element.hasMaxElement()) {
30436        composeStringCore("max", element.getMaxElement(), false);
30437        composeStringExtras("max", element.getMaxElement(), false);
30438      }
30439  }
30440
30441  protected void composeElementDefinitionTypeRefComponent(String name, ElementDefinition.TypeRefComponent element) throws IOException {
30442    if (element != null) {
30443      open(name);
30444      composeElementDefinitionTypeRefComponentInner(element);
30445      close();
30446    }
30447  }
30448
30449  protected void composeElementDefinitionTypeRefComponentInner(ElementDefinition.TypeRefComponent element) throws IOException {
30450      composeElement(element);
30451      if (element.hasCodeElement()) {
30452        composeUriCore("code", element.getCodeElement(), false);
30453        composeUriExtras("code", element.getCodeElement(), false);
30454      }
30455      if (element.hasProfile()) {
30456        openArray("profile");
30457        for (CanonicalType e : element.getProfile()) 
30458          composeCanonicalCore(null, e, true);
30459        closeArray();
30460        if (anyHasExtras(element.getProfile())) {
30461          openArray("_profile");
30462          for (CanonicalType e : element.getProfile()) 
30463            composeCanonicalExtras(null, e, true);
30464          closeArray();
30465        }
30466      };
30467      if (element.hasTargetProfile()) {
30468        openArray("targetProfile");
30469        for (CanonicalType e : element.getTargetProfile()) 
30470          composeCanonicalCore(null, e, true);
30471        closeArray();
30472        if (anyHasExtras(element.getTargetProfile())) {
30473          openArray("_targetProfile");
30474          for (CanonicalType e : element.getTargetProfile()) 
30475            composeCanonicalExtras(null, e, true);
30476          closeArray();
30477        }
30478      };
30479      if (element.hasAggregation()) {
30480        openArray("aggregation");
30481        for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
30482          composeEnumerationCore(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
30483        closeArray();
30484        if (anyHasExtras(element.getAggregation())) {
30485          openArray("_aggregation");
30486          for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
30487            composeEnumerationExtras(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
30488          closeArray();
30489        }
30490      };
30491      if (element.hasVersioningElement()) {
30492        composeEnumerationCore("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
30493        composeEnumerationExtras("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
30494      }
30495  }
30496
30497  protected void composeElementDefinitionElementDefinitionExampleComponent(String name, ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
30498    if (element != null) {
30499      open(name);
30500      composeElementDefinitionElementDefinitionExampleComponentInner(element);
30501      close();
30502    }
30503  }
30504
30505  protected void composeElementDefinitionElementDefinitionExampleComponentInner(ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
30506      composeElement(element);
30507      if (element.hasLabelElement()) {
30508        composeStringCore("label", element.getLabelElement(), false);
30509        composeStringExtras("label", element.getLabelElement(), false);
30510      }
30511      if (element.hasValue()) {
30512        composeType("value", element.getValue());
30513      }
30514  }
30515
30516  protected void composeElementDefinitionElementDefinitionConstraintComponent(String name, ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
30517    if (element != null) {
30518      open(name);
30519      composeElementDefinitionElementDefinitionConstraintComponentInner(element);
30520      close();
30521    }
30522  }
30523
30524  protected void composeElementDefinitionElementDefinitionConstraintComponentInner(ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
30525      composeElement(element);
30526      if (element.hasKeyElement()) {
30527        composeIdCore("key", element.getKeyElement(), false);
30528        composeIdExtras("key", element.getKeyElement(), false);
30529      }
30530      if (element.hasRequirementsElement()) {
30531        composeStringCore("requirements", element.getRequirementsElement(), false);
30532        composeStringExtras("requirements", element.getRequirementsElement(), false);
30533      }
30534      if (element.hasSeverityElement()) {
30535        composeEnumerationCore("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
30536        composeEnumerationExtras("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
30537      }
30538      if (element.hasHumanElement()) {
30539        composeStringCore("human", element.getHumanElement(), false);
30540        composeStringExtras("human", element.getHumanElement(), false);
30541      }
30542      if (element.hasExpressionElement()) {
30543        composeStringCore("expression", element.getExpressionElement(), false);
30544        composeStringExtras("expression", element.getExpressionElement(), false);
30545      }
30546      if (element.hasXpathElement()) {
30547        composeStringCore("xpath", element.getXpathElement(), false);
30548        composeStringExtras("xpath", element.getXpathElement(), false);
30549      }
30550      if (element.hasSourceElement()) {
30551        composeCanonicalCore("source", element.getSourceElement(), false);
30552        composeCanonicalExtras("source", element.getSourceElement(), false);
30553      }
30554  }
30555
30556  protected void composeElementDefinitionElementDefinitionBindingComponent(String name, ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
30557    if (element != null) {
30558      open(name);
30559      composeElementDefinitionElementDefinitionBindingComponentInner(element);
30560      close();
30561    }
30562  }
30563
30564  protected void composeElementDefinitionElementDefinitionBindingComponentInner(ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
30565      composeElement(element);
30566      if (element.hasStrengthElement()) {
30567        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
30568        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
30569      }
30570      if (element.hasDescriptionElement()) {
30571        composeStringCore("description", element.getDescriptionElement(), false);
30572        composeStringExtras("description", element.getDescriptionElement(), false);
30573      }
30574      if (element.hasValueSetElement()) {
30575        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
30576        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
30577      }
30578  }
30579
30580  protected void composeElementDefinitionElementDefinitionMappingComponent(String name, ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
30581    if (element != null) {
30582      open(name);
30583      composeElementDefinitionElementDefinitionMappingComponentInner(element);
30584      close();
30585    }
30586  }
30587
30588  protected void composeElementDefinitionElementDefinitionMappingComponentInner(ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
30589      composeElement(element);
30590      if (element.hasIdentityElement()) {
30591        composeIdCore("identity", element.getIdentityElement(), false);
30592        composeIdExtras("identity", element.getIdentityElement(), false);
30593      }
30594      if (element.hasLanguageElement()) {
30595        composeCodeCore("language", element.getLanguageElement(), false);
30596        composeCodeExtras("language", element.getLanguageElement(), false);
30597      }
30598      if (element.hasMapElement()) {
30599        composeStringCore("map", element.getMapElement(), false);
30600        composeStringExtras("map", element.getMapElement(), false);
30601      }
30602      if (element.hasCommentElement()) {
30603        composeStringCore("comment", element.getCommentElement(), false);
30604        composeStringExtras("comment", element.getCommentElement(), false);
30605      }
30606  }
30607
30608  protected void composeDomainResourceElements(DomainResource element) throws IOException {
30609      composeResourceElements(element);
30610      if (element.hasText()) {
30611        composeNarrative("text", element.getText());
30612      }
30613      if (element.hasContained()) {
30614        openArray("contained");
30615        for (Resource e : element.getContained()) {
30616          open(null);
30617          composeResource(e);
30618          close();
30619        }
30620        closeArray();
30621      };
30622      if (element.hasExtension()) {
30623        openArray("extension");
30624        for (Extension e : element.getExtension()) 
30625          composeExtension(null, e);
30626        closeArray();
30627      };
30628      if (element.hasModifierExtension()) {
30629        openArray("modifierExtension");
30630        for (Extension e : element.getModifierExtension()) 
30631          composeExtension(null, e);
30632        closeArray();
30633      };
30634  }
30635
30636  protected void composeParameters(String name, Parameters element) throws IOException {
30637    if (element != null) {
30638      prop("resourceType", name);
30639      composeParametersInner(element);
30640    }
30641  }
30642
30643  protected void composeParametersInner(Parameters element) throws IOException {
30644      composeResourceElements(element);
30645      if (element.hasParameter()) {
30646        openArray("parameter");
30647        for (Parameters.ParametersParameterComponent e : element.getParameter()) 
30648          composeParametersParametersParameterComponent(null, e);
30649        closeArray();
30650      };
30651  }
30652
30653  protected void composeParametersParametersParameterComponent(String name, Parameters.ParametersParameterComponent element) throws IOException {
30654    if (element != null) {
30655      open(name);
30656      composeParametersParametersParameterComponentInner(element);
30657      close();
30658    }
30659  }
30660
30661  protected void composeParametersParametersParameterComponentInner(Parameters.ParametersParameterComponent element) throws IOException {
30662      composeBackbone(element);
30663      if (element.hasNameElement()) {
30664        composeStringCore("name", element.getNameElement(), false);
30665        composeStringExtras("name", element.getNameElement(), false);
30666      }
30667      if (element.hasValue()) {
30668        composeType("value", element.getValue());
30669      }
30670        if (element.hasResource()) {
30671          open("resource");
30672          composeResource(element.getResource());
30673          close();
30674        }
30675      if (element.hasPart()) {
30676        openArray("part");
30677        for (Parameters.ParametersParameterComponent e : element.getPart()) 
30678          composeParametersParametersParameterComponent(null, e);
30679        closeArray();
30680      };
30681  }
30682
30683  protected void composeResourceElements(Resource element) throws IOException {
30684      if (element.hasIdElement()) {
30685        composeIdCore("id", element.getIdElement(), false);
30686        composeIdExtras("id", element.getIdElement(), false);
30687      }
30688      if (element.hasMeta()) {
30689        composeMeta("meta", element.getMeta());
30690      }
30691      if (element.hasImplicitRulesElement()) {
30692        composeUriCore("implicitRules", element.getImplicitRulesElement(), false);
30693        composeUriExtras("implicitRules", element.getImplicitRulesElement(), false);
30694      }
30695      if (element.hasLanguageElement()) {
30696        composeCodeCore("language", element.getLanguageElement(), false);
30697        composeCodeExtras("language", element.getLanguageElement(), false);
30698      }
30699  }
30700
30701  protected void composeAccount(String name, Account element) throws IOException {
30702    if (element != null) {
30703      prop("resourceType", name);
30704      composeAccountInner(element);
30705    }
30706  }
30707
30708  protected void composeAccountInner(Account element) throws IOException {
30709      composeDomainResourceElements(element);
30710      if (element.hasIdentifier()) {
30711        openArray("identifier");
30712        for (Identifier e : element.getIdentifier()) 
30713          composeIdentifier(null, e);
30714        closeArray();
30715      };
30716      if (element.hasStatusElement()) {
30717        composeEnumerationCore("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
30718        composeEnumerationExtras("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
30719      }
30720      if (element.hasType()) {
30721        composeCodeableConcept("type", element.getType());
30722      }
30723      if (element.hasNameElement()) {
30724        composeStringCore("name", element.getNameElement(), false);
30725        composeStringExtras("name", element.getNameElement(), false);
30726      }
30727      if (element.hasSubject()) {
30728        openArray("subject");
30729        for (Reference e : element.getSubject()) 
30730          composeReference(null, e);
30731        closeArray();
30732      };
30733      if (element.hasServicePeriod()) {
30734        composePeriod("servicePeriod", element.getServicePeriod());
30735      }
30736      if (element.hasCoverage()) {
30737        openArray("coverage");
30738        for (Account.CoverageComponent e : element.getCoverage()) 
30739          composeAccountCoverageComponent(null, e);
30740        closeArray();
30741      };
30742      if (element.hasOwner()) {
30743        composeReference("owner", element.getOwner());
30744      }
30745      if (element.hasDescriptionElement()) {
30746        composeStringCore("description", element.getDescriptionElement(), false);
30747        composeStringExtras("description", element.getDescriptionElement(), false);
30748      }
30749      if (element.hasGuarantor()) {
30750        openArray("guarantor");
30751        for (Account.GuarantorComponent e : element.getGuarantor()) 
30752          composeAccountGuarantorComponent(null, e);
30753        closeArray();
30754      };
30755      if (element.hasPartOf()) {
30756        composeReference("partOf", element.getPartOf());
30757      }
30758  }
30759
30760  protected void composeAccountCoverageComponent(String name, Account.CoverageComponent element) throws IOException {
30761    if (element != null) {
30762      open(name);
30763      composeAccountCoverageComponentInner(element);
30764      close();
30765    }
30766  }
30767
30768  protected void composeAccountCoverageComponentInner(Account.CoverageComponent element) throws IOException {
30769      composeBackbone(element);
30770      if (element.hasCoverage()) {
30771        composeReference("coverage", element.getCoverage());
30772      }
30773      if (element.hasPriorityElement()) {
30774        composePositiveIntCore("priority", element.getPriorityElement(), false);
30775        composePositiveIntExtras("priority", element.getPriorityElement(), false);
30776      }
30777  }
30778
30779  protected void composeAccountGuarantorComponent(String name, Account.GuarantorComponent element) throws IOException {
30780    if (element != null) {
30781      open(name);
30782      composeAccountGuarantorComponentInner(element);
30783      close();
30784    }
30785  }
30786
30787  protected void composeAccountGuarantorComponentInner(Account.GuarantorComponent element) throws IOException {
30788      composeBackbone(element);
30789      if (element.hasParty()) {
30790        composeReference("party", element.getParty());
30791      }
30792      if (element.hasOnHoldElement()) {
30793        composeBooleanCore("onHold", element.getOnHoldElement(), false);
30794        composeBooleanExtras("onHold", element.getOnHoldElement(), false);
30795      }
30796      if (element.hasPeriod()) {
30797        composePeriod("period", element.getPeriod());
30798      }
30799  }
30800
30801  protected void composeActivityDefinition(String name, ActivityDefinition element) throws IOException {
30802    if (element != null) {
30803      prop("resourceType", name);
30804      composeActivityDefinitionInner(element);
30805    }
30806  }
30807
30808  protected void composeActivityDefinitionInner(ActivityDefinition element) throws IOException {
30809      composeDomainResourceElements(element);
30810      if (element.hasUrlElement()) {
30811        composeUriCore("url", element.getUrlElement(), false);
30812        composeUriExtras("url", element.getUrlElement(), false);
30813      }
30814      if (element.hasIdentifier()) {
30815        openArray("identifier");
30816        for (Identifier e : element.getIdentifier()) 
30817          composeIdentifier(null, e);
30818        closeArray();
30819      };
30820      if (element.hasVersionElement()) {
30821        composeStringCore("version", element.getVersionElement(), false);
30822        composeStringExtras("version", element.getVersionElement(), false);
30823      }
30824      if (element.hasNameElement()) {
30825        composeStringCore("name", element.getNameElement(), false);
30826        composeStringExtras("name", element.getNameElement(), false);
30827      }
30828      if (element.hasTitleElement()) {
30829        composeStringCore("title", element.getTitleElement(), false);
30830        composeStringExtras("title", element.getTitleElement(), false);
30831      }
30832      if (element.hasSubtitleElement()) {
30833        composeStringCore("subtitle", element.getSubtitleElement(), false);
30834        composeStringExtras("subtitle", element.getSubtitleElement(), false);
30835      }
30836      if (element.hasStatusElement()) {
30837        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
30838        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
30839      }
30840      if (element.hasExperimentalElement()) {
30841        composeBooleanCore("experimental", element.getExperimentalElement(), false);
30842        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
30843      }
30844      if (element.hasSubject()) {
30845        composeType("subject", element.getSubject());
30846      }
30847      if (element.hasDateElement()) {
30848        composeDateTimeCore("date", element.getDateElement(), false);
30849        composeDateTimeExtras("date", element.getDateElement(), false);
30850      }
30851      if (element.hasPublisherElement()) {
30852        composeStringCore("publisher", element.getPublisherElement(), false);
30853        composeStringExtras("publisher", element.getPublisherElement(), false);
30854      }
30855      if (element.hasContact()) {
30856        openArray("contact");
30857        for (ContactDetail e : element.getContact()) 
30858          composeContactDetail(null, e);
30859        closeArray();
30860      };
30861      if (element.hasDescriptionElement()) {
30862        composeMarkdownCore("description", element.getDescriptionElement(), false);
30863        composeMarkdownExtras("description", element.getDescriptionElement(), false);
30864      }
30865      if (element.hasUseContext()) {
30866        openArray("useContext");
30867        for (UsageContext e : element.getUseContext()) 
30868          composeUsageContext(null, e);
30869        closeArray();
30870      };
30871      if (element.hasJurisdiction()) {
30872        openArray("jurisdiction");
30873        for (CodeableConcept e : element.getJurisdiction()) 
30874          composeCodeableConcept(null, e);
30875        closeArray();
30876      };
30877      if (element.hasPurposeElement()) {
30878        composeMarkdownCore("purpose", element.getPurposeElement(), false);
30879        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
30880      }
30881      if (element.hasUsageElement()) {
30882        composeStringCore("usage", element.getUsageElement(), false);
30883        composeStringExtras("usage", element.getUsageElement(), false);
30884      }
30885      if (element.hasCopyrightElement()) {
30886        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
30887        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
30888      }
30889      if (element.hasApprovalDateElement()) {
30890        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
30891        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
30892      }
30893      if (element.hasLastReviewDateElement()) {
30894        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
30895        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
30896      }
30897      if (element.hasEffectivePeriod()) {
30898        composePeriod("effectivePeriod", element.getEffectivePeriod());
30899      }
30900      if (element.hasTopic()) {
30901        openArray("topic");
30902        for (CodeableConcept e : element.getTopic()) 
30903          composeCodeableConcept(null, e);
30904        closeArray();
30905      };
30906      if (element.hasAuthor()) {
30907        openArray("author");
30908        for (ContactDetail e : element.getAuthor()) 
30909          composeContactDetail(null, e);
30910        closeArray();
30911      };
30912      if (element.hasEditor()) {
30913        openArray("editor");
30914        for (ContactDetail e : element.getEditor()) 
30915          composeContactDetail(null, e);
30916        closeArray();
30917      };
30918      if (element.hasReviewer()) {
30919        openArray("reviewer");
30920        for (ContactDetail e : element.getReviewer()) 
30921          composeContactDetail(null, e);
30922        closeArray();
30923      };
30924      if (element.hasEndorser()) {
30925        openArray("endorser");
30926        for (ContactDetail e : element.getEndorser()) 
30927          composeContactDetail(null, e);
30928        closeArray();
30929      };
30930      if (element.hasRelatedArtifact()) {
30931        openArray("relatedArtifact");
30932        for (RelatedArtifact e : element.getRelatedArtifact()) 
30933          composeRelatedArtifact(null, e);
30934        closeArray();
30935      };
30936      if (element.hasLibrary()) {
30937        openArray("library");
30938        for (CanonicalType e : element.getLibrary()) 
30939          composeCanonicalCore(null, e, true);
30940        closeArray();
30941        if (anyHasExtras(element.getLibrary())) {
30942          openArray("_library");
30943          for (CanonicalType e : element.getLibrary()) 
30944            composeCanonicalExtras(null, e, true);
30945          closeArray();
30946        }
30947      };
30948      if (element.hasKindElement()) {
30949        composeEnumerationCore("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
30950        composeEnumerationExtras("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
30951      }
30952      if (element.hasProfileElement()) {
30953        composeCanonicalCore("profile", element.getProfileElement(), false);
30954        composeCanonicalExtras("profile", element.getProfileElement(), false);
30955      }
30956      if (element.hasCode()) {
30957        composeCodeableConcept("code", element.getCode());
30958      }
30959      if (element.hasIntentElement()) {
30960        composeEnumerationCore("intent", element.getIntentElement(), new ActivityDefinition.RequestIntentEnumFactory(), false);
30961        composeEnumerationExtras("intent", element.getIntentElement(), new ActivityDefinition.RequestIntentEnumFactory(), false);
30962      }
30963      if (element.hasPriorityElement()) {
30964        composeEnumerationCore("priority", element.getPriorityElement(), new ActivityDefinition.RequestPriorityEnumFactory(), false);
30965        composeEnumerationExtras("priority", element.getPriorityElement(), new ActivityDefinition.RequestPriorityEnumFactory(), false);
30966      }
30967      if (element.hasDoNotPerformElement()) {
30968        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
30969        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
30970      }
30971      if (element.hasTiming()) {
30972        composeType("timing", element.getTiming());
30973      }
30974      if (element.hasLocation()) {
30975        composeReference("location", element.getLocation());
30976      }
30977      if (element.hasParticipant()) {
30978        openArray("participant");
30979        for (ActivityDefinition.ActivityDefinitionParticipantComponent e : element.getParticipant()) 
30980          composeActivityDefinitionActivityDefinitionParticipantComponent(null, e);
30981        closeArray();
30982      };
30983      if (element.hasProduct()) {
30984        composeType("product", element.getProduct());
30985      }
30986      if (element.hasQuantity()) {
30987        composeQuantity("quantity", element.getQuantity());
30988      }
30989      if (element.hasDosage()) {
30990        openArray("dosage");
30991        for (Dosage e : element.getDosage()) 
30992          composeDosage(null, e);
30993        closeArray();
30994      };
30995      if (element.hasBodySite()) {
30996        openArray("bodySite");
30997        for (CodeableConcept e : element.getBodySite()) 
30998          composeCodeableConcept(null, e);
30999        closeArray();
31000      };
31001      if (element.hasSpecimenRequirement()) {
31002        openArray("specimenRequirement");
31003        for (Reference e : element.getSpecimenRequirement()) 
31004          composeReference(null, e);
31005        closeArray();
31006      };
31007      if (element.hasObservationRequirement()) {
31008        openArray("observationRequirement");
31009        for (Reference e : element.getObservationRequirement()) 
31010          composeReference(null, e);
31011        closeArray();
31012      };
31013      if (element.hasObservationResultRequirement()) {
31014        openArray("observationResultRequirement");
31015        for (Reference e : element.getObservationResultRequirement()) 
31016          composeReference(null, e);
31017        closeArray();
31018      };
31019      if (element.hasTransformElement()) {
31020        composeCanonicalCore("transform", element.getTransformElement(), false);
31021        composeCanonicalExtras("transform", element.getTransformElement(), false);
31022      }
31023      if (element.hasDynamicValue()) {
31024        openArray("dynamicValue");
31025        for (ActivityDefinition.ActivityDefinitionDynamicValueComponent e : element.getDynamicValue()) 
31026          composeActivityDefinitionActivityDefinitionDynamicValueComponent(null, e);
31027        closeArray();
31028      };
31029  }
31030
31031  protected void composeActivityDefinitionActivityDefinitionParticipantComponent(String name, ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
31032    if (element != null) {
31033      open(name);
31034      composeActivityDefinitionActivityDefinitionParticipantComponentInner(element);
31035      close();
31036    }
31037  }
31038
31039  protected void composeActivityDefinitionActivityDefinitionParticipantComponentInner(ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
31040      composeBackbone(element);
31041      if (element.hasTypeElement()) {
31042        composeEnumerationCore("type", element.getTypeElement(), new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
31043        composeEnumerationExtras("type", element.getTypeElement(), new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
31044      }
31045      if (element.hasRole()) {
31046        composeCodeableConcept("role", element.getRole());
31047      }
31048  }
31049
31050  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponent(String name, ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
31051    if (element != null) {
31052      open(name);
31053      composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(element);
31054      close();
31055    }
31056  }
31057
31058  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
31059      composeBackbone(element);
31060      if (element.hasPathElement()) {
31061        composeStringCore("path", element.getPathElement(), false);
31062        composeStringExtras("path", element.getPathElement(), false);
31063      }
31064      if (element.hasExpression()) {
31065        composeExpression("expression", element.getExpression());
31066      }
31067  }
31068
31069  protected void composeAdverseEvent(String name, AdverseEvent element) throws IOException {
31070    if (element != null) {
31071      prop("resourceType", name);
31072      composeAdverseEventInner(element);
31073    }
31074  }
31075
31076  protected void composeAdverseEventInner(AdverseEvent element) throws IOException {
31077      composeDomainResourceElements(element);
31078      if (element.hasIdentifier()) {
31079        composeIdentifier("identifier", element.getIdentifier());
31080      }
31081      if (element.hasActualityElement()) {
31082        composeEnumerationCore("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
31083        composeEnumerationExtras("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
31084      }
31085      if (element.hasCategory()) {
31086        openArray("category");
31087        for (CodeableConcept e : element.getCategory()) 
31088          composeCodeableConcept(null, e);
31089        closeArray();
31090      };
31091      if (element.hasEvent()) {
31092        composeCodeableConcept("event", element.getEvent());
31093      }
31094      if (element.hasSubject()) {
31095        composeReference("subject", element.getSubject());
31096      }
31097      if (element.hasEncounter()) {
31098        composeReference("encounter", element.getEncounter());
31099      }
31100      if (element.hasDateElement()) {
31101        composeDateTimeCore("date", element.getDateElement(), false);
31102        composeDateTimeExtras("date", element.getDateElement(), false);
31103      }
31104      if (element.hasDetectedElement()) {
31105        composeDateTimeCore("detected", element.getDetectedElement(), false);
31106        composeDateTimeExtras("detected", element.getDetectedElement(), false);
31107      }
31108      if (element.hasRecordedDateElement()) {
31109        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
31110        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
31111      }
31112      if (element.hasResultingCondition()) {
31113        openArray("resultingCondition");
31114        for (Reference e : element.getResultingCondition()) 
31115          composeReference(null, e);
31116        closeArray();
31117      };
31118      if (element.hasLocation()) {
31119        composeReference("location", element.getLocation());
31120      }
31121      if (element.hasSeriousness()) {
31122        composeCodeableConcept("seriousness", element.getSeriousness());
31123      }
31124      if (element.hasSeverity()) {
31125        composeCodeableConcept("severity", element.getSeverity());
31126      }
31127      if (element.hasOutcome()) {
31128        composeCodeableConcept("outcome", element.getOutcome());
31129      }
31130      if (element.hasRecorder()) {
31131        composeReference("recorder", element.getRecorder());
31132      }
31133      if (element.hasContributor()) {
31134        openArray("contributor");
31135        for (Reference e : element.getContributor()) 
31136          composeReference(null, e);
31137        closeArray();
31138      };
31139      if (element.hasSuspectEntity()) {
31140        openArray("suspectEntity");
31141        for (AdverseEvent.AdverseEventSuspectEntityComponent e : element.getSuspectEntity()) 
31142          composeAdverseEventAdverseEventSuspectEntityComponent(null, e);
31143        closeArray();
31144      };
31145      if (element.hasSubjectMedicalHistory()) {
31146        openArray("subjectMedicalHistory");
31147        for (Reference e : element.getSubjectMedicalHistory()) 
31148          composeReference(null, e);
31149        closeArray();
31150      };
31151      if (element.hasReferenceDocument()) {
31152        openArray("referenceDocument");
31153        for (Reference e : element.getReferenceDocument()) 
31154          composeReference(null, e);
31155        closeArray();
31156      };
31157      if (element.hasStudy()) {
31158        openArray("study");
31159        for (Reference e : element.getStudy()) 
31160          composeReference(null, e);
31161        closeArray();
31162      };
31163  }
31164
31165  protected void composeAdverseEventAdverseEventSuspectEntityComponent(String name, AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
31166    if (element != null) {
31167      open(name);
31168      composeAdverseEventAdverseEventSuspectEntityComponentInner(element);
31169      close();
31170    }
31171  }
31172
31173  protected void composeAdverseEventAdverseEventSuspectEntityComponentInner(AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
31174      composeBackbone(element);
31175      if (element.hasInstance()) {
31176        composeReference("instance", element.getInstance());
31177      }
31178      if (element.hasCausality()) {
31179        openArray("causality");
31180        for (AdverseEvent.AdverseEventSuspectEntityCausalityComponent e : element.getCausality()) 
31181          composeAdverseEventAdverseEventSuspectEntityCausalityComponent(null, e);
31182        closeArray();
31183      };
31184  }
31185
31186  protected void composeAdverseEventAdverseEventSuspectEntityCausalityComponent(String name, AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
31187    if (element != null) {
31188      open(name);
31189      composeAdverseEventAdverseEventSuspectEntityCausalityComponentInner(element);
31190      close();
31191    }
31192  }
31193
31194  protected void composeAdverseEventAdverseEventSuspectEntityCausalityComponentInner(AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
31195      composeBackbone(element);
31196      if (element.hasAssessment()) {
31197        composeCodeableConcept("assessment", element.getAssessment());
31198      }
31199      if (element.hasProductRelatednessElement()) {
31200        composeStringCore("productRelatedness", element.getProductRelatednessElement(), false);
31201        composeStringExtras("productRelatedness", element.getProductRelatednessElement(), false);
31202      }
31203      if (element.hasAuthor()) {
31204        composeReference("author", element.getAuthor());
31205      }
31206      if (element.hasMethod()) {
31207        composeCodeableConcept("method", element.getMethod());
31208      }
31209  }
31210
31211  protected void composeAllergyIntolerance(String name, AllergyIntolerance element) throws IOException {
31212    if (element != null) {
31213      prop("resourceType", name);
31214      composeAllergyIntoleranceInner(element);
31215    }
31216  }
31217
31218  protected void composeAllergyIntoleranceInner(AllergyIntolerance element) throws IOException {
31219      composeDomainResourceElements(element);
31220      if (element.hasIdentifier()) {
31221        openArray("identifier");
31222        for (Identifier e : element.getIdentifier()) 
31223          composeIdentifier(null, e);
31224        closeArray();
31225      };
31226      if (element.hasClinicalStatus()) {
31227        composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
31228      }
31229      if (element.hasVerificationStatus()) {
31230        composeCodeableConcept("verificationStatus", element.getVerificationStatus());
31231      }
31232      if (element.hasTypeElement()) {
31233        composeEnumerationCore("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
31234        composeEnumerationExtras("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
31235      }
31236      if (element.hasCategory()) {
31237        openArray("category");
31238        for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
31239          composeEnumerationCore(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
31240        closeArray();
31241        if (anyHasExtras(element.getCategory())) {
31242          openArray("_category");
31243          for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
31244            composeEnumerationExtras(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
31245          closeArray();
31246        }
31247      };
31248      if (element.hasCriticalityElement()) {
31249        composeEnumerationCore("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
31250        composeEnumerationExtras("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
31251      }
31252      if (element.hasCode()) {
31253        composeCodeableConcept("code", element.getCode());
31254      }
31255      if (element.hasPatient()) {
31256        composeReference("patient", element.getPatient());
31257      }
31258      if (element.hasEncounter()) {
31259        composeReference("encounter", element.getEncounter());
31260      }
31261      if (element.hasOnset()) {
31262        composeType("onset", element.getOnset());
31263      }
31264      if (element.hasRecordedDateElement()) {
31265        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
31266        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
31267      }
31268      if (element.hasRecorder()) {
31269        composeReference("recorder", element.getRecorder());
31270      }
31271      if (element.hasAsserter()) {
31272        composeReference("asserter", element.getAsserter());
31273      }
31274      if (element.hasLastOccurrenceElement()) {
31275        composeDateTimeCore("lastOccurrence", element.getLastOccurrenceElement(), false);
31276        composeDateTimeExtras("lastOccurrence", element.getLastOccurrenceElement(), false);
31277      }
31278      if (element.hasNote()) {
31279        openArray("note");
31280        for (Annotation e : element.getNote()) 
31281          composeAnnotation(null, e);
31282        closeArray();
31283      };
31284      if (element.hasReaction()) {
31285        openArray("reaction");
31286        for (AllergyIntolerance.AllergyIntoleranceReactionComponent e : element.getReaction()) 
31287          composeAllergyIntoleranceAllergyIntoleranceReactionComponent(null, e);
31288        closeArray();
31289      };
31290  }
31291
31292  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponent(String name, AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
31293    if (element != null) {
31294      open(name);
31295      composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(element);
31296      close();
31297    }
31298  }
31299
31300  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
31301      composeBackbone(element);
31302      if (element.hasSubstance()) {
31303        composeCodeableConcept("substance", element.getSubstance());
31304      }
31305      if (element.hasManifestation()) {
31306        openArray("manifestation");
31307        for (CodeableConcept e : element.getManifestation()) 
31308          composeCodeableConcept(null, e);
31309        closeArray();
31310      };
31311      if (element.hasDescriptionElement()) {
31312        composeStringCore("description", element.getDescriptionElement(), false);
31313        composeStringExtras("description", element.getDescriptionElement(), false);
31314      }
31315      if (element.hasOnsetElement()) {
31316        composeDateTimeCore("onset", element.getOnsetElement(), false);
31317        composeDateTimeExtras("onset", element.getOnsetElement(), false);
31318      }
31319      if (element.hasSeverityElement()) {
31320        composeEnumerationCore("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
31321        composeEnumerationExtras("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
31322      }
31323      if (element.hasExposureRoute()) {
31324        composeCodeableConcept("exposureRoute", element.getExposureRoute());
31325      }
31326      if (element.hasNote()) {
31327        openArray("note");
31328        for (Annotation e : element.getNote()) 
31329          composeAnnotation(null, e);
31330        closeArray();
31331      };
31332  }
31333
31334  protected void composeAppointment(String name, Appointment element) throws IOException {
31335    if (element != null) {
31336      prop("resourceType", name);
31337      composeAppointmentInner(element);
31338    }
31339  }
31340
31341  protected void composeAppointmentInner(Appointment element) throws IOException {
31342      composeDomainResourceElements(element);
31343      if (element.hasIdentifier()) {
31344        openArray("identifier");
31345        for (Identifier e : element.getIdentifier()) 
31346          composeIdentifier(null, e);
31347        closeArray();
31348      };
31349      if (element.hasStatusElement()) {
31350        composeEnumerationCore("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
31351        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
31352      }
31353      if (element.hasCancelationReason()) {
31354        composeCodeableConcept("cancelationReason", element.getCancelationReason());
31355      }
31356      if (element.hasServiceCategory()) {
31357        openArray("serviceCategory");
31358        for (CodeableConcept e : element.getServiceCategory()) 
31359          composeCodeableConcept(null, e);
31360        closeArray();
31361      };
31362      if (element.hasServiceType()) {
31363        openArray("serviceType");
31364        for (CodeableConcept e : element.getServiceType()) 
31365          composeCodeableConcept(null, e);
31366        closeArray();
31367      };
31368      if (element.hasSpecialty()) {
31369        openArray("specialty");
31370        for (CodeableConcept e : element.getSpecialty()) 
31371          composeCodeableConcept(null, e);
31372        closeArray();
31373      };
31374      if (element.hasAppointmentType()) {
31375        composeCodeableConcept("appointmentType", element.getAppointmentType());
31376      }
31377      if (element.hasReasonCode()) {
31378        openArray("reasonCode");
31379        for (CodeableConcept e : element.getReasonCode()) 
31380          composeCodeableConcept(null, e);
31381        closeArray();
31382      };
31383      if (element.hasReasonReference()) {
31384        openArray("reasonReference");
31385        for (Reference e : element.getReasonReference()) 
31386          composeReference(null, e);
31387        closeArray();
31388      };
31389      if (element.hasPriorityElement()) {
31390        composeUnsignedIntCore("priority", element.getPriorityElement(), false);
31391        composeUnsignedIntExtras("priority", element.getPriorityElement(), false);
31392      }
31393      if (element.hasDescriptionElement()) {
31394        composeStringCore("description", element.getDescriptionElement(), false);
31395        composeStringExtras("description", element.getDescriptionElement(), false);
31396      }
31397      if (element.hasSupportingInformation()) {
31398        openArray("supportingInformation");
31399        for (Reference e : element.getSupportingInformation()) 
31400          composeReference(null, e);
31401        closeArray();
31402      };
31403      if (element.hasStartElement()) {
31404        composeInstantCore("start", element.getStartElement(), false);
31405        composeInstantExtras("start", element.getStartElement(), false);
31406      }
31407      if (element.hasEndElement()) {
31408        composeInstantCore("end", element.getEndElement(), false);
31409        composeInstantExtras("end", element.getEndElement(), false);
31410      }
31411      if (element.hasMinutesDurationElement()) {
31412        composePositiveIntCore("minutesDuration", element.getMinutesDurationElement(), false);
31413        composePositiveIntExtras("minutesDuration", element.getMinutesDurationElement(), false);
31414      }
31415      if (element.hasSlot()) {
31416        openArray("slot");
31417        for (Reference e : element.getSlot()) 
31418          composeReference(null, e);
31419        closeArray();
31420      };
31421      if (element.hasCreatedElement()) {
31422        composeDateTimeCore("created", element.getCreatedElement(), false);
31423        composeDateTimeExtras("created", element.getCreatedElement(), false);
31424      }
31425      if (element.hasCommentElement()) {
31426        composeStringCore("comment", element.getCommentElement(), false);
31427        composeStringExtras("comment", element.getCommentElement(), false);
31428      }
31429      if (element.hasPatientInstructionElement()) {
31430        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
31431        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
31432      }
31433      if (element.hasBasedOn()) {
31434        openArray("basedOn");
31435        for (Reference e : element.getBasedOn()) 
31436          composeReference(null, e);
31437        closeArray();
31438      };
31439      if (element.hasParticipant()) {
31440        openArray("participant");
31441        for (Appointment.AppointmentParticipantComponent e : element.getParticipant()) 
31442          composeAppointmentAppointmentParticipantComponent(null, e);
31443        closeArray();
31444      };
31445      if (element.hasRequestedPeriod()) {
31446        openArray("requestedPeriod");
31447        for (Period e : element.getRequestedPeriod()) 
31448          composePeriod(null, e);
31449        closeArray();
31450      };
31451  }
31452
31453  protected void composeAppointmentAppointmentParticipantComponent(String name, Appointment.AppointmentParticipantComponent element) throws IOException {
31454    if (element != null) {
31455      open(name);
31456      composeAppointmentAppointmentParticipantComponentInner(element);
31457      close();
31458    }
31459  }
31460
31461  protected void composeAppointmentAppointmentParticipantComponentInner(Appointment.AppointmentParticipantComponent element) throws IOException {
31462      composeBackbone(element);
31463      if (element.hasType()) {
31464        openArray("type");
31465        for (CodeableConcept e : element.getType()) 
31466          composeCodeableConcept(null, e);
31467        closeArray();
31468      };
31469      if (element.hasActor()) {
31470        composeReference("actor", element.getActor());
31471      }
31472      if (element.hasRequiredElement()) {
31473        composeEnumerationCore("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
31474        composeEnumerationExtras("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
31475      }
31476      if (element.hasStatusElement()) {
31477        composeEnumerationCore("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
31478        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
31479      }
31480      if (element.hasPeriod()) {
31481        composePeriod("period", element.getPeriod());
31482      }
31483  }
31484
31485  protected void composeAppointmentResponse(String name, AppointmentResponse element) throws IOException {
31486    if (element != null) {
31487      prop("resourceType", name);
31488      composeAppointmentResponseInner(element);
31489    }
31490  }
31491
31492  protected void composeAppointmentResponseInner(AppointmentResponse element) throws IOException {
31493      composeDomainResourceElements(element);
31494      if (element.hasIdentifier()) {
31495        openArray("identifier");
31496        for (Identifier e : element.getIdentifier()) 
31497          composeIdentifier(null, e);
31498        closeArray();
31499      };
31500      if (element.hasAppointment()) {
31501        composeReference("appointment", element.getAppointment());
31502      }
31503      if (element.hasStartElement()) {
31504        composeInstantCore("start", element.getStartElement(), false);
31505        composeInstantExtras("start", element.getStartElement(), false);
31506      }
31507      if (element.hasEndElement()) {
31508        composeInstantCore("end", element.getEndElement(), false);
31509        composeInstantExtras("end", element.getEndElement(), false);
31510      }
31511      if (element.hasParticipantType()) {
31512        openArray("participantType");
31513        for (CodeableConcept e : element.getParticipantType()) 
31514          composeCodeableConcept(null, e);
31515        closeArray();
31516      };
31517      if (element.hasActor()) {
31518        composeReference("actor", element.getActor());
31519      }
31520      if (element.hasParticipantStatusElement()) {
31521        composeEnumerationCore("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
31522        composeEnumerationExtras("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
31523      }
31524      if (element.hasCommentElement()) {
31525        composeStringCore("comment", element.getCommentElement(), false);
31526        composeStringExtras("comment", element.getCommentElement(), false);
31527      }
31528  }
31529
31530  protected void composeAuditEvent(String name, AuditEvent element) throws IOException {
31531    if (element != null) {
31532      prop("resourceType", name);
31533      composeAuditEventInner(element);
31534    }
31535  }
31536
31537  protected void composeAuditEventInner(AuditEvent element) throws IOException {
31538      composeDomainResourceElements(element);
31539      if (element.hasType()) {
31540        composeCoding("type", element.getType());
31541      }
31542      if (element.hasSubtype()) {
31543        openArray("subtype");
31544        for (Coding e : element.getSubtype()) 
31545          composeCoding(null, e);
31546        closeArray();
31547      };
31548      if (element.hasActionElement()) {
31549        composeEnumerationCore("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
31550        composeEnumerationExtras("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
31551      }
31552      if (element.hasPeriod()) {
31553        composePeriod("period", element.getPeriod());
31554      }
31555      if (element.hasRecordedElement()) {
31556        composeInstantCore("recorded", element.getRecordedElement(), false);
31557        composeInstantExtras("recorded", element.getRecordedElement(), false);
31558      }
31559      if (element.hasOutcomeElement()) {
31560        composeEnumerationCore("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
31561        composeEnumerationExtras("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
31562      }
31563      if (element.hasOutcomeDescElement()) {
31564        composeStringCore("outcomeDesc", element.getOutcomeDescElement(), false);
31565        composeStringExtras("outcomeDesc", element.getOutcomeDescElement(), false);
31566      }
31567      if (element.hasPurposeOfEvent()) {
31568        openArray("purposeOfEvent");
31569        for (CodeableConcept e : element.getPurposeOfEvent()) 
31570          composeCodeableConcept(null, e);
31571        closeArray();
31572      };
31573      if (element.hasAgent()) {
31574        openArray("agent");
31575        for (AuditEvent.AuditEventAgentComponent e : element.getAgent()) 
31576          composeAuditEventAuditEventAgentComponent(null, e);
31577        closeArray();
31578      };
31579      if (element.hasSource()) {
31580        composeAuditEventAuditEventSourceComponent("source", element.getSource());
31581      }
31582      if (element.hasEntity()) {
31583        openArray("entity");
31584        for (AuditEvent.AuditEventEntityComponent e : element.getEntity()) 
31585          composeAuditEventAuditEventEntityComponent(null, e);
31586        closeArray();
31587      };
31588  }
31589
31590  protected void composeAuditEventAuditEventAgentComponent(String name, AuditEvent.AuditEventAgentComponent element) throws IOException {
31591    if (element != null) {
31592      open(name);
31593      composeAuditEventAuditEventAgentComponentInner(element);
31594      close();
31595    }
31596  }
31597
31598  protected void composeAuditEventAuditEventAgentComponentInner(AuditEvent.AuditEventAgentComponent element) throws IOException {
31599      composeBackbone(element);
31600      if (element.hasType()) {
31601        composeCodeableConcept("type", element.getType());
31602      }
31603      if (element.hasRole()) {
31604        openArray("role");
31605        for (CodeableConcept e : element.getRole()) 
31606          composeCodeableConcept(null, e);
31607        closeArray();
31608      };
31609      if (element.hasWho()) {
31610        composeReference("who", element.getWho());
31611      }
31612      if (element.hasAltIdElement()) {
31613        composeStringCore("altId", element.getAltIdElement(), false);
31614        composeStringExtras("altId", element.getAltIdElement(), false);
31615      }
31616      if (element.hasNameElement()) {
31617        composeStringCore("name", element.getNameElement(), false);
31618        composeStringExtras("name", element.getNameElement(), false);
31619      }
31620      if (element.hasRequestorElement()) {
31621        composeBooleanCore("requestor", element.getRequestorElement(), false);
31622        composeBooleanExtras("requestor", element.getRequestorElement(), false);
31623      }
31624      if (element.hasLocation()) {
31625        composeReference("location", element.getLocation());
31626      }
31627      if (element.hasPolicy()) {
31628        openArray("policy");
31629        for (UriType e : element.getPolicy()) 
31630          composeUriCore(null, e, true);
31631        closeArray();
31632        if (anyHasExtras(element.getPolicy())) {
31633          openArray("_policy");
31634          for (UriType e : element.getPolicy()) 
31635            composeUriExtras(null, e, true);
31636          closeArray();
31637        }
31638      };
31639      if (element.hasMedia()) {
31640        composeCoding("media", element.getMedia());
31641      }
31642      if (element.hasNetwork()) {
31643        composeAuditEventAuditEventAgentNetworkComponent("network", element.getNetwork());
31644      }
31645      if (element.hasPurposeOfUse()) {
31646        openArray("purposeOfUse");
31647        for (CodeableConcept e : element.getPurposeOfUse()) 
31648          composeCodeableConcept(null, e);
31649        closeArray();
31650      };
31651  }
31652
31653  protected void composeAuditEventAuditEventAgentNetworkComponent(String name, AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
31654    if (element != null) {
31655      open(name);
31656      composeAuditEventAuditEventAgentNetworkComponentInner(element);
31657      close();
31658    }
31659  }
31660
31661  protected void composeAuditEventAuditEventAgentNetworkComponentInner(AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
31662      composeBackbone(element);
31663      if (element.hasAddressElement()) {
31664        composeStringCore("address", element.getAddressElement(), false);
31665        composeStringExtras("address", element.getAddressElement(), false);
31666      }
31667      if (element.hasTypeElement()) {
31668        composeEnumerationCore("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
31669        composeEnumerationExtras("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
31670      }
31671  }
31672
31673  protected void composeAuditEventAuditEventSourceComponent(String name, AuditEvent.AuditEventSourceComponent element) throws IOException {
31674    if (element != null) {
31675      open(name);
31676      composeAuditEventAuditEventSourceComponentInner(element);
31677      close();
31678    }
31679  }
31680
31681  protected void composeAuditEventAuditEventSourceComponentInner(AuditEvent.AuditEventSourceComponent element) throws IOException {
31682      composeBackbone(element);
31683      if (element.hasSiteElement()) {
31684        composeStringCore("site", element.getSiteElement(), false);
31685        composeStringExtras("site", element.getSiteElement(), false);
31686      }
31687      if (element.hasObserver()) {
31688        composeReference("observer", element.getObserver());
31689      }
31690      if (element.hasType()) {
31691        openArray("type");
31692        for (Coding e : element.getType()) 
31693          composeCoding(null, e);
31694        closeArray();
31695      };
31696  }
31697
31698  protected void composeAuditEventAuditEventEntityComponent(String name, AuditEvent.AuditEventEntityComponent element) throws IOException {
31699    if (element != null) {
31700      open(name);
31701      composeAuditEventAuditEventEntityComponentInner(element);
31702      close();
31703    }
31704  }
31705
31706  protected void composeAuditEventAuditEventEntityComponentInner(AuditEvent.AuditEventEntityComponent element) throws IOException {
31707      composeBackbone(element);
31708      if (element.hasWhat()) {
31709        composeReference("what", element.getWhat());
31710      }
31711      if (element.hasType()) {
31712        composeCoding("type", element.getType());
31713      }
31714      if (element.hasRole()) {
31715        composeCoding("role", element.getRole());
31716      }
31717      if (element.hasLifecycle()) {
31718        composeCoding("lifecycle", element.getLifecycle());
31719      }
31720      if (element.hasSecurityLabel()) {
31721        openArray("securityLabel");
31722        for (Coding e : element.getSecurityLabel()) 
31723          composeCoding(null, e);
31724        closeArray();
31725      };
31726      if (element.hasNameElement()) {
31727        composeStringCore("name", element.getNameElement(), false);
31728        composeStringExtras("name", element.getNameElement(), false);
31729      }
31730      if (element.hasDescriptionElement()) {
31731        composeStringCore("description", element.getDescriptionElement(), false);
31732        composeStringExtras("description", element.getDescriptionElement(), false);
31733      }
31734      if (element.hasQueryElement()) {
31735        composeBase64BinaryCore("query", element.getQueryElement(), false);
31736        composeBase64BinaryExtras("query", element.getQueryElement(), false);
31737      }
31738      if (element.hasDetail()) {
31739        openArray("detail");
31740        for (AuditEvent.AuditEventEntityDetailComponent e : element.getDetail()) 
31741          composeAuditEventAuditEventEntityDetailComponent(null, e);
31742        closeArray();
31743      };
31744  }
31745
31746  protected void composeAuditEventAuditEventEntityDetailComponent(String name, AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
31747    if (element != null) {
31748      open(name);
31749      composeAuditEventAuditEventEntityDetailComponentInner(element);
31750      close();
31751    }
31752  }
31753
31754  protected void composeAuditEventAuditEventEntityDetailComponentInner(AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
31755      composeBackbone(element);
31756      if (element.hasTypeElement()) {
31757        composeStringCore("type", element.getTypeElement(), false);
31758        composeStringExtras("type", element.getTypeElement(), false);
31759      }
31760      if (element.hasValue()) {
31761        composeType("value", element.getValue());
31762      }
31763  }
31764
31765  protected void composeBasic(String name, Basic element) throws IOException {
31766    if (element != null) {
31767      prop("resourceType", name);
31768      composeBasicInner(element);
31769    }
31770  }
31771
31772  protected void composeBasicInner(Basic element) throws IOException {
31773      composeDomainResourceElements(element);
31774      if (element.hasIdentifier()) {
31775        openArray("identifier");
31776        for (Identifier e : element.getIdentifier()) 
31777          composeIdentifier(null, e);
31778        closeArray();
31779      };
31780      if (element.hasCode()) {
31781        composeCodeableConcept("code", element.getCode());
31782      }
31783      if (element.hasSubject()) {
31784        composeReference("subject", element.getSubject());
31785      }
31786      if (element.hasCreatedElement()) {
31787        composeDateCore("created", element.getCreatedElement(), false);
31788        composeDateExtras("created", element.getCreatedElement(), false);
31789      }
31790      if (element.hasAuthor()) {
31791        composeReference("author", element.getAuthor());
31792      }
31793  }
31794
31795  protected void composeBinary(String name, Binary element) throws IOException {
31796    if (element != null) {
31797      prop("resourceType", name);
31798      composeBinaryInner(element);
31799    }
31800  }
31801
31802  protected void composeBinaryInner(Binary element) throws IOException {
31803      composeResourceElements(element);
31804      if (element.hasContentTypeElement()) {
31805        composeCodeCore("contentType", element.getContentTypeElement(), false);
31806        composeCodeExtras("contentType", element.getContentTypeElement(), false);
31807      }
31808      if (element.hasSecurityContext()) {
31809        composeReference("securityContext", element.getSecurityContext());
31810      }
31811      if (element.hasDataElement()) {
31812        composeBase64BinaryCore("data", element.getDataElement(), false);
31813        composeBase64BinaryExtras("data", element.getDataElement(), false);
31814      }
31815  }
31816
31817  protected void composeBiologicallyDerivedProduct(String name, BiologicallyDerivedProduct element) throws IOException {
31818    if (element != null) {
31819      prop("resourceType", name);
31820      composeBiologicallyDerivedProductInner(element);
31821    }
31822  }
31823
31824  protected void composeBiologicallyDerivedProductInner(BiologicallyDerivedProduct element) throws IOException {
31825      composeDomainResourceElements(element);
31826      if (element.hasIdentifier()) {
31827        openArray("identifier");
31828        for (Identifier e : element.getIdentifier()) 
31829          composeIdentifier(null, e);
31830        closeArray();
31831      };
31832      if (element.hasProductCategoryElement()) {
31833        composeEnumerationCore("productCategory", element.getProductCategoryElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory(), false);
31834        composeEnumerationExtras("productCategory", element.getProductCategoryElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory(), false);
31835      }
31836      if (element.hasProductCode()) {
31837        composeCodeableConcept("productCode", element.getProductCode());
31838      }
31839      if (element.hasStatusElement()) {
31840        composeEnumerationCore("status", element.getStatusElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory(), false);
31841        composeEnumerationExtras("status", element.getStatusElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory(), false);
31842      }
31843      if (element.hasRequest()) {
31844        openArray("request");
31845        for (Reference e : element.getRequest()) 
31846          composeReference(null, e);
31847        closeArray();
31848      };
31849      if (element.hasQuantityElement()) {
31850        composeIntegerCore("quantity", element.getQuantityElement(), false);
31851        composeIntegerExtras("quantity", element.getQuantityElement(), false);
31852      }
31853      if (element.hasParent()) {
31854        openArray("parent");
31855        for (Reference e : element.getParent()) 
31856          composeReference(null, e);
31857        closeArray();
31858      };
31859      if (element.hasCollection()) {
31860        composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent("collection", element.getCollection());
31861      }
31862      if (element.hasProcessing()) {
31863        openArray("processing");
31864        for (BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent e : element.getProcessing()) 
31865          composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(null, e);
31866        closeArray();
31867      };
31868      if (element.hasManipulation()) {
31869        composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent("manipulation", element.getManipulation());
31870      }
31871      if (element.hasStorage()) {
31872        openArray("storage");
31873        for (BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent e : element.getStorage()) 
31874          composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(null, e);
31875        closeArray();
31876      };
31877  }
31878
31879  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
31880    if (element != null) {
31881      open(name);
31882      composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentInner(element);
31883      close();
31884    }
31885  }
31886
31887  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
31888      composeBackbone(element);
31889      if (element.hasCollector()) {
31890        composeReference("collector", element.getCollector());
31891      }
31892      if (element.hasSource()) {
31893        composeReference("source", element.getSource());
31894      }
31895      if (element.hasCollected()) {
31896        composeType("collected", element.getCollected());
31897      }
31898  }
31899
31900  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
31901    if (element != null) {
31902      open(name);
31903      composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentInner(element);
31904      close();
31905    }
31906  }
31907
31908  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
31909      composeBackbone(element);
31910      if (element.hasDescriptionElement()) {
31911        composeStringCore("description", element.getDescriptionElement(), false);
31912        composeStringExtras("description", element.getDescriptionElement(), false);
31913      }
31914      if (element.hasProcedure()) {
31915        composeCodeableConcept("procedure", element.getProcedure());
31916      }
31917      if (element.hasAdditive()) {
31918        composeReference("additive", element.getAdditive());
31919      }
31920      if (element.hasTime()) {
31921        composeType("time", element.getTime());
31922      }
31923  }
31924
31925  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
31926    if (element != null) {
31927      open(name);
31928      composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentInner(element);
31929      close();
31930    }
31931  }
31932
31933  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
31934      composeBackbone(element);
31935      if (element.hasDescriptionElement()) {
31936        composeStringCore("description", element.getDescriptionElement(), false);
31937        composeStringExtras("description", element.getDescriptionElement(), false);
31938      }
31939      if (element.hasTime()) {
31940        composeType("time", element.getTime());
31941      }
31942  }
31943
31944  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
31945    if (element != null) {
31946      open(name);
31947      composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentInner(element);
31948      close();
31949    }
31950  }
31951
31952  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
31953      composeBackbone(element);
31954      if (element.hasDescriptionElement()) {
31955        composeStringCore("description", element.getDescriptionElement(), false);
31956        composeStringExtras("description", element.getDescriptionElement(), false);
31957      }
31958      if (element.hasTemperatureElement()) {
31959        composeDecimalCore("temperature", element.getTemperatureElement(), false);
31960        composeDecimalExtras("temperature", element.getTemperatureElement(), false);
31961      }
31962      if (element.hasScaleElement()) {
31963        composeEnumerationCore("scale", element.getScaleElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory(), false);
31964        composeEnumerationExtras("scale", element.getScaleElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory(), false);
31965      }
31966      if (element.hasDuration()) {
31967        composePeriod("duration", element.getDuration());
31968      }
31969  }
31970
31971  protected void composeBodyStructure(String name, BodyStructure element) throws IOException {
31972    if (element != null) {
31973      prop("resourceType", name);
31974      composeBodyStructureInner(element);
31975    }
31976  }
31977
31978  protected void composeBodyStructureInner(BodyStructure element) throws IOException {
31979      composeDomainResourceElements(element);
31980      if (element.hasIdentifier()) {
31981        openArray("identifier");
31982        for (Identifier e : element.getIdentifier()) 
31983          composeIdentifier(null, e);
31984        closeArray();
31985      };
31986      if (element.hasActiveElement()) {
31987        composeBooleanCore("active", element.getActiveElement(), false);
31988        composeBooleanExtras("active", element.getActiveElement(), false);
31989      }
31990      if (element.hasMorphology()) {
31991        composeCodeableConcept("morphology", element.getMorphology());
31992      }
31993      if (element.hasLocation()) {
31994        composeCodeableConcept("location", element.getLocation());
31995      }
31996      if (element.hasLocationQualifier()) {
31997        openArray("locationQualifier");
31998        for (CodeableConcept e : element.getLocationQualifier()) 
31999          composeCodeableConcept(null, e);
32000        closeArray();
32001      };
32002      if (element.hasDescriptionElement()) {
32003        composeStringCore("description", element.getDescriptionElement(), false);
32004        composeStringExtras("description", element.getDescriptionElement(), false);
32005      }
32006      if (element.hasImage()) {
32007        openArray("image");
32008        for (Attachment e : element.getImage()) 
32009          composeAttachment(null, e);
32010        closeArray();
32011      };
32012      if (element.hasPatient()) {
32013        composeReference("patient", element.getPatient());
32014      }
32015  }
32016
32017  protected void composeBundle(String name, Bundle element) throws IOException {
32018    if (element != null) {
32019      prop("resourceType", name);
32020      composeBundleInner(element);
32021    }
32022  }
32023
32024  protected void composeBundleInner(Bundle element) throws IOException {
32025      composeResourceElements(element);
32026      if (element.hasIdentifier()) {
32027        composeIdentifier("identifier", element.getIdentifier());
32028      }
32029      if (element.hasTypeElement()) {
32030        composeEnumerationCore("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
32031        composeEnumerationExtras("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
32032      }
32033      if (element.hasTimestampElement()) {
32034        composeInstantCore("timestamp", element.getTimestampElement(), false);
32035        composeInstantExtras("timestamp", element.getTimestampElement(), false);
32036      }
32037      if (element.hasTotalElement()) {
32038        composeUnsignedIntCore("total", element.getTotalElement(), false);
32039        composeUnsignedIntExtras("total", element.getTotalElement(), false);
32040      }
32041      if (element.hasLink()) {
32042        openArray("link");
32043        for (Bundle.BundleLinkComponent e : element.getLink()) 
32044          composeBundleBundleLinkComponent(null, e);
32045        closeArray();
32046      };
32047      if (element.hasEntry()) {
32048        openArray("entry");
32049        for (Bundle.BundleEntryComponent e : element.getEntry()) 
32050          composeBundleBundleEntryComponent(null, e);
32051        closeArray();
32052      };
32053      if (element.hasSignature()) {
32054        composeSignature("signature", element.getSignature());
32055      }
32056  }
32057
32058  protected void composeBundleBundleLinkComponent(String name, Bundle.BundleLinkComponent element) throws IOException {
32059    if (element != null) {
32060      open(name);
32061      composeBundleBundleLinkComponentInner(element);
32062      close();
32063    }
32064  }
32065
32066  protected void composeBundleBundleLinkComponentInner(Bundle.BundleLinkComponent element) throws IOException {
32067      composeBackbone(element);
32068      if (element.hasRelationElement()) {
32069        composeStringCore("relation", element.getRelationElement(), false);
32070        composeStringExtras("relation", element.getRelationElement(), false);
32071      }
32072      if (element.hasUrlElement()) {
32073        composeUriCore("url", element.getUrlElement(), false);
32074        composeUriExtras("url", element.getUrlElement(), false);
32075      }
32076  }
32077
32078  protected void composeBundleBundleEntryComponent(String name, Bundle.BundleEntryComponent element) throws IOException {
32079    if (element != null) {
32080      open(name);
32081      composeBundleBundleEntryComponentInner(element);
32082      close();
32083    }
32084  }
32085
32086  protected void composeBundleBundleEntryComponentInner(Bundle.BundleEntryComponent element) throws IOException {
32087      composeBackbone(element);
32088      if (element.hasLink()) {
32089        openArray("link");
32090        for (Bundle.BundleLinkComponent e : element.getLink()) 
32091          composeBundleBundleLinkComponent(null, e);
32092        closeArray();
32093      };
32094      if (element.hasFullUrlElement()) {
32095        composeUriCore("fullUrl", element.getFullUrlElement(), false);
32096        composeUriExtras("fullUrl", element.getFullUrlElement(), false);
32097      }
32098        if (element.hasResource()) {
32099          open("resource");
32100          composeResource(element.getResource());
32101          close();
32102        }
32103      if (element.hasSearch()) {
32104        composeBundleBundleEntrySearchComponent("search", element.getSearch());
32105      }
32106      if (element.hasRequest()) {
32107        composeBundleBundleEntryRequestComponent("request", element.getRequest());
32108      }
32109      if (element.hasResponse()) {
32110        composeBundleBundleEntryResponseComponent("response", element.getResponse());
32111      }
32112  }
32113
32114  protected void composeBundleBundleEntrySearchComponent(String name, Bundle.BundleEntrySearchComponent element) throws IOException {
32115    if (element != null) {
32116      open(name);
32117      composeBundleBundleEntrySearchComponentInner(element);
32118      close();
32119    }
32120  }
32121
32122  protected void composeBundleBundleEntrySearchComponentInner(Bundle.BundleEntrySearchComponent element) throws IOException {
32123      composeBackbone(element);
32124      if (element.hasModeElement()) {
32125        composeEnumerationCore("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
32126        composeEnumerationExtras("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
32127      }
32128      if (element.hasScoreElement()) {
32129        composeDecimalCore("score", element.getScoreElement(), false);
32130        composeDecimalExtras("score", element.getScoreElement(), false);
32131      }
32132  }
32133
32134  protected void composeBundleBundleEntryRequestComponent(String name, Bundle.BundleEntryRequestComponent element) throws IOException {
32135    if (element != null) {
32136      open(name);
32137      composeBundleBundleEntryRequestComponentInner(element);
32138      close();
32139    }
32140  }
32141
32142  protected void composeBundleBundleEntryRequestComponentInner(Bundle.BundleEntryRequestComponent element) throws IOException {
32143      composeBackbone(element);
32144      if (element.hasMethodElement()) {
32145        composeEnumerationCore("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
32146        composeEnumerationExtras("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
32147      }
32148      if (element.hasUrlElement()) {
32149        composeUriCore("url", element.getUrlElement(), false);
32150        composeUriExtras("url", element.getUrlElement(), false);
32151      }
32152      if (element.hasIfNoneMatchElement()) {
32153        composeStringCore("ifNoneMatch", element.getIfNoneMatchElement(), false);
32154        composeStringExtras("ifNoneMatch", element.getIfNoneMatchElement(), false);
32155      }
32156      if (element.hasIfModifiedSinceElement()) {
32157        composeInstantCore("ifModifiedSince", element.getIfModifiedSinceElement(), false);
32158        composeInstantExtras("ifModifiedSince", element.getIfModifiedSinceElement(), false);
32159      }
32160      if (element.hasIfMatchElement()) {
32161        composeStringCore("ifMatch", element.getIfMatchElement(), false);
32162        composeStringExtras("ifMatch", element.getIfMatchElement(), false);
32163      }
32164      if (element.hasIfNoneExistElement()) {
32165        composeStringCore("ifNoneExist", element.getIfNoneExistElement(), false);
32166        composeStringExtras("ifNoneExist", element.getIfNoneExistElement(), false);
32167      }
32168  }
32169
32170  protected void composeBundleBundleEntryResponseComponent(String name, Bundle.BundleEntryResponseComponent element) throws IOException {
32171    if (element != null) {
32172      open(name);
32173      composeBundleBundleEntryResponseComponentInner(element);
32174      close();
32175    }
32176  }
32177
32178  protected void composeBundleBundleEntryResponseComponentInner(Bundle.BundleEntryResponseComponent element) throws IOException {
32179      composeBackbone(element);
32180      if (element.hasStatusElement()) {
32181        composeStringCore("status", element.getStatusElement(), false);
32182        composeStringExtras("status", element.getStatusElement(), false);
32183      }
32184      if (element.hasLocationElement()) {
32185        composeUriCore("location", element.getLocationElement(), false);
32186        composeUriExtras("location", element.getLocationElement(), false);
32187      }
32188      if (element.hasEtagElement()) {
32189        composeStringCore("etag", element.getEtagElement(), false);
32190        composeStringExtras("etag", element.getEtagElement(), false);
32191      }
32192      if (element.hasLastModifiedElement()) {
32193        composeInstantCore("lastModified", element.getLastModifiedElement(), false);
32194        composeInstantExtras("lastModified", element.getLastModifiedElement(), false);
32195      }
32196        if (element.hasOutcome()) {
32197          open("outcome");
32198          composeResource(element.getOutcome());
32199          close();
32200        }
32201  }
32202
32203  protected void composeCapabilityStatement(String name, CapabilityStatement element) throws IOException {
32204    if (element != null) {
32205      prop("resourceType", name);
32206      composeCapabilityStatementInner(element);
32207    }
32208  }
32209
32210  protected void composeCapabilityStatementInner(CapabilityStatement element) throws IOException {
32211      composeDomainResourceElements(element);
32212      if (element.hasUrlElement()) {
32213        composeUriCore("url", element.getUrlElement(), false);
32214        composeUriExtras("url", element.getUrlElement(), false);
32215      }
32216      if (element.hasVersionElement()) {
32217        composeStringCore("version", element.getVersionElement(), false);
32218        composeStringExtras("version", element.getVersionElement(), false);
32219      }
32220      if (element.hasNameElement()) {
32221        composeStringCore("name", element.getNameElement(), false);
32222        composeStringExtras("name", element.getNameElement(), false);
32223      }
32224      if (element.hasTitleElement()) {
32225        composeStringCore("title", element.getTitleElement(), false);
32226        composeStringExtras("title", element.getTitleElement(), false);
32227      }
32228      if (element.hasStatusElement()) {
32229        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32230        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32231      }
32232      if (element.hasExperimentalElement()) {
32233        composeBooleanCore("experimental", element.getExperimentalElement(), false);
32234        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
32235      }
32236      if (element.hasDateElement()) {
32237        composeDateTimeCore("date", element.getDateElement(), false);
32238        composeDateTimeExtras("date", element.getDateElement(), false);
32239      }
32240      if (element.hasPublisherElement()) {
32241        composeStringCore("publisher", element.getPublisherElement(), false);
32242        composeStringExtras("publisher", element.getPublisherElement(), false);
32243      }
32244      if (element.hasContact()) {
32245        openArray("contact");
32246        for (ContactDetail e : element.getContact()) 
32247          composeContactDetail(null, e);
32248        closeArray();
32249      };
32250      if (element.hasDescriptionElement()) {
32251        composeMarkdownCore("description", element.getDescriptionElement(), false);
32252        composeMarkdownExtras("description", element.getDescriptionElement(), false);
32253      }
32254      if (element.hasUseContext()) {
32255        openArray("useContext");
32256        for (UsageContext e : element.getUseContext()) 
32257          composeUsageContext(null, e);
32258        closeArray();
32259      };
32260      if (element.hasJurisdiction()) {
32261        openArray("jurisdiction");
32262        for (CodeableConcept e : element.getJurisdiction()) 
32263          composeCodeableConcept(null, e);
32264        closeArray();
32265      };
32266      if (element.hasPurposeElement()) {
32267        composeMarkdownCore("purpose", element.getPurposeElement(), false);
32268        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
32269      }
32270      if (element.hasCopyrightElement()) {
32271        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
32272        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
32273      }
32274      if (element.hasKindElement()) {
32275        composeEnumerationCore("kind", element.getKindElement(), new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
32276        composeEnumerationExtras("kind", element.getKindElement(), new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
32277      }
32278      if (element.hasInstantiates()) {
32279        openArray("instantiates");
32280        for (CanonicalType e : element.getInstantiates()) 
32281          composeCanonicalCore(null, e, true);
32282        closeArray();
32283        if (anyHasExtras(element.getInstantiates())) {
32284          openArray("_instantiates");
32285          for (CanonicalType e : element.getInstantiates()) 
32286            composeCanonicalExtras(null, e, true);
32287          closeArray();
32288        }
32289      };
32290      if (element.hasImports()) {
32291        openArray("imports");
32292        for (CanonicalType e : element.getImports()) 
32293          composeCanonicalCore(null, e, true);
32294        closeArray();
32295        if (anyHasExtras(element.getImports())) {
32296          openArray("_imports");
32297          for (CanonicalType e : element.getImports()) 
32298            composeCanonicalExtras(null, e, true);
32299          closeArray();
32300        }
32301      };
32302      if (element.hasSoftware()) {
32303        composeCapabilityStatementCapabilityStatementSoftwareComponent("software", element.getSoftware());
32304      }
32305      if (element.hasImplementation()) {
32306        composeCapabilityStatementCapabilityStatementImplementationComponent("implementation", element.getImplementation());
32307      }
32308      if (element.hasFhirVersionElement()) {
32309        composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
32310        composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
32311      }
32312      if (element.hasFormat()) {
32313        openArray("format");
32314        for (CodeType e : element.getFormat()) 
32315          composeCodeCore(null, e, true);
32316        closeArray();
32317        if (anyHasExtras(element.getFormat())) {
32318          openArray("_format");
32319          for (CodeType e : element.getFormat()) 
32320            composeCodeExtras(null, e, true);
32321          closeArray();
32322        }
32323      };
32324      if (element.hasPatchFormat()) {
32325        openArray("patchFormat");
32326        for (CodeType e : element.getPatchFormat()) 
32327          composeCodeCore(null, e, true);
32328        closeArray();
32329        if (anyHasExtras(element.getPatchFormat())) {
32330          openArray("_patchFormat");
32331          for (CodeType e : element.getPatchFormat()) 
32332            composeCodeExtras(null, e, true);
32333          closeArray();
32334        }
32335      };
32336      if (element.hasImplementationGuide()) {
32337        openArray("implementationGuide");
32338        for (CanonicalType e : element.getImplementationGuide()) 
32339          composeCanonicalCore(null, e, true);
32340        closeArray();
32341        if (anyHasExtras(element.getImplementationGuide())) {
32342          openArray("_implementationGuide");
32343          for (CanonicalType e : element.getImplementationGuide()) 
32344            composeCanonicalExtras(null, e, true);
32345          closeArray();
32346        }
32347      };
32348      if (element.hasRest()) {
32349        openArray("rest");
32350        for (CapabilityStatement.CapabilityStatementRestComponent e : element.getRest()) 
32351          composeCapabilityStatementCapabilityStatementRestComponent(null, e);
32352        closeArray();
32353      };
32354      if (element.hasMessaging()) {
32355        openArray("messaging");
32356        for (CapabilityStatement.CapabilityStatementMessagingComponent e : element.getMessaging()) 
32357          composeCapabilityStatementCapabilityStatementMessagingComponent(null, e);
32358        closeArray();
32359      };
32360      if (element.hasDocument()) {
32361        openArray("document");
32362        for (CapabilityStatement.CapabilityStatementDocumentComponent e : element.getDocument()) 
32363          composeCapabilityStatementCapabilityStatementDocumentComponent(null, e);
32364        closeArray();
32365      };
32366  }
32367
32368  protected void composeCapabilityStatementCapabilityStatementSoftwareComponent(String name, CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
32369    if (element != null) {
32370      open(name);
32371      composeCapabilityStatementCapabilityStatementSoftwareComponentInner(element);
32372      close();
32373    }
32374  }
32375
32376  protected void composeCapabilityStatementCapabilityStatementSoftwareComponentInner(CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
32377      composeBackbone(element);
32378      if (element.hasNameElement()) {
32379        composeStringCore("name", element.getNameElement(), false);
32380        composeStringExtras("name", element.getNameElement(), false);
32381      }
32382      if (element.hasVersionElement()) {
32383        composeStringCore("version", element.getVersionElement(), false);
32384        composeStringExtras("version", element.getVersionElement(), false);
32385      }
32386      if (element.hasReleaseDateElement()) {
32387        composeDateTimeCore("releaseDate", element.getReleaseDateElement(), false);
32388        composeDateTimeExtras("releaseDate", element.getReleaseDateElement(), false);
32389      }
32390  }
32391
32392  protected void composeCapabilityStatementCapabilityStatementImplementationComponent(String name, CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
32393    if (element != null) {
32394      open(name);
32395      composeCapabilityStatementCapabilityStatementImplementationComponentInner(element);
32396      close();
32397    }
32398  }
32399
32400  protected void composeCapabilityStatementCapabilityStatementImplementationComponentInner(CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
32401      composeBackbone(element);
32402      if (element.hasDescriptionElement()) {
32403        composeStringCore("description", element.getDescriptionElement(), false);
32404        composeStringExtras("description", element.getDescriptionElement(), false);
32405      }
32406      if (element.hasUrlElement()) {
32407        composeUrlCore("url", element.getUrlElement(), false);
32408        composeUrlExtras("url", element.getUrlElement(), false);
32409      }
32410      if (element.hasCustodian()) {
32411        composeReference("custodian", element.getCustodian());
32412      }
32413  }
32414
32415  protected void composeCapabilityStatementCapabilityStatementRestComponent(String name, CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
32416    if (element != null) {
32417      open(name);
32418      composeCapabilityStatementCapabilityStatementRestComponentInner(element);
32419      close();
32420    }
32421  }
32422
32423  protected void composeCapabilityStatementCapabilityStatementRestComponentInner(CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
32424      composeBackbone(element);
32425      if (element.hasModeElement()) {
32426        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
32427        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
32428      }
32429      if (element.hasDocumentationElement()) {
32430        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32431        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32432      }
32433      if (element.hasSecurity()) {
32434        composeCapabilityStatementCapabilityStatementRestSecurityComponent("security", element.getSecurity());
32435      }
32436      if (element.hasResource()) {
32437        openArray("resource");
32438        for (CapabilityStatement.CapabilityStatementRestResourceComponent e : element.getResource()) 
32439          composeCapabilityStatementCapabilityStatementRestResourceComponent(null, e);
32440        closeArray();
32441      };
32442      if (element.hasInteraction()) {
32443        openArray("interaction");
32444        for (CapabilityStatement.SystemInteractionComponent e : element.getInteraction()) 
32445          composeCapabilityStatementSystemInteractionComponent(null, e);
32446        closeArray();
32447      };
32448      if (element.hasSearchParam()) {
32449        openArray("searchParam");
32450        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
32451          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
32452        closeArray();
32453      };
32454      if (element.hasOperation()) {
32455        openArray("operation");
32456        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
32457          composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(null, e);
32458        closeArray();
32459      };
32460      if (element.hasCompartment()) {
32461        openArray("compartment");
32462        for (CanonicalType e : element.getCompartment()) 
32463          composeCanonicalCore(null, e, true);
32464        closeArray();
32465        if (anyHasExtras(element.getCompartment())) {
32466          openArray("_compartment");
32467          for (CanonicalType e : element.getCompartment()) 
32468            composeCanonicalExtras(null, e, true);
32469          closeArray();
32470        }
32471      };
32472  }
32473
32474  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponent(String name, CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
32475    if (element != null) {
32476      open(name);
32477      composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(element);
32478      close();
32479    }
32480  }
32481
32482  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
32483      composeBackbone(element);
32484      if (element.hasCorsElement()) {
32485        composeBooleanCore("cors", element.getCorsElement(), false);
32486        composeBooleanExtras("cors", element.getCorsElement(), false);
32487      }
32488      if (element.hasService()) {
32489        openArray("service");
32490        for (CodeableConcept e : element.getService()) 
32491          composeCodeableConcept(null, e);
32492        closeArray();
32493      };
32494      if (element.hasDescriptionElement()) {
32495        composeMarkdownCore("description", element.getDescriptionElement(), false);
32496        composeMarkdownExtras("description", element.getDescriptionElement(), false);
32497      }
32498  }
32499
32500  protected void composeCapabilityStatementCapabilityStatementRestResourceComponent(String name, CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
32501    if (element != null) {
32502      open(name);
32503      composeCapabilityStatementCapabilityStatementRestResourceComponentInner(element);
32504      close();
32505    }
32506  }
32507
32508  protected void composeCapabilityStatementCapabilityStatementRestResourceComponentInner(CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
32509      composeBackbone(element);
32510      if (element.hasTypeElement()) {
32511        composeCodeCore("type", element.getTypeElement(), false);
32512        composeCodeExtras("type", element.getTypeElement(), false);
32513      }
32514      if (element.hasProfileElement()) {
32515        composeCanonicalCore("profile", element.getProfileElement(), false);
32516        composeCanonicalExtras("profile", element.getProfileElement(), false);
32517      }
32518      if (element.hasSupportedProfile()) {
32519        openArray("supportedProfile");
32520        for (CanonicalType e : element.getSupportedProfile()) 
32521          composeCanonicalCore(null, e, true);
32522        closeArray();
32523        if (anyHasExtras(element.getSupportedProfile())) {
32524          openArray("_supportedProfile");
32525          for (CanonicalType e : element.getSupportedProfile()) 
32526            composeCanonicalExtras(null, e, true);
32527          closeArray();
32528        }
32529      };
32530      if (element.hasDocumentationElement()) {
32531        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32532        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32533      }
32534      if (element.hasInteraction()) {
32535        openArray("interaction");
32536        for (CapabilityStatement.ResourceInteractionComponent e : element.getInteraction()) 
32537          composeCapabilityStatementResourceInteractionComponent(null, e);
32538        closeArray();
32539      };
32540      if (element.hasVersioningElement()) {
32541        composeEnumerationCore("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
32542        composeEnumerationExtras("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
32543      }
32544      if (element.hasReadHistoryElement()) {
32545        composeBooleanCore("readHistory", element.getReadHistoryElement(), false);
32546        composeBooleanExtras("readHistory", element.getReadHistoryElement(), false);
32547      }
32548      if (element.hasUpdateCreateElement()) {
32549        composeBooleanCore("updateCreate", element.getUpdateCreateElement(), false);
32550        composeBooleanExtras("updateCreate", element.getUpdateCreateElement(), false);
32551      }
32552      if (element.hasConditionalCreateElement()) {
32553        composeBooleanCore("conditionalCreate", element.getConditionalCreateElement(), false);
32554        composeBooleanExtras("conditionalCreate", element.getConditionalCreateElement(), false);
32555      }
32556      if (element.hasConditionalReadElement()) {
32557        composeEnumerationCore("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
32558        composeEnumerationExtras("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
32559      }
32560      if (element.hasConditionalUpdateElement()) {
32561        composeBooleanCore("conditionalUpdate", element.getConditionalUpdateElement(), false);
32562        composeBooleanExtras("conditionalUpdate", element.getConditionalUpdateElement(), false);
32563      }
32564      if (element.hasConditionalDeleteElement()) {
32565        composeEnumerationCore("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
32566        composeEnumerationExtras("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
32567      }
32568      if (element.hasReferencePolicy()) {
32569        openArray("referencePolicy");
32570        for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
32571          composeEnumerationCore(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
32572        closeArray();
32573        if (anyHasExtras(element.getReferencePolicy())) {
32574          openArray("_referencePolicy");
32575          for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
32576            composeEnumerationExtras(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
32577          closeArray();
32578        }
32579      };
32580      if (element.hasSearchInclude()) {
32581        openArray("searchInclude");
32582        for (StringType e : element.getSearchInclude()) 
32583          composeStringCore(null, e, true);
32584        closeArray();
32585        if (anyHasExtras(element.getSearchInclude())) {
32586          openArray("_searchInclude");
32587          for (StringType e : element.getSearchInclude()) 
32588            composeStringExtras(null, e, true);
32589          closeArray();
32590        }
32591      };
32592      if (element.hasSearchRevInclude()) {
32593        openArray("searchRevInclude");
32594        for (StringType e : element.getSearchRevInclude()) 
32595          composeStringCore(null, e, true);
32596        closeArray();
32597        if (anyHasExtras(element.getSearchRevInclude())) {
32598          openArray("_searchRevInclude");
32599          for (StringType e : element.getSearchRevInclude()) 
32600            composeStringExtras(null, e, true);
32601          closeArray();
32602        }
32603      };
32604      if (element.hasSearchParam()) {
32605        openArray("searchParam");
32606        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
32607          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
32608        closeArray();
32609      };
32610      if (element.hasOperation()) {
32611        openArray("operation");
32612        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
32613          composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(null, e);
32614        closeArray();
32615      };
32616  }
32617
32618  protected void composeCapabilityStatementResourceInteractionComponent(String name, CapabilityStatement.ResourceInteractionComponent element) throws IOException {
32619    if (element != null) {
32620      open(name);
32621      composeCapabilityStatementResourceInteractionComponentInner(element);
32622      close();
32623    }
32624  }
32625
32626  protected void composeCapabilityStatementResourceInteractionComponentInner(CapabilityStatement.ResourceInteractionComponent element) throws IOException {
32627      composeBackbone(element);
32628      if (element.hasCodeElement()) {
32629        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
32630        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
32631      }
32632      if (element.hasDocumentationElement()) {
32633        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32634        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32635      }
32636  }
32637
32638  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(String name, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
32639    if (element != null) {
32640      open(name);
32641      composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(element);
32642      close();
32643    }
32644  }
32645
32646  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
32647      composeBackbone(element);
32648      if (element.hasNameElement()) {
32649        composeStringCore("name", element.getNameElement(), false);
32650        composeStringExtras("name", element.getNameElement(), false);
32651      }
32652      if (element.hasDefinitionElement()) {
32653        composeCanonicalCore("definition", element.getDefinitionElement(), false);
32654        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
32655      }
32656      if (element.hasTypeElement()) {
32657        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
32658        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
32659      }
32660      if (element.hasDocumentationElement()) {
32661        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32662        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32663      }
32664  }
32665
32666  protected void composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(String name, CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
32667    if (element != null) {
32668      open(name);
32669      composeCapabilityStatementCapabilityStatementRestResourceOperationComponentInner(element);
32670      close();
32671    }
32672  }
32673
32674  protected void composeCapabilityStatementCapabilityStatementRestResourceOperationComponentInner(CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
32675      composeBackbone(element);
32676      if (element.hasNameElement()) {
32677        composeStringCore("name", element.getNameElement(), false);
32678        composeStringExtras("name", element.getNameElement(), false);
32679      }
32680      if (element.hasDefinitionElement()) {
32681        composeCanonicalCore("definition", element.getDefinitionElement(), false);
32682        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
32683      }
32684      if (element.hasDocumentationElement()) {
32685        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32686        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32687      }
32688  }
32689
32690  protected void composeCapabilityStatementSystemInteractionComponent(String name, CapabilityStatement.SystemInteractionComponent element) throws IOException {
32691    if (element != null) {
32692      open(name);
32693      composeCapabilityStatementSystemInteractionComponentInner(element);
32694      close();
32695    }
32696  }
32697
32698  protected void composeCapabilityStatementSystemInteractionComponentInner(CapabilityStatement.SystemInteractionComponent element) throws IOException {
32699      composeBackbone(element);
32700      if (element.hasCodeElement()) {
32701        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
32702        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
32703      }
32704      if (element.hasDocumentationElement()) {
32705        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32706        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32707      }
32708  }
32709
32710  protected void composeCapabilityStatementCapabilityStatementMessagingComponent(String name, CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
32711    if (element != null) {
32712      open(name);
32713      composeCapabilityStatementCapabilityStatementMessagingComponentInner(element);
32714      close();
32715    }
32716  }
32717
32718  protected void composeCapabilityStatementCapabilityStatementMessagingComponentInner(CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
32719      composeBackbone(element);
32720      if (element.hasEndpoint()) {
32721        openArray("endpoint");
32722        for (CapabilityStatement.CapabilityStatementMessagingEndpointComponent e : element.getEndpoint()) 
32723          composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(null, e);
32724        closeArray();
32725      };
32726      if (element.hasReliableCacheElement()) {
32727        composeUnsignedIntCore("reliableCache", element.getReliableCacheElement(), false);
32728        composeUnsignedIntExtras("reliableCache", element.getReliableCacheElement(), false);
32729      }
32730      if (element.hasDocumentationElement()) {
32731        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32732        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32733      }
32734      if (element.hasSupportedMessage()) {
32735        openArray("supportedMessage");
32736        for (CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent e : element.getSupportedMessage()) 
32737          composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(null, e);
32738        closeArray();
32739      };
32740  }
32741
32742  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(String name, CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
32743    if (element != null) {
32744      open(name);
32745      composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(element);
32746      close();
32747    }
32748  }
32749
32750  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
32751      composeBackbone(element);
32752      if (element.hasProtocol()) {
32753        composeCoding("protocol", element.getProtocol());
32754      }
32755      if (element.hasAddressElement()) {
32756        composeUrlCore("address", element.getAddressElement(), false);
32757        composeUrlExtras("address", element.getAddressElement(), false);
32758      }
32759  }
32760
32761  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(String name, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
32762    if (element != null) {
32763      open(name);
32764      composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(element);
32765      close();
32766    }
32767  }
32768
32769  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
32770      composeBackbone(element);
32771      if (element.hasModeElement()) {
32772        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
32773        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
32774      }
32775      if (element.hasDefinitionElement()) {
32776        composeCanonicalCore("definition", element.getDefinitionElement(), false);
32777        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
32778      }
32779  }
32780
32781  protected void composeCapabilityStatementCapabilityStatementDocumentComponent(String name, CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
32782    if (element != null) {
32783      open(name);
32784      composeCapabilityStatementCapabilityStatementDocumentComponentInner(element);
32785      close();
32786    }
32787  }
32788
32789  protected void composeCapabilityStatementCapabilityStatementDocumentComponentInner(CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
32790      composeBackbone(element);
32791      if (element.hasModeElement()) {
32792        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
32793        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
32794      }
32795      if (element.hasDocumentationElement()) {
32796        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32797        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32798      }
32799      if (element.hasProfileElement()) {
32800        composeCanonicalCore("profile", element.getProfileElement(), false);
32801        composeCanonicalExtras("profile", element.getProfileElement(), false);
32802      }
32803  }
32804
32805  protected void composeCarePlan(String name, CarePlan element) throws IOException {
32806    if (element != null) {
32807      prop("resourceType", name);
32808      composeCarePlanInner(element);
32809    }
32810  }
32811
32812  protected void composeCarePlanInner(CarePlan element) throws IOException {
32813      composeDomainResourceElements(element);
32814      if (element.hasIdentifier()) {
32815        openArray("identifier");
32816        for (Identifier e : element.getIdentifier()) 
32817          composeIdentifier(null, e);
32818        closeArray();
32819      };
32820      if (element.hasInstantiatesCanonical()) {
32821        openArray("instantiatesCanonical");
32822        for (CanonicalType e : element.getInstantiatesCanonical()) 
32823          composeCanonicalCore(null, e, true);
32824        closeArray();
32825        if (anyHasExtras(element.getInstantiatesCanonical())) {
32826          openArray("_instantiatesCanonical");
32827          for (CanonicalType e : element.getInstantiatesCanonical()) 
32828            composeCanonicalExtras(null, e, true);
32829          closeArray();
32830        }
32831      };
32832      if (element.hasInstantiatesUri()) {
32833        openArray("instantiatesUri");
32834        for (UriType e : element.getInstantiatesUri()) 
32835          composeUriCore(null, e, true);
32836        closeArray();
32837        if (anyHasExtras(element.getInstantiatesUri())) {
32838          openArray("_instantiatesUri");
32839          for (UriType e : element.getInstantiatesUri()) 
32840            composeUriExtras(null, e, true);
32841          closeArray();
32842        }
32843      };
32844      if (element.hasBasedOn()) {
32845        openArray("basedOn");
32846        for (Reference e : element.getBasedOn()) 
32847          composeReference(null, e);
32848        closeArray();
32849      };
32850      if (element.hasReplaces()) {
32851        openArray("replaces");
32852        for (Reference e : element.getReplaces()) 
32853          composeReference(null, e);
32854        closeArray();
32855      };
32856      if (element.hasPartOf()) {
32857        openArray("partOf");
32858        for (Reference e : element.getPartOf()) 
32859          composeReference(null, e);
32860        closeArray();
32861      };
32862      if (element.hasStatusElement()) {
32863        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
32864        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
32865      }
32866      if (element.hasIntentElement()) {
32867        composeEnumerationCore("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
32868        composeEnumerationExtras("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
32869      }
32870      if (element.hasCategory()) {
32871        openArray("category");
32872        for (CodeableConcept e : element.getCategory()) 
32873          composeCodeableConcept(null, e);
32874        closeArray();
32875      };
32876      if (element.hasTitleElement()) {
32877        composeStringCore("title", element.getTitleElement(), false);
32878        composeStringExtras("title", element.getTitleElement(), false);
32879      }
32880      if (element.hasDescriptionElement()) {
32881        composeStringCore("description", element.getDescriptionElement(), false);
32882        composeStringExtras("description", element.getDescriptionElement(), false);
32883      }
32884      if (element.hasSubject()) {
32885        composeReference("subject", element.getSubject());
32886      }
32887      if (element.hasEncounter()) {
32888        composeReference("encounter", element.getEncounter());
32889      }
32890      if (element.hasPeriod()) {
32891        composePeriod("period", element.getPeriod());
32892      }
32893      if (element.hasCreatedElement()) {
32894        composeDateTimeCore("created", element.getCreatedElement(), false);
32895        composeDateTimeExtras("created", element.getCreatedElement(), false);
32896      }
32897      if (element.hasAuthor()) {
32898        composeReference("author", element.getAuthor());
32899      }
32900      if (element.hasContributor()) {
32901        openArray("contributor");
32902        for (Reference e : element.getContributor()) 
32903          composeReference(null, e);
32904        closeArray();
32905      };
32906      if (element.hasCareTeam()) {
32907        openArray("careTeam");
32908        for (Reference e : element.getCareTeam()) 
32909          composeReference(null, e);
32910        closeArray();
32911      };
32912      if (element.hasAddresses()) {
32913        openArray("addresses");
32914        for (Reference e : element.getAddresses()) 
32915          composeReference(null, e);
32916        closeArray();
32917      };
32918      if (element.hasSupportingInfo()) {
32919        openArray("supportingInfo");
32920        for (Reference e : element.getSupportingInfo()) 
32921          composeReference(null, e);
32922        closeArray();
32923      };
32924      if (element.hasGoal()) {
32925        openArray("goal");
32926        for (Reference e : element.getGoal()) 
32927          composeReference(null, e);
32928        closeArray();
32929      };
32930      if (element.hasActivity()) {
32931        openArray("activity");
32932        for (CarePlan.CarePlanActivityComponent e : element.getActivity()) 
32933          composeCarePlanCarePlanActivityComponent(null, e);
32934        closeArray();
32935      };
32936      if (element.hasNote()) {
32937        openArray("note");
32938        for (Annotation e : element.getNote()) 
32939          composeAnnotation(null, e);
32940        closeArray();
32941      };
32942  }
32943
32944  protected void composeCarePlanCarePlanActivityComponent(String name, CarePlan.CarePlanActivityComponent element) throws IOException {
32945    if (element != null) {
32946      open(name);
32947      composeCarePlanCarePlanActivityComponentInner(element);
32948      close();
32949    }
32950  }
32951
32952  protected void composeCarePlanCarePlanActivityComponentInner(CarePlan.CarePlanActivityComponent element) throws IOException {
32953      composeBackbone(element);
32954      if (element.hasOutcomeCodeableConcept()) {
32955        openArray("outcomeCodeableConcept");
32956        for (CodeableConcept e : element.getOutcomeCodeableConcept()) 
32957          composeCodeableConcept(null, e);
32958        closeArray();
32959      };
32960      if (element.hasOutcomeReference()) {
32961        openArray("outcomeReference");
32962        for (Reference e : element.getOutcomeReference()) 
32963          composeReference(null, e);
32964        closeArray();
32965      };
32966      if (element.hasProgress()) {
32967        openArray("progress");
32968        for (Annotation e : element.getProgress()) 
32969          composeAnnotation(null, e);
32970        closeArray();
32971      };
32972      if (element.hasReference()) {
32973        composeReference("reference", element.getReference());
32974      }
32975      if (element.hasDetail()) {
32976        composeCarePlanCarePlanActivityDetailComponent("detail", element.getDetail());
32977      }
32978  }
32979
32980  protected void composeCarePlanCarePlanActivityDetailComponent(String name, CarePlan.CarePlanActivityDetailComponent element) throws IOException {
32981    if (element != null) {
32982      open(name);
32983      composeCarePlanCarePlanActivityDetailComponentInner(element);
32984      close();
32985    }
32986  }
32987
32988  protected void composeCarePlanCarePlanActivityDetailComponentInner(CarePlan.CarePlanActivityDetailComponent element) throws IOException {
32989      composeBackbone(element);
32990      if (element.hasKindElement()) {
32991        composeEnumerationCore("kind", element.getKindElement(), new CarePlan.CarePlanActivityKindEnumFactory(), false);
32992        composeEnumerationExtras("kind", element.getKindElement(), new CarePlan.CarePlanActivityKindEnumFactory(), false);
32993      }
32994      if (element.hasInstantiatesCanonical()) {
32995        openArray("instantiatesCanonical");
32996        for (CanonicalType e : element.getInstantiatesCanonical()) 
32997          composeCanonicalCore(null, e, true);
32998        closeArray();
32999        if (anyHasExtras(element.getInstantiatesCanonical())) {
33000          openArray("_instantiatesCanonical");
33001          for (CanonicalType e : element.getInstantiatesCanonical()) 
33002            composeCanonicalExtras(null, e, true);
33003          closeArray();
33004        }
33005      };
33006      if (element.hasInstantiatesUri()) {
33007        openArray("instantiatesUri");
33008        for (UriType e : element.getInstantiatesUri()) 
33009          composeUriCore(null, e, true);
33010        closeArray();
33011        if (anyHasExtras(element.getInstantiatesUri())) {
33012          openArray("_instantiatesUri");
33013          for (UriType e : element.getInstantiatesUri()) 
33014            composeUriExtras(null, e, true);
33015          closeArray();
33016        }
33017      };
33018      if (element.hasCode()) {
33019        composeCodeableConcept("code", element.getCode());
33020      }
33021      if (element.hasReasonCode()) {
33022        openArray("reasonCode");
33023        for (CodeableConcept e : element.getReasonCode()) 
33024          composeCodeableConcept(null, e);
33025        closeArray();
33026      };
33027      if (element.hasReasonReference()) {
33028        openArray("reasonReference");
33029        for (Reference e : element.getReasonReference()) 
33030          composeReference(null, e);
33031        closeArray();
33032      };
33033      if (element.hasGoal()) {
33034        openArray("goal");
33035        for (Reference e : element.getGoal()) 
33036          composeReference(null, e);
33037        closeArray();
33038      };
33039      if (element.hasStatusElement()) {
33040        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
33041        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
33042      }
33043      if (element.hasStatusReason()) {
33044        composeCodeableConcept("statusReason", element.getStatusReason());
33045      }
33046      if (element.hasDoNotPerformElement()) {
33047        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
33048        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
33049      }
33050      if (element.hasScheduled()) {
33051        composeType("scheduled", element.getScheduled());
33052      }
33053      if (element.hasLocation()) {
33054        composeReference("location", element.getLocation());
33055      }
33056      if (element.hasPerformer()) {
33057        openArray("performer");
33058        for (Reference e : element.getPerformer()) 
33059          composeReference(null, e);
33060        closeArray();
33061      };
33062      if (element.hasProduct()) {
33063        composeType("product", element.getProduct());
33064      }
33065      if (element.hasDailyAmount()) {
33066        composeQuantity("dailyAmount", element.getDailyAmount());
33067      }
33068      if (element.hasQuantity()) {
33069        composeQuantity("quantity", element.getQuantity());
33070      }
33071      if (element.hasDescriptionElement()) {
33072        composeStringCore("description", element.getDescriptionElement(), false);
33073        composeStringExtras("description", element.getDescriptionElement(), false);
33074      }
33075  }
33076
33077  protected void composeCareTeam(String name, CareTeam element) throws IOException {
33078    if (element != null) {
33079      prop("resourceType", name);
33080      composeCareTeamInner(element);
33081    }
33082  }
33083
33084  protected void composeCareTeamInner(CareTeam element) throws IOException {
33085      composeDomainResourceElements(element);
33086      if (element.hasIdentifier()) {
33087        openArray("identifier");
33088        for (Identifier e : element.getIdentifier()) 
33089          composeIdentifier(null, e);
33090        closeArray();
33091      };
33092      if (element.hasStatusElement()) {
33093        composeEnumerationCore("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
33094        composeEnumerationExtras("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
33095      }
33096      if (element.hasCategory()) {
33097        openArray("category");
33098        for (CodeableConcept e : element.getCategory()) 
33099          composeCodeableConcept(null, e);
33100        closeArray();
33101      };
33102      if (element.hasNameElement()) {
33103        composeStringCore("name", element.getNameElement(), false);
33104        composeStringExtras("name", element.getNameElement(), false);
33105      }
33106      if (element.hasSubject()) {
33107        composeReference("subject", element.getSubject());
33108      }
33109      if (element.hasEncounter()) {
33110        composeReference("encounter", element.getEncounter());
33111      }
33112      if (element.hasPeriod()) {
33113        composePeriod("period", element.getPeriod());
33114      }
33115      if (element.hasParticipant()) {
33116        openArray("participant");
33117        for (CareTeam.CareTeamParticipantComponent e : element.getParticipant()) 
33118          composeCareTeamCareTeamParticipantComponent(null, e);
33119        closeArray();
33120      };
33121      if (element.hasReasonCode()) {
33122        openArray("reasonCode");
33123        for (CodeableConcept e : element.getReasonCode()) 
33124          composeCodeableConcept(null, e);
33125        closeArray();
33126      };
33127      if (element.hasReasonReference()) {
33128        openArray("reasonReference");
33129        for (Reference e : element.getReasonReference()) 
33130          composeReference(null, e);
33131        closeArray();
33132      };
33133      if (element.hasManagingOrganization()) {
33134        openArray("managingOrganization");
33135        for (Reference e : element.getManagingOrganization()) 
33136          composeReference(null, e);
33137        closeArray();
33138      };
33139      if (element.hasTelecom()) {
33140        openArray("telecom");
33141        for (ContactPoint e : element.getTelecom()) 
33142          composeContactPoint(null, e);
33143        closeArray();
33144      };
33145      if (element.hasNote()) {
33146        openArray("note");
33147        for (Annotation e : element.getNote()) 
33148          composeAnnotation(null, e);
33149        closeArray();
33150      };
33151  }
33152
33153  protected void composeCareTeamCareTeamParticipantComponent(String name, CareTeam.CareTeamParticipantComponent element) throws IOException {
33154    if (element != null) {
33155      open(name);
33156      composeCareTeamCareTeamParticipantComponentInner(element);
33157      close();
33158    }
33159  }
33160
33161  protected void composeCareTeamCareTeamParticipantComponentInner(CareTeam.CareTeamParticipantComponent element) throws IOException {
33162      composeBackbone(element);
33163      if (element.hasRole()) {
33164        openArray("role");
33165        for (CodeableConcept e : element.getRole()) 
33166          composeCodeableConcept(null, e);
33167        closeArray();
33168      };
33169      if (element.hasMember()) {
33170        composeReference("member", element.getMember());
33171      }
33172      if (element.hasOnBehalfOf()) {
33173        composeReference("onBehalfOf", element.getOnBehalfOf());
33174      }
33175      if (element.hasPeriod()) {
33176        composePeriod("period", element.getPeriod());
33177      }
33178  }
33179
33180  protected void composeCatalogEntry(String name, CatalogEntry element) throws IOException {
33181    if (element != null) {
33182      prop("resourceType", name);
33183      composeCatalogEntryInner(element);
33184    }
33185  }
33186
33187  protected void composeCatalogEntryInner(CatalogEntry element) throws IOException {
33188      composeDomainResourceElements(element);
33189      if (element.hasIdentifier()) {
33190        openArray("identifier");
33191        for (Identifier e : element.getIdentifier()) 
33192          composeIdentifier(null, e);
33193        closeArray();
33194      };
33195      if (element.hasType()) {
33196        composeCodeableConcept("type", element.getType());
33197      }
33198      if (element.hasOrderableElement()) {
33199        composeBooleanCore("orderable", element.getOrderableElement(), false);
33200        composeBooleanExtras("orderable", element.getOrderableElement(), false);
33201      }
33202      if (element.hasReferencedItem()) {
33203        composeReference("referencedItem", element.getReferencedItem());
33204      }
33205      if (element.hasAdditionalIdentifier()) {
33206        openArray("additionalIdentifier");
33207        for (Identifier e : element.getAdditionalIdentifier()) 
33208          composeIdentifier(null, e);
33209        closeArray();
33210      };
33211      if (element.hasClassification()) {
33212        openArray("classification");
33213        for (CodeableConcept e : element.getClassification()) 
33214          composeCodeableConcept(null, e);
33215        closeArray();
33216      };
33217      if (element.hasStatusElement()) {
33218        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33219        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33220      }
33221      if (element.hasValidityPeriod()) {
33222        composePeriod("validityPeriod", element.getValidityPeriod());
33223      }
33224      if (element.hasValidToElement()) {
33225        composeDateTimeCore("validTo", element.getValidToElement(), false);
33226        composeDateTimeExtras("validTo", element.getValidToElement(), false);
33227      }
33228      if (element.hasLastUpdatedElement()) {
33229        composeDateTimeCore("lastUpdated", element.getLastUpdatedElement(), false);
33230        composeDateTimeExtras("lastUpdated", element.getLastUpdatedElement(), false);
33231      }
33232      if (element.hasAdditionalCharacteristic()) {
33233        openArray("additionalCharacteristic");
33234        for (CodeableConcept e : element.getAdditionalCharacteristic()) 
33235          composeCodeableConcept(null, e);
33236        closeArray();
33237      };
33238      if (element.hasAdditionalClassification()) {
33239        openArray("additionalClassification");
33240        for (CodeableConcept e : element.getAdditionalClassification()) 
33241          composeCodeableConcept(null, e);
33242        closeArray();
33243      };
33244      if (element.hasRelatedEntry()) {
33245        openArray("relatedEntry");
33246        for (CatalogEntry.CatalogEntryRelatedEntryComponent e : element.getRelatedEntry()) 
33247          composeCatalogEntryCatalogEntryRelatedEntryComponent(null, e);
33248        closeArray();
33249      };
33250  }
33251
33252  protected void composeCatalogEntryCatalogEntryRelatedEntryComponent(String name, CatalogEntry.CatalogEntryRelatedEntryComponent element) throws IOException {
33253    if (element != null) {
33254      open(name);
33255      composeCatalogEntryCatalogEntryRelatedEntryComponentInner(element);
33256      close();
33257    }
33258  }
33259
33260  protected void composeCatalogEntryCatalogEntryRelatedEntryComponentInner(CatalogEntry.CatalogEntryRelatedEntryComponent element) throws IOException {
33261      composeBackbone(element);
33262      if (element.hasRelationtypeElement()) {
33263        composeEnumerationCore("relationtype", element.getRelationtypeElement(), new CatalogEntry.CatalogEntryRelationTypeEnumFactory(), false);
33264        composeEnumerationExtras("relationtype", element.getRelationtypeElement(), new CatalogEntry.CatalogEntryRelationTypeEnumFactory(), false);
33265      }
33266      if (element.hasItem()) {
33267        composeReference("item", element.getItem());
33268      }
33269  }
33270
33271  protected void composeChargeItem(String name, ChargeItem element) throws IOException {
33272    if (element != null) {
33273      prop("resourceType", name);
33274      composeChargeItemInner(element);
33275    }
33276  }
33277
33278  protected void composeChargeItemInner(ChargeItem element) throws IOException {
33279      composeDomainResourceElements(element);
33280      if (element.hasIdentifier()) {
33281        openArray("identifier");
33282        for (Identifier e : element.getIdentifier()) 
33283          composeIdentifier(null, e);
33284        closeArray();
33285      };
33286      if (element.hasDefinitionUri()) {
33287        openArray("definitionUri");
33288        for (UriType e : element.getDefinitionUri()) 
33289          composeUriCore(null, e, true);
33290        closeArray();
33291        if (anyHasExtras(element.getDefinitionUri())) {
33292          openArray("_definitionUri");
33293          for (UriType e : element.getDefinitionUri()) 
33294            composeUriExtras(null, e, true);
33295          closeArray();
33296        }
33297      };
33298      if (element.hasDefinitionCanonical()) {
33299        openArray("definitionCanonical");
33300        for (CanonicalType e : element.getDefinitionCanonical()) 
33301          composeCanonicalCore(null, e, true);
33302        closeArray();
33303        if (anyHasExtras(element.getDefinitionCanonical())) {
33304          openArray("_definitionCanonical");
33305          for (CanonicalType e : element.getDefinitionCanonical()) 
33306            composeCanonicalExtras(null, e, true);
33307          closeArray();
33308        }
33309      };
33310      if (element.hasStatusElement()) {
33311        composeEnumerationCore("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
33312        composeEnumerationExtras("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
33313      }
33314      if (element.hasPartOf()) {
33315        openArray("partOf");
33316        for (Reference e : element.getPartOf()) 
33317          composeReference(null, e);
33318        closeArray();
33319      };
33320      if (element.hasCode()) {
33321        composeCodeableConcept("code", element.getCode());
33322      }
33323      if (element.hasSubject()) {
33324        composeReference("subject", element.getSubject());
33325      }
33326      if (element.hasContext()) {
33327        composeReference("context", element.getContext());
33328      }
33329      if (element.hasOccurrence()) {
33330        composeType("occurrence", element.getOccurrence());
33331      }
33332      if (element.hasPerformer()) {
33333        openArray("performer");
33334        for (ChargeItem.ChargeItemPerformerComponent e : element.getPerformer()) 
33335          composeChargeItemChargeItemPerformerComponent(null, e);
33336        closeArray();
33337      };
33338      if (element.hasPerformingOrganization()) {
33339        composeReference("performingOrganization", element.getPerformingOrganization());
33340      }
33341      if (element.hasRequestingOrganization()) {
33342        composeReference("requestingOrganization", element.getRequestingOrganization());
33343      }
33344      if (element.hasCostCenter()) {
33345        composeReference("costCenter", element.getCostCenter());
33346      }
33347      if (element.hasQuantity()) {
33348        composeQuantity("quantity", element.getQuantity());
33349      }
33350      if (element.hasBodysite()) {
33351        openArray("bodysite");
33352        for (CodeableConcept e : element.getBodysite()) 
33353          composeCodeableConcept(null, e);
33354        closeArray();
33355      };
33356      if (element.hasFactorOverrideElement()) {
33357        composeDecimalCore("factorOverride", element.getFactorOverrideElement(), false);
33358        composeDecimalExtras("factorOverride", element.getFactorOverrideElement(), false);
33359      }
33360      if (element.hasPriceOverride()) {
33361        composeMoney("priceOverride", element.getPriceOverride());
33362      }
33363      if (element.hasOverrideReasonElement()) {
33364        composeStringCore("overrideReason", element.getOverrideReasonElement(), false);
33365        composeStringExtras("overrideReason", element.getOverrideReasonElement(), false);
33366      }
33367      if (element.hasEnterer()) {
33368        composeReference("enterer", element.getEnterer());
33369      }
33370      if (element.hasEnteredDateElement()) {
33371        composeDateTimeCore("enteredDate", element.getEnteredDateElement(), false);
33372        composeDateTimeExtras("enteredDate", element.getEnteredDateElement(), false);
33373      }
33374      if (element.hasReason()) {
33375        openArray("reason");
33376        for (CodeableConcept e : element.getReason()) 
33377          composeCodeableConcept(null, e);
33378        closeArray();
33379      };
33380      if (element.hasService()) {
33381        openArray("service");
33382        for (Reference e : element.getService()) 
33383          composeReference(null, e);
33384        closeArray();
33385      };
33386      if (element.hasProduct()) {
33387        composeType("product", element.getProduct());
33388      }
33389      if (element.hasAccount()) {
33390        openArray("account");
33391        for (Reference e : element.getAccount()) 
33392          composeReference(null, e);
33393        closeArray();
33394      };
33395      if (element.hasNote()) {
33396        openArray("note");
33397        for (Annotation e : element.getNote()) 
33398          composeAnnotation(null, e);
33399        closeArray();
33400      };
33401      if (element.hasSupportingInformation()) {
33402        openArray("supportingInformation");
33403        for (Reference e : element.getSupportingInformation()) 
33404          composeReference(null, e);
33405        closeArray();
33406      };
33407  }
33408
33409  protected void composeChargeItemChargeItemPerformerComponent(String name, ChargeItem.ChargeItemPerformerComponent element) throws IOException {
33410    if (element != null) {
33411      open(name);
33412      composeChargeItemChargeItemPerformerComponentInner(element);
33413      close();
33414    }
33415  }
33416
33417  protected void composeChargeItemChargeItemPerformerComponentInner(ChargeItem.ChargeItemPerformerComponent element) throws IOException {
33418      composeBackbone(element);
33419      if (element.hasFunction()) {
33420        composeCodeableConcept("function", element.getFunction());
33421      }
33422      if (element.hasActor()) {
33423        composeReference("actor", element.getActor());
33424      }
33425  }
33426
33427  protected void composeChargeItemDefinition(String name, ChargeItemDefinition element) throws IOException {
33428    if (element != null) {
33429      prop("resourceType", name);
33430      composeChargeItemDefinitionInner(element);
33431    }
33432  }
33433
33434  protected void composeChargeItemDefinitionInner(ChargeItemDefinition element) throws IOException {
33435      composeDomainResourceElements(element);
33436      if (element.hasUrlElement()) {
33437        composeUriCore("url", element.getUrlElement(), false);
33438        composeUriExtras("url", element.getUrlElement(), false);
33439      }
33440      if (element.hasIdentifier()) {
33441        openArray("identifier");
33442        for (Identifier e : element.getIdentifier()) 
33443          composeIdentifier(null, e);
33444        closeArray();
33445      };
33446      if (element.hasVersionElement()) {
33447        composeStringCore("version", element.getVersionElement(), false);
33448        composeStringExtras("version", element.getVersionElement(), false);
33449      }
33450      if (element.hasTitleElement()) {
33451        composeStringCore("title", element.getTitleElement(), false);
33452        composeStringExtras("title", element.getTitleElement(), false);
33453      }
33454      if (element.hasDerivedFromUri()) {
33455        openArray("derivedFromUri");
33456        for (UriType e : element.getDerivedFromUri()) 
33457          composeUriCore(null, e, true);
33458        closeArray();
33459        if (anyHasExtras(element.getDerivedFromUri())) {
33460          openArray("_derivedFromUri");
33461          for (UriType e : element.getDerivedFromUri()) 
33462            composeUriExtras(null, e, true);
33463          closeArray();
33464        }
33465      };
33466      if (element.hasPartOf()) {
33467        openArray("partOf");
33468        for (CanonicalType e : element.getPartOf()) 
33469          composeCanonicalCore(null, e, true);
33470        closeArray();
33471        if (anyHasExtras(element.getPartOf())) {
33472          openArray("_partOf");
33473          for (CanonicalType e : element.getPartOf()) 
33474            composeCanonicalExtras(null, e, true);
33475          closeArray();
33476        }
33477      };
33478      if (element.hasReplaces()) {
33479        openArray("replaces");
33480        for (CanonicalType e : element.getReplaces()) 
33481          composeCanonicalCore(null, e, true);
33482        closeArray();
33483        if (anyHasExtras(element.getReplaces())) {
33484          openArray("_replaces");
33485          for (CanonicalType e : element.getReplaces()) 
33486            composeCanonicalExtras(null, e, true);
33487          closeArray();
33488        }
33489      };
33490      if (element.hasStatusElement()) {
33491        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33492        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33493      }
33494      if (element.hasExperimentalElement()) {
33495        composeBooleanCore("experimental", element.getExperimentalElement(), false);
33496        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
33497      }
33498      if (element.hasDateElement()) {
33499        composeDateTimeCore("date", element.getDateElement(), false);
33500        composeDateTimeExtras("date", element.getDateElement(), false);
33501      }
33502      if (element.hasPublisherElement()) {
33503        composeStringCore("publisher", element.getPublisherElement(), false);
33504        composeStringExtras("publisher", element.getPublisherElement(), false);
33505      }
33506      if (element.hasContact()) {
33507        openArray("contact");
33508        for (ContactDetail e : element.getContact()) 
33509          composeContactDetail(null, e);
33510        closeArray();
33511      };
33512      if (element.hasDescriptionElement()) {
33513        composeMarkdownCore("description", element.getDescriptionElement(), false);
33514        composeMarkdownExtras("description", element.getDescriptionElement(), false);
33515      }
33516      if (element.hasUseContext()) {
33517        openArray("useContext");
33518        for (UsageContext e : element.getUseContext()) 
33519          composeUsageContext(null, e);
33520        closeArray();
33521      };
33522      if (element.hasJurisdiction()) {
33523        openArray("jurisdiction");
33524        for (CodeableConcept e : element.getJurisdiction()) 
33525          composeCodeableConcept(null, e);
33526        closeArray();
33527      };
33528      if (element.hasCopyrightElement()) {
33529        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
33530        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
33531      }
33532      if (element.hasApprovalDateElement()) {
33533        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
33534        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
33535      }
33536      if (element.hasLastReviewDateElement()) {
33537        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
33538        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
33539      }
33540      if (element.hasEffectivePeriod()) {
33541        composePeriod("effectivePeriod", element.getEffectivePeriod());
33542      }
33543      if (element.hasCode()) {
33544        composeCodeableConcept("code", element.getCode());
33545      }
33546      if (element.hasInstance()) {
33547        openArray("instance");
33548        for (Reference e : element.getInstance()) 
33549          composeReference(null, e);
33550        closeArray();
33551      };
33552      if (element.hasApplicability()) {
33553        openArray("applicability");
33554        for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability()) 
33555          composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(null, e);
33556        closeArray();
33557      };
33558      if (element.hasPropertyGroup()) {
33559        openArray("propertyGroup");
33560        for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent e : element.getPropertyGroup()) 
33561          composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(null, e);
33562        closeArray();
33563      };
33564  }
33565
33566  protected void composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(String name, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
33567    if (element != null) {
33568      open(name);
33569      composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponentInner(element);
33570      close();
33571    }
33572  }
33573
33574  protected void composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponentInner(ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
33575      composeBackbone(element);
33576      if (element.hasDescriptionElement()) {
33577        composeStringCore("description", element.getDescriptionElement(), false);
33578        composeStringExtras("description", element.getDescriptionElement(), false);
33579      }
33580      if (element.hasLanguageElement()) {
33581        composeStringCore("language", element.getLanguageElement(), false);
33582        composeStringExtras("language", element.getLanguageElement(), false);
33583      }
33584      if (element.hasExpressionElement()) {
33585        composeStringCore("expression", element.getExpressionElement(), false);
33586        composeStringExtras("expression", element.getExpressionElement(), false);
33587      }
33588  }
33589
33590  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(String name, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
33591    if (element != null) {
33592      open(name);
33593      composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentInner(element);
33594      close();
33595    }
33596  }
33597
33598  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentInner(ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
33599      composeBackbone(element);
33600      if (element.hasApplicability()) {
33601        openArray("applicability");
33602        for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability()) 
33603          composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(null, e);
33604        closeArray();
33605      };
33606      if (element.hasPriceComponent()) {
33607        openArray("priceComponent");
33608        for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent e : element.getPriceComponent()) 
33609          composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(null, e);
33610        closeArray();
33611      };
33612  }
33613
33614  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(String name, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent element) throws IOException {
33615    if (element != null) {
33616      open(name);
33617      composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentInner(element);
33618      close();
33619    }
33620  }
33621
33622  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentInner(ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent element) throws IOException {
33623      composeBackbone(element);
33624      if (element.hasTypeElement()) {
33625        composeEnumerationCore("type", element.getTypeElement(), new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory(), false);
33626        composeEnumerationExtras("type", element.getTypeElement(), new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory(), false);
33627      }
33628      if (element.hasCode()) {
33629        composeCodeableConcept("code", element.getCode());
33630      }
33631      if (element.hasFactorElement()) {
33632        composeDecimalCore("factor", element.getFactorElement(), false);
33633        composeDecimalExtras("factor", element.getFactorElement(), false);
33634      }
33635      if (element.hasAmount()) {
33636        composeMoney("amount", element.getAmount());
33637      }
33638  }
33639
33640  protected void composeClaim(String name, Claim element) throws IOException {
33641    if (element != null) {
33642      prop("resourceType", name);
33643      composeClaimInner(element);
33644    }
33645  }
33646
33647  protected void composeClaimInner(Claim element) throws IOException {
33648      composeDomainResourceElements(element);
33649      if (element.hasIdentifier()) {
33650        openArray("identifier");
33651        for (Identifier e : element.getIdentifier()) 
33652          composeIdentifier(null, e);
33653        closeArray();
33654      };
33655      if (element.hasStatusElement()) {
33656        composeEnumerationCore("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
33657        composeEnumerationExtras("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
33658      }
33659      if (element.hasType()) {
33660        composeCodeableConcept("type", element.getType());
33661      }
33662      if (element.hasSubType()) {
33663        composeCodeableConcept("subType", element.getSubType());
33664      }
33665      if (element.hasUseElement()) {
33666        composeEnumerationCore("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
33667        composeEnumerationExtras("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
33668      }
33669      if (element.hasPatient()) {
33670        composeReference("patient", element.getPatient());
33671      }
33672      if (element.hasBillablePeriod()) {
33673        composePeriod("billablePeriod", element.getBillablePeriod());
33674      }
33675      if (element.hasCreatedElement()) {
33676        composeDateTimeCore("created", element.getCreatedElement(), false);
33677        composeDateTimeExtras("created", element.getCreatedElement(), false);
33678      }
33679      if (element.hasEnterer()) {
33680        composeReference("enterer", element.getEnterer());
33681      }
33682      if (element.hasInsurer()) {
33683        composeReference("insurer", element.getInsurer());
33684      }
33685      if (element.hasProvider()) {
33686        composeReference("provider", element.getProvider());
33687      }
33688      if (element.hasPriority()) {
33689        composeCodeableConcept("priority", element.getPriority());
33690      }
33691      if (element.hasFundsReserve()) {
33692        composeCodeableConcept("fundsReserve", element.getFundsReserve());
33693      }
33694      if (element.hasRelated()) {
33695        openArray("related");
33696        for (Claim.RelatedClaimComponent e : element.getRelated()) 
33697          composeClaimRelatedClaimComponent(null, e);
33698        closeArray();
33699      };
33700      if (element.hasPrescription()) {
33701        composeReference("prescription", element.getPrescription());
33702      }
33703      if (element.hasOriginalPrescription()) {
33704        composeReference("originalPrescription", element.getOriginalPrescription());
33705      }
33706      if (element.hasPayee()) {
33707        composeClaimPayeeComponent("payee", element.getPayee());
33708      }
33709      if (element.hasReferral()) {
33710        composeReference("referral", element.getReferral());
33711      }
33712      if (element.hasFacility()) {
33713        composeReference("facility", element.getFacility());
33714      }
33715      if (element.hasCareTeam()) {
33716        openArray("careTeam");
33717        for (Claim.CareTeamComponent e : element.getCareTeam()) 
33718          composeClaimCareTeamComponent(null, e);
33719        closeArray();
33720      };
33721      if (element.hasSupportingInfo()) {
33722        openArray("supportingInfo");
33723        for (Claim.SupportingInformationComponent e : element.getSupportingInfo()) 
33724          composeClaimSupportingInformationComponent(null, e);
33725        closeArray();
33726      };
33727      if (element.hasDiagnosis()) {
33728        openArray("diagnosis");
33729        for (Claim.DiagnosisComponent e : element.getDiagnosis()) 
33730          composeClaimDiagnosisComponent(null, e);
33731        closeArray();
33732      };
33733      if (element.hasProcedure()) {
33734        openArray("procedure");
33735        for (Claim.ProcedureComponent e : element.getProcedure()) 
33736          composeClaimProcedureComponent(null, e);
33737        closeArray();
33738      };
33739      if (element.hasInsurance()) {
33740        openArray("insurance");
33741        for (Claim.InsuranceComponent e : element.getInsurance()) 
33742          composeClaimInsuranceComponent(null, e);
33743        closeArray();
33744      };
33745      if (element.hasAccident()) {
33746        composeClaimAccidentComponent("accident", element.getAccident());
33747      }
33748      if (element.hasItem()) {
33749        openArray("item");
33750        for (Claim.ItemComponent e : element.getItem()) 
33751          composeClaimItemComponent(null, e);
33752        closeArray();
33753      };
33754      if (element.hasTotal()) {
33755        composeMoney("total", element.getTotal());
33756      }
33757  }
33758
33759  protected void composeClaimRelatedClaimComponent(String name, Claim.RelatedClaimComponent element) throws IOException {
33760    if (element != null) {
33761      open(name);
33762      composeClaimRelatedClaimComponentInner(element);
33763      close();
33764    }
33765  }
33766
33767  protected void composeClaimRelatedClaimComponentInner(Claim.RelatedClaimComponent element) throws IOException {
33768      composeBackbone(element);
33769      if (element.hasClaim()) {
33770        composeReference("claim", element.getClaim());
33771      }
33772      if (element.hasRelationship()) {
33773        composeCodeableConcept("relationship", element.getRelationship());
33774      }
33775      if (element.hasReference()) {
33776        composeIdentifier("reference", element.getReference());
33777      }
33778  }
33779
33780  protected void composeClaimPayeeComponent(String name, Claim.PayeeComponent element) throws IOException {
33781    if (element != null) {
33782      open(name);
33783      composeClaimPayeeComponentInner(element);
33784      close();
33785    }
33786  }
33787
33788  protected void composeClaimPayeeComponentInner(Claim.PayeeComponent element) throws IOException {
33789      composeBackbone(element);
33790      if (element.hasType()) {
33791        composeCodeableConcept("type", element.getType());
33792      }
33793      if (element.hasParty()) {
33794        composeReference("party", element.getParty());
33795      }
33796  }
33797
33798  protected void composeClaimCareTeamComponent(String name, Claim.CareTeamComponent element) throws IOException {
33799    if (element != null) {
33800      open(name);
33801      composeClaimCareTeamComponentInner(element);
33802      close();
33803    }
33804  }
33805
33806  protected void composeClaimCareTeamComponentInner(Claim.CareTeamComponent element) throws IOException {
33807      composeBackbone(element);
33808      if (element.hasSequenceElement()) {
33809        composePositiveIntCore("sequence", element.getSequenceElement(), false);
33810        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
33811      }
33812      if (element.hasProvider()) {
33813        composeReference("provider", element.getProvider());
33814      }
33815      if (element.hasResponsibleElement()) {
33816        composeBooleanCore("responsible", element.getResponsibleElement(), false);
33817        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
33818      }
33819      if (element.hasRole()) {
33820        composeCodeableConcept("role", element.getRole());
33821      }
33822      if (element.hasQualification()) {
33823        composeCodeableConcept("qualification", element.getQualification());
33824      }
33825  }
33826
33827  protected void composeClaimSupportingInformationComponent(String name, Claim.SupportingInformationComponent element) throws IOException {
33828    if (element != null) {
33829      open(name);
33830      composeClaimSupportingInformationComponentInner(element);
33831      close();
33832    }
33833  }
33834
33835  protected void composeClaimSupportingInformationComponentInner(Claim.SupportingInformationComponent element) throws IOException {
33836      composeBackbone(element);
33837      if (element.hasSequenceElement()) {
33838        composePositiveIntCore("sequence", element.getSequenceElement(), false);
33839        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
33840      }
33841      if (element.hasCategory()) {
33842        composeCodeableConcept("category", element.getCategory());
33843      }
33844      if (element.hasCode()) {
33845        composeCodeableConcept("code", element.getCode());
33846      }
33847      if (element.hasTiming()) {
33848        composeType("timing", element.getTiming());
33849      }
33850      if (element.hasValue()) {
33851        composeType("value", element.getValue());
33852      }
33853      if (element.hasReason()) {
33854        composeCodeableConcept("reason", element.getReason());
33855      }
33856  }
33857
33858  protected void composeClaimDiagnosisComponent(String name, Claim.DiagnosisComponent element) throws IOException {
33859    if (element != null) {
33860      open(name);
33861      composeClaimDiagnosisComponentInner(element);
33862      close();
33863    }
33864  }
33865
33866  protected void composeClaimDiagnosisComponentInner(Claim.DiagnosisComponent element) throws IOException {
33867      composeBackbone(element);
33868      if (element.hasSequenceElement()) {
33869        composePositiveIntCore("sequence", element.getSequenceElement(), false);
33870        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
33871      }
33872      if (element.hasDiagnosis()) {
33873        composeType("diagnosis", element.getDiagnosis());
33874      }
33875      if (element.hasType()) {
33876        openArray("type");
33877        for (CodeableConcept e : element.getType()) 
33878          composeCodeableConcept(null, e);
33879        closeArray();
33880      };
33881      if (element.hasOnAdmission()) {
33882        composeCodeableConcept("onAdmission", element.getOnAdmission());
33883      }
33884      if (element.hasPackageCode()) {
33885        composeCodeableConcept("packageCode", element.getPackageCode());
33886      }
33887  }
33888
33889  protected void composeClaimProcedureComponent(String name, Claim.ProcedureComponent element) throws IOException {
33890    if (element != null) {
33891      open(name);
33892      composeClaimProcedureComponentInner(element);
33893      close();
33894    }
33895  }
33896
33897  protected void composeClaimProcedureComponentInner(Claim.ProcedureComponent element) throws IOException {
33898      composeBackbone(element);
33899      if (element.hasSequenceElement()) {
33900        composePositiveIntCore("sequence", element.getSequenceElement(), false);
33901        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
33902      }
33903      if (element.hasType()) {
33904        openArray("type");
33905        for (CodeableConcept e : element.getType()) 
33906          composeCodeableConcept(null, e);
33907        closeArray();
33908      };
33909      if (element.hasDateElement()) {
33910        composeDateTimeCore("date", element.getDateElement(), false);
33911        composeDateTimeExtras("date", element.getDateElement(), false);
33912      }
33913      if (element.hasProcedure()) {
33914        composeType("procedure", element.getProcedure());
33915      }
33916      if (element.hasUdi()) {
33917        openArray("udi");
33918        for (Reference e : element.getUdi()) 
33919          composeReference(null, e);
33920        closeArray();
33921      };
33922  }
33923
33924  protected void composeClaimInsuranceComponent(String name, Claim.InsuranceComponent element) throws IOException {
33925    if (element != null) {
33926      open(name);
33927      composeClaimInsuranceComponentInner(element);
33928      close();
33929    }
33930  }
33931
33932  protected void composeClaimInsuranceComponentInner(Claim.InsuranceComponent element) throws IOException {
33933      composeBackbone(element);
33934      if (element.hasSequenceElement()) {
33935        composePositiveIntCore("sequence", element.getSequenceElement(), false);
33936        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
33937      }
33938      if (element.hasFocalElement()) {
33939        composeBooleanCore("focal", element.getFocalElement(), false);
33940        composeBooleanExtras("focal", element.getFocalElement(), false);
33941      }
33942      if (element.hasIdentifier()) {
33943        composeIdentifier("identifier", element.getIdentifier());
33944      }
33945      if (element.hasCoverage()) {
33946        composeReference("coverage", element.getCoverage());
33947      }
33948      if (element.hasBusinessArrangementElement()) {
33949        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
33950        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
33951      }
33952      if (element.hasPreAuthRef()) {
33953        openArray("preAuthRef");
33954        for (StringType e : element.getPreAuthRef()) 
33955          composeStringCore(null, e, true);
33956        closeArray();
33957        if (anyHasExtras(element.getPreAuthRef())) {
33958          openArray("_preAuthRef");
33959          for (StringType e : element.getPreAuthRef()) 
33960            composeStringExtras(null, e, true);
33961          closeArray();
33962        }
33963      };
33964      if (element.hasClaimResponse()) {
33965        composeReference("claimResponse", element.getClaimResponse());
33966      }
33967  }
33968
33969  protected void composeClaimAccidentComponent(String name, Claim.AccidentComponent element) throws IOException {
33970    if (element != null) {
33971      open(name);
33972      composeClaimAccidentComponentInner(element);
33973      close();
33974    }
33975  }
33976
33977  protected void composeClaimAccidentComponentInner(Claim.AccidentComponent element) throws IOException {
33978      composeBackbone(element);
33979      if (element.hasDateElement()) {
33980        composeDateCore("date", element.getDateElement(), false);
33981        composeDateExtras("date", element.getDateElement(), false);
33982      }
33983      if (element.hasType()) {
33984        composeCodeableConcept("type", element.getType());
33985      }
33986      if (element.hasLocation()) {
33987        composeType("location", element.getLocation());
33988      }
33989  }
33990
33991  protected void composeClaimItemComponent(String name, Claim.ItemComponent element) throws IOException {
33992    if (element != null) {
33993      open(name);
33994      composeClaimItemComponentInner(element);
33995      close();
33996    }
33997  }
33998
33999  protected void composeClaimItemComponentInner(Claim.ItemComponent element) throws IOException {
34000      composeBackbone(element);
34001      if (element.hasSequenceElement()) {
34002        composePositiveIntCore("sequence", element.getSequenceElement(), false);
34003        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
34004      }
34005      if (element.hasCareTeamSequence()) {
34006        openArray("careTeamSequence");
34007        for (PositiveIntType e : element.getCareTeamSequence()) 
34008          composePositiveIntCore(null, e, true);
34009        closeArray();
34010        if (anyHasExtras(element.getCareTeamSequence())) {
34011          openArray("_careTeamSequence");
34012          for (PositiveIntType e : element.getCareTeamSequence()) 
34013            composePositiveIntExtras(null, e, true);
34014          closeArray();
34015        }
34016      };
34017      if (element.hasDiagnosisSequence()) {
34018        openArray("diagnosisSequence");
34019        for (PositiveIntType e : element.getDiagnosisSequence()) 
34020          composePositiveIntCore(null, e, true);
34021        closeArray();
34022        if (anyHasExtras(element.getDiagnosisSequence())) {
34023          openArray("_diagnosisSequence");
34024          for (PositiveIntType e : element.getDiagnosisSequence()) 
34025            composePositiveIntExtras(null, e, true);
34026          closeArray();
34027        }
34028      };
34029      if (element.hasProcedureSequence()) {
34030        openArray("procedureSequence");
34031        for (PositiveIntType e : element.getProcedureSequence()) 
34032          composePositiveIntCore(null, e, true);
34033        closeArray();
34034        if (anyHasExtras(element.getProcedureSequence())) {
34035          openArray("_procedureSequence");
34036          for (PositiveIntType e : element.getProcedureSequence()) 
34037            composePositiveIntExtras(null, e, true);
34038          closeArray();
34039        }
34040      };
34041      if (element.hasInformationSequence()) {
34042        openArray("informationSequence");
34043        for (PositiveIntType e : element.getInformationSequence()) 
34044          composePositiveIntCore(null, e, true);
34045        closeArray();
34046        if (anyHasExtras(element.getInformationSequence())) {
34047          openArray("_informationSequence");
34048          for (PositiveIntType e : element.getInformationSequence()) 
34049            composePositiveIntExtras(null, e, true);
34050          closeArray();
34051        }
34052      };
34053      if (element.hasRevenue()) {
34054        composeCodeableConcept("revenue", element.getRevenue());
34055      }
34056      if (element.hasCategory()) {
34057        composeCodeableConcept("category", element.getCategory());
34058      }
34059      if (element.hasProductOrService()) {
34060        composeCodeableConcept("productOrService", element.getProductOrService());
34061      }
34062      if (element.hasModifier()) {
34063        openArray("modifier");
34064        for (CodeableConcept e : element.getModifier()) 
34065          composeCodeableConcept(null, e);
34066        closeArray();
34067      };
34068      if (element.hasProgramCode()) {
34069        openArray("programCode");
34070        for (CodeableConcept e : element.getProgramCode()) 
34071          composeCodeableConcept(null, e);
34072        closeArray();
34073      };
34074      if (element.hasServiced()) {
34075        composeType("serviced", element.getServiced());
34076      }
34077      if (element.hasLocation()) {
34078        composeType("location", element.getLocation());
34079      }
34080      if (element.hasQuantity()) {
34081        composeQuantity("quantity", element.getQuantity());
34082      }
34083      if (element.hasUnitPrice()) {
34084        composeMoney("unitPrice", element.getUnitPrice());
34085      }
34086      if (element.hasFactorElement()) {
34087        composeDecimalCore("factor", element.getFactorElement(), false);
34088        composeDecimalExtras("factor", element.getFactorElement(), false);
34089      }
34090      if (element.hasNet()) {
34091        composeMoney("net", element.getNet());
34092      }
34093      if (element.hasUdi()) {
34094        openArray("udi");
34095        for (Reference e : element.getUdi()) 
34096          composeReference(null, e);
34097        closeArray();
34098      };
34099      if (element.hasBodySite()) {
34100        composeCodeableConcept("bodySite", element.getBodySite());
34101      }
34102      if (element.hasSubSite()) {
34103        openArray("subSite");
34104        for (CodeableConcept e : element.getSubSite()) 
34105          composeCodeableConcept(null, e);
34106        closeArray();
34107      };
34108      if (element.hasEncounter()) {
34109        openArray("encounter");
34110        for (Reference e : element.getEncounter()) 
34111          composeReference(null, e);
34112        closeArray();
34113      };
34114      if (element.hasDetail()) {
34115        openArray("detail");
34116        for (Claim.DetailComponent e : element.getDetail()) 
34117          composeClaimDetailComponent(null, e);
34118        closeArray();
34119      };
34120  }
34121
34122  protected void composeClaimDetailComponent(String name, Claim.DetailComponent element) throws IOException {
34123    if (element != null) {
34124      open(name);
34125      composeClaimDetailComponentInner(element);
34126      close();
34127    }
34128  }
34129
34130  protected void composeClaimDetailComponentInner(Claim.DetailComponent element) throws IOException {
34131      composeBackbone(element);
34132      if (element.hasSequenceElement()) {
34133        composePositiveIntCore("sequence", element.getSequenceElement(), false);
34134        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
34135      }
34136      if (element.hasRevenue()) {
34137        composeCodeableConcept("revenue", element.getRevenue());
34138      }
34139      if (element.hasCategory()) {
34140        composeCodeableConcept("category", element.getCategory());
34141      }
34142      if (element.hasProductOrService()) {
34143        composeCodeableConcept("productOrService", element.getProductOrService());
34144      }
34145      if (element.hasModifier()) {
34146        openArray("modifier");
34147        for (CodeableConcept e : element.getModifier()) 
34148          composeCodeableConcept(null, e);
34149        closeArray();
34150      };
34151      if (element.hasProgramCode()) {
34152        openArray("programCode");
34153        for (CodeableConcept e : element.getProgramCode()) 
34154          composeCodeableConcept(null, e);
34155        closeArray();
34156      };
34157      if (element.hasQuantity()) {
34158        composeQuantity("quantity", element.getQuantity());
34159      }
34160      if (element.hasUnitPrice()) {
34161        composeMoney("unitPrice", element.getUnitPrice());
34162      }
34163      if (element.hasFactorElement()) {
34164        composeDecimalCore("factor", element.getFactorElement(), false);
34165        composeDecimalExtras("factor", element.getFactorElement(), false);
34166      }
34167      if (element.hasNet()) {
34168        composeMoney("net", element.getNet());
34169      }
34170      if (element.hasUdi()) {
34171        openArray("udi");
34172        for (Reference e : element.getUdi()) 
34173          composeReference(null, e);
34174        closeArray();
34175      };
34176      if (element.hasSubDetail()) {
34177        openArray("subDetail");
34178        for (Claim.SubDetailComponent e : element.getSubDetail()) 
34179          composeClaimSubDetailComponent(null, e);
34180        closeArray();
34181      };
34182  }
34183
34184  protected void composeClaimSubDetailComponent(String name, Claim.SubDetailComponent element) throws IOException {
34185    if (element != null) {
34186      open(name);
34187      composeClaimSubDetailComponentInner(element);
34188      close();
34189    }
34190  }
34191
34192  protected void composeClaimSubDetailComponentInner(Claim.SubDetailComponent element) throws IOException {
34193      composeBackbone(element);
34194      if (element.hasSequenceElement()) {
34195        composePositiveIntCore("sequence", element.getSequenceElement(), false);
34196        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
34197      }
34198      if (element.hasRevenue()) {
34199        composeCodeableConcept("revenue", element.getRevenue());
34200      }
34201      if (element.hasCategory()) {
34202        composeCodeableConcept("category", element.getCategory());
34203      }
34204      if (element.hasProductOrService()) {
34205        composeCodeableConcept("productOrService", element.getProductOrService());
34206      }
34207      if (element.hasModifier()) {
34208        openArray("modifier");
34209        for (CodeableConcept e : element.getModifier()) 
34210          composeCodeableConcept(null, e);
34211        closeArray();
34212      };
34213      if (element.hasProgramCode()) {
34214        openArray("programCode");
34215        for (CodeableConcept e : element.getProgramCode()) 
34216          composeCodeableConcept(null, e);
34217        closeArray();
34218      };
34219      if (element.hasQuantity()) {
34220        composeQuantity("quantity", element.getQuantity());
34221      }
34222      if (element.hasUnitPrice()) {
34223        composeMoney("unitPrice", element.getUnitPrice());
34224      }
34225      if (element.hasFactorElement()) {
34226        composeDecimalCore("factor", element.getFactorElement(), false);
34227        composeDecimalExtras("factor", element.getFactorElement(), false);
34228      }
34229      if (element.hasNet()) {
34230        composeMoney("net", element.getNet());
34231      }
34232      if (element.hasUdi()) {
34233        openArray("udi");
34234        for (Reference e : element.getUdi()) 
34235          composeReference(null, e);
34236        closeArray();
34237      };
34238  }
34239
34240  protected void composeClaimResponse(String name, ClaimResponse element) throws IOException {
34241    if (element != null) {
34242      prop("resourceType", name);
34243      composeClaimResponseInner(element);
34244    }
34245  }
34246
34247  protected void composeClaimResponseInner(ClaimResponse element) throws IOException {
34248      composeDomainResourceElements(element);
34249      if (element.hasIdentifier()) {
34250        openArray("identifier");
34251        for (Identifier e : element.getIdentifier()) 
34252          composeIdentifier(null, e);
34253        closeArray();
34254      };
34255      if (element.hasStatusElement()) {
34256        composeEnumerationCore("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(), false);
34257        composeEnumerationExtras("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(), false);
34258      }
34259      if (element.hasType()) {
34260        composeCodeableConcept("type", element.getType());
34261      }
34262      if (element.hasSubType()) {
34263        composeCodeableConcept("subType", element.getSubType());
34264      }
34265      if (element.hasUseElement()) {
34266        composeEnumerationCore("use", element.getUseElement(), new ClaimResponse.UseEnumFactory(), false);
34267        composeEnumerationExtras("use", element.getUseElement(), new ClaimResponse.UseEnumFactory(), false);
34268      }
34269      if (element.hasPatient()) {
34270        composeReference("patient", element.getPatient());
34271      }
34272      if (element.hasCreatedElement()) {
34273        composeDateTimeCore("created", element.getCreatedElement(), false);
34274        composeDateTimeExtras("created", element.getCreatedElement(), false);
34275      }
34276      if (element.hasInsurer()) {
34277        composeReference("insurer", element.getInsurer());
34278      }
34279      if (element.hasRequestor()) {
34280        composeReference("requestor", element.getRequestor());
34281      }
34282      if (element.hasRequest()) {
34283        composeReference("request", element.getRequest());
34284      }
34285      if (element.hasOutcomeElement()) {
34286        composeEnumerationCore("outcome", element.getOutcomeElement(), new ClaimResponse.RemittanceOutcomeEnumFactory(), false);
34287        composeEnumerationExtras("outcome", element.getOutcomeElement(), new ClaimResponse.RemittanceOutcomeEnumFactory(), false);
34288      }
34289      if (element.hasDispositionElement()) {
34290        composeStringCore("disposition", element.getDispositionElement(), false);
34291        composeStringExtras("disposition", element.getDispositionElement(), false);
34292      }
34293      if (element.hasPreAuthRefElement()) {
34294        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
34295        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
34296      }
34297      if (element.hasPreAuthPeriod()) {
34298        composePeriod("preAuthPeriod", element.getPreAuthPeriod());
34299      }
34300      if (element.hasPayeeType()) {
34301        composeCodeableConcept("payeeType", element.getPayeeType());
34302      }
34303      if (element.hasItem()) {
34304        openArray("item");
34305        for (ClaimResponse.ItemComponent e : element.getItem()) 
34306          composeClaimResponseItemComponent(null, e);
34307        closeArray();
34308      };
34309      if (element.hasAddItem()) {
34310        openArray("addItem");
34311        for (ClaimResponse.AddedItemComponent e : element.getAddItem()) 
34312          composeClaimResponseAddedItemComponent(null, e);
34313        closeArray();
34314      };
34315      if (element.hasAdjudication()) {
34316        openArray("adjudication");
34317        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
34318          composeClaimResponseAdjudicationComponent(null, e);
34319        closeArray();
34320      };
34321      if (element.hasTotal()) {
34322        openArray("total");
34323        for (ClaimResponse.TotalComponent e : element.getTotal()) 
34324          composeClaimResponseTotalComponent(null, e);
34325        closeArray();
34326      };
34327      if (element.hasPayment()) {
34328        composeClaimResponsePaymentComponent("payment", element.getPayment());
34329      }
34330      if (element.hasFundsReserve()) {
34331        composeCodeableConcept("fundsReserve", element.getFundsReserve());
34332      }
34333      if (element.hasFormCode()) {
34334        composeCodeableConcept("formCode", element.getFormCode());
34335      }
34336      if (element.hasForm()) {
34337        composeAttachment("form", element.getForm());
34338      }
34339      if (element.hasProcessNote()) {
34340        openArray("processNote");
34341        for (ClaimResponse.NoteComponent e : element.getProcessNote()) 
34342          composeClaimResponseNoteComponent(null, e);
34343        closeArray();
34344      };
34345      if (element.hasCommunicationRequest()) {
34346        openArray("communicationRequest");
34347        for (Reference e : element.getCommunicationRequest()) 
34348          composeReference(null, e);
34349        closeArray();
34350      };
34351      if (element.hasInsurance()) {
34352        openArray("insurance");
34353        for (ClaimResponse.InsuranceComponent e : element.getInsurance()) 
34354          composeClaimResponseInsuranceComponent(null, e);
34355        closeArray();
34356      };
34357      if (element.hasError()) {
34358        openArray("error");
34359        for (ClaimResponse.ErrorComponent e : element.getError()) 
34360          composeClaimResponseErrorComponent(null, e);
34361        closeArray();
34362      };
34363  }
34364
34365  protected void composeClaimResponseItemComponent(String name, ClaimResponse.ItemComponent element) throws IOException {
34366    if (element != null) {
34367      open(name);
34368      composeClaimResponseItemComponentInner(element);
34369      close();
34370    }
34371  }
34372
34373  protected void composeClaimResponseItemComponentInner(ClaimResponse.ItemComponent element) throws IOException {
34374      composeBackbone(element);
34375      if (element.hasItemSequenceElement()) {
34376        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
34377        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
34378      }
34379      if (element.hasNoteNumber()) {
34380        openArray("noteNumber");
34381        for (PositiveIntType e : element.getNoteNumber()) 
34382          composePositiveIntCore(null, e, true);
34383        closeArray();
34384        if (anyHasExtras(element.getNoteNumber())) {
34385          openArray("_noteNumber");
34386          for (PositiveIntType e : element.getNoteNumber()) 
34387            composePositiveIntExtras(null, e, true);
34388          closeArray();
34389        }
34390      };
34391      if (element.hasAdjudication()) {
34392        openArray("adjudication");
34393        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
34394          composeClaimResponseAdjudicationComponent(null, e);
34395        closeArray();
34396      };
34397      if (element.hasDetail()) {
34398        openArray("detail");
34399        for (ClaimResponse.ItemDetailComponent e : element.getDetail()) 
34400          composeClaimResponseItemDetailComponent(null, e);
34401        closeArray();
34402      };
34403  }
34404
34405  protected void composeClaimResponseAdjudicationComponent(String name, ClaimResponse.AdjudicationComponent element) throws IOException {
34406    if (element != null) {
34407      open(name);
34408      composeClaimResponseAdjudicationComponentInner(element);
34409      close();
34410    }
34411  }
34412
34413  protected void composeClaimResponseAdjudicationComponentInner(ClaimResponse.AdjudicationComponent element) throws IOException {
34414      composeBackbone(element);
34415      if (element.hasCategory()) {
34416        composeCodeableConcept("category", element.getCategory());
34417      }
34418      if (element.hasReason()) {
34419        composeCodeableConcept("reason", element.getReason());
34420      }
34421      if (element.hasAmount()) {
34422        composeMoney("amount", element.getAmount());
34423      }
34424      if (element.hasValueElement()) {
34425        composeDecimalCore("value", element.getValueElement(), false);
34426        composeDecimalExtras("value", element.getValueElement(), false);
34427      }
34428  }
34429
34430  protected void composeClaimResponseItemDetailComponent(String name, ClaimResponse.ItemDetailComponent element) throws IOException {
34431    if (element != null) {
34432      open(name);
34433      composeClaimResponseItemDetailComponentInner(element);
34434      close();
34435    }
34436  }
34437
34438  protected void composeClaimResponseItemDetailComponentInner(ClaimResponse.ItemDetailComponent element) throws IOException {
34439      composeBackbone(element);
34440      if (element.hasDetailSequenceElement()) {
34441        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
34442        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
34443      }
34444      if (element.hasNoteNumber()) {
34445        openArray("noteNumber");
34446        for (PositiveIntType e : element.getNoteNumber()) 
34447          composePositiveIntCore(null, e, true);
34448        closeArray();
34449        if (anyHasExtras(element.getNoteNumber())) {
34450          openArray("_noteNumber");
34451          for (PositiveIntType e : element.getNoteNumber()) 
34452            composePositiveIntExtras(null, e, true);
34453          closeArray();
34454        }
34455      };
34456      if (element.hasAdjudication()) {
34457        openArray("adjudication");
34458        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
34459          composeClaimResponseAdjudicationComponent(null, e);
34460        closeArray();
34461      };
34462      if (element.hasSubDetail()) {
34463        openArray("subDetail");
34464        for (ClaimResponse.SubDetailComponent e : element.getSubDetail()) 
34465          composeClaimResponseSubDetailComponent(null, e);
34466        closeArray();
34467      };
34468  }
34469
34470  protected void composeClaimResponseSubDetailComponent(String name, ClaimResponse.SubDetailComponent element) throws IOException {
34471    if (element != null) {
34472      open(name);
34473      composeClaimResponseSubDetailComponentInner(element);
34474      close();
34475    }
34476  }
34477
34478  protected void composeClaimResponseSubDetailComponentInner(ClaimResponse.SubDetailComponent element) throws IOException {
34479      composeBackbone(element);
34480      if (element.hasSubDetailSequenceElement()) {
34481        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
34482        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
34483      }
34484      if (element.hasNoteNumber()) {
34485        openArray("noteNumber");
34486        for (PositiveIntType e : element.getNoteNumber()) 
34487          composePositiveIntCore(null, e, true);
34488        closeArray();
34489        if (anyHasExtras(element.getNoteNumber())) {
34490          openArray("_noteNumber");
34491          for (PositiveIntType e : element.getNoteNumber()) 
34492            composePositiveIntExtras(null, e, true);
34493          closeArray();
34494        }
34495      };
34496      if (element.hasAdjudication()) {
34497        openArray("adjudication");
34498        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
34499          composeClaimResponseAdjudicationComponent(null, e);
34500        closeArray();
34501      };
34502  }
34503
34504  protected void composeClaimResponseAddedItemComponent(String name, ClaimResponse.AddedItemComponent element) throws IOException {
34505    if (element != null) {
34506      open(name);
34507      composeClaimResponseAddedItemComponentInner(element);
34508      close();
34509    }
34510  }
34511
34512  protected void composeClaimResponseAddedItemComponentInner(ClaimResponse.AddedItemComponent element) throws IOException {
34513      composeBackbone(element);
34514      if (element.hasItemSequence()) {
34515        openArray("itemSequence");
34516        for (PositiveIntType e : element.getItemSequence()) 
34517          composePositiveIntCore(null, e, true);
34518        closeArray();
34519        if (anyHasExtras(element.getItemSequence())) {
34520          openArray("_itemSequence");
34521          for (PositiveIntType e : element.getItemSequence()) 
34522            composePositiveIntExtras(null, e, true);
34523          closeArray();
34524        }
34525      };
34526      if (element.hasDetailSequence()) {
34527        openArray("detailSequence");
34528        for (PositiveIntType e : element.getDetailSequence()) 
34529          composePositiveIntCore(null, e, true);
34530        closeArray();
34531        if (anyHasExtras(element.getDetailSequence())) {
34532          openArray("_detailSequence");
34533          for (PositiveIntType e : element.getDetailSequence()) 
34534            composePositiveIntExtras(null, e, true);
34535          closeArray();
34536        }
34537      };
34538      if (element.hasSubdetailSequence()) {
34539        openArray("subdetailSequence");
34540        for (PositiveIntType e : element.getSubdetailSequence()) 
34541          composePositiveIntCore(null, e, true);
34542        closeArray();
34543        if (anyHasExtras(element.getSubdetailSequence())) {
34544          openArray("_subdetailSequence");
34545          for (PositiveIntType e : element.getSubdetailSequence()) 
34546            composePositiveIntExtras(null, e, true);
34547          closeArray();
34548        }
34549      };
34550      if (element.hasProvider()) {
34551        openArray("provider");
34552        for (Reference e : element.getProvider()) 
34553          composeReference(null, e);
34554        closeArray();
34555      };
34556      if (element.hasProductOrService()) {
34557        composeCodeableConcept("productOrService", element.getProductOrService());
34558      }
34559      if (element.hasModifier()) {
34560        openArray("modifier");
34561        for (CodeableConcept e : element.getModifier()) 
34562          composeCodeableConcept(null, e);
34563        closeArray();
34564      };
34565      if (element.hasProgramCode()) {
34566        openArray("programCode");
34567        for (CodeableConcept e : element.getProgramCode()) 
34568          composeCodeableConcept(null, e);
34569        closeArray();
34570      };
34571      if (element.hasServiced()) {
34572        composeType("serviced", element.getServiced());
34573      }
34574      if (element.hasLocation()) {
34575        composeType("location", element.getLocation());
34576      }
34577      if (element.hasQuantity()) {
34578        composeQuantity("quantity", element.getQuantity());
34579      }
34580      if (element.hasUnitPrice()) {
34581        composeMoney("unitPrice", element.getUnitPrice());
34582      }
34583      if (element.hasFactorElement()) {
34584        composeDecimalCore("factor", element.getFactorElement(), false);
34585        composeDecimalExtras("factor", element.getFactorElement(), false);
34586      }
34587      if (element.hasNet()) {
34588        composeMoney("net", element.getNet());
34589      }
34590      if (element.hasBodySite()) {
34591        composeCodeableConcept("bodySite", element.getBodySite());
34592      }
34593      if (element.hasSubSite()) {
34594        openArray("subSite");
34595        for (CodeableConcept e : element.getSubSite()) 
34596          composeCodeableConcept(null, e);
34597        closeArray();
34598      };
34599      if (element.hasNoteNumber()) {
34600        openArray("noteNumber");
34601        for (PositiveIntType e : element.getNoteNumber()) 
34602          composePositiveIntCore(null, e, true);
34603        closeArray();
34604        if (anyHasExtras(element.getNoteNumber())) {
34605          openArray("_noteNumber");
34606          for (PositiveIntType e : element.getNoteNumber()) 
34607            composePositiveIntExtras(null, e, true);
34608          closeArray();
34609        }
34610      };
34611      if (element.hasAdjudication()) {
34612        openArray("adjudication");
34613        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
34614          composeClaimResponseAdjudicationComponent(null, e);
34615        closeArray();
34616      };
34617      if (element.hasDetail()) {
34618        openArray("detail");
34619        for (ClaimResponse.AddedItemDetailComponent e : element.getDetail()) 
34620          composeClaimResponseAddedItemDetailComponent(null, e);
34621        closeArray();
34622      };
34623  }
34624
34625  protected void composeClaimResponseAddedItemDetailComponent(String name, ClaimResponse.AddedItemDetailComponent element) throws IOException {
34626    if (element != null) {
34627      open(name);
34628      composeClaimResponseAddedItemDetailComponentInner(element);
34629      close();
34630    }
34631  }
34632
34633  protected void composeClaimResponseAddedItemDetailComponentInner(ClaimResponse.AddedItemDetailComponent element) throws IOException {
34634      composeBackbone(element);
34635      if (element.hasProductOrService()) {
34636        composeCodeableConcept("productOrService", element.getProductOrService());
34637      }
34638      if (element.hasModifier()) {
34639        openArray("modifier");
34640        for (CodeableConcept e : element.getModifier()) 
34641          composeCodeableConcept(null, e);
34642        closeArray();
34643      };
34644      if (element.hasQuantity()) {
34645        composeQuantity("quantity", element.getQuantity());
34646      }
34647      if (element.hasUnitPrice()) {
34648        composeMoney("unitPrice", element.getUnitPrice());
34649      }
34650      if (element.hasFactorElement()) {
34651        composeDecimalCore("factor", element.getFactorElement(), false);
34652        composeDecimalExtras("factor", element.getFactorElement(), false);
34653      }
34654      if (element.hasNet()) {
34655        composeMoney("net", element.getNet());
34656      }
34657      if (element.hasNoteNumber()) {
34658        openArray("noteNumber");
34659        for (PositiveIntType e : element.getNoteNumber()) 
34660          composePositiveIntCore(null, e, true);
34661        closeArray();
34662        if (anyHasExtras(element.getNoteNumber())) {
34663          openArray("_noteNumber");
34664          for (PositiveIntType e : element.getNoteNumber()) 
34665            composePositiveIntExtras(null, e, true);
34666          closeArray();
34667        }
34668      };
34669      if (element.hasAdjudication()) {
34670        openArray("adjudication");
34671        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
34672          composeClaimResponseAdjudicationComponent(null, e);
34673        closeArray();
34674      };
34675      if (element.hasSubDetail()) {
34676        openArray("subDetail");
34677        for (ClaimResponse.AddedItemSubDetailComponent e : element.getSubDetail()) 
34678          composeClaimResponseAddedItemSubDetailComponent(null, e);
34679        closeArray();
34680      };
34681  }
34682
34683  protected void composeClaimResponseAddedItemSubDetailComponent(String name, ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
34684    if (element != null) {
34685      open(name);
34686      composeClaimResponseAddedItemSubDetailComponentInner(element);
34687      close();
34688    }
34689  }
34690
34691  protected void composeClaimResponseAddedItemSubDetailComponentInner(ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
34692      composeBackbone(element);
34693      if (element.hasProductOrService()) {
34694        composeCodeableConcept("productOrService", element.getProductOrService());
34695      }
34696      if (element.hasModifier()) {
34697        openArray("modifier");
34698        for (CodeableConcept e : element.getModifier()) 
34699          composeCodeableConcept(null, e);
34700        closeArray();
34701      };
34702      if (element.hasQuantity()) {
34703        composeQuantity("quantity", element.getQuantity());
34704      }
34705      if (element.hasUnitPrice()) {
34706        composeMoney("unitPrice", element.getUnitPrice());
34707      }
34708      if (element.hasFactorElement()) {
34709        composeDecimalCore("factor", element.getFactorElement(), false);
34710        composeDecimalExtras("factor", element.getFactorElement(), false);
34711      }
34712      if (element.hasNet()) {
34713        composeMoney("net", element.getNet());
34714      }
34715      if (element.hasNoteNumber()) {
34716        openArray("noteNumber");
34717        for (PositiveIntType e : element.getNoteNumber()) 
34718          composePositiveIntCore(null, e, true);
34719        closeArray();
34720        if (anyHasExtras(element.getNoteNumber())) {
34721          openArray("_noteNumber");
34722          for (PositiveIntType e : element.getNoteNumber()) 
34723            composePositiveIntExtras(null, e, true);
34724          closeArray();
34725        }
34726      };
34727      if (element.hasAdjudication()) {
34728        openArray("adjudication");
34729        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
34730          composeClaimResponseAdjudicationComponent(null, e);
34731        closeArray();
34732      };
34733  }
34734
34735  protected void composeClaimResponseTotalComponent(String name, ClaimResponse.TotalComponent element) throws IOException {
34736    if (element != null) {
34737      open(name);
34738      composeClaimResponseTotalComponentInner(element);
34739      close();
34740    }
34741  }
34742
34743  protected void composeClaimResponseTotalComponentInner(ClaimResponse.TotalComponent element) throws IOException {
34744      composeBackbone(element);
34745      if (element.hasCategory()) {
34746        composeCodeableConcept("category", element.getCategory());
34747      }
34748      if (element.hasAmount()) {
34749        composeMoney("amount", element.getAmount());
34750      }
34751  }
34752
34753  protected void composeClaimResponsePaymentComponent(String name, ClaimResponse.PaymentComponent element) throws IOException {
34754    if (element != null) {
34755      open(name);
34756      composeClaimResponsePaymentComponentInner(element);
34757      close();
34758    }
34759  }
34760
34761  protected void composeClaimResponsePaymentComponentInner(ClaimResponse.PaymentComponent element) throws IOException {
34762      composeBackbone(element);
34763      if (element.hasType()) {
34764        composeCodeableConcept("type", element.getType());
34765      }
34766      if (element.hasAdjustment()) {
34767        composeMoney("adjustment", element.getAdjustment());
34768      }
34769      if (element.hasAdjustmentReason()) {
34770        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
34771      }
34772      if (element.hasDateElement()) {
34773        composeDateCore("date", element.getDateElement(), false);
34774        composeDateExtras("date", element.getDateElement(), false);
34775      }
34776      if (element.hasAmount()) {
34777        composeMoney("amount", element.getAmount());
34778      }
34779      if (element.hasIdentifier()) {
34780        composeIdentifier("identifier", element.getIdentifier());
34781      }
34782  }
34783
34784  protected void composeClaimResponseNoteComponent(String name, ClaimResponse.NoteComponent element) throws IOException {
34785    if (element != null) {
34786      open(name);
34787      composeClaimResponseNoteComponentInner(element);
34788      close();
34789    }
34790  }
34791
34792  protected void composeClaimResponseNoteComponentInner(ClaimResponse.NoteComponent element) throws IOException {
34793      composeBackbone(element);
34794      if (element.hasNumberElement()) {
34795        composePositiveIntCore("number", element.getNumberElement(), false);
34796        composePositiveIntExtras("number", element.getNumberElement(), false);
34797      }
34798      if (element.hasTypeElement()) {
34799        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
34800        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
34801      }
34802      if (element.hasTextElement()) {
34803        composeStringCore("text", element.getTextElement(), false);
34804        composeStringExtras("text", element.getTextElement(), false);
34805      }
34806      if (element.hasLanguage()) {
34807        composeCodeableConcept("language", element.getLanguage());
34808      }
34809  }
34810
34811  protected void composeClaimResponseInsuranceComponent(String name, ClaimResponse.InsuranceComponent element) throws IOException {
34812    if (element != null) {
34813      open(name);
34814      composeClaimResponseInsuranceComponentInner(element);
34815      close();
34816    }
34817  }
34818
34819  protected void composeClaimResponseInsuranceComponentInner(ClaimResponse.InsuranceComponent element) throws IOException {
34820      composeBackbone(element);
34821      if (element.hasSequenceElement()) {
34822        composePositiveIntCore("sequence", element.getSequenceElement(), false);
34823        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
34824      }
34825      if (element.hasFocalElement()) {
34826        composeBooleanCore("focal", element.getFocalElement(), false);
34827        composeBooleanExtras("focal", element.getFocalElement(), false);
34828      }
34829      if (element.hasCoverage()) {
34830        composeReference("coverage", element.getCoverage());
34831      }
34832      if (element.hasBusinessArrangementElement()) {
34833        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
34834        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
34835      }
34836      if (element.hasClaimResponse()) {
34837        composeReference("claimResponse", element.getClaimResponse());
34838      }
34839  }
34840
34841  protected void composeClaimResponseErrorComponent(String name, ClaimResponse.ErrorComponent element) throws IOException {
34842    if (element != null) {
34843      open(name);
34844      composeClaimResponseErrorComponentInner(element);
34845      close();
34846    }
34847  }
34848
34849  protected void composeClaimResponseErrorComponentInner(ClaimResponse.ErrorComponent element) throws IOException {
34850      composeBackbone(element);
34851      if (element.hasItemSequenceElement()) {
34852        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
34853        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
34854      }
34855      if (element.hasDetailSequenceElement()) {
34856        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
34857        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
34858      }
34859      if (element.hasSubDetailSequenceElement()) {
34860        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
34861        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
34862      }
34863      if (element.hasCode()) {
34864        composeCodeableConcept("code", element.getCode());
34865      }
34866  }
34867
34868  protected void composeClinicalImpression(String name, ClinicalImpression element) throws IOException {
34869    if (element != null) {
34870      prop("resourceType", name);
34871      composeClinicalImpressionInner(element);
34872    }
34873  }
34874
34875  protected void composeClinicalImpressionInner(ClinicalImpression element) throws IOException {
34876      composeDomainResourceElements(element);
34877      if (element.hasIdentifier()) {
34878        openArray("identifier");
34879        for (Identifier e : element.getIdentifier()) 
34880          composeIdentifier(null, e);
34881        closeArray();
34882      };
34883      if (element.hasStatusElement()) {
34884        composeEnumerationCore("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
34885        composeEnumerationExtras("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
34886      }
34887      if (element.hasStatusReason()) {
34888        composeCodeableConcept("statusReason", element.getStatusReason());
34889      }
34890      if (element.hasCode()) {
34891        composeCodeableConcept("code", element.getCode());
34892      }
34893      if (element.hasDescriptionElement()) {
34894        composeStringCore("description", element.getDescriptionElement(), false);
34895        composeStringExtras("description", element.getDescriptionElement(), false);
34896      }
34897      if (element.hasSubject()) {
34898        composeReference("subject", element.getSubject());
34899      }
34900      if (element.hasEncounter()) {
34901        composeReference("encounter", element.getEncounter());
34902      }
34903      if (element.hasEffective()) {
34904        composeType("effective", element.getEffective());
34905      }
34906      if (element.hasDateElement()) {
34907        composeDateTimeCore("date", element.getDateElement(), false);
34908        composeDateTimeExtras("date", element.getDateElement(), false);
34909      }
34910      if (element.hasAssessor()) {
34911        composeReference("assessor", element.getAssessor());
34912      }
34913      if (element.hasPrevious()) {
34914        composeReference("previous", element.getPrevious());
34915      }
34916      if (element.hasProblem()) {
34917        openArray("problem");
34918        for (Reference e : element.getProblem()) 
34919          composeReference(null, e);
34920        closeArray();
34921      };
34922      if (element.hasInvestigation()) {
34923        openArray("investigation");
34924        for (ClinicalImpression.ClinicalImpressionInvestigationComponent e : element.getInvestigation()) 
34925          composeClinicalImpressionClinicalImpressionInvestigationComponent(null, e);
34926        closeArray();
34927      };
34928      if (element.hasProtocol()) {
34929        openArray("protocol");
34930        for (UriType e : element.getProtocol()) 
34931          composeUriCore(null, e, true);
34932        closeArray();
34933        if (anyHasExtras(element.getProtocol())) {
34934          openArray("_protocol");
34935          for (UriType e : element.getProtocol()) 
34936            composeUriExtras(null, e, true);
34937          closeArray();
34938        }
34939      };
34940      if (element.hasSummaryElement()) {
34941        composeStringCore("summary", element.getSummaryElement(), false);
34942        composeStringExtras("summary", element.getSummaryElement(), false);
34943      }
34944      if (element.hasFinding()) {
34945        openArray("finding");
34946        for (ClinicalImpression.ClinicalImpressionFindingComponent e : element.getFinding()) 
34947          composeClinicalImpressionClinicalImpressionFindingComponent(null, e);
34948        closeArray();
34949      };
34950      if (element.hasPrognosisCodeableConcept()) {
34951        openArray("prognosisCodeableConcept");
34952        for (CodeableConcept e : element.getPrognosisCodeableConcept()) 
34953          composeCodeableConcept(null, e);
34954        closeArray();
34955      };
34956      if (element.hasPrognosisReference()) {
34957        openArray("prognosisReference");
34958        for (Reference e : element.getPrognosisReference()) 
34959          composeReference(null, e);
34960        closeArray();
34961      };
34962      if (element.hasSupportingInfo()) {
34963        openArray("supportingInfo");
34964        for (Reference e : element.getSupportingInfo()) 
34965          composeReference(null, e);
34966        closeArray();
34967      };
34968      if (element.hasNote()) {
34969        openArray("note");
34970        for (Annotation e : element.getNote()) 
34971          composeAnnotation(null, e);
34972        closeArray();
34973      };
34974  }
34975
34976  protected void composeClinicalImpressionClinicalImpressionInvestigationComponent(String name, ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
34977    if (element != null) {
34978      open(name);
34979      composeClinicalImpressionClinicalImpressionInvestigationComponentInner(element);
34980      close();
34981    }
34982  }
34983
34984  protected void composeClinicalImpressionClinicalImpressionInvestigationComponentInner(ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
34985      composeBackbone(element);
34986      if (element.hasCode()) {
34987        composeCodeableConcept("code", element.getCode());
34988      }
34989      if (element.hasItem()) {
34990        openArray("item");
34991        for (Reference e : element.getItem()) 
34992          composeReference(null, e);
34993        closeArray();
34994      };
34995  }
34996
34997  protected void composeClinicalImpressionClinicalImpressionFindingComponent(String name, ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
34998    if (element != null) {
34999      open(name);
35000      composeClinicalImpressionClinicalImpressionFindingComponentInner(element);
35001      close();
35002    }
35003  }
35004
35005  protected void composeClinicalImpressionClinicalImpressionFindingComponentInner(ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
35006      composeBackbone(element);
35007      if (element.hasItemCodeableConcept()) {
35008        composeCodeableConcept("itemCodeableConcept", element.getItemCodeableConcept());
35009      }
35010      if (element.hasItemReference()) {
35011        composeReference("itemReference", element.getItemReference());
35012      }
35013      if (element.hasBasisElement()) {
35014        composeStringCore("basis", element.getBasisElement(), false);
35015        composeStringExtras("basis", element.getBasisElement(), false);
35016      }
35017  }
35018
35019  protected void composeCodeSystem(String name, CodeSystem element) throws IOException {
35020    if (element != null) {
35021      prop("resourceType", name);
35022      composeCodeSystemInner(element);
35023    }
35024  }
35025
35026  protected void composeCodeSystemInner(CodeSystem element) throws IOException {
35027      composeDomainResourceElements(element);
35028      if (element.hasUrlElement()) {
35029        composeUriCore("url", element.getUrlElement(), false);
35030        composeUriExtras("url", element.getUrlElement(), false);
35031      }
35032      if (element.hasIdentifier()) {
35033        openArray("identifier");
35034        for (Identifier e : element.getIdentifier()) 
35035          composeIdentifier(null, e);
35036        closeArray();
35037      };
35038      if (element.hasVersionElement()) {
35039        composeStringCore("version", element.getVersionElement(), false);
35040        composeStringExtras("version", element.getVersionElement(), false);
35041      }
35042      if (element.hasNameElement()) {
35043        composeStringCore("name", element.getNameElement(), false);
35044        composeStringExtras("name", element.getNameElement(), false);
35045      }
35046      if (element.hasTitleElement()) {
35047        composeStringCore("title", element.getTitleElement(), false);
35048        composeStringExtras("title", element.getTitleElement(), false);
35049      }
35050      if (element.hasStatusElement()) {
35051        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35052        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35053      }
35054      if (element.hasExperimentalElement()) {
35055        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35056        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35057      }
35058      if (element.hasDateElement()) {
35059        composeDateTimeCore("date", element.getDateElement(), false);
35060        composeDateTimeExtras("date", element.getDateElement(), false);
35061      }
35062      if (element.hasPublisherElement()) {
35063        composeStringCore("publisher", element.getPublisherElement(), false);
35064        composeStringExtras("publisher", element.getPublisherElement(), false);
35065      }
35066      if (element.hasContact()) {
35067        openArray("contact");
35068        for (ContactDetail e : element.getContact()) 
35069          composeContactDetail(null, e);
35070        closeArray();
35071      };
35072      if (element.hasDescriptionElement()) {
35073        composeMarkdownCore("description", element.getDescriptionElement(), false);
35074        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35075      }
35076      if (element.hasUseContext()) {
35077        openArray("useContext");
35078        for (UsageContext e : element.getUseContext()) 
35079          composeUsageContext(null, e);
35080        closeArray();
35081      };
35082      if (element.hasJurisdiction()) {
35083        openArray("jurisdiction");
35084        for (CodeableConcept e : element.getJurisdiction()) 
35085          composeCodeableConcept(null, e);
35086        closeArray();
35087      };
35088      if (element.hasPurposeElement()) {
35089        composeMarkdownCore("purpose", element.getPurposeElement(), false);
35090        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
35091      }
35092      if (element.hasCopyrightElement()) {
35093        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
35094        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
35095      }
35096      if (element.hasCaseSensitiveElement()) {
35097        composeBooleanCore("caseSensitive", element.getCaseSensitiveElement(), false);
35098        composeBooleanExtras("caseSensitive", element.getCaseSensitiveElement(), false);
35099      }
35100      if (element.hasValueSetElement()) {
35101        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
35102        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
35103      }
35104      if (element.hasHierarchyMeaningElement()) {
35105        composeEnumerationCore("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
35106        composeEnumerationExtras("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
35107      }
35108      if (element.hasCompositionalElement()) {
35109        composeBooleanCore("compositional", element.getCompositionalElement(), false);
35110        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
35111      }
35112      if (element.hasVersionNeededElement()) {
35113        composeBooleanCore("versionNeeded", element.getVersionNeededElement(), false);
35114        composeBooleanExtras("versionNeeded", element.getVersionNeededElement(), false);
35115      }
35116      if (element.hasContentElement()) {
35117        composeEnumerationCore("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
35118        composeEnumerationExtras("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
35119      }
35120      if (element.hasSupplementsElement()) {
35121        composeCanonicalCore("supplements", element.getSupplementsElement(), false);
35122        composeCanonicalExtras("supplements", element.getSupplementsElement(), false);
35123      }
35124      if (element.hasCountElement()) {
35125        composeUnsignedIntCore("count", element.getCountElement(), false);
35126        composeUnsignedIntExtras("count", element.getCountElement(), false);
35127      }
35128      if (element.hasFilter()) {
35129        openArray("filter");
35130        for (CodeSystem.CodeSystemFilterComponent e : element.getFilter()) 
35131          composeCodeSystemCodeSystemFilterComponent(null, e);
35132        closeArray();
35133      };
35134      if (element.hasProperty()) {
35135        openArray("property");
35136        for (CodeSystem.PropertyComponent e : element.getProperty()) 
35137          composeCodeSystemPropertyComponent(null, e);
35138        closeArray();
35139      };
35140      if (element.hasConcept()) {
35141        openArray("concept");
35142        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
35143          composeCodeSystemConceptDefinitionComponent(null, e);
35144        closeArray();
35145      };
35146  }
35147
35148  protected void composeCodeSystemCodeSystemFilterComponent(String name, CodeSystem.CodeSystemFilterComponent element) throws IOException {
35149    if (element != null) {
35150      open(name);
35151      composeCodeSystemCodeSystemFilterComponentInner(element);
35152      close();
35153    }
35154  }
35155
35156  protected void composeCodeSystemCodeSystemFilterComponentInner(CodeSystem.CodeSystemFilterComponent element) throws IOException {
35157      composeBackbone(element);
35158      if (element.hasCodeElement()) {
35159        composeCodeCore("code", element.getCodeElement(), false);
35160        composeCodeExtras("code", element.getCodeElement(), false);
35161      }
35162      if (element.hasDescriptionElement()) {
35163        composeStringCore("description", element.getDescriptionElement(), false);
35164        composeStringExtras("description", element.getDescriptionElement(), false);
35165      }
35166      if (element.hasOperator()) {
35167        openArray("operator");
35168        for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator()) 
35169          composeEnumerationCore(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
35170        closeArray();
35171        if (anyHasExtras(element.getOperator())) {
35172          openArray("_operator");
35173          for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator()) 
35174            composeEnumerationExtras(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
35175          closeArray();
35176        }
35177      };
35178      if (element.hasValueElement()) {
35179        composeStringCore("value", element.getValueElement(), false);
35180        composeStringExtras("value", element.getValueElement(), false);
35181      }
35182  }
35183
35184  protected void composeCodeSystemPropertyComponent(String name, CodeSystem.PropertyComponent element) throws IOException {
35185    if (element != null) {
35186      open(name);
35187      composeCodeSystemPropertyComponentInner(element);
35188      close();
35189    }
35190  }
35191
35192  protected void composeCodeSystemPropertyComponentInner(CodeSystem.PropertyComponent element) throws IOException {
35193      composeBackbone(element);
35194      if (element.hasCodeElement()) {
35195        composeCodeCore("code", element.getCodeElement(), false);
35196        composeCodeExtras("code", element.getCodeElement(), false);
35197      }
35198      if (element.hasUriElement()) {
35199        composeUriCore("uri", element.getUriElement(), false);
35200        composeUriExtras("uri", element.getUriElement(), false);
35201      }
35202      if (element.hasDescriptionElement()) {
35203        composeStringCore("description", element.getDescriptionElement(), false);
35204        composeStringExtras("description", element.getDescriptionElement(), false);
35205      }
35206      if (element.hasTypeElement()) {
35207        composeEnumerationCore("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
35208        composeEnumerationExtras("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
35209      }
35210  }
35211
35212  protected void composeCodeSystemConceptDefinitionComponent(String name, CodeSystem.ConceptDefinitionComponent element) throws IOException {
35213    if (element != null) {
35214      open(name);
35215      composeCodeSystemConceptDefinitionComponentInner(element);
35216      close();
35217    }
35218  }
35219
35220  protected void composeCodeSystemConceptDefinitionComponentInner(CodeSystem.ConceptDefinitionComponent element) throws IOException {
35221      composeBackbone(element);
35222      if (element.hasCodeElement()) {
35223        composeCodeCore("code", element.getCodeElement(), false);
35224        composeCodeExtras("code", element.getCodeElement(), false);
35225      }
35226      if (element.hasDisplayElement()) {
35227        composeStringCore("display", element.getDisplayElement(), false);
35228        composeStringExtras("display", element.getDisplayElement(), false);
35229      }
35230      if (element.hasDefinitionElement()) {
35231        composeStringCore("definition", element.getDefinitionElement(), false);
35232        composeStringExtras("definition", element.getDefinitionElement(), false);
35233      }
35234      if (element.hasDesignation()) {
35235        openArray("designation");
35236        for (CodeSystem.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
35237          composeCodeSystemConceptDefinitionDesignationComponent(null, e);
35238        closeArray();
35239      };
35240      if (element.hasProperty()) {
35241        openArray("property");
35242        for (CodeSystem.ConceptPropertyComponent e : element.getProperty()) 
35243          composeCodeSystemConceptPropertyComponent(null, e);
35244        closeArray();
35245      };
35246      if (element.hasConcept()) {
35247        openArray("concept");
35248        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
35249          composeCodeSystemConceptDefinitionComponent(null, e);
35250        closeArray();
35251      };
35252  }
35253
35254  protected void composeCodeSystemConceptDefinitionDesignationComponent(String name, CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
35255    if (element != null) {
35256      open(name);
35257      composeCodeSystemConceptDefinitionDesignationComponentInner(element);
35258      close();
35259    }
35260  }
35261
35262  protected void composeCodeSystemConceptDefinitionDesignationComponentInner(CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
35263      composeBackbone(element);
35264      if (element.hasLanguageElement()) {
35265        composeCodeCore("language", element.getLanguageElement(), false);
35266        composeCodeExtras("language", element.getLanguageElement(), false);
35267      }
35268      if (element.hasUse()) {
35269        composeCoding("use", element.getUse());
35270      }
35271      if (element.hasValueElement()) {
35272        composeStringCore("value", element.getValueElement(), false);
35273        composeStringExtras("value", element.getValueElement(), false);
35274      }
35275  }
35276
35277  protected void composeCodeSystemConceptPropertyComponent(String name, CodeSystem.ConceptPropertyComponent element) throws IOException {
35278    if (element != null) {
35279      open(name);
35280      composeCodeSystemConceptPropertyComponentInner(element);
35281      close();
35282    }
35283  }
35284
35285  protected void composeCodeSystemConceptPropertyComponentInner(CodeSystem.ConceptPropertyComponent element) throws IOException {
35286      composeBackbone(element);
35287      if (element.hasCodeElement()) {
35288        composeCodeCore("code", element.getCodeElement(), false);
35289        composeCodeExtras("code", element.getCodeElement(), false);
35290      }
35291      if (element.hasValue()) {
35292        composeType("value", element.getValue());
35293      }
35294  }
35295
35296  protected void composeCommunication(String name, Communication element) throws IOException {
35297    if (element != null) {
35298      prop("resourceType", name);
35299      composeCommunicationInner(element);
35300    }
35301  }
35302
35303  protected void composeCommunicationInner(Communication element) throws IOException {
35304      composeDomainResourceElements(element);
35305      if (element.hasIdentifier()) {
35306        openArray("identifier");
35307        for (Identifier e : element.getIdentifier()) 
35308          composeIdentifier(null, e);
35309        closeArray();
35310      };
35311      if (element.hasInstantiatesCanonical()) {
35312        openArray("instantiatesCanonical");
35313        for (CanonicalType e : element.getInstantiatesCanonical()) 
35314          composeCanonicalCore(null, e, true);
35315        closeArray();
35316        if (anyHasExtras(element.getInstantiatesCanonical())) {
35317          openArray("_instantiatesCanonical");
35318          for (CanonicalType e : element.getInstantiatesCanonical()) 
35319            composeCanonicalExtras(null, e, true);
35320          closeArray();
35321        }
35322      };
35323      if (element.hasInstantiatesUri()) {
35324        openArray("instantiatesUri");
35325        for (UriType e : element.getInstantiatesUri()) 
35326          composeUriCore(null, e, true);
35327        closeArray();
35328        if (anyHasExtras(element.getInstantiatesUri())) {
35329          openArray("_instantiatesUri");
35330          for (UriType e : element.getInstantiatesUri()) 
35331            composeUriExtras(null, e, true);
35332          closeArray();
35333        }
35334      };
35335      if (element.hasBasedOn()) {
35336        openArray("basedOn");
35337        for (Reference e : element.getBasedOn()) 
35338          composeReference(null, e);
35339        closeArray();
35340      };
35341      if (element.hasPartOf()) {
35342        openArray("partOf");
35343        for (Reference e : element.getPartOf()) 
35344          composeReference(null, e);
35345        closeArray();
35346      };
35347      if (element.hasInResponseTo()) {
35348        openArray("inResponseTo");
35349        for (Reference e : element.getInResponseTo()) 
35350          composeReference(null, e);
35351        closeArray();
35352      };
35353      if (element.hasStatusElement()) {
35354        composeEnumerationCore("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
35355        composeEnumerationExtras("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
35356      }
35357      if (element.hasStatusReason()) {
35358        composeCodeableConcept("statusReason", element.getStatusReason());
35359      }
35360      if (element.hasCategory()) {
35361        openArray("category");
35362        for (CodeableConcept e : element.getCategory()) 
35363          composeCodeableConcept(null, e);
35364        closeArray();
35365      };
35366      if (element.hasPriorityElement()) {
35367        composeEnumerationCore("priority", element.getPriorityElement(), new Communication.CommunicationPriorityEnumFactory(), false);
35368        composeEnumerationExtras("priority", element.getPriorityElement(), new Communication.CommunicationPriorityEnumFactory(), false);
35369      }
35370      if (element.hasMedium()) {
35371        openArray("medium");
35372        for (CodeableConcept e : element.getMedium()) 
35373          composeCodeableConcept(null, e);
35374        closeArray();
35375      };
35376      if (element.hasSubject()) {
35377        composeReference("subject", element.getSubject());
35378      }
35379      if (element.hasTopic()) {
35380        composeCodeableConcept("topic", element.getTopic());
35381      }
35382      if (element.hasAbout()) {
35383        openArray("about");
35384        for (Reference e : element.getAbout()) 
35385          composeReference(null, e);
35386        closeArray();
35387      };
35388      if (element.hasEncounter()) {
35389        composeReference("encounter", element.getEncounter());
35390      }
35391      if (element.hasSentElement()) {
35392        composeDateTimeCore("sent", element.getSentElement(), false);
35393        composeDateTimeExtras("sent", element.getSentElement(), false);
35394      }
35395      if (element.hasReceivedElement()) {
35396        composeDateTimeCore("received", element.getReceivedElement(), false);
35397        composeDateTimeExtras("received", element.getReceivedElement(), false);
35398      }
35399      if (element.hasRecipient()) {
35400        openArray("recipient");
35401        for (Reference e : element.getRecipient()) 
35402          composeReference(null, e);
35403        closeArray();
35404      };
35405      if (element.hasSender()) {
35406        composeReference("sender", element.getSender());
35407      }
35408      if (element.hasReasonCode()) {
35409        openArray("reasonCode");
35410        for (CodeableConcept e : element.getReasonCode()) 
35411          composeCodeableConcept(null, e);
35412        closeArray();
35413      };
35414      if (element.hasReasonReference()) {
35415        openArray("reasonReference");
35416        for (Reference e : element.getReasonReference()) 
35417          composeReference(null, e);
35418        closeArray();
35419      };
35420      if (element.hasPayload()) {
35421        openArray("payload");
35422        for (Communication.CommunicationPayloadComponent e : element.getPayload()) 
35423          composeCommunicationCommunicationPayloadComponent(null, e);
35424        closeArray();
35425      };
35426      if (element.hasNote()) {
35427        openArray("note");
35428        for (Annotation e : element.getNote()) 
35429          composeAnnotation(null, e);
35430        closeArray();
35431      };
35432  }
35433
35434  protected void composeCommunicationCommunicationPayloadComponent(String name, Communication.CommunicationPayloadComponent element) throws IOException {
35435    if (element != null) {
35436      open(name);
35437      composeCommunicationCommunicationPayloadComponentInner(element);
35438      close();
35439    }
35440  }
35441
35442  protected void composeCommunicationCommunicationPayloadComponentInner(Communication.CommunicationPayloadComponent element) throws IOException {
35443      composeBackbone(element);
35444      if (element.hasContent()) {
35445        composeType("content", element.getContent());
35446      }
35447  }
35448
35449  protected void composeCommunicationRequest(String name, CommunicationRequest element) throws IOException {
35450    if (element != null) {
35451      prop("resourceType", name);
35452      composeCommunicationRequestInner(element);
35453    }
35454  }
35455
35456  protected void composeCommunicationRequestInner(CommunicationRequest element) throws IOException {
35457      composeDomainResourceElements(element);
35458      if (element.hasIdentifier()) {
35459        openArray("identifier");
35460        for (Identifier e : element.getIdentifier()) 
35461          composeIdentifier(null, e);
35462        closeArray();
35463      };
35464      if (element.hasBasedOn()) {
35465        openArray("basedOn");
35466        for (Reference e : element.getBasedOn()) 
35467          composeReference(null, e);
35468        closeArray();
35469      };
35470      if (element.hasReplaces()) {
35471        openArray("replaces");
35472        for (Reference e : element.getReplaces()) 
35473          composeReference(null, e);
35474        closeArray();
35475      };
35476      if (element.hasGroupIdentifier()) {
35477        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
35478      }
35479      if (element.hasStatusElement()) {
35480        composeEnumerationCore("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
35481        composeEnumerationExtras("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
35482      }
35483      if (element.hasStatusReason()) {
35484        composeCodeableConcept("statusReason", element.getStatusReason());
35485      }
35486      if (element.hasCategory()) {
35487        openArray("category");
35488        for (CodeableConcept e : element.getCategory()) 
35489          composeCodeableConcept(null, e);
35490        closeArray();
35491      };
35492      if (element.hasPriorityElement()) {
35493        composeEnumerationCore("priority", element.getPriorityElement(), new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
35494        composeEnumerationExtras("priority", element.getPriorityElement(), new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
35495      }
35496      if (element.hasDoNotPerformElement()) {
35497        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
35498        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
35499      }
35500      if (element.hasMedium()) {
35501        openArray("medium");
35502        for (CodeableConcept e : element.getMedium()) 
35503          composeCodeableConcept(null, e);
35504        closeArray();
35505      };
35506      if (element.hasSubject()) {
35507        composeReference("subject", element.getSubject());
35508      }
35509      if (element.hasAbout()) {
35510        openArray("about");
35511        for (Reference e : element.getAbout()) 
35512          composeReference(null, e);
35513        closeArray();
35514      };
35515      if (element.hasEncounter()) {
35516        composeReference("encounter", element.getEncounter());
35517      }
35518      if (element.hasPayload()) {
35519        openArray("payload");
35520        for (CommunicationRequest.CommunicationRequestPayloadComponent e : element.getPayload()) 
35521          composeCommunicationRequestCommunicationRequestPayloadComponent(null, e);
35522        closeArray();
35523      };
35524      if (element.hasOccurrence()) {
35525        composeType("occurrence", element.getOccurrence());
35526      }
35527      if (element.hasAuthoredOnElement()) {
35528        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
35529        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
35530      }
35531      if (element.hasRequester()) {
35532        composeReference("requester", element.getRequester());
35533      }
35534      if (element.hasRecipient()) {
35535        openArray("recipient");
35536        for (Reference e : element.getRecipient()) 
35537          composeReference(null, e);
35538        closeArray();
35539      };
35540      if (element.hasSender()) {
35541        composeReference("sender", element.getSender());
35542      }
35543      if (element.hasReasonCode()) {
35544        openArray("reasonCode");
35545        for (CodeableConcept e : element.getReasonCode()) 
35546          composeCodeableConcept(null, e);
35547        closeArray();
35548      };
35549      if (element.hasReasonReference()) {
35550        openArray("reasonReference");
35551        for (Reference e : element.getReasonReference()) 
35552          composeReference(null, e);
35553        closeArray();
35554      };
35555      if (element.hasNote()) {
35556        openArray("note");
35557        for (Annotation e : element.getNote()) 
35558          composeAnnotation(null, e);
35559        closeArray();
35560      };
35561  }
35562
35563  protected void composeCommunicationRequestCommunicationRequestPayloadComponent(String name, CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
35564    if (element != null) {
35565      open(name);
35566      composeCommunicationRequestCommunicationRequestPayloadComponentInner(element);
35567      close();
35568    }
35569  }
35570
35571  protected void composeCommunicationRequestCommunicationRequestPayloadComponentInner(CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
35572      composeBackbone(element);
35573      if (element.hasContent()) {
35574        composeType("content", element.getContent());
35575      }
35576  }
35577
35578  protected void composeCompartmentDefinition(String name, CompartmentDefinition element) throws IOException {
35579    if (element != null) {
35580      prop("resourceType", name);
35581      composeCompartmentDefinitionInner(element);
35582    }
35583  }
35584
35585  protected void composeCompartmentDefinitionInner(CompartmentDefinition element) throws IOException {
35586      composeDomainResourceElements(element);
35587      if (element.hasUrlElement()) {
35588        composeUriCore("url", element.getUrlElement(), false);
35589        composeUriExtras("url", element.getUrlElement(), false);
35590      }
35591      if (element.hasVersionElement()) {
35592        composeStringCore("version", element.getVersionElement(), false);
35593        composeStringExtras("version", element.getVersionElement(), false);
35594      }
35595      if (element.hasNameElement()) {
35596        composeStringCore("name", element.getNameElement(), false);
35597        composeStringExtras("name", element.getNameElement(), false);
35598      }
35599      if (element.hasStatusElement()) {
35600        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35601        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35602      }
35603      if (element.hasExperimentalElement()) {
35604        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35605        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35606      }
35607      if (element.hasDateElement()) {
35608        composeDateTimeCore("date", element.getDateElement(), false);
35609        composeDateTimeExtras("date", element.getDateElement(), false);
35610      }
35611      if (element.hasPublisherElement()) {
35612        composeStringCore("publisher", element.getPublisherElement(), false);
35613        composeStringExtras("publisher", element.getPublisherElement(), false);
35614      }
35615      if (element.hasContact()) {
35616        openArray("contact");
35617        for (ContactDetail e : element.getContact()) 
35618          composeContactDetail(null, e);
35619        closeArray();
35620      };
35621      if (element.hasDescriptionElement()) {
35622        composeMarkdownCore("description", element.getDescriptionElement(), false);
35623        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35624      }
35625      if (element.hasUseContext()) {
35626        openArray("useContext");
35627        for (UsageContext e : element.getUseContext()) 
35628          composeUsageContext(null, e);
35629        closeArray();
35630      };
35631      if (element.hasPurposeElement()) {
35632        composeMarkdownCore("purpose", element.getPurposeElement(), false);
35633        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
35634      }
35635      if (element.hasCodeElement()) {
35636        composeEnumerationCore("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
35637        composeEnumerationExtras("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
35638      }
35639      if (element.hasSearchElement()) {
35640        composeBooleanCore("search", element.getSearchElement(), false);
35641        composeBooleanExtras("search", element.getSearchElement(), false);
35642      }
35643      if (element.hasResource()) {
35644        openArray("resource");
35645        for (CompartmentDefinition.CompartmentDefinitionResourceComponent e : element.getResource()) 
35646          composeCompartmentDefinitionCompartmentDefinitionResourceComponent(null, e);
35647        closeArray();
35648      };
35649  }
35650
35651  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponent(String name, CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
35652    if (element != null) {
35653      open(name);
35654      composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(element);
35655      close();
35656    }
35657  }
35658
35659  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
35660      composeBackbone(element);
35661      if (element.hasCodeElement()) {
35662        composeCodeCore("code", element.getCodeElement(), false);
35663        composeCodeExtras("code", element.getCodeElement(), false);
35664      }
35665      if (element.hasParam()) {
35666        openArray("param");
35667        for (StringType e : element.getParam()) 
35668          composeStringCore(null, e, true);
35669        closeArray();
35670        if (anyHasExtras(element.getParam())) {
35671          openArray("_param");
35672          for (StringType e : element.getParam()) 
35673            composeStringExtras(null, e, true);
35674          closeArray();
35675        }
35676      };
35677      if (element.hasDocumentationElement()) {
35678        composeStringCore("documentation", element.getDocumentationElement(), false);
35679        composeStringExtras("documentation", element.getDocumentationElement(), false);
35680      }
35681  }
35682
35683  protected void composeComposition(String name, Composition element) throws IOException {
35684    if (element != null) {
35685      prop("resourceType", name);
35686      composeCompositionInner(element);
35687    }
35688  }
35689
35690  protected void composeCompositionInner(Composition element) throws IOException {
35691      composeDomainResourceElements(element);
35692      if (element.hasIdentifier()) {
35693        composeIdentifier("identifier", element.getIdentifier());
35694      }
35695      if (element.hasStatusElement()) {
35696        composeEnumerationCore("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
35697        composeEnumerationExtras("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
35698      }
35699      if (element.hasType()) {
35700        composeCodeableConcept("type", element.getType());
35701      }
35702      if (element.hasCategory()) {
35703        openArray("category");
35704        for (CodeableConcept e : element.getCategory()) 
35705          composeCodeableConcept(null, e);
35706        closeArray();
35707      };
35708      if (element.hasSubject()) {
35709        composeReference("subject", element.getSubject());
35710      }
35711      if (element.hasEncounter()) {
35712        composeReference("encounter", element.getEncounter());
35713      }
35714      if (element.hasDateElement()) {
35715        composeDateTimeCore("date", element.getDateElement(), false);
35716        composeDateTimeExtras("date", element.getDateElement(), false);
35717      }
35718      if (element.hasAuthor()) {
35719        openArray("author");
35720        for (Reference e : element.getAuthor()) 
35721          composeReference(null, e);
35722        closeArray();
35723      };
35724      if (element.hasTitleElement()) {
35725        composeStringCore("title", element.getTitleElement(), false);
35726        composeStringExtras("title", element.getTitleElement(), false);
35727      }
35728      if (element.hasConfidentialityElement()) {
35729        composeEnumerationCore("confidentiality", element.getConfidentialityElement(), new Composition.DocumentConfidentialityEnumFactory(), false);
35730        composeEnumerationExtras("confidentiality", element.getConfidentialityElement(), new Composition.DocumentConfidentialityEnumFactory(), false);
35731      }
35732      if (element.hasAttester()) {
35733        openArray("attester");
35734        for (Composition.CompositionAttesterComponent e : element.getAttester()) 
35735          composeCompositionCompositionAttesterComponent(null, e);
35736        closeArray();
35737      };
35738      if (element.hasCustodian()) {
35739        composeReference("custodian", element.getCustodian());
35740      }
35741      if (element.hasRelatesTo()) {
35742        openArray("relatesTo");
35743        for (Composition.CompositionRelatesToComponent e : element.getRelatesTo()) 
35744          composeCompositionCompositionRelatesToComponent(null, e);
35745        closeArray();
35746      };
35747      if (element.hasEvent()) {
35748        openArray("event");
35749        for (Composition.CompositionEventComponent e : element.getEvent()) 
35750          composeCompositionCompositionEventComponent(null, e);
35751        closeArray();
35752      };
35753      if (element.hasSection()) {
35754        openArray("section");
35755        for (Composition.SectionComponent e : element.getSection()) 
35756          composeCompositionSectionComponent(null, e);
35757        closeArray();
35758      };
35759  }
35760
35761  protected void composeCompositionCompositionAttesterComponent(String name, Composition.CompositionAttesterComponent element) throws IOException {
35762    if (element != null) {
35763      open(name);
35764      composeCompositionCompositionAttesterComponentInner(element);
35765      close();
35766    }
35767  }
35768
35769  protected void composeCompositionCompositionAttesterComponentInner(Composition.CompositionAttesterComponent element) throws IOException {
35770      composeBackbone(element);
35771      if (element.hasModeElement()) {
35772        composeEnumerationCore("mode", element.getModeElement(), new Composition.CompositionAttestationModeEnumFactory(), false);
35773        composeEnumerationExtras("mode", element.getModeElement(), new Composition.CompositionAttestationModeEnumFactory(), false);
35774      }
35775      if (element.hasTimeElement()) {
35776        composeDateTimeCore("time", element.getTimeElement(), false);
35777        composeDateTimeExtras("time", element.getTimeElement(), false);
35778      }
35779      if (element.hasParty()) {
35780        composeReference("party", element.getParty());
35781      }
35782  }
35783
35784  protected void composeCompositionCompositionRelatesToComponent(String name, Composition.CompositionRelatesToComponent element) throws IOException {
35785    if (element != null) {
35786      open(name);
35787      composeCompositionCompositionRelatesToComponentInner(element);
35788      close();
35789    }
35790  }
35791
35792  protected void composeCompositionCompositionRelatesToComponentInner(Composition.CompositionRelatesToComponent element) throws IOException {
35793      composeBackbone(element);
35794      if (element.hasCodeElement()) {
35795        composeEnumerationCore("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(), false);
35796        composeEnumerationExtras("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(), false);
35797      }
35798      if (element.hasTarget()) {
35799        composeType("target", element.getTarget());
35800      }
35801  }
35802
35803  protected void composeCompositionCompositionEventComponent(String name, Composition.CompositionEventComponent element) throws IOException {
35804    if (element != null) {
35805      open(name);
35806      composeCompositionCompositionEventComponentInner(element);
35807      close();
35808    }
35809  }
35810
35811  protected void composeCompositionCompositionEventComponentInner(Composition.CompositionEventComponent element) throws IOException {
35812      composeBackbone(element);
35813      if (element.hasCode()) {
35814        openArray("code");
35815        for (CodeableConcept e : element.getCode()) 
35816          composeCodeableConcept(null, e);
35817        closeArray();
35818      };
35819      if (element.hasPeriod()) {
35820        composePeriod("period", element.getPeriod());
35821      }
35822      if (element.hasDetail()) {
35823        openArray("detail");
35824        for (Reference e : element.getDetail()) 
35825          composeReference(null, e);
35826        closeArray();
35827      };
35828  }
35829
35830  protected void composeCompositionSectionComponent(String name, Composition.SectionComponent element) throws IOException {
35831    if (element != null) {
35832      open(name);
35833      composeCompositionSectionComponentInner(element);
35834      close();
35835    }
35836  }
35837
35838  protected void composeCompositionSectionComponentInner(Composition.SectionComponent element) throws IOException {
35839      composeBackbone(element);
35840      if (element.hasTitleElement()) {
35841        composeStringCore("title", element.getTitleElement(), false);
35842        composeStringExtras("title", element.getTitleElement(), false);
35843      }
35844      if (element.hasCode()) {
35845        composeCodeableConcept("code", element.getCode());
35846      }
35847      if (element.hasAuthor()) {
35848        openArray("author");
35849        for (Reference e : element.getAuthor()) 
35850          composeReference(null, e);
35851        closeArray();
35852      };
35853      if (element.hasFocus()) {
35854        composeReference("focus", element.getFocus());
35855      }
35856      if (element.hasText()) {
35857        composeNarrative("text", element.getText());
35858      }
35859      if (element.hasModeElement()) {
35860        composeEnumerationCore("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
35861        composeEnumerationExtras("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
35862      }
35863      if (element.hasOrderedBy()) {
35864        composeCodeableConcept("orderedBy", element.getOrderedBy());
35865      }
35866      if (element.hasEntry()) {
35867        openArray("entry");
35868        for (Reference e : element.getEntry()) 
35869          composeReference(null, e);
35870        closeArray();
35871      };
35872      if (element.hasEmptyReason()) {
35873        composeCodeableConcept("emptyReason", element.getEmptyReason());
35874      }
35875      if (element.hasSection()) {
35876        openArray("section");
35877        for (Composition.SectionComponent e : element.getSection()) 
35878          composeCompositionSectionComponent(null, e);
35879        closeArray();
35880      };
35881  }
35882
35883  protected void composeConceptMap(String name, ConceptMap element) throws IOException {
35884    if (element != null) {
35885      prop("resourceType", name);
35886      composeConceptMapInner(element);
35887    }
35888  }
35889
35890  protected void composeConceptMapInner(ConceptMap element) throws IOException {
35891      composeDomainResourceElements(element);
35892      if (element.hasUrlElement()) {
35893        composeUriCore("url", element.getUrlElement(), false);
35894        composeUriExtras("url", element.getUrlElement(), false);
35895      }
35896      if (element.hasIdentifier()) {
35897        composeIdentifier("identifier", element.getIdentifier());
35898      }
35899      if (element.hasVersionElement()) {
35900        composeStringCore("version", element.getVersionElement(), false);
35901        composeStringExtras("version", element.getVersionElement(), false);
35902      }
35903      if (element.hasNameElement()) {
35904        composeStringCore("name", element.getNameElement(), false);
35905        composeStringExtras("name", element.getNameElement(), false);
35906      }
35907      if (element.hasTitleElement()) {
35908        composeStringCore("title", element.getTitleElement(), false);
35909        composeStringExtras("title", element.getTitleElement(), false);
35910      }
35911      if (element.hasStatusElement()) {
35912        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35913        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35914      }
35915      if (element.hasExperimentalElement()) {
35916        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35917        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35918      }
35919      if (element.hasDateElement()) {
35920        composeDateTimeCore("date", element.getDateElement(), false);
35921        composeDateTimeExtras("date", element.getDateElement(), false);
35922      }
35923      if (element.hasPublisherElement()) {
35924        composeStringCore("publisher", element.getPublisherElement(), false);
35925        composeStringExtras("publisher", element.getPublisherElement(), false);
35926      }
35927      if (element.hasContact()) {
35928        openArray("contact");
35929        for (ContactDetail e : element.getContact()) 
35930          composeContactDetail(null, e);
35931        closeArray();
35932      };
35933      if (element.hasDescriptionElement()) {
35934        composeMarkdownCore("description", element.getDescriptionElement(), false);
35935        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35936      }
35937      if (element.hasUseContext()) {
35938        openArray("useContext");
35939        for (UsageContext e : element.getUseContext()) 
35940          composeUsageContext(null, e);
35941        closeArray();
35942      };
35943      if (element.hasJurisdiction()) {
35944        openArray("jurisdiction");
35945        for (CodeableConcept e : element.getJurisdiction()) 
35946          composeCodeableConcept(null, e);
35947        closeArray();
35948      };
35949      if (element.hasPurposeElement()) {
35950        composeMarkdownCore("purpose", element.getPurposeElement(), false);
35951        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
35952      }
35953      if (element.hasCopyrightElement()) {
35954        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
35955        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
35956      }
35957      if (element.hasSource()) {
35958        composeType("source", element.getSource());
35959      }
35960      if (element.hasTarget()) {
35961        composeType("target", element.getTarget());
35962      }
35963      if (element.hasGroup()) {
35964        openArray("group");
35965        for (ConceptMap.ConceptMapGroupComponent e : element.getGroup()) 
35966          composeConceptMapConceptMapGroupComponent(null, e);
35967        closeArray();
35968      };
35969  }
35970
35971  protected void composeConceptMapConceptMapGroupComponent(String name, ConceptMap.ConceptMapGroupComponent element) throws IOException {
35972    if (element != null) {
35973      open(name);
35974      composeConceptMapConceptMapGroupComponentInner(element);
35975      close();
35976    }
35977  }
35978
35979  protected void composeConceptMapConceptMapGroupComponentInner(ConceptMap.ConceptMapGroupComponent element) throws IOException {
35980      composeBackbone(element);
35981      if (element.hasSourceElement()) {
35982        composeUriCore("source", element.getSourceElement(), false);
35983        composeUriExtras("source", element.getSourceElement(), false);
35984      }
35985      if (element.hasSourceVersionElement()) {
35986        composeStringCore("sourceVersion", element.getSourceVersionElement(), false);
35987        composeStringExtras("sourceVersion", element.getSourceVersionElement(), false);
35988      }
35989      if (element.hasTargetElement()) {
35990        composeUriCore("target", element.getTargetElement(), false);
35991        composeUriExtras("target", element.getTargetElement(), false);
35992      }
35993      if (element.hasTargetVersionElement()) {
35994        composeStringCore("targetVersion", element.getTargetVersionElement(), false);
35995        composeStringExtras("targetVersion", element.getTargetVersionElement(), false);
35996      }
35997      if (element.hasElement()) {
35998        openArray("element");
35999        for (ConceptMap.SourceElementComponent e : element.getElement()) 
36000          composeConceptMapSourceElementComponent(null, e);
36001        closeArray();
36002      };
36003      if (element.hasUnmapped()) {
36004        composeConceptMapConceptMapGroupUnmappedComponent("unmapped", element.getUnmapped());
36005      }
36006  }
36007
36008  protected void composeConceptMapSourceElementComponent(String name, ConceptMap.SourceElementComponent element) throws IOException {
36009    if (element != null) {
36010      open(name);
36011      composeConceptMapSourceElementComponentInner(element);
36012      close();
36013    }
36014  }
36015
36016  protected void composeConceptMapSourceElementComponentInner(ConceptMap.SourceElementComponent element) throws IOException {
36017      composeBackbone(element);
36018      if (element.hasCodeElement()) {
36019        composeCodeCore("code", element.getCodeElement(), false);
36020        composeCodeExtras("code", element.getCodeElement(), false);
36021      }
36022      if (element.hasDisplayElement()) {
36023        composeStringCore("display", element.getDisplayElement(), false);
36024        composeStringExtras("display", element.getDisplayElement(), false);
36025      }
36026      if (element.hasTarget()) {
36027        openArray("target");
36028        for (ConceptMap.TargetElementComponent e : element.getTarget()) 
36029          composeConceptMapTargetElementComponent(null, e);
36030        closeArray();
36031      };
36032  }
36033
36034  protected void composeConceptMapTargetElementComponent(String name, ConceptMap.TargetElementComponent element) throws IOException {
36035    if (element != null) {
36036      open(name);
36037      composeConceptMapTargetElementComponentInner(element);
36038      close();
36039    }
36040  }
36041
36042  protected void composeConceptMapTargetElementComponentInner(ConceptMap.TargetElementComponent element) throws IOException {
36043      composeBackbone(element);
36044      if (element.hasCodeElement()) {
36045        composeCodeCore("code", element.getCodeElement(), false);
36046        composeCodeExtras("code", element.getCodeElement(), false);
36047      }
36048      if (element.hasDisplayElement()) {
36049        composeStringCore("display", element.getDisplayElement(), false);
36050        composeStringExtras("display", element.getDisplayElement(), false);
36051      }
36052      if (element.hasEquivalenceElement()) {
36053        composeEnumerationCore("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
36054        composeEnumerationExtras("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
36055      }
36056      if (element.hasCommentElement()) {
36057        composeStringCore("comment", element.getCommentElement(), false);
36058        composeStringExtras("comment", element.getCommentElement(), false);
36059      }
36060      if (element.hasDependsOn()) {
36061        openArray("dependsOn");
36062        for (ConceptMap.OtherElementComponent e : element.getDependsOn()) 
36063          composeConceptMapOtherElementComponent(null, e);
36064        closeArray();
36065      };
36066      if (element.hasProduct()) {
36067        openArray("product");
36068        for (ConceptMap.OtherElementComponent e : element.getProduct()) 
36069          composeConceptMapOtherElementComponent(null, e);
36070        closeArray();
36071      };
36072  }
36073
36074  protected void composeConceptMapOtherElementComponent(String name, ConceptMap.OtherElementComponent element) throws IOException {
36075    if (element != null) {
36076      open(name);
36077      composeConceptMapOtherElementComponentInner(element);
36078      close();
36079    }
36080  }
36081
36082  protected void composeConceptMapOtherElementComponentInner(ConceptMap.OtherElementComponent element) throws IOException {
36083      composeBackbone(element);
36084      if (element.hasPropertyElement()) {
36085        composeUriCore("property", element.getPropertyElement(), false);
36086        composeUriExtras("property", element.getPropertyElement(), false);
36087      }
36088      if (element.hasSystemElement()) {
36089        composeCanonicalCore("system", element.getSystemElement(), false);
36090        composeCanonicalExtras("system", element.getSystemElement(), false);
36091      }
36092      if (element.hasValueElement()) {
36093        composeStringCore("value", element.getValueElement(), false);
36094        composeStringExtras("value", element.getValueElement(), false);
36095      }
36096      if (element.hasDisplayElement()) {
36097        composeStringCore("display", element.getDisplayElement(), false);
36098        composeStringExtras("display", element.getDisplayElement(), false);
36099      }
36100  }
36101
36102  protected void composeConceptMapConceptMapGroupUnmappedComponent(String name, ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
36103    if (element != null) {
36104      open(name);
36105      composeConceptMapConceptMapGroupUnmappedComponentInner(element);
36106      close();
36107    }
36108  }
36109
36110  protected void composeConceptMapConceptMapGroupUnmappedComponentInner(ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
36111      composeBackbone(element);
36112      if (element.hasModeElement()) {
36113        composeEnumerationCore("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
36114        composeEnumerationExtras("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
36115      }
36116      if (element.hasCodeElement()) {
36117        composeCodeCore("code", element.getCodeElement(), false);
36118        composeCodeExtras("code", element.getCodeElement(), false);
36119      }
36120      if (element.hasDisplayElement()) {
36121        composeStringCore("display", element.getDisplayElement(), false);
36122        composeStringExtras("display", element.getDisplayElement(), false);
36123      }
36124      if (element.hasUrlElement()) {
36125        composeCanonicalCore("url", element.getUrlElement(), false);
36126        composeCanonicalExtras("url", element.getUrlElement(), false);
36127      }
36128  }
36129
36130  protected void composeCondition(String name, Condition element) throws IOException {
36131    if (element != null) {
36132      prop("resourceType", name);
36133      composeConditionInner(element);
36134    }
36135  }
36136
36137  protected void composeConditionInner(Condition element) throws IOException {
36138      composeDomainResourceElements(element);
36139      if (element.hasIdentifier()) {
36140        openArray("identifier");
36141        for (Identifier e : element.getIdentifier()) 
36142          composeIdentifier(null, e);
36143        closeArray();
36144      };
36145      if (element.hasClinicalStatus()) {
36146        composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
36147      }
36148      if (element.hasVerificationStatus()) {
36149        composeCodeableConcept("verificationStatus", element.getVerificationStatus());
36150      }
36151      if (element.hasCategory()) {
36152        openArray("category");
36153        for (CodeableConcept e : element.getCategory()) 
36154          composeCodeableConcept(null, e);
36155        closeArray();
36156      };
36157      if (element.hasSeverity()) {
36158        composeCodeableConcept("severity", element.getSeverity());
36159      }
36160      if (element.hasCode()) {
36161        composeCodeableConcept("code", element.getCode());
36162      }
36163      if (element.hasBodySite()) {
36164        openArray("bodySite");
36165        for (CodeableConcept e : element.getBodySite()) 
36166          composeCodeableConcept(null, e);
36167        closeArray();
36168      };
36169      if (element.hasSubject()) {
36170        composeReference("subject", element.getSubject());
36171      }
36172      if (element.hasEncounter()) {
36173        composeReference("encounter", element.getEncounter());
36174      }
36175      if (element.hasOnset()) {
36176        composeType("onset", element.getOnset());
36177      }
36178      if (element.hasAbatement()) {
36179        composeType("abatement", element.getAbatement());
36180      }
36181      if (element.hasRecordedDateElement()) {
36182        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
36183        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
36184      }
36185      if (element.hasRecorder()) {
36186        composeReference("recorder", element.getRecorder());
36187      }
36188      if (element.hasAsserter()) {
36189        composeReference("asserter", element.getAsserter());
36190      }
36191      if (element.hasStage()) {
36192        openArray("stage");
36193        for (Condition.ConditionStageComponent e : element.getStage()) 
36194          composeConditionConditionStageComponent(null, e);
36195        closeArray();
36196      };
36197      if (element.hasEvidence()) {
36198        openArray("evidence");
36199        for (Condition.ConditionEvidenceComponent e : element.getEvidence()) 
36200          composeConditionConditionEvidenceComponent(null, e);
36201        closeArray();
36202      };
36203      if (element.hasNote()) {
36204        openArray("note");
36205        for (Annotation e : element.getNote()) 
36206          composeAnnotation(null, e);
36207        closeArray();
36208      };
36209  }
36210
36211  protected void composeConditionConditionStageComponent(String name, Condition.ConditionStageComponent element) throws IOException {
36212    if (element != null) {
36213      open(name);
36214      composeConditionConditionStageComponentInner(element);
36215      close();
36216    }
36217  }
36218
36219  protected void composeConditionConditionStageComponentInner(Condition.ConditionStageComponent element) throws IOException {
36220      composeBackbone(element);
36221      if (element.hasSummary()) {
36222        composeCodeableConcept("summary", element.getSummary());
36223      }
36224      if (element.hasAssessment()) {
36225        openArray("assessment");
36226        for (Reference e : element.getAssessment()) 
36227          composeReference(null, e);
36228        closeArray();
36229      };
36230      if (element.hasType()) {
36231        composeCodeableConcept("type", element.getType());
36232      }
36233  }
36234
36235  protected void composeConditionConditionEvidenceComponent(String name, Condition.ConditionEvidenceComponent element) throws IOException {
36236    if (element != null) {
36237      open(name);
36238      composeConditionConditionEvidenceComponentInner(element);
36239      close();
36240    }
36241  }
36242
36243  protected void composeConditionConditionEvidenceComponentInner(Condition.ConditionEvidenceComponent element) throws IOException {
36244      composeBackbone(element);
36245      if (element.hasCode()) {
36246        openArray("code");
36247        for (CodeableConcept e : element.getCode()) 
36248          composeCodeableConcept(null, e);
36249        closeArray();
36250      };
36251      if (element.hasDetail()) {
36252        openArray("detail");
36253        for (Reference e : element.getDetail()) 
36254          composeReference(null, e);
36255        closeArray();
36256      };
36257  }
36258
36259  protected void composeConsent(String name, Consent element) throws IOException {
36260    if (element != null) {
36261      prop("resourceType", name);
36262      composeConsentInner(element);
36263    }
36264  }
36265
36266  protected void composeConsentInner(Consent element) throws IOException {
36267      composeDomainResourceElements(element);
36268      if (element.hasIdentifier()) {
36269        openArray("identifier");
36270        for (Identifier e : element.getIdentifier()) 
36271          composeIdentifier(null, e);
36272        closeArray();
36273      };
36274      if (element.hasStatusElement()) {
36275        composeEnumerationCore("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
36276        composeEnumerationExtras("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
36277      }
36278      if (element.hasScope()) {
36279        composeCodeableConcept("scope", element.getScope());
36280      }
36281      if (element.hasCategory()) {
36282        openArray("category");
36283        for (CodeableConcept e : element.getCategory()) 
36284          composeCodeableConcept(null, e);
36285        closeArray();
36286      };
36287      if (element.hasPatient()) {
36288        composeReference("patient", element.getPatient());
36289      }
36290      if (element.hasDateTimeElement()) {
36291        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
36292        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
36293      }
36294      if (element.hasPerformer()) {
36295        openArray("performer");
36296        for (Reference e : element.getPerformer()) 
36297          composeReference(null, e);
36298        closeArray();
36299      };
36300      if (element.hasOrganization()) {
36301        openArray("organization");
36302        for (Reference e : element.getOrganization()) 
36303          composeReference(null, e);
36304        closeArray();
36305      };
36306      if (element.hasSource()) {
36307        composeType("source", element.getSource());
36308      }
36309      if (element.hasPolicy()) {
36310        openArray("policy");
36311        for (Consent.ConsentPolicyComponent e : element.getPolicy()) 
36312          composeConsentConsentPolicyComponent(null, e);
36313        closeArray();
36314      };
36315      if (element.hasPolicyRule()) {
36316        composeCodeableConcept("policyRule", element.getPolicyRule());
36317      }
36318      if (element.hasVerification()) {
36319        openArray("verification");
36320        for (Consent.ConsentVerificationComponent e : element.getVerification()) 
36321          composeConsentConsentVerificationComponent(null, e);
36322        closeArray();
36323      };
36324      if (element.hasProvision()) {
36325        composeConsentprovisionComponent("provision", element.getProvision());
36326      }
36327  }
36328
36329  protected void composeConsentConsentPolicyComponent(String name, Consent.ConsentPolicyComponent element) throws IOException {
36330    if (element != null) {
36331      open(name);
36332      composeConsentConsentPolicyComponentInner(element);
36333      close();
36334    }
36335  }
36336
36337  protected void composeConsentConsentPolicyComponentInner(Consent.ConsentPolicyComponent element) throws IOException {
36338      composeBackbone(element);
36339      if (element.hasAuthorityElement()) {
36340        composeUriCore("authority", element.getAuthorityElement(), false);
36341        composeUriExtras("authority", element.getAuthorityElement(), false);
36342      }
36343      if (element.hasUriElement()) {
36344        composeUriCore("uri", element.getUriElement(), false);
36345        composeUriExtras("uri", element.getUriElement(), false);
36346      }
36347  }
36348
36349  protected void composeConsentConsentVerificationComponent(String name, Consent.ConsentVerificationComponent element) throws IOException {
36350    if (element != null) {
36351      open(name);
36352      composeConsentConsentVerificationComponentInner(element);
36353      close();
36354    }
36355  }
36356
36357  protected void composeConsentConsentVerificationComponentInner(Consent.ConsentVerificationComponent element) throws IOException {
36358      composeBackbone(element);
36359      if (element.hasVerifiedElement()) {
36360        composeBooleanCore("verified", element.getVerifiedElement(), false);
36361        composeBooleanExtras("verified", element.getVerifiedElement(), false);
36362      }
36363      if (element.hasVerifiedWith()) {
36364        composeReference("verifiedWith", element.getVerifiedWith());
36365      }
36366      if (element.hasVerificationDateElement()) {
36367        composeDateTimeCore("verificationDate", element.getVerificationDateElement(), false);
36368        composeDateTimeExtras("verificationDate", element.getVerificationDateElement(), false);
36369      }
36370  }
36371
36372  protected void composeConsentprovisionComponent(String name, Consent.provisionComponent element) throws IOException {
36373    if (element != null) {
36374      open(name);
36375      composeConsentprovisionComponentInner(element);
36376      close();
36377    }
36378  }
36379
36380  protected void composeConsentprovisionComponentInner(Consent.provisionComponent element) throws IOException {
36381      composeBackbone(element);
36382      if (element.hasTypeElement()) {
36383        composeEnumerationCore("type", element.getTypeElement(), new Consent.ConsentProvisionTypeEnumFactory(), false);
36384        composeEnumerationExtras("type", element.getTypeElement(), new Consent.ConsentProvisionTypeEnumFactory(), false);
36385      }
36386      if (element.hasPeriod()) {
36387        composePeriod("period", element.getPeriod());
36388      }
36389      if (element.hasActor()) {
36390        openArray("actor");
36391        for (Consent.provisionActorComponent e : element.getActor()) 
36392          composeConsentprovisionActorComponent(null, e);
36393        closeArray();
36394      };
36395      if (element.hasAction()) {
36396        openArray("action");
36397        for (CodeableConcept e : element.getAction()) 
36398          composeCodeableConcept(null, e);
36399        closeArray();
36400      };
36401      if (element.hasSecurityLabel()) {
36402        openArray("securityLabel");
36403        for (Coding e : element.getSecurityLabel()) 
36404          composeCoding(null, e);
36405        closeArray();
36406      };
36407      if (element.hasPurpose()) {
36408        openArray("purpose");
36409        for (Coding e : element.getPurpose()) 
36410          composeCoding(null, e);
36411        closeArray();
36412      };
36413      if (element.hasClass_()) {
36414        openArray("class");
36415        for (Coding e : element.getClass_()) 
36416          composeCoding(null, e);
36417        closeArray();
36418      };
36419      if (element.hasCode()) {
36420        openArray("code");
36421        for (CodeableConcept e : element.getCode()) 
36422          composeCodeableConcept(null, e);
36423        closeArray();
36424      };
36425      if (element.hasDataPeriod()) {
36426        composePeriod("dataPeriod", element.getDataPeriod());
36427      }
36428      if (element.hasData()) {
36429        openArray("data");
36430        for (Consent.provisionDataComponent e : element.getData()) 
36431          composeConsentprovisionDataComponent(null, e);
36432        closeArray();
36433      };
36434      if (element.hasProvision()) {
36435        openArray("provision");
36436        for (Consent.provisionComponent e : element.getProvision()) 
36437          composeConsentprovisionComponent(null, e);
36438        closeArray();
36439      };
36440  }
36441
36442  protected void composeConsentprovisionActorComponent(String name, Consent.provisionActorComponent element) throws IOException {
36443    if (element != null) {
36444      open(name);
36445      composeConsentprovisionActorComponentInner(element);
36446      close();
36447    }
36448  }
36449
36450  protected void composeConsentprovisionActorComponentInner(Consent.provisionActorComponent element) throws IOException {
36451      composeBackbone(element);
36452      if (element.hasRole()) {
36453        composeCodeableConcept("role", element.getRole());
36454      }
36455      if (element.hasReference()) {
36456        composeReference("reference", element.getReference());
36457      }
36458  }
36459
36460  protected void composeConsentprovisionDataComponent(String name, Consent.provisionDataComponent element) throws IOException {
36461    if (element != null) {
36462      open(name);
36463      composeConsentprovisionDataComponentInner(element);
36464      close();
36465    }
36466  }
36467
36468  protected void composeConsentprovisionDataComponentInner(Consent.provisionDataComponent element) throws IOException {
36469      composeBackbone(element);
36470      if (element.hasMeaningElement()) {
36471        composeEnumerationCore("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
36472        composeEnumerationExtras("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
36473      }
36474      if (element.hasReference()) {
36475        composeReference("reference", element.getReference());
36476      }
36477  }
36478
36479  protected void composeContract(String name, Contract element) throws IOException {
36480    if (element != null) {
36481      prop("resourceType", name);
36482      composeContractInner(element);
36483    }
36484  }
36485
36486  protected void composeContractInner(Contract element) throws IOException {
36487      composeDomainResourceElements(element);
36488      if (element.hasIdentifier()) {
36489        openArray("identifier");
36490        for (Identifier e : element.getIdentifier()) 
36491          composeIdentifier(null, e);
36492        closeArray();
36493      };
36494      if (element.hasUrlElement()) {
36495        composeUriCore("url", element.getUrlElement(), false);
36496        composeUriExtras("url", element.getUrlElement(), false);
36497      }
36498      if (element.hasVersionElement()) {
36499        composeStringCore("version", element.getVersionElement(), false);
36500        composeStringExtras("version", element.getVersionElement(), false);
36501      }
36502      if (element.hasStatusElement()) {
36503        composeEnumerationCore("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
36504        composeEnumerationExtras("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
36505      }
36506      if (element.hasLegalState()) {
36507        composeCodeableConcept("legalState", element.getLegalState());
36508      }
36509      if (element.hasInstantiatesCanonical()) {
36510        composeReference("instantiatesCanonical", element.getInstantiatesCanonical());
36511      }
36512      if (element.hasInstantiatesUriElement()) {
36513        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
36514        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
36515      }
36516      if (element.hasContentDerivative()) {
36517        composeCodeableConcept("contentDerivative", element.getContentDerivative());
36518      }
36519      if (element.hasIssuedElement()) {
36520        composeDateTimeCore("issued", element.getIssuedElement(), false);
36521        composeDateTimeExtras("issued", element.getIssuedElement(), false);
36522      }
36523      if (element.hasApplies()) {
36524        composePeriod("applies", element.getApplies());
36525      }
36526      if (element.hasExpirationType()) {
36527        composeCodeableConcept("expirationType", element.getExpirationType());
36528      }
36529      if (element.hasSubject()) {
36530        openArray("subject");
36531        for (Reference e : element.getSubject()) 
36532          composeReference(null, e);
36533        closeArray();
36534      };
36535      if (element.hasAuthority()) {
36536        openArray("authority");
36537        for (Reference e : element.getAuthority()) 
36538          composeReference(null, e);
36539        closeArray();
36540      };
36541      if (element.hasDomain()) {
36542        openArray("domain");
36543        for (Reference e : element.getDomain()) 
36544          composeReference(null, e);
36545        closeArray();
36546      };
36547      if (element.hasSite()) {
36548        openArray("site");
36549        for (Reference e : element.getSite()) 
36550          composeReference(null, e);
36551        closeArray();
36552      };
36553      if (element.hasNameElement()) {
36554        composeStringCore("name", element.getNameElement(), false);
36555        composeStringExtras("name", element.getNameElement(), false);
36556      }
36557      if (element.hasTitleElement()) {
36558        composeStringCore("title", element.getTitleElement(), false);
36559        composeStringExtras("title", element.getTitleElement(), false);
36560      }
36561      if (element.hasSubtitleElement()) {
36562        composeStringCore("subtitle", element.getSubtitleElement(), false);
36563        composeStringExtras("subtitle", element.getSubtitleElement(), false);
36564      }
36565      if (element.hasAlias()) {
36566        openArray("alias");
36567        for (StringType e : element.getAlias()) 
36568          composeStringCore(null, e, true);
36569        closeArray();
36570        if (anyHasExtras(element.getAlias())) {
36571          openArray("_alias");
36572          for (StringType e : element.getAlias()) 
36573            composeStringExtras(null, e, true);
36574          closeArray();
36575        }
36576      };
36577      if (element.hasAuthor()) {
36578        composeReference("author", element.getAuthor());
36579      }
36580      if (element.hasScope()) {
36581        composeCodeableConcept("scope", element.getScope());
36582      }
36583      if (element.hasTopic()) {
36584        composeType("topic", element.getTopic());
36585      }
36586      if (element.hasType()) {
36587        composeCodeableConcept("type", element.getType());
36588      }
36589      if (element.hasSubType()) {
36590        openArray("subType");
36591        for (CodeableConcept e : element.getSubType()) 
36592          composeCodeableConcept(null, e);
36593        closeArray();
36594      };
36595      if (element.hasContentDefinition()) {
36596        composeContractContentDefinitionComponent("contentDefinition", element.getContentDefinition());
36597      }
36598      if (element.hasTerm()) {
36599        openArray("term");
36600        for (Contract.TermComponent e : element.getTerm()) 
36601          composeContractTermComponent(null, e);
36602        closeArray();
36603      };
36604      if (element.hasSupportingInfo()) {
36605        openArray("supportingInfo");
36606        for (Reference e : element.getSupportingInfo()) 
36607          composeReference(null, e);
36608        closeArray();
36609      };
36610      if (element.hasRelevantHistory()) {
36611        openArray("relevantHistory");
36612        for (Reference e : element.getRelevantHistory()) 
36613          composeReference(null, e);
36614        closeArray();
36615      };
36616      if (element.hasSigner()) {
36617        openArray("signer");
36618        for (Contract.SignatoryComponent e : element.getSigner()) 
36619          composeContractSignatoryComponent(null, e);
36620        closeArray();
36621      };
36622      if (element.hasFriendly()) {
36623        openArray("friendly");
36624        for (Contract.FriendlyLanguageComponent e : element.getFriendly()) 
36625          composeContractFriendlyLanguageComponent(null, e);
36626        closeArray();
36627      };
36628      if (element.hasLegal()) {
36629        openArray("legal");
36630        for (Contract.LegalLanguageComponent e : element.getLegal()) 
36631          composeContractLegalLanguageComponent(null, e);
36632        closeArray();
36633      };
36634      if (element.hasRule()) {
36635        openArray("rule");
36636        for (Contract.ComputableLanguageComponent e : element.getRule()) 
36637          composeContractComputableLanguageComponent(null, e);
36638        closeArray();
36639      };
36640      if (element.hasLegallyBinding()) {
36641        composeType("legallyBinding", element.getLegallyBinding());
36642      }
36643  }
36644
36645  protected void composeContractContentDefinitionComponent(String name, Contract.ContentDefinitionComponent element) throws IOException {
36646    if (element != null) {
36647      open(name);
36648      composeContractContentDefinitionComponentInner(element);
36649      close();
36650    }
36651  }
36652
36653  protected void composeContractContentDefinitionComponentInner(Contract.ContentDefinitionComponent element) throws IOException {
36654      composeBackbone(element);
36655      if (element.hasType()) {
36656        composeCodeableConcept("type", element.getType());
36657      }
36658      if (element.hasSubType()) {
36659        composeCodeableConcept("subType", element.getSubType());
36660      }
36661      if (element.hasPublisher()) {
36662        composeReference("publisher", element.getPublisher());
36663      }
36664      if (element.hasPublicationDateElement()) {
36665        composeDateTimeCore("publicationDate", element.getPublicationDateElement(), false);
36666        composeDateTimeExtras("publicationDate", element.getPublicationDateElement(), false);
36667      }
36668      if (element.hasPublicationStatusElement()) {
36669        composeEnumerationCore("publicationStatus", element.getPublicationStatusElement(), new Contract.ContractPublicationStatusEnumFactory(), false);
36670        composeEnumerationExtras("publicationStatus", element.getPublicationStatusElement(), new Contract.ContractPublicationStatusEnumFactory(), false);
36671      }
36672      if (element.hasCopyrightElement()) {
36673        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
36674        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
36675      }
36676  }
36677
36678  protected void composeContractTermComponent(String name, Contract.TermComponent element) throws IOException {
36679    if (element != null) {
36680      open(name);
36681      composeContractTermComponentInner(element);
36682      close();
36683    }
36684  }
36685
36686  protected void composeContractTermComponentInner(Contract.TermComponent element) throws IOException {
36687      composeBackbone(element);
36688      if (element.hasIdentifier()) {
36689        composeIdentifier("identifier", element.getIdentifier());
36690      }
36691      if (element.hasIssuedElement()) {
36692        composeDateTimeCore("issued", element.getIssuedElement(), false);
36693        composeDateTimeExtras("issued", element.getIssuedElement(), false);
36694      }
36695      if (element.hasApplies()) {
36696        composePeriod("applies", element.getApplies());
36697      }
36698      if (element.hasTopic()) {
36699        composeType("topic", element.getTopic());
36700      }
36701      if (element.hasType()) {
36702        composeCodeableConcept("type", element.getType());
36703      }
36704      if (element.hasSubType()) {
36705        composeCodeableConcept("subType", element.getSubType());
36706      }
36707      if (element.hasTextElement()) {
36708        composeStringCore("text", element.getTextElement(), false);
36709        composeStringExtras("text", element.getTextElement(), false);
36710      }
36711      if (element.hasSecurityLabel()) {
36712        openArray("securityLabel");
36713        for (Contract.SecurityLabelComponent e : element.getSecurityLabel()) 
36714          composeContractSecurityLabelComponent(null, e);
36715        closeArray();
36716      };
36717      if (element.hasOffer()) {
36718        composeContractContractOfferComponent("offer", element.getOffer());
36719      }
36720      if (element.hasAsset()) {
36721        openArray("asset");
36722        for (Contract.ContractAssetComponent e : element.getAsset()) 
36723          composeContractContractAssetComponent(null, e);
36724        closeArray();
36725      };
36726      if (element.hasAction()) {
36727        openArray("action");
36728        for (Contract.ActionComponent e : element.getAction()) 
36729          composeContractActionComponent(null, e);
36730        closeArray();
36731      };
36732      if (element.hasGroup()) {
36733        openArray("group");
36734        for (Contract.TermComponent e : element.getGroup()) 
36735          composeContractTermComponent(null, e);
36736        closeArray();
36737      };
36738  }
36739
36740  protected void composeContractSecurityLabelComponent(String name, Contract.SecurityLabelComponent element) throws IOException {
36741    if (element != null) {
36742      open(name);
36743      composeContractSecurityLabelComponentInner(element);
36744      close();
36745    }
36746  }
36747
36748  protected void composeContractSecurityLabelComponentInner(Contract.SecurityLabelComponent element) throws IOException {
36749      composeBackbone(element);
36750      if (element.hasNumber()) {
36751        openArray("number");
36752        for (UnsignedIntType e : element.getNumber()) 
36753          composeUnsignedIntCore(null, e, true);
36754        closeArray();
36755        if (anyHasExtras(element.getNumber())) {
36756          openArray("_number");
36757          for (UnsignedIntType e : element.getNumber()) 
36758            composeUnsignedIntExtras(null, e, true);
36759          closeArray();
36760        }
36761      };
36762      if (element.hasClassification()) {
36763        composeCoding("classification", element.getClassification());
36764      }
36765      if (element.hasCategory()) {
36766        openArray("category");
36767        for (Coding e : element.getCategory()) 
36768          composeCoding(null, e);
36769        closeArray();
36770      };
36771      if (element.hasControl()) {
36772        openArray("control");
36773        for (Coding e : element.getControl()) 
36774          composeCoding(null, e);
36775        closeArray();
36776      };
36777  }
36778
36779  protected void composeContractContractOfferComponent(String name, Contract.ContractOfferComponent element) throws IOException {
36780    if (element != null) {
36781      open(name);
36782      composeContractContractOfferComponentInner(element);
36783      close();
36784    }
36785  }
36786
36787  protected void composeContractContractOfferComponentInner(Contract.ContractOfferComponent element) throws IOException {
36788      composeBackbone(element);
36789      if (element.hasIdentifier()) {
36790        openArray("identifier");
36791        for (Identifier e : element.getIdentifier()) 
36792          composeIdentifier(null, e);
36793        closeArray();
36794      };
36795      if (element.hasParty()) {
36796        openArray("party");
36797        for (Contract.ContractPartyComponent e : element.getParty()) 
36798          composeContractContractPartyComponent(null, e);
36799        closeArray();
36800      };
36801      if (element.hasTopic()) {
36802        composeReference("topic", element.getTopic());
36803      }
36804      if (element.hasType()) {
36805        composeCodeableConcept("type", element.getType());
36806      }
36807      if (element.hasDecision()) {
36808        composeCodeableConcept("decision", element.getDecision());
36809      }
36810      if (element.hasDecisionMode()) {
36811        openArray("decisionMode");
36812        for (CodeableConcept e : element.getDecisionMode()) 
36813          composeCodeableConcept(null, e);
36814        closeArray();
36815      };
36816      if (element.hasAnswer()) {
36817        openArray("answer");
36818        for (Contract.AnswerComponent e : element.getAnswer()) 
36819          composeContractAnswerComponent(null, e);
36820        closeArray();
36821      };
36822      if (element.hasTextElement()) {
36823        composeStringCore("text", element.getTextElement(), false);
36824        composeStringExtras("text", element.getTextElement(), false);
36825      }
36826      if (element.hasLinkId()) {
36827        openArray("linkId");
36828        for (StringType e : element.getLinkId()) 
36829          composeStringCore(null, e, true);
36830        closeArray();
36831        if (anyHasExtras(element.getLinkId())) {
36832          openArray("_linkId");
36833          for (StringType e : element.getLinkId()) 
36834            composeStringExtras(null, e, true);
36835          closeArray();
36836        }
36837      };
36838      if (element.hasSecurityLabelNumber()) {
36839        openArray("securityLabelNumber");
36840        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
36841          composeUnsignedIntCore(null, e, true);
36842        closeArray();
36843        if (anyHasExtras(element.getSecurityLabelNumber())) {
36844          openArray("_securityLabelNumber");
36845          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
36846            composeUnsignedIntExtras(null, e, true);
36847          closeArray();
36848        }
36849      };
36850  }
36851
36852  protected void composeContractContractPartyComponent(String name, Contract.ContractPartyComponent element) throws IOException {
36853    if (element != null) {
36854      open(name);
36855      composeContractContractPartyComponentInner(element);
36856      close();
36857    }
36858  }
36859
36860  protected void composeContractContractPartyComponentInner(Contract.ContractPartyComponent element) throws IOException {
36861      composeBackbone(element);
36862      if (element.hasReference()) {
36863        openArray("reference");
36864        for (Reference e : element.getReference()) 
36865          composeReference(null, e);
36866        closeArray();
36867      };
36868      if (element.hasRole()) {
36869        composeCodeableConcept("role", element.getRole());
36870      }
36871  }
36872
36873  protected void composeContractAnswerComponent(String name, Contract.AnswerComponent element) throws IOException {
36874    if (element != null) {
36875      open(name);
36876      composeContractAnswerComponentInner(element);
36877      close();
36878    }
36879  }
36880
36881  protected void composeContractAnswerComponentInner(Contract.AnswerComponent element) throws IOException {
36882      composeBackbone(element);
36883      if (element.hasValue()) {
36884        composeType("value", element.getValue());
36885      }
36886  }
36887
36888  protected void composeContractContractAssetComponent(String name, Contract.ContractAssetComponent element) throws IOException {
36889    if (element != null) {
36890      open(name);
36891      composeContractContractAssetComponentInner(element);
36892      close();
36893    }
36894  }
36895
36896  protected void composeContractContractAssetComponentInner(Contract.ContractAssetComponent element) throws IOException {
36897      composeBackbone(element);
36898      if (element.hasScope()) {
36899        composeCodeableConcept("scope", element.getScope());
36900      }
36901      if (element.hasType()) {
36902        openArray("type");
36903        for (CodeableConcept e : element.getType()) 
36904          composeCodeableConcept(null, e);
36905        closeArray();
36906      };
36907      if (element.hasTypeReference()) {
36908        openArray("typeReference");
36909        for (Reference e : element.getTypeReference()) 
36910          composeReference(null, e);
36911        closeArray();
36912      };
36913      if (element.hasSubtype()) {
36914        openArray("subtype");
36915        for (CodeableConcept e : element.getSubtype()) 
36916          composeCodeableConcept(null, e);
36917        closeArray();
36918      };
36919      if (element.hasRelationship()) {
36920        composeCoding("relationship", element.getRelationship());
36921      }
36922      if (element.hasContext()) {
36923        openArray("context");
36924        for (Contract.AssetContextComponent e : element.getContext()) 
36925          composeContractAssetContextComponent(null, e);
36926        closeArray();
36927      };
36928      if (element.hasConditionElement()) {
36929        composeStringCore("condition", element.getConditionElement(), false);
36930        composeStringExtras("condition", element.getConditionElement(), false);
36931      }
36932      if (element.hasPeriodType()) {
36933        openArray("periodType");
36934        for (CodeableConcept e : element.getPeriodType()) 
36935          composeCodeableConcept(null, e);
36936        closeArray();
36937      };
36938      if (element.hasPeriod()) {
36939        openArray("period");
36940        for (Period e : element.getPeriod()) 
36941          composePeriod(null, e);
36942        closeArray();
36943      };
36944      if (element.hasUsePeriod()) {
36945        openArray("usePeriod");
36946        for (Period e : element.getUsePeriod()) 
36947          composePeriod(null, e);
36948        closeArray();
36949      };
36950      if (element.hasTextElement()) {
36951        composeStringCore("text", element.getTextElement(), false);
36952        composeStringExtras("text", element.getTextElement(), false);
36953      }
36954      if (element.hasLinkId()) {
36955        openArray("linkId");
36956        for (StringType e : element.getLinkId()) 
36957          composeStringCore(null, e, true);
36958        closeArray();
36959        if (anyHasExtras(element.getLinkId())) {
36960          openArray("_linkId");
36961          for (StringType e : element.getLinkId()) 
36962            composeStringExtras(null, e, true);
36963          closeArray();
36964        }
36965      };
36966      if (element.hasAnswer()) {
36967        openArray("answer");
36968        for (Contract.AnswerComponent e : element.getAnswer()) 
36969          composeContractAnswerComponent(null, e);
36970        closeArray();
36971      };
36972      if (element.hasSecurityLabelNumber()) {
36973        openArray("securityLabelNumber");
36974        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
36975          composeUnsignedIntCore(null, e, true);
36976        closeArray();
36977        if (anyHasExtras(element.getSecurityLabelNumber())) {
36978          openArray("_securityLabelNumber");
36979          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
36980            composeUnsignedIntExtras(null, e, true);
36981          closeArray();
36982        }
36983      };
36984      if (element.hasValuedItem()) {
36985        openArray("valuedItem");
36986        for (Contract.ValuedItemComponent e : element.getValuedItem()) 
36987          composeContractValuedItemComponent(null, e);
36988        closeArray();
36989      };
36990  }
36991
36992  protected void composeContractAssetContextComponent(String name, Contract.AssetContextComponent element) throws IOException {
36993    if (element != null) {
36994      open(name);
36995      composeContractAssetContextComponentInner(element);
36996      close();
36997    }
36998  }
36999
37000  protected void composeContractAssetContextComponentInner(Contract.AssetContextComponent element) throws IOException {
37001      composeBackbone(element);
37002      if (element.hasReference()) {
37003        composeReference("reference", element.getReference());
37004      }
37005      if (element.hasCode()) {
37006        openArray("code");
37007        for (CodeableConcept e : element.getCode()) 
37008          composeCodeableConcept(null, e);
37009        closeArray();
37010      };
37011      if (element.hasTextElement()) {
37012        composeStringCore("text", element.getTextElement(), false);
37013        composeStringExtras("text", element.getTextElement(), false);
37014      }
37015  }
37016
37017  protected void composeContractValuedItemComponent(String name, Contract.ValuedItemComponent element) throws IOException {
37018    if (element != null) {
37019      open(name);
37020      composeContractValuedItemComponentInner(element);
37021      close();
37022    }
37023  }
37024
37025  protected void composeContractValuedItemComponentInner(Contract.ValuedItemComponent element) throws IOException {
37026      composeBackbone(element);
37027      if (element.hasEntity()) {
37028        composeType("entity", element.getEntity());
37029      }
37030      if (element.hasIdentifier()) {
37031        composeIdentifier("identifier", element.getIdentifier());
37032      }
37033      if (element.hasEffectiveTimeElement()) {
37034        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
37035        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
37036      }
37037      if (element.hasQuantity()) {
37038        composeQuantity("quantity", element.getQuantity());
37039      }
37040      if (element.hasUnitPrice()) {
37041        composeMoney("unitPrice", element.getUnitPrice());
37042      }
37043      if (element.hasFactorElement()) {
37044        composeDecimalCore("factor", element.getFactorElement(), false);
37045        composeDecimalExtras("factor", element.getFactorElement(), false);
37046      }
37047      if (element.hasPointsElement()) {
37048        composeDecimalCore("points", element.getPointsElement(), false);
37049        composeDecimalExtras("points", element.getPointsElement(), false);
37050      }
37051      if (element.hasNet()) {
37052        composeMoney("net", element.getNet());
37053      }
37054      if (element.hasPaymentElement()) {
37055        composeStringCore("payment", element.getPaymentElement(), false);
37056        composeStringExtras("payment", element.getPaymentElement(), false);
37057      }
37058      if (element.hasPaymentDateElement()) {
37059        composeDateTimeCore("paymentDate", element.getPaymentDateElement(), false);
37060        composeDateTimeExtras("paymentDate", element.getPaymentDateElement(), false);
37061      }
37062      if (element.hasResponsible()) {
37063        composeReference("responsible", element.getResponsible());
37064      }
37065      if (element.hasRecipient()) {
37066        composeReference("recipient", element.getRecipient());
37067      }
37068      if (element.hasLinkId()) {
37069        openArray("linkId");
37070        for (StringType e : element.getLinkId()) 
37071          composeStringCore(null, e, true);
37072        closeArray();
37073        if (anyHasExtras(element.getLinkId())) {
37074          openArray("_linkId");
37075          for (StringType e : element.getLinkId()) 
37076            composeStringExtras(null, e, true);
37077          closeArray();
37078        }
37079      };
37080      if (element.hasSecurityLabelNumber()) {
37081        openArray("securityLabelNumber");
37082        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
37083          composeUnsignedIntCore(null, e, true);
37084        closeArray();
37085        if (anyHasExtras(element.getSecurityLabelNumber())) {
37086          openArray("_securityLabelNumber");
37087          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
37088            composeUnsignedIntExtras(null, e, true);
37089          closeArray();
37090        }
37091      };
37092  }
37093
37094  protected void composeContractActionComponent(String name, Contract.ActionComponent element) throws IOException {
37095    if (element != null) {
37096      open(name);
37097      composeContractActionComponentInner(element);
37098      close();
37099    }
37100  }
37101
37102  protected void composeContractActionComponentInner(Contract.ActionComponent element) throws IOException {
37103      composeBackbone(element);
37104      if (element.hasDoNotPerformElement()) {
37105        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
37106        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
37107      }
37108      if (element.hasType()) {
37109        composeCodeableConcept("type", element.getType());
37110      }
37111      if (element.hasSubject()) {
37112        openArray("subject");
37113        for (Contract.ActionSubjectComponent e : element.getSubject()) 
37114          composeContractActionSubjectComponent(null, e);
37115        closeArray();
37116      };
37117      if (element.hasIntent()) {
37118        composeCodeableConcept("intent", element.getIntent());
37119      }
37120      if (element.hasLinkId()) {
37121        openArray("linkId");
37122        for (StringType e : element.getLinkId()) 
37123          composeStringCore(null, e, true);
37124        closeArray();
37125        if (anyHasExtras(element.getLinkId())) {
37126          openArray("_linkId");
37127          for (StringType e : element.getLinkId()) 
37128            composeStringExtras(null, e, true);
37129          closeArray();
37130        }
37131      };
37132      if (element.hasStatus()) {
37133        composeCodeableConcept("status", element.getStatus());
37134      }
37135      if (element.hasContext()) {
37136        composeReference("context", element.getContext());
37137      }
37138      if (element.hasContextLinkId()) {
37139        openArray("contextLinkId");
37140        for (StringType e : element.getContextLinkId()) 
37141          composeStringCore(null, e, true);
37142        closeArray();
37143        if (anyHasExtras(element.getContextLinkId())) {
37144          openArray("_contextLinkId");
37145          for (StringType e : element.getContextLinkId()) 
37146            composeStringExtras(null, e, true);
37147          closeArray();
37148        }
37149      };
37150      if (element.hasOccurrence()) {
37151        composeType("occurrence", element.getOccurrence());
37152      }
37153      if (element.hasRequester()) {
37154        openArray("requester");
37155        for (Reference e : element.getRequester()) 
37156          composeReference(null, e);
37157        closeArray();
37158      };
37159      if (element.hasRequesterLinkId()) {
37160        openArray("requesterLinkId");
37161        for (StringType e : element.getRequesterLinkId()) 
37162          composeStringCore(null, e, true);
37163        closeArray();
37164        if (anyHasExtras(element.getRequesterLinkId())) {
37165          openArray("_requesterLinkId");
37166          for (StringType e : element.getRequesterLinkId()) 
37167            composeStringExtras(null, e, true);
37168          closeArray();
37169        }
37170      };
37171      if (element.hasPerformerType()) {
37172        openArray("performerType");
37173        for (CodeableConcept e : element.getPerformerType()) 
37174          composeCodeableConcept(null, e);
37175        closeArray();
37176      };
37177      if (element.hasPerformerRole()) {
37178        composeCodeableConcept("performerRole", element.getPerformerRole());
37179      }
37180      if (element.hasPerformer()) {
37181        composeReference("performer", element.getPerformer());
37182      }
37183      if (element.hasPerformerLinkId()) {
37184        openArray("performerLinkId");
37185        for (StringType e : element.getPerformerLinkId()) 
37186          composeStringCore(null, e, true);
37187        closeArray();
37188        if (anyHasExtras(element.getPerformerLinkId())) {
37189          openArray("_performerLinkId");
37190          for (StringType e : element.getPerformerLinkId()) 
37191            composeStringExtras(null, e, true);
37192          closeArray();
37193        }
37194      };
37195      if (element.hasReasonCode()) {
37196        openArray("reasonCode");
37197        for (CodeableConcept e : element.getReasonCode()) 
37198          composeCodeableConcept(null, e);
37199        closeArray();
37200      };
37201      if (element.hasReasonReference()) {
37202        openArray("reasonReference");
37203        for (Reference e : element.getReasonReference()) 
37204          composeReference(null, e);
37205        closeArray();
37206      };
37207      if (element.hasReason()) {
37208        openArray("reason");
37209        for (StringType e : element.getReason()) 
37210          composeStringCore(null, e, true);
37211        closeArray();
37212        if (anyHasExtras(element.getReason())) {
37213          openArray("_reason");
37214          for (StringType e : element.getReason()) 
37215            composeStringExtras(null, e, true);
37216          closeArray();
37217        }
37218      };
37219      if (element.hasReasonLinkId()) {
37220        openArray("reasonLinkId");
37221        for (StringType e : element.getReasonLinkId()) 
37222          composeStringCore(null, e, true);
37223        closeArray();
37224        if (anyHasExtras(element.getReasonLinkId())) {
37225          openArray("_reasonLinkId");
37226          for (StringType e : element.getReasonLinkId()) 
37227            composeStringExtras(null, e, true);
37228          closeArray();
37229        }
37230      };
37231      if (element.hasNote()) {
37232        openArray("note");
37233        for (Annotation e : element.getNote()) 
37234          composeAnnotation(null, e);
37235        closeArray();
37236      };
37237      if (element.hasSecurityLabelNumber()) {
37238        openArray("securityLabelNumber");
37239        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
37240          composeUnsignedIntCore(null, e, true);
37241        closeArray();
37242        if (anyHasExtras(element.getSecurityLabelNumber())) {
37243          openArray("_securityLabelNumber");
37244          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
37245            composeUnsignedIntExtras(null, e, true);
37246          closeArray();
37247        }
37248      };
37249  }
37250
37251  protected void composeContractActionSubjectComponent(String name, Contract.ActionSubjectComponent element) throws IOException {
37252    if (element != null) {
37253      open(name);
37254      composeContractActionSubjectComponentInner(element);
37255      close();
37256    }
37257  }
37258
37259  protected void composeContractActionSubjectComponentInner(Contract.ActionSubjectComponent element) throws IOException {
37260      composeBackbone(element);
37261      if (element.hasReference()) {
37262        openArray("reference");
37263        for (Reference e : element.getReference()) 
37264          composeReference(null, e);
37265        closeArray();
37266      };
37267      if (element.hasRole()) {
37268        composeCodeableConcept("role", element.getRole());
37269      }
37270  }
37271
37272  protected void composeContractSignatoryComponent(String name, Contract.SignatoryComponent element) throws IOException {
37273    if (element != null) {
37274      open(name);
37275      composeContractSignatoryComponentInner(element);
37276      close();
37277    }
37278  }
37279
37280  protected void composeContractSignatoryComponentInner(Contract.SignatoryComponent element) throws IOException {
37281      composeBackbone(element);
37282      if (element.hasType()) {
37283        composeCoding("type", element.getType());
37284      }
37285      if (element.hasParty()) {
37286        composeReference("party", element.getParty());
37287      }
37288      if (element.hasSignature()) {
37289        openArray("signature");
37290        for (Signature e : element.getSignature()) 
37291          composeSignature(null, e);
37292        closeArray();
37293      };
37294  }
37295
37296  protected void composeContractFriendlyLanguageComponent(String name, Contract.FriendlyLanguageComponent element) throws IOException {
37297    if (element != null) {
37298      open(name);
37299      composeContractFriendlyLanguageComponentInner(element);
37300      close();
37301    }
37302  }
37303
37304  protected void composeContractFriendlyLanguageComponentInner(Contract.FriendlyLanguageComponent element) throws IOException {
37305      composeBackbone(element);
37306      if (element.hasContent()) {
37307        composeType("content", element.getContent());
37308      }
37309  }
37310
37311  protected void composeContractLegalLanguageComponent(String name, Contract.LegalLanguageComponent element) throws IOException {
37312    if (element != null) {
37313      open(name);
37314      composeContractLegalLanguageComponentInner(element);
37315      close();
37316    }
37317  }
37318
37319  protected void composeContractLegalLanguageComponentInner(Contract.LegalLanguageComponent element) throws IOException {
37320      composeBackbone(element);
37321      if (element.hasContent()) {
37322        composeType("content", element.getContent());
37323      }
37324  }
37325
37326  protected void composeContractComputableLanguageComponent(String name, Contract.ComputableLanguageComponent element) throws IOException {
37327    if (element != null) {
37328      open(name);
37329      composeContractComputableLanguageComponentInner(element);
37330      close();
37331    }
37332  }
37333
37334  protected void composeContractComputableLanguageComponentInner(Contract.ComputableLanguageComponent element) throws IOException {
37335      composeBackbone(element);
37336      if (element.hasContent()) {
37337        composeType("content", element.getContent());
37338      }
37339  }
37340
37341  protected void composeCoverage(String name, Coverage element) throws IOException {
37342    if (element != null) {
37343      prop("resourceType", name);
37344      composeCoverageInner(element);
37345    }
37346  }
37347
37348  protected void composeCoverageInner(Coverage element) throws IOException {
37349      composeDomainResourceElements(element);
37350      if (element.hasIdentifier()) {
37351        openArray("identifier");
37352        for (Identifier e : element.getIdentifier()) 
37353          composeIdentifier(null, e);
37354        closeArray();
37355      };
37356      if (element.hasStatusElement()) {
37357        composeEnumerationCore("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
37358        composeEnumerationExtras("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
37359      }
37360      if (element.hasType()) {
37361        composeCodeableConcept("type", element.getType());
37362      }
37363      if (element.hasPolicyHolder()) {
37364        composeReference("policyHolder", element.getPolicyHolder());
37365      }
37366      if (element.hasSubscriber()) {
37367        composeReference("subscriber", element.getSubscriber());
37368      }
37369      if (element.hasSubscriberIdElement()) {
37370        composeStringCore("subscriberId", element.getSubscriberIdElement(), false);
37371        composeStringExtras("subscriberId", element.getSubscriberIdElement(), false);
37372      }
37373      if (element.hasBeneficiary()) {
37374        composeReference("beneficiary", element.getBeneficiary());
37375      }
37376      if (element.hasDependentElement()) {
37377        composeStringCore("dependent", element.getDependentElement(), false);
37378        composeStringExtras("dependent", element.getDependentElement(), false);
37379      }
37380      if (element.hasRelationship()) {
37381        composeCodeableConcept("relationship", element.getRelationship());
37382      }
37383      if (element.hasPeriod()) {
37384        composePeriod("period", element.getPeriod());
37385      }
37386      if (element.hasPayor()) {
37387        openArray("payor");
37388        for (Reference e : element.getPayor()) 
37389          composeReference(null, e);
37390        closeArray();
37391      };
37392      if (element.hasClass_()) {
37393        openArray("class");
37394        for (Coverage.ClassComponent e : element.getClass_()) 
37395          composeCoverageClassComponent(null, e);
37396        closeArray();
37397      };
37398      if (element.hasOrderElement()) {
37399        composePositiveIntCore("order", element.getOrderElement(), false);
37400        composePositiveIntExtras("order", element.getOrderElement(), false);
37401      }
37402      if (element.hasNetworkElement()) {
37403        composeStringCore("network", element.getNetworkElement(), false);
37404        composeStringExtras("network", element.getNetworkElement(), false);
37405      }
37406      if (element.hasCostToBeneficiary()) {
37407        openArray("costToBeneficiary");
37408        for (Coverage.CostToBeneficiaryComponent e : element.getCostToBeneficiary()) 
37409          composeCoverageCostToBeneficiaryComponent(null, e);
37410        closeArray();
37411      };
37412      if (element.hasSubrogationElement()) {
37413        composeBooleanCore("subrogation", element.getSubrogationElement(), false);
37414        composeBooleanExtras("subrogation", element.getSubrogationElement(), false);
37415      }
37416      if (element.hasContract()) {
37417        openArray("contract");
37418        for (Reference e : element.getContract()) 
37419          composeReference(null, e);
37420        closeArray();
37421      };
37422  }
37423
37424  protected void composeCoverageClassComponent(String name, Coverage.ClassComponent element) throws IOException {
37425    if (element != null) {
37426      open(name);
37427      composeCoverageClassComponentInner(element);
37428      close();
37429    }
37430  }
37431
37432  protected void composeCoverageClassComponentInner(Coverage.ClassComponent element) throws IOException {
37433      composeBackbone(element);
37434      if (element.hasType()) {
37435        composeCodeableConcept("type", element.getType());
37436      }
37437      if (element.hasValueElement()) {
37438        composeStringCore("value", element.getValueElement(), false);
37439        composeStringExtras("value", element.getValueElement(), false);
37440      }
37441      if (element.hasNameElement()) {
37442        composeStringCore("name", element.getNameElement(), false);
37443        composeStringExtras("name", element.getNameElement(), false);
37444      }
37445  }
37446
37447  protected void composeCoverageCostToBeneficiaryComponent(String name, Coverage.CostToBeneficiaryComponent element) throws IOException {
37448    if (element != null) {
37449      open(name);
37450      composeCoverageCostToBeneficiaryComponentInner(element);
37451      close();
37452    }
37453  }
37454
37455  protected void composeCoverageCostToBeneficiaryComponentInner(Coverage.CostToBeneficiaryComponent element) throws IOException {
37456      composeBackbone(element);
37457      if (element.hasType()) {
37458        composeCodeableConcept("type", element.getType());
37459      }
37460      if (element.hasValue()) {
37461        composeType("value", element.getValue());
37462      }
37463      if (element.hasException()) {
37464        openArray("exception");
37465        for (Coverage.ExemptionComponent e : element.getException()) 
37466          composeCoverageExemptionComponent(null, e);
37467        closeArray();
37468      };
37469  }
37470
37471  protected void composeCoverageExemptionComponent(String name, Coverage.ExemptionComponent element) throws IOException {
37472    if (element != null) {
37473      open(name);
37474      composeCoverageExemptionComponentInner(element);
37475      close();
37476    }
37477  }
37478
37479  protected void composeCoverageExemptionComponentInner(Coverage.ExemptionComponent element) throws IOException {
37480      composeBackbone(element);
37481      if (element.hasType()) {
37482        composeCodeableConcept("type", element.getType());
37483      }
37484      if (element.hasPeriod()) {
37485        composePeriod("period", element.getPeriod());
37486      }
37487  }
37488
37489  protected void composeCoverageEligibilityRequest(String name, CoverageEligibilityRequest element) throws IOException {
37490    if (element != null) {
37491      prop("resourceType", name);
37492      composeCoverageEligibilityRequestInner(element);
37493    }
37494  }
37495
37496  protected void composeCoverageEligibilityRequestInner(CoverageEligibilityRequest element) throws IOException {
37497      composeDomainResourceElements(element);
37498      if (element.hasIdentifier()) {
37499        openArray("identifier");
37500        for (Identifier e : element.getIdentifier()) 
37501          composeIdentifier(null, e);
37502        closeArray();
37503      };
37504      if (element.hasStatusElement()) {
37505        composeEnumerationCore("status", element.getStatusElement(), new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
37506        composeEnumerationExtras("status", element.getStatusElement(), new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
37507      }
37508      if (element.hasPriority()) {
37509        composeCodeableConcept("priority", element.getPriority());
37510      }
37511      if (element.hasPurpose()) {
37512        openArray("purpose");
37513        for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose()) 
37514          composeEnumerationCore(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), true);
37515        closeArray();
37516        if (anyHasExtras(element.getPurpose())) {
37517          openArray("_purpose");
37518          for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose()) 
37519            composeEnumerationExtras(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), true);
37520          closeArray();
37521        }
37522      };
37523      if (element.hasPatient()) {
37524        composeReference("patient", element.getPatient());
37525      }
37526      if (element.hasServiced()) {
37527        composeType("serviced", element.getServiced());
37528      }
37529      if (element.hasCreatedElement()) {
37530        composeDateTimeCore("created", element.getCreatedElement(), false);
37531        composeDateTimeExtras("created", element.getCreatedElement(), false);
37532      }
37533      if (element.hasEnterer()) {
37534        composeReference("enterer", element.getEnterer());
37535      }
37536      if (element.hasProvider()) {
37537        composeReference("provider", element.getProvider());
37538      }
37539      if (element.hasInsurer()) {
37540        composeReference("insurer", element.getInsurer());
37541      }
37542      if (element.hasFacility()) {
37543        composeReference("facility", element.getFacility());
37544      }
37545      if (element.hasSupportingInfo()) {
37546        openArray("supportingInfo");
37547        for (CoverageEligibilityRequest.SupportingInformationComponent e : element.getSupportingInfo()) 
37548          composeCoverageEligibilityRequestSupportingInformationComponent(null, e);
37549        closeArray();
37550      };
37551      if (element.hasInsurance()) {
37552        openArray("insurance");
37553        for (CoverageEligibilityRequest.InsuranceComponent e : element.getInsurance()) 
37554          composeCoverageEligibilityRequestInsuranceComponent(null, e);
37555        closeArray();
37556      };
37557      if (element.hasItem()) {
37558        openArray("item");
37559        for (CoverageEligibilityRequest.DetailsComponent e : element.getItem()) 
37560          composeCoverageEligibilityRequestDetailsComponent(null, e);
37561        closeArray();
37562      };
37563  }
37564
37565  protected void composeCoverageEligibilityRequestSupportingInformationComponent(String name, CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
37566    if (element != null) {
37567      open(name);
37568      composeCoverageEligibilityRequestSupportingInformationComponentInner(element);
37569      close();
37570    }
37571  }
37572
37573  protected void composeCoverageEligibilityRequestSupportingInformationComponentInner(CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
37574      composeBackbone(element);
37575      if (element.hasSequenceElement()) {
37576        composePositiveIntCore("sequence", element.getSequenceElement(), false);
37577        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
37578      }
37579      if (element.hasInformation()) {
37580        composeReference("information", element.getInformation());
37581      }
37582      if (element.hasAppliesToAllElement()) {
37583        composeBooleanCore("appliesToAll", element.getAppliesToAllElement(), false);
37584        composeBooleanExtras("appliesToAll", element.getAppliesToAllElement(), false);
37585      }
37586  }
37587
37588  protected void composeCoverageEligibilityRequestInsuranceComponent(String name, CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
37589    if (element != null) {
37590      open(name);
37591      composeCoverageEligibilityRequestInsuranceComponentInner(element);
37592      close();
37593    }
37594  }
37595
37596  protected void composeCoverageEligibilityRequestInsuranceComponentInner(CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
37597      composeBackbone(element);
37598      if (element.hasFocalElement()) {
37599        composeBooleanCore("focal", element.getFocalElement(), false);
37600        composeBooleanExtras("focal", element.getFocalElement(), false);
37601      }
37602      if (element.hasCoverage()) {
37603        composeReference("coverage", element.getCoverage());
37604      }
37605      if (element.hasBusinessArrangementElement()) {
37606        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
37607        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
37608      }
37609  }
37610
37611  protected void composeCoverageEligibilityRequestDetailsComponent(String name, CoverageEligibilityRequest.DetailsComponent element) throws IOException {
37612    if (element != null) {
37613      open(name);
37614      composeCoverageEligibilityRequestDetailsComponentInner(element);
37615      close();
37616    }
37617  }
37618
37619  protected void composeCoverageEligibilityRequestDetailsComponentInner(CoverageEligibilityRequest.DetailsComponent element) throws IOException {
37620      composeBackbone(element);
37621      if (element.hasSupportingInfoSequence()) {
37622        openArray("supportingInfoSequence");
37623        for (PositiveIntType e : element.getSupportingInfoSequence()) 
37624          composePositiveIntCore(null, e, true);
37625        closeArray();
37626        if (anyHasExtras(element.getSupportingInfoSequence())) {
37627          openArray("_supportingInfoSequence");
37628          for (PositiveIntType e : element.getSupportingInfoSequence()) 
37629            composePositiveIntExtras(null, e, true);
37630          closeArray();
37631        }
37632      };
37633      if (element.hasCategory()) {
37634        composeCodeableConcept("category", element.getCategory());
37635      }
37636      if (element.hasProductOrService()) {
37637        composeCodeableConcept("productOrService", element.getProductOrService());
37638      }
37639      if (element.hasModifier()) {
37640        openArray("modifier");
37641        for (CodeableConcept e : element.getModifier()) 
37642          composeCodeableConcept(null, e);
37643        closeArray();
37644      };
37645      if (element.hasProvider()) {
37646        composeReference("provider", element.getProvider());
37647      }
37648      if (element.hasQuantity()) {
37649        composeQuantity("quantity", element.getQuantity());
37650      }
37651      if (element.hasUnitPrice()) {
37652        composeMoney("unitPrice", element.getUnitPrice());
37653      }
37654      if (element.hasFacility()) {
37655        composeReference("facility", element.getFacility());
37656      }
37657      if (element.hasDiagnosis()) {
37658        openArray("diagnosis");
37659        for (CoverageEligibilityRequest.DiagnosisComponent e : element.getDiagnosis()) 
37660          composeCoverageEligibilityRequestDiagnosisComponent(null, e);
37661        closeArray();
37662      };
37663      if (element.hasDetail()) {
37664        openArray("detail");
37665        for (Reference e : element.getDetail()) 
37666          composeReference(null, e);
37667        closeArray();
37668      };
37669  }
37670
37671  protected void composeCoverageEligibilityRequestDiagnosisComponent(String name, CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
37672    if (element != null) {
37673      open(name);
37674      composeCoverageEligibilityRequestDiagnosisComponentInner(element);
37675      close();
37676    }
37677  }
37678
37679  protected void composeCoverageEligibilityRequestDiagnosisComponentInner(CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
37680      composeBackbone(element);
37681      if (element.hasDiagnosis()) {
37682        composeType("diagnosis", element.getDiagnosis());
37683      }
37684  }
37685
37686  protected void composeCoverageEligibilityResponse(String name, CoverageEligibilityResponse element) throws IOException {
37687    if (element != null) {
37688      prop("resourceType", name);
37689      composeCoverageEligibilityResponseInner(element);
37690    }
37691  }
37692
37693  protected void composeCoverageEligibilityResponseInner(CoverageEligibilityResponse element) throws IOException {
37694      composeDomainResourceElements(element);
37695      if (element.hasIdentifier()) {
37696        openArray("identifier");
37697        for (Identifier e : element.getIdentifier()) 
37698          composeIdentifier(null, e);
37699        closeArray();
37700      };
37701      if (element.hasStatusElement()) {
37702        composeEnumerationCore("status", element.getStatusElement(), new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
37703        composeEnumerationExtras("status", element.getStatusElement(), new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
37704      }
37705      if (element.hasPurpose()) {
37706        openArray("purpose");
37707        for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose()) 
37708          composeEnumerationCore(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), true);
37709        closeArray();
37710        if (anyHasExtras(element.getPurpose())) {
37711          openArray("_purpose");
37712          for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose()) 
37713            composeEnumerationExtras(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), true);
37714          closeArray();
37715        }
37716      };
37717      if (element.hasPatient()) {
37718        composeReference("patient", element.getPatient());
37719      }
37720      if (element.hasServiced()) {
37721        composeType("serviced", element.getServiced());
37722      }
37723      if (element.hasCreatedElement()) {
37724        composeDateTimeCore("created", element.getCreatedElement(), false);
37725        composeDateTimeExtras("created", element.getCreatedElement(), false);
37726      }
37727      if (element.hasRequestor()) {
37728        composeReference("requestor", element.getRequestor());
37729      }
37730      if (element.hasRequest()) {
37731        composeReference("request", element.getRequest());
37732      }
37733      if (element.hasOutcomeElement()) {
37734        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
37735        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
37736      }
37737      if (element.hasDispositionElement()) {
37738        composeStringCore("disposition", element.getDispositionElement(), false);
37739        composeStringExtras("disposition", element.getDispositionElement(), false);
37740      }
37741      if (element.hasInsurer()) {
37742        composeReference("insurer", element.getInsurer());
37743      }
37744      if (element.hasInsurance()) {
37745        openArray("insurance");
37746        for (CoverageEligibilityResponse.InsuranceComponent e : element.getInsurance()) 
37747          composeCoverageEligibilityResponseInsuranceComponent(null, e);
37748        closeArray();
37749      };
37750      if (element.hasPreAuthRefElement()) {
37751        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
37752        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
37753      }
37754      if (element.hasForm()) {
37755        composeCodeableConcept("form", element.getForm());
37756      }
37757      if (element.hasError()) {
37758        openArray("error");
37759        for (CoverageEligibilityResponse.ErrorsComponent e : element.getError()) 
37760          composeCoverageEligibilityResponseErrorsComponent(null, e);
37761        closeArray();
37762      };
37763  }
37764
37765  protected void composeCoverageEligibilityResponseInsuranceComponent(String name, CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
37766    if (element != null) {
37767      open(name);
37768      composeCoverageEligibilityResponseInsuranceComponentInner(element);
37769      close();
37770    }
37771  }
37772
37773  protected void composeCoverageEligibilityResponseInsuranceComponentInner(CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
37774      composeBackbone(element);
37775      if (element.hasCoverage()) {
37776        composeReference("coverage", element.getCoverage());
37777      }
37778      if (element.hasInforceElement()) {
37779        composeBooleanCore("inforce", element.getInforceElement(), false);
37780        composeBooleanExtras("inforce", element.getInforceElement(), false);
37781      }
37782      if (element.hasBenefitPeriod()) {
37783        composePeriod("benefitPeriod", element.getBenefitPeriod());
37784      }
37785      if (element.hasItem()) {
37786        openArray("item");
37787        for (CoverageEligibilityResponse.ItemsComponent e : element.getItem()) 
37788          composeCoverageEligibilityResponseItemsComponent(null, e);
37789        closeArray();
37790      };
37791  }
37792
37793  protected void composeCoverageEligibilityResponseItemsComponent(String name, CoverageEligibilityResponse.ItemsComponent element) throws IOException {
37794    if (element != null) {
37795      open(name);
37796      composeCoverageEligibilityResponseItemsComponentInner(element);
37797      close();
37798    }
37799  }
37800
37801  protected void composeCoverageEligibilityResponseItemsComponentInner(CoverageEligibilityResponse.ItemsComponent element) throws IOException {
37802      composeBackbone(element);
37803      if (element.hasCategory()) {
37804        composeCodeableConcept("category", element.getCategory());
37805      }
37806      if (element.hasProductOrService()) {
37807        composeCodeableConcept("productOrService", element.getProductOrService());
37808      }
37809      if (element.hasModifier()) {
37810        openArray("modifier");
37811        for (CodeableConcept e : element.getModifier()) 
37812          composeCodeableConcept(null, e);
37813        closeArray();
37814      };
37815      if (element.hasProvider()) {
37816        composeReference("provider", element.getProvider());
37817      }
37818      if (element.hasExcludedElement()) {
37819        composeBooleanCore("excluded", element.getExcludedElement(), false);
37820        composeBooleanExtras("excluded", element.getExcludedElement(), false);
37821      }
37822      if (element.hasNameElement()) {
37823        composeStringCore("name", element.getNameElement(), false);
37824        composeStringExtras("name", element.getNameElement(), false);
37825      }
37826      if (element.hasDescriptionElement()) {
37827        composeStringCore("description", element.getDescriptionElement(), false);
37828        composeStringExtras("description", element.getDescriptionElement(), false);
37829      }
37830      if (element.hasNetwork()) {
37831        composeCodeableConcept("network", element.getNetwork());
37832      }
37833      if (element.hasUnit()) {
37834        composeCodeableConcept("unit", element.getUnit());
37835      }
37836      if (element.hasTerm()) {
37837        composeCodeableConcept("term", element.getTerm());
37838      }
37839      if (element.hasBenefit()) {
37840        openArray("benefit");
37841        for (CoverageEligibilityResponse.BenefitComponent e : element.getBenefit()) 
37842          composeCoverageEligibilityResponseBenefitComponent(null, e);
37843        closeArray();
37844      };
37845      if (element.hasAuthorizationRequiredElement()) {
37846        composeBooleanCore("authorizationRequired", element.getAuthorizationRequiredElement(), false);
37847        composeBooleanExtras("authorizationRequired", element.getAuthorizationRequiredElement(), false);
37848      }
37849      if (element.hasAuthorizationSupporting()) {
37850        openArray("authorizationSupporting");
37851        for (CodeableConcept e : element.getAuthorizationSupporting()) 
37852          composeCodeableConcept(null, e);
37853        closeArray();
37854      };
37855      if (element.hasAuthorizationUrlElement()) {
37856        composeUriCore("authorizationUrl", element.getAuthorizationUrlElement(), false);
37857        composeUriExtras("authorizationUrl", element.getAuthorizationUrlElement(), false);
37858      }
37859  }
37860
37861  protected void composeCoverageEligibilityResponseBenefitComponent(String name, CoverageEligibilityResponse.BenefitComponent element) throws IOException {
37862    if (element != null) {
37863      open(name);
37864      composeCoverageEligibilityResponseBenefitComponentInner(element);
37865      close();
37866    }
37867  }
37868
37869  protected void composeCoverageEligibilityResponseBenefitComponentInner(CoverageEligibilityResponse.BenefitComponent element) throws IOException {
37870      composeBackbone(element);
37871      if (element.hasType()) {
37872        composeCodeableConcept("type", element.getType());
37873      }
37874      if (element.hasAllowed()) {
37875        composeType("allowed", element.getAllowed());
37876      }
37877      if (element.hasUsed()) {
37878        composeType("used", element.getUsed());
37879      }
37880  }
37881
37882  protected void composeCoverageEligibilityResponseErrorsComponent(String name, CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
37883    if (element != null) {
37884      open(name);
37885      composeCoverageEligibilityResponseErrorsComponentInner(element);
37886      close();
37887    }
37888  }
37889
37890  protected void composeCoverageEligibilityResponseErrorsComponentInner(CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
37891      composeBackbone(element);
37892      if (element.hasCode()) {
37893        composeCodeableConcept("code", element.getCode());
37894      }
37895  }
37896
37897  protected void composeDetectedIssue(String name, DetectedIssue element) throws IOException {
37898    if (element != null) {
37899      prop("resourceType", name);
37900      composeDetectedIssueInner(element);
37901    }
37902  }
37903
37904  protected void composeDetectedIssueInner(DetectedIssue element) throws IOException {
37905      composeDomainResourceElements(element);
37906      if (element.hasIdentifier()) {
37907        openArray("identifier");
37908        for (Identifier e : element.getIdentifier()) 
37909          composeIdentifier(null, e);
37910        closeArray();
37911      };
37912      if (element.hasStatusElement()) {
37913        composeEnumerationCore("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
37914        composeEnumerationExtras("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
37915      }
37916      if (element.hasCode()) {
37917        composeCodeableConcept("code", element.getCode());
37918      }
37919      if (element.hasSeverityElement()) {
37920        composeEnumerationCore("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
37921        composeEnumerationExtras("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
37922      }
37923      if (element.hasPatient()) {
37924        composeReference("patient", element.getPatient());
37925      }
37926      if (element.hasIdentified()) {
37927        composeType("identified", element.getIdentified());
37928      }
37929      if (element.hasAuthor()) {
37930        composeReference("author", element.getAuthor());
37931      }
37932      if (element.hasImplicated()) {
37933        openArray("implicated");
37934        for (Reference e : element.getImplicated()) 
37935          composeReference(null, e);
37936        closeArray();
37937      };
37938      if (element.hasEvidence()) {
37939        openArray("evidence");
37940        for (DetectedIssue.DetectedIssueEvidenceComponent e : element.getEvidence()) 
37941          composeDetectedIssueDetectedIssueEvidenceComponent(null, e);
37942        closeArray();
37943      };
37944      if (element.hasDetailElement()) {
37945        composeStringCore("detail", element.getDetailElement(), false);
37946        composeStringExtras("detail", element.getDetailElement(), false);
37947      }
37948      if (element.hasReferenceElement()) {
37949        composeUriCore("reference", element.getReferenceElement(), false);
37950        composeUriExtras("reference", element.getReferenceElement(), false);
37951      }
37952      if (element.hasMitigation()) {
37953        openArray("mitigation");
37954        for (DetectedIssue.DetectedIssueMitigationComponent e : element.getMitigation()) 
37955          composeDetectedIssueDetectedIssueMitigationComponent(null, e);
37956        closeArray();
37957      };
37958  }
37959
37960  protected void composeDetectedIssueDetectedIssueEvidenceComponent(String name, DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
37961    if (element != null) {
37962      open(name);
37963      composeDetectedIssueDetectedIssueEvidenceComponentInner(element);
37964      close();
37965    }
37966  }
37967
37968  protected void composeDetectedIssueDetectedIssueEvidenceComponentInner(DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
37969      composeBackbone(element);
37970      if (element.hasCode()) {
37971        openArray("code");
37972        for (CodeableConcept e : element.getCode()) 
37973          composeCodeableConcept(null, e);
37974        closeArray();
37975      };
37976      if (element.hasDetail()) {
37977        openArray("detail");
37978        for (Reference e : element.getDetail()) 
37979          composeReference(null, e);
37980        closeArray();
37981      };
37982  }
37983
37984  protected void composeDetectedIssueDetectedIssueMitigationComponent(String name, DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
37985    if (element != null) {
37986      open(name);
37987      composeDetectedIssueDetectedIssueMitigationComponentInner(element);
37988      close();
37989    }
37990  }
37991
37992  protected void composeDetectedIssueDetectedIssueMitigationComponentInner(DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
37993      composeBackbone(element);
37994      if (element.hasAction()) {
37995        composeCodeableConcept("action", element.getAction());
37996      }
37997      if (element.hasDateElement()) {
37998        composeDateTimeCore("date", element.getDateElement(), false);
37999        composeDateTimeExtras("date", element.getDateElement(), false);
38000      }
38001      if (element.hasAuthor()) {
38002        composeReference("author", element.getAuthor());
38003      }
38004  }
38005
38006  protected void composeDevice(String name, Device element) throws IOException {
38007    if (element != null) {
38008      prop("resourceType", name);
38009      composeDeviceInner(element);
38010    }
38011  }
38012
38013  protected void composeDeviceInner(Device element) throws IOException {
38014      composeDomainResourceElements(element);
38015      if (element.hasIdentifier()) {
38016        openArray("identifier");
38017        for (Identifier e : element.getIdentifier()) 
38018          composeIdentifier(null, e);
38019        closeArray();
38020      };
38021      if (element.hasDefinition()) {
38022        composeReference("definition", element.getDefinition());
38023      }
38024      if (element.hasUdiCarrier()) {
38025        openArray("udiCarrier");
38026        for (Device.DeviceUdiCarrierComponent e : element.getUdiCarrier()) 
38027          composeDeviceDeviceUdiCarrierComponent(null, e);
38028        closeArray();
38029      };
38030      if (element.hasStatusElement()) {
38031        composeEnumerationCore("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
38032        composeEnumerationExtras("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
38033      }
38034      if (element.hasStatusReason()) {
38035        openArray("statusReason");
38036        for (CodeableConcept e : element.getStatusReason()) 
38037          composeCodeableConcept(null, e);
38038        closeArray();
38039      };
38040      if (element.hasDistinctIdentifierElement()) {
38041        composeStringCore("distinctIdentifier", element.getDistinctIdentifierElement(), false);
38042        composeStringExtras("distinctIdentifier", element.getDistinctIdentifierElement(), false);
38043      }
38044      if (element.hasManufacturerElement()) {
38045        composeStringCore("manufacturer", element.getManufacturerElement(), false);
38046        composeStringExtras("manufacturer", element.getManufacturerElement(), false);
38047      }
38048      if (element.hasManufactureDateElement()) {
38049        composeDateTimeCore("manufactureDate", element.getManufactureDateElement(), false);
38050        composeDateTimeExtras("manufactureDate", element.getManufactureDateElement(), false);
38051      }
38052      if (element.hasExpirationDateElement()) {
38053        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
38054        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
38055      }
38056      if (element.hasLotNumberElement()) {
38057        composeStringCore("lotNumber", element.getLotNumberElement(), false);
38058        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
38059      }
38060      if (element.hasSerialNumberElement()) {
38061        composeStringCore("serialNumber", element.getSerialNumberElement(), false);
38062        composeStringExtras("serialNumber", element.getSerialNumberElement(), false);
38063      }
38064      if (element.hasDeviceName()) {
38065        openArray("deviceName");
38066        for (Device.DeviceDeviceNameComponent e : element.getDeviceName()) 
38067          composeDeviceDeviceDeviceNameComponent(null, e);
38068        closeArray();
38069      };
38070      if (element.hasModelNumberElement()) {
38071        composeStringCore("modelNumber", element.getModelNumberElement(), false);
38072        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
38073      }
38074      if (element.hasPartNumberElement()) {
38075        composeStringCore("partNumber", element.getPartNumberElement(), false);
38076        composeStringExtras("partNumber", element.getPartNumberElement(), false);
38077      }
38078      if (element.hasType()) {
38079        composeCodeableConcept("type", element.getType());
38080      }
38081      if (element.hasSpecialization()) {
38082        openArray("specialization");
38083        for (Device.DeviceSpecializationComponent e : element.getSpecialization()) 
38084          composeDeviceDeviceSpecializationComponent(null, e);
38085        closeArray();
38086      };
38087      if (element.hasVersion()) {
38088        openArray("version");
38089        for (Device.DeviceVersionComponent e : element.getVersion()) 
38090          composeDeviceDeviceVersionComponent(null, e);
38091        closeArray();
38092      };
38093      if (element.hasProperty()) {
38094        openArray("property");
38095        for (Device.DevicePropertyComponent e : element.getProperty()) 
38096          composeDeviceDevicePropertyComponent(null, e);
38097        closeArray();
38098      };
38099      if (element.hasPatient()) {
38100        composeReference("patient", element.getPatient());
38101      }
38102      if (element.hasOwner()) {
38103        composeReference("owner", element.getOwner());
38104      }
38105      if (element.hasContact()) {
38106        openArray("contact");
38107        for (ContactPoint e : element.getContact()) 
38108          composeContactPoint(null, e);
38109        closeArray();
38110      };
38111      if (element.hasLocation()) {
38112        composeReference("location", element.getLocation());
38113      }
38114      if (element.hasUrlElement()) {
38115        composeUriCore("url", element.getUrlElement(), false);
38116        composeUriExtras("url", element.getUrlElement(), false);
38117      }
38118      if (element.hasNote()) {
38119        openArray("note");
38120        for (Annotation e : element.getNote()) 
38121          composeAnnotation(null, e);
38122        closeArray();
38123      };
38124      if (element.hasSafety()) {
38125        openArray("safety");
38126        for (CodeableConcept e : element.getSafety()) 
38127          composeCodeableConcept(null, e);
38128        closeArray();
38129      };
38130      if (element.hasParent()) {
38131        composeReference("parent", element.getParent());
38132      }
38133  }
38134
38135  protected void composeDeviceDeviceUdiCarrierComponent(String name, Device.DeviceUdiCarrierComponent element) throws IOException {
38136    if (element != null) {
38137      open(name);
38138      composeDeviceDeviceUdiCarrierComponentInner(element);
38139      close();
38140    }
38141  }
38142
38143  protected void composeDeviceDeviceUdiCarrierComponentInner(Device.DeviceUdiCarrierComponent element) throws IOException {
38144      composeBackbone(element);
38145      if (element.hasDeviceIdentifierElement()) {
38146        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
38147        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
38148      }
38149      if (element.hasIssuerElement()) {
38150        composeUriCore("issuer", element.getIssuerElement(), false);
38151        composeUriExtras("issuer", element.getIssuerElement(), false);
38152      }
38153      if (element.hasJurisdictionElement()) {
38154        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
38155        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
38156      }
38157      if (element.hasCarrierAIDCElement()) {
38158        composeBase64BinaryCore("carrierAIDC", element.getCarrierAIDCElement(), false);
38159        composeBase64BinaryExtras("carrierAIDC", element.getCarrierAIDCElement(), false);
38160      }
38161      if (element.hasCarrierHRFElement()) {
38162        composeStringCore("carrierHRF", element.getCarrierHRFElement(), false);
38163        composeStringExtras("carrierHRF", element.getCarrierHRFElement(), false);
38164      }
38165      if (element.hasEntryTypeElement()) {
38166        composeEnumerationCore("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
38167        composeEnumerationExtras("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
38168      }
38169  }
38170
38171  protected void composeDeviceDeviceDeviceNameComponent(String name, Device.DeviceDeviceNameComponent element) throws IOException {
38172    if (element != null) {
38173      open(name);
38174      composeDeviceDeviceDeviceNameComponentInner(element);
38175      close();
38176    }
38177  }
38178
38179  protected void composeDeviceDeviceDeviceNameComponentInner(Device.DeviceDeviceNameComponent element) throws IOException {
38180      composeBackbone(element);
38181      if (element.hasNameElement()) {
38182        composeStringCore("name", element.getNameElement(), false);
38183        composeStringExtras("name", element.getNameElement(), false);
38184      }
38185      if (element.hasTypeElement()) {
38186        composeEnumerationCore("type", element.getTypeElement(), new Device.DeviceNameTypeEnumFactory(), false);
38187        composeEnumerationExtras("type", element.getTypeElement(), new Device.DeviceNameTypeEnumFactory(), false);
38188      }
38189  }
38190
38191  protected void composeDeviceDeviceSpecializationComponent(String name, Device.DeviceSpecializationComponent element) throws IOException {
38192    if (element != null) {
38193      open(name);
38194      composeDeviceDeviceSpecializationComponentInner(element);
38195      close();
38196    }
38197  }
38198
38199  protected void composeDeviceDeviceSpecializationComponentInner(Device.DeviceSpecializationComponent element) throws IOException {
38200      composeBackbone(element);
38201      if (element.hasSystemType()) {
38202        composeCodeableConcept("systemType", element.getSystemType());
38203      }
38204      if (element.hasVersionElement()) {
38205        composeStringCore("version", element.getVersionElement(), false);
38206        composeStringExtras("version", element.getVersionElement(), false);
38207      }
38208  }
38209
38210  protected void composeDeviceDeviceVersionComponent(String name, Device.DeviceVersionComponent element) throws IOException {
38211    if (element != null) {
38212      open(name);
38213      composeDeviceDeviceVersionComponentInner(element);
38214      close();
38215    }
38216  }
38217
38218  protected void composeDeviceDeviceVersionComponentInner(Device.DeviceVersionComponent element) throws IOException {
38219      composeBackbone(element);
38220      if (element.hasType()) {
38221        composeCodeableConcept("type", element.getType());
38222      }
38223      if (element.hasComponent()) {
38224        composeIdentifier("component", element.getComponent());
38225      }
38226      if (element.hasValueElement()) {
38227        composeStringCore("value", element.getValueElement(), false);
38228        composeStringExtras("value", element.getValueElement(), false);
38229      }
38230  }
38231
38232  protected void composeDeviceDevicePropertyComponent(String name, Device.DevicePropertyComponent element) throws IOException {
38233    if (element != null) {
38234      open(name);
38235      composeDeviceDevicePropertyComponentInner(element);
38236      close();
38237    }
38238  }
38239
38240  protected void composeDeviceDevicePropertyComponentInner(Device.DevicePropertyComponent element) throws IOException {
38241      composeBackbone(element);
38242      if (element.hasType()) {
38243        composeCodeableConcept("type", element.getType());
38244      }
38245      if (element.hasValueQuantity()) {
38246        openArray("valueQuantity");
38247        for (Quantity e : element.getValueQuantity()) 
38248          composeQuantity(null, e);
38249        closeArray();
38250      };
38251      if (element.hasValueCode()) {
38252        openArray("valueCode");
38253        for (CodeableConcept e : element.getValueCode()) 
38254          composeCodeableConcept(null, e);
38255        closeArray();
38256      };
38257  }
38258
38259  protected void composeDeviceDefinition(String name, DeviceDefinition element) throws IOException {
38260    if (element != null) {
38261      prop("resourceType", name);
38262      composeDeviceDefinitionInner(element);
38263    }
38264  }
38265
38266  protected void composeDeviceDefinitionInner(DeviceDefinition element) throws IOException {
38267      composeDomainResourceElements(element);
38268      if (element.hasIdentifier()) {
38269        openArray("identifier");
38270        for (Identifier e : element.getIdentifier()) 
38271          composeIdentifier(null, e);
38272        closeArray();
38273      };
38274      if (element.hasUdiDeviceIdentifier()) {
38275        openArray("udiDeviceIdentifier");
38276        for (DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent e : element.getUdiDeviceIdentifier()) 
38277          composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(null, e);
38278        closeArray();
38279      };
38280      if (element.hasManufacturer()) {
38281        composeType("manufacturer", element.getManufacturer());
38282      }
38283      if (element.hasDeviceName()) {
38284        openArray("deviceName");
38285        for (DeviceDefinition.DeviceDefinitionDeviceNameComponent e : element.getDeviceName()) 
38286          composeDeviceDefinitionDeviceDefinitionDeviceNameComponent(null, e);
38287        closeArray();
38288      };
38289      if (element.hasModelNumberElement()) {
38290        composeStringCore("modelNumber", element.getModelNumberElement(), false);
38291        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
38292      }
38293      if (element.hasType()) {
38294        composeCodeableConcept("type", element.getType());
38295      }
38296      if (element.hasSpecialization()) {
38297        openArray("specialization");
38298        for (DeviceDefinition.DeviceDefinitionSpecializationComponent e : element.getSpecialization()) 
38299          composeDeviceDefinitionDeviceDefinitionSpecializationComponent(null, e);
38300        closeArray();
38301      };
38302      if (element.hasVersion()) {
38303        openArray("version");
38304        for (StringType e : element.getVersion()) 
38305          composeStringCore(null, e, true);
38306        closeArray();
38307        if (anyHasExtras(element.getVersion())) {
38308          openArray("_version");
38309          for (StringType e : element.getVersion()) 
38310            composeStringExtras(null, e, true);
38311          closeArray();
38312        }
38313      };
38314      if (element.hasSafety()) {
38315        openArray("safety");
38316        for (CodeableConcept e : element.getSafety()) 
38317          composeCodeableConcept(null, e);
38318        closeArray();
38319      };
38320      if (element.hasShelfLifeStorage()) {
38321        openArray("shelfLifeStorage");
38322        for (ProductShelfLife e : element.getShelfLifeStorage()) 
38323          composeProductShelfLife(null, e);
38324        closeArray();
38325      };
38326      if (element.hasPhysicalCharacteristics()) {
38327        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
38328      }
38329      if (element.hasLanguageCode()) {
38330        openArray("languageCode");
38331        for (CodeableConcept e : element.getLanguageCode()) 
38332          composeCodeableConcept(null, e);
38333        closeArray();
38334      };
38335      if (element.hasCapability()) {
38336        openArray("capability");
38337        for (DeviceDefinition.DeviceDefinitionCapabilityComponent e : element.getCapability()) 
38338          composeDeviceDefinitionDeviceDefinitionCapabilityComponent(null, e);
38339        closeArray();
38340      };
38341      if (element.hasProperty()) {
38342        openArray("property");
38343        for (DeviceDefinition.DeviceDefinitionPropertyComponent e : element.getProperty()) 
38344          composeDeviceDefinitionDeviceDefinitionPropertyComponent(null, e);
38345        closeArray();
38346      };
38347      if (element.hasOwner()) {
38348        composeReference("owner", element.getOwner());
38349      }
38350      if (element.hasContact()) {
38351        openArray("contact");
38352        for (ContactPoint e : element.getContact()) 
38353          composeContactPoint(null, e);
38354        closeArray();
38355      };
38356      if (element.hasUrlElement()) {
38357        composeUriCore("url", element.getUrlElement(), false);
38358        composeUriExtras("url", element.getUrlElement(), false);
38359      }
38360      if (element.hasOnlineInformationElement()) {
38361        composeUriCore("onlineInformation", element.getOnlineInformationElement(), false);
38362        composeUriExtras("onlineInformation", element.getOnlineInformationElement(), false);
38363      }
38364      if (element.hasNote()) {
38365        openArray("note");
38366        for (Annotation e : element.getNote()) 
38367          composeAnnotation(null, e);
38368        closeArray();
38369      };
38370      if (element.hasQuantity()) {
38371        composeQuantity("quantity", element.getQuantity());
38372      }
38373      if (element.hasParentDevice()) {
38374        composeReference("parentDevice", element.getParentDevice());
38375      }
38376      if (element.hasMaterial()) {
38377        openArray("material");
38378        for (DeviceDefinition.DeviceDefinitionMaterialComponent e : element.getMaterial()) 
38379          composeDeviceDefinitionDeviceDefinitionMaterialComponent(null, e);
38380        closeArray();
38381      };
38382  }
38383
38384  protected void composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(String name, DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
38385    if (element != null) {
38386      open(name);
38387      composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentInner(element);
38388      close();
38389    }
38390  }
38391
38392  protected void composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentInner(DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
38393      composeBackbone(element);
38394      if (element.hasDeviceIdentifierElement()) {
38395        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
38396        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
38397      }
38398      if (element.hasIssuerElement()) {
38399        composeUriCore("issuer", element.getIssuerElement(), false);
38400        composeUriExtras("issuer", element.getIssuerElement(), false);
38401      }
38402      if (element.hasJurisdictionElement()) {
38403        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
38404        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
38405      }
38406  }
38407
38408  protected void composeDeviceDefinitionDeviceDefinitionDeviceNameComponent(String name, DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
38409    if (element != null) {
38410      open(name);
38411      composeDeviceDefinitionDeviceDefinitionDeviceNameComponentInner(element);
38412      close();
38413    }
38414  }
38415
38416  protected void composeDeviceDefinitionDeviceDefinitionDeviceNameComponentInner(DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
38417      composeBackbone(element);
38418      if (element.hasNameElement()) {
38419        composeStringCore("name", element.getNameElement(), false);
38420        composeStringExtras("name", element.getNameElement(), false);
38421      }
38422      if (element.hasTypeElement()) {
38423        composeEnumerationCore("type", element.getTypeElement(), new DeviceDefinition.DeviceNameTypeEnumFactory(), false);
38424        composeEnumerationExtras("type", element.getTypeElement(), new DeviceDefinition.DeviceNameTypeEnumFactory(), false);
38425      }
38426  }
38427
38428  protected void composeDeviceDefinitionDeviceDefinitionSpecializationComponent(String name, DeviceDefinition.DeviceDefinitionSpecializationComponent element) throws IOException {
38429    if (element != null) {
38430      open(name);
38431      composeDeviceDefinitionDeviceDefinitionSpecializationComponentInner(element);
38432      close();
38433    }
38434  }
38435
38436  protected void composeDeviceDefinitionDeviceDefinitionSpecializationComponentInner(DeviceDefinition.DeviceDefinitionSpecializationComponent element) throws IOException {
38437      composeBackbone(element);
38438      if (element.hasSystemTypeElement()) {
38439        composeStringCore("systemType", element.getSystemTypeElement(), false);
38440        composeStringExtras("systemType", element.getSystemTypeElement(), false);
38441      }
38442      if (element.hasVersionElement()) {
38443        composeStringCore("version", element.getVersionElement(), false);
38444        composeStringExtras("version", element.getVersionElement(), false);
38445      }
38446  }
38447
38448  protected void composeDeviceDefinitionDeviceDefinitionCapabilityComponent(String name, DeviceDefinition.DeviceDefinitionCapabilityComponent element) throws IOException {
38449    if (element != null) {
38450      open(name);
38451      composeDeviceDefinitionDeviceDefinitionCapabilityComponentInner(element);
38452      close();
38453    }
38454  }
38455
38456  protected void composeDeviceDefinitionDeviceDefinitionCapabilityComponentInner(DeviceDefinition.DeviceDefinitionCapabilityComponent element) throws IOException {
38457      composeBackbone(element);
38458      if (element.hasType()) {
38459        composeCodeableConcept("type", element.getType());
38460      }
38461      if (element.hasDescription()) {
38462        openArray("description");
38463        for (CodeableConcept e : element.getDescription()) 
38464          composeCodeableConcept(null, e);
38465        closeArray();
38466      };
38467  }
38468
38469  protected void composeDeviceDefinitionDeviceDefinitionPropertyComponent(String name, DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
38470    if (element != null) {
38471      open(name);
38472      composeDeviceDefinitionDeviceDefinitionPropertyComponentInner(element);
38473      close();
38474    }
38475  }
38476
38477  protected void composeDeviceDefinitionDeviceDefinitionPropertyComponentInner(DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
38478      composeBackbone(element);
38479      if (element.hasType()) {
38480        composeCodeableConcept("type", element.getType());
38481      }
38482      if (element.hasValueQuantity()) {
38483        openArray("valueQuantity");
38484        for (Quantity e : element.getValueQuantity()) 
38485          composeQuantity(null, e);
38486        closeArray();
38487      };
38488      if (element.hasValueCode()) {
38489        openArray("valueCode");
38490        for (CodeableConcept e : element.getValueCode()) 
38491          composeCodeableConcept(null, e);
38492        closeArray();
38493      };
38494  }
38495
38496  protected void composeDeviceDefinitionDeviceDefinitionMaterialComponent(String name, DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
38497    if (element != null) {
38498      open(name);
38499      composeDeviceDefinitionDeviceDefinitionMaterialComponentInner(element);
38500      close();
38501    }
38502  }
38503
38504  protected void composeDeviceDefinitionDeviceDefinitionMaterialComponentInner(DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
38505      composeBackbone(element);
38506      if (element.hasSubstance()) {
38507        composeCodeableConcept("substance", element.getSubstance());
38508      }
38509      if (element.hasAlternateElement()) {
38510        composeBooleanCore("alternate", element.getAlternateElement(), false);
38511        composeBooleanExtras("alternate", element.getAlternateElement(), false);
38512      }
38513      if (element.hasAllergenicIndicatorElement()) {
38514        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
38515        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
38516      }
38517  }
38518
38519  protected void composeDeviceMetric(String name, DeviceMetric element) throws IOException {
38520    if (element != null) {
38521      prop("resourceType", name);
38522      composeDeviceMetricInner(element);
38523    }
38524  }
38525
38526  protected void composeDeviceMetricInner(DeviceMetric element) throws IOException {
38527      composeDomainResourceElements(element);
38528      if (element.hasIdentifier()) {
38529        openArray("identifier");
38530        for (Identifier e : element.getIdentifier()) 
38531          composeIdentifier(null, e);
38532        closeArray();
38533      };
38534      if (element.hasType()) {
38535        composeCodeableConcept("type", element.getType());
38536      }
38537      if (element.hasUnit()) {
38538        composeCodeableConcept("unit", element.getUnit());
38539      }
38540      if (element.hasSource()) {
38541        composeReference("source", element.getSource());
38542      }
38543      if (element.hasParent()) {
38544        composeReference("parent", element.getParent());
38545      }
38546      if (element.hasOperationalStatusElement()) {
38547        composeEnumerationCore("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
38548        composeEnumerationExtras("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
38549      }
38550      if (element.hasColorElement()) {
38551        composeEnumerationCore("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
38552        composeEnumerationExtras("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
38553      }
38554      if (element.hasCategoryElement()) {
38555        composeEnumerationCore("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
38556        composeEnumerationExtras("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
38557      }
38558      if (element.hasMeasurementPeriod()) {
38559        composeTiming("measurementPeriod", element.getMeasurementPeriod());
38560      }
38561      if (element.hasCalibration()) {
38562        openArray("calibration");
38563        for (DeviceMetric.DeviceMetricCalibrationComponent e : element.getCalibration()) 
38564          composeDeviceMetricDeviceMetricCalibrationComponent(null, e);
38565        closeArray();
38566      };
38567  }
38568
38569  protected void composeDeviceMetricDeviceMetricCalibrationComponent(String name, DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
38570    if (element != null) {
38571      open(name);
38572      composeDeviceMetricDeviceMetricCalibrationComponentInner(element);
38573      close();
38574    }
38575  }
38576
38577  protected void composeDeviceMetricDeviceMetricCalibrationComponentInner(DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
38578      composeBackbone(element);
38579      if (element.hasTypeElement()) {
38580        composeEnumerationCore("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
38581        composeEnumerationExtras("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
38582      }
38583      if (element.hasStateElement()) {
38584        composeEnumerationCore("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
38585        composeEnumerationExtras("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
38586      }
38587      if (element.hasTimeElement()) {
38588        composeInstantCore("time", element.getTimeElement(), false);
38589        composeInstantExtras("time", element.getTimeElement(), false);
38590      }
38591  }
38592
38593  protected void composeDeviceRequest(String name, DeviceRequest element) throws IOException {
38594    if (element != null) {
38595      prop("resourceType", name);
38596      composeDeviceRequestInner(element);
38597    }
38598  }
38599
38600  protected void composeDeviceRequestInner(DeviceRequest element) throws IOException {
38601      composeDomainResourceElements(element);
38602      if (element.hasIdentifier()) {
38603        openArray("identifier");
38604        for (Identifier e : element.getIdentifier()) 
38605          composeIdentifier(null, e);
38606        closeArray();
38607      };
38608      if (element.hasInstantiatesCanonical()) {
38609        openArray("instantiatesCanonical");
38610        for (CanonicalType e : element.getInstantiatesCanonical()) 
38611          composeCanonicalCore(null, e, true);
38612        closeArray();
38613        if (anyHasExtras(element.getInstantiatesCanonical())) {
38614          openArray("_instantiatesCanonical");
38615          for (CanonicalType e : element.getInstantiatesCanonical()) 
38616            composeCanonicalExtras(null, e, true);
38617          closeArray();
38618        }
38619      };
38620      if (element.hasInstantiatesUri()) {
38621        openArray("instantiatesUri");
38622        for (UriType e : element.getInstantiatesUri()) 
38623          composeUriCore(null, e, true);
38624        closeArray();
38625        if (anyHasExtras(element.getInstantiatesUri())) {
38626          openArray("_instantiatesUri");
38627          for (UriType e : element.getInstantiatesUri()) 
38628            composeUriExtras(null, e, true);
38629          closeArray();
38630        }
38631      };
38632      if (element.hasBasedOn()) {
38633        openArray("basedOn");
38634        for (Reference e : element.getBasedOn()) 
38635          composeReference(null, e);
38636        closeArray();
38637      };
38638      if (element.hasPriorRequest()) {
38639        openArray("priorRequest");
38640        for (Reference e : element.getPriorRequest()) 
38641          composeReference(null, e);
38642        closeArray();
38643      };
38644      if (element.hasGroupIdentifier()) {
38645        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
38646      }
38647      if (element.hasStatusElement()) {
38648        composeEnumerationCore("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(), false);
38649        composeEnumerationExtras("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(), false);
38650      }
38651      if (element.hasIntentElement()) {
38652        composeEnumerationCore("intent", element.getIntentElement(), new DeviceRequest.RequestIntentEnumFactory(), false);
38653        composeEnumerationExtras("intent", element.getIntentElement(), new DeviceRequest.RequestIntentEnumFactory(), false);
38654      }
38655      if (element.hasPriorityElement()) {
38656        composeEnumerationCore("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(), false);
38657        composeEnumerationExtras("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(), false);
38658      }
38659      if (element.hasCode()) {
38660        composeType("code", element.getCode());
38661      }
38662      if (element.hasParameter()) {
38663        openArray("parameter");
38664        for (DeviceRequest.DeviceRequestParameterComponent e : element.getParameter()) 
38665          composeDeviceRequestDeviceRequestParameterComponent(null, e);
38666        closeArray();
38667      };
38668      if (element.hasSubject()) {
38669        composeReference("subject", element.getSubject());
38670      }
38671      if (element.hasEncounter()) {
38672        composeReference("encounter", element.getEncounter());
38673      }
38674      if (element.hasOccurrence()) {
38675        composeType("occurrence", element.getOccurrence());
38676      }
38677      if (element.hasAuthoredOnElement()) {
38678        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
38679        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
38680      }
38681      if (element.hasRequester()) {
38682        composeReference("requester", element.getRequester());
38683      }
38684      if (element.hasPerformerType()) {
38685        composeCodeableConcept("performerType", element.getPerformerType());
38686      }
38687      if (element.hasPerformer()) {
38688        composeReference("performer", element.getPerformer());
38689      }
38690      if (element.hasReasonCode()) {
38691        openArray("reasonCode");
38692        for (CodeableConcept e : element.getReasonCode()) 
38693          composeCodeableConcept(null, e);
38694        closeArray();
38695      };
38696      if (element.hasReasonReference()) {
38697        openArray("reasonReference");
38698        for (Reference e : element.getReasonReference()) 
38699          composeReference(null, e);
38700        closeArray();
38701      };
38702      if (element.hasInsurance()) {
38703        openArray("insurance");
38704        for (Reference e : element.getInsurance()) 
38705          composeReference(null, e);
38706        closeArray();
38707      };
38708      if (element.hasSupportingInfo()) {
38709        openArray("supportingInfo");
38710        for (Reference e : element.getSupportingInfo()) 
38711          composeReference(null, e);
38712        closeArray();
38713      };
38714      if (element.hasNote()) {
38715        openArray("note");
38716        for (Annotation e : element.getNote()) 
38717          composeAnnotation(null, e);
38718        closeArray();
38719      };
38720      if (element.hasRelevantHistory()) {
38721        openArray("relevantHistory");
38722        for (Reference e : element.getRelevantHistory()) 
38723          composeReference(null, e);
38724        closeArray();
38725      };
38726  }
38727
38728  protected void composeDeviceRequestDeviceRequestParameterComponent(String name, DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
38729    if (element != null) {
38730      open(name);
38731      composeDeviceRequestDeviceRequestParameterComponentInner(element);
38732      close();
38733    }
38734  }
38735
38736  protected void composeDeviceRequestDeviceRequestParameterComponentInner(DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
38737      composeBackbone(element);
38738      if (element.hasCode()) {
38739        composeCodeableConcept("code", element.getCode());
38740      }
38741      if (element.hasValue()) {
38742        composeType("value", element.getValue());
38743      }
38744  }
38745
38746  protected void composeDeviceUseStatement(String name, DeviceUseStatement element) throws IOException {
38747    if (element != null) {
38748      prop("resourceType", name);
38749      composeDeviceUseStatementInner(element);
38750    }
38751  }
38752
38753  protected void composeDeviceUseStatementInner(DeviceUseStatement element) throws IOException {
38754      composeDomainResourceElements(element);
38755      if (element.hasIdentifier()) {
38756        openArray("identifier");
38757        for (Identifier e : element.getIdentifier()) 
38758          composeIdentifier(null, e);
38759        closeArray();
38760      };
38761      if (element.hasBasedOn()) {
38762        openArray("basedOn");
38763        for (Reference e : element.getBasedOn()) 
38764          composeReference(null, e);
38765        closeArray();
38766      };
38767      if (element.hasStatusElement()) {
38768        composeEnumerationCore("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
38769        composeEnumerationExtras("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
38770      }
38771      if (element.hasSubject()) {
38772        composeReference("subject", element.getSubject());
38773      }
38774      if (element.hasDerivedFrom()) {
38775        openArray("derivedFrom");
38776        for (Reference e : element.getDerivedFrom()) 
38777          composeReference(null, e);
38778        closeArray();
38779      };
38780      if (element.hasTiming()) {
38781        composeType("timing", element.getTiming());
38782      }
38783      if (element.hasRecordedOnElement()) {
38784        composeDateTimeCore("recordedOn", element.getRecordedOnElement(), false);
38785        composeDateTimeExtras("recordedOn", element.getRecordedOnElement(), false);
38786      }
38787      if (element.hasSource()) {
38788        composeReference("source", element.getSource());
38789      }
38790      if (element.hasDevice()) {
38791        composeReference("device", element.getDevice());
38792      }
38793      if (element.hasReasonCode()) {
38794        openArray("reasonCode");
38795        for (CodeableConcept e : element.getReasonCode()) 
38796          composeCodeableConcept(null, e);
38797        closeArray();
38798      };
38799      if (element.hasReasonReference()) {
38800        openArray("reasonReference");
38801        for (Reference e : element.getReasonReference()) 
38802          composeReference(null, e);
38803        closeArray();
38804      };
38805      if (element.hasBodySite()) {
38806        composeCodeableConcept("bodySite", element.getBodySite());
38807      }
38808      if (element.hasNote()) {
38809        openArray("note");
38810        for (Annotation e : element.getNote()) 
38811          composeAnnotation(null, e);
38812        closeArray();
38813      };
38814  }
38815
38816  protected void composeDiagnosticReport(String name, DiagnosticReport element) throws IOException {
38817    if (element != null) {
38818      prop("resourceType", name);
38819      composeDiagnosticReportInner(element);
38820    }
38821  }
38822
38823  protected void composeDiagnosticReportInner(DiagnosticReport element) throws IOException {
38824      composeDomainResourceElements(element);
38825      if (element.hasIdentifier()) {
38826        openArray("identifier");
38827        for (Identifier e : element.getIdentifier()) 
38828          composeIdentifier(null, e);
38829        closeArray();
38830      };
38831      if (element.hasBasedOn()) {
38832        openArray("basedOn");
38833        for (Reference e : element.getBasedOn()) 
38834          composeReference(null, e);
38835        closeArray();
38836      };
38837      if (element.hasStatusElement()) {
38838        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
38839        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
38840      }
38841      if (element.hasCategory()) {
38842        openArray("category");
38843        for (CodeableConcept e : element.getCategory()) 
38844          composeCodeableConcept(null, e);
38845        closeArray();
38846      };
38847      if (element.hasCode()) {
38848        composeCodeableConcept("code", element.getCode());
38849      }
38850      if (element.hasSubject()) {
38851        composeReference("subject", element.getSubject());
38852      }
38853      if (element.hasEncounter()) {
38854        composeReference("encounter", element.getEncounter());
38855      }
38856      if (element.hasEffective()) {
38857        composeType("effective", element.getEffective());
38858      }
38859      if (element.hasIssuedElement()) {
38860        composeInstantCore("issued", element.getIssuedElement(), false);
38861        composeInstantExtras("issued", element.getIssuedElement(), false);
38862      }
38863      if (element.hasPerformer()) {
38864        openArray("performer");
38865        for (Reference e : element.getPerformer()) 
38866          composeReference(null, e);
38867        closeArray();
38868      };
38869      if (element.hasResultsInterpreter()) {
38870        openArray("resultsInterpreter");
38871        for (Reference e : element.getResultsInterpreter()) 
38872          composeReference(null, e);
38873        closeArray();
38874      };
38875      if (element.hasSpecimen()) {
38876        openArray("specimen");
38877        for (Reference e : element.getSpecimen()) 
38878          composeReference(null, e);
38879        closeArray();
38880      };
38881      if (element.hasResult()) {
38882        openArray("result");
38883        for (Reference e : element.getResult()) 
38884          composeReference(null, e);
38885        closeArray();
38886      };
38887      if (element.hasImagingStudy()) {
38888        openArray("imagingStudy");
38889        for (Reference e : element.getImagingStudy()) 
38890          composeReference(null, e);
38891        closeArray();
38892      };
38893      if (element.hasMedia()) {
38894        openArray("media");
38895        for (DiagnosticReport.DiagnosticReportMediaComponent e : element.getMedia()) 
38896          composeDiagnosticReportDiagnosticReportMediaComponent(null, e);
38897        closeArray();
38898      };
38899      if (element.hasConclusionElement()) {
38900        composeStringCore("conclusion", element.getConclusionElement(), false);
38901        composeStringExtras("conclusion", element.getConclusionElement(), false);
38902      }
38903      if (element.hasConclusionCode()) {
38904        openArray("conclusionCode");
38905        for (CodeableConcept e : element.getConclusionCode()) 
38906          composeCodeableConcept(null, e);
38907        closeArray();
38908      };
38909      if (element.hasPresentedForm()) {
38910        openArray("presentedForm");
38911        for (Attachment e : element.getPresentedForm()) 
38912          composeAttachment(null, e);
38913        closeArray();
38914      };
38915  }
38916
38917  protected void composeDiagnosticReportDiagnosticReportMediaComponent(String name, DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
38918    if (element != null) {
38919      open(name);
38920      composeDiagnosticReportDiagnosticReportMediaComponentInner(element);
38921      close();
38922    }
38923  }
38924
38925  protected void composeDiagnosticReportDiagnosticReportMediaComponentInner(DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
38926      composeBackbone(element);
38927      if (element.hasCommentElement()) {
38928        composeStringCore("comment", element.getCommentElement(), false);
38929        composeStringExtras("comment", element.getCommentElement(), false);
38930      }
38931      if (element.hasLink()) {
38932        composeReference("link", element.getLink());
38933      }
38934  }
38935
38936  protected void composeDocumentManifest(String name, DocumentManifest element) throws IOException {
38937    if (element != null) {
38938      prop("resourceType", name);
38939      composeDocumentManifestInner(element);
38940    }
38941  }
38942
38943  protected void composeDocumentManifestInner(DocumentManifest element) throws IOException {
38944      composeDomainResourceElements(element);
38945      if (element.hasMasterIdentifier()) {
38946        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
38947      }
38948      if (element.hasIdentifier()) {
38949        openArray("identifier");
38950        for (Identifier e : element.getIdentifier()) 
38951          composeIdentifier(null, e);
38952        closeArray();
38953      };
38954      if (element.hasStatusElement()) {
38955        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
38956        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
38957      }
38958      if (element.hasType()) {
38959        composeCodeableConcept("type", element.getType());
38960      }
38961      if (element.hasSubject()) {
38962        composeReference("subject", element.getSubject());
38963      }
38964      if (element.hasCreatedElement()) {
38965        composeDateTimeCore("created", element.getCreatedElement(), false);
38966        composeDateTimeExtras("created", element.getCreatedElement(), false);
38967      }
38968      if (element.hasAuthor()) {
38969        openArray("author");
38970        for (Reference e : element.getAuthor()) 
38971          composeReference(null, e);
38972        closeArray();
38973      };
38974      if (element.hasRecipient()) {
38975        openArray("recipient");
38976        for (Reference e : element.getRecipient()) 
38977          composeReference(null, e);
38978        closeArray();
38979      };
38980      if (element.hasSourceElement()) {
38981        composeUriCore("source", element.getSourceElement(), false);
38982        composeUriExtras("source", element.getSourceElement(), false);
38983      }
38984      if (element.hasDescriptionElement()) {
38985        composeStringCore("description", element.getDescriptionElement(), false);
38986        composeStringExtras("description", element.getDescriptionElement(), false);
38987      }
38988      if (element.hasContent()) {
38989        openArray("content");
38990        for (Reference e : element.getContent()) 
38991          composeReference(null, e);
38992        closeArray();
38993      };
38994      if (element.hasRelated()) {
38995        openArray("related");
38996        for (DocumentManifest.DocumentManifestRelatedComponent e : element.getRelated()) 
38997          composeDocumentManifestDocumentManifestRelatedComponent(null, e);
38998        closeArray();
38999      };
39000  }
39001
39002  protected void composeDocumentManifestDocumentManifestRelatedComponent(String name, DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
39003    if (element != null) {
39004      open(name);
39005      composeDocumentManifestDocumentManifestRelatedComponentInner(element);
39006      close();
39007    }
39008  }
39009
39010  protected void composeDocumentManifestDocumentManifestRelatedComponentInner(DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
39011      composeBackbone(element);
39012      if (element.hasIdentifier()) {
39013        composeIdentifier("identifier", element.getIdentifier());
39014      }
39015      if (element.hasRef()) {
39016        composeReference("ref", element.getRef());
39017      }
39018  }
39019
39020  protected void composeDocumentReference(String name, DocumentReference element) throws IOException {
39021    if (element != null) {
39022      prop("resourceType", name);
39023      composeDocumentReferenceInner(element);
39024    }
39025  }
39026
39027  protected void composeDocumentReferenceInner(DocumentReference element) throws IOException {
39028      composeDomainResourceElements(element);
39029      if (element.hasMasterIdentifier()) {
39030        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
39031      }
39032      if (element.hasIdentifier()) {
39033        openArray("identifier");
39034        for (Identifier e : element.getIdentifier()) 
39035          composeIdentifier(null, e);
39036        closeArray();
39037      };
39038      if (element.hasStatusElement()) {
39039        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
39040        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
39041      }
39042      if (element.hasDocStatusElement()) {
39043        composeEnumerationCore("docStatus", element.getDocStatusElement(), new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
39044        composeEnumerationExtras("docStatus", element.getDocStatusElement(), new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
39045      }
39046      if (element.hasType()) {
39047        composeCodeableConcept("type", element.getType());
39048      }
39049      if (element.hasCategory()) {
39050        openArray("category");
39051        for (CodeableConcept e : element.getCategory()) 
39052          composeCodeableConcept(null, e);
39053        closeArray();
39054      };
39055      if (element.hasSubject()) {
39056        composeReference("subject", element.getSubject());
39057      }
39058      if (element.hasDateElement()) {
39059        composeInstantCore("date", element.getDateElement(), false);
39060        composeInstantExtras("date", element.getDateElement(), false);
39061      }
39062      if (element.hasAuthor()) {
39063        openArray("author");
39064        for (Reference e : element.getAuthor()) 
39065          composeReference(null, e);
39066        closeArray();
39067      };
39068      if (element.hasAuthenticator()) {
39069        composeReference("authenticator", element.getAuthenticator());
39070      }
39071      if (element.hasCustodian()) {
39072        composeReference("custodian", element.getCustodian());
39073      }
39074      if (element.hasRelatesTo()) {
39075        openArray("relatesTo");
39076        for (DocumentReference.DocumentReferenceRelatesToComponent e : element.getRelatesTo()) 
39077          composeDocumentReferenceDocumentReferenceRelatesToComponent(null, e);
39078        closeArray();
39079      };
39080      if (element.hasDescriptionElement()) {
39081        composeStringCore("description", element.getDescriptionElement(), false);
39082        composeStringExtras("description", element.getDescriptionElement(), false);
39083      }
39084      if (element.hasSecurityLabel()) {
39085        openArray("securityLabel");
39086        for (CodeableConcept e : element.getSecurityLabel()) 
39087          composeCodeableConcept(null, e);
39088        closeArray();
39089      };
39090      if (element.hasContent()) {
39091        openArray("content");
39092        for (DocumentReference.DocumentReferenceContentComponent e : element.getContent()) 
39093          composeDocumentReferenceDocumentReferenceContentComponent(null, e);
39094        closeArray();
39095      };
39096      if (element.hasContext()) {
39097        composeDocumentReferenceDocumentReferenceContextComponent("context", element.getContext());
39098      }
39099  }
39100
39101  protected void composeDocumentReferenceDocumentReferenceRelatesToComponent(String name, DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
39102    if (element != null) {
39103      open(name);
39104      composeDocumentReferenceDocumentReferenceRelatesToComponentInner(element);
39105      close();
39106    }
39107  }
39108
39109  protected void composeDocumentReferenceDocumentReferenceRelatesToComponentInner(DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
39110      composeBackbone(element);
39111      if (element.hasCodeElement()) {
39112        composeEnumerationCore("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
39113        composeEnumerationExtras("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
39114      }
39115      if (element.hasTarget()) {
39116        composeReference("target", element.getTarget());
39117      }
39118  }
39119
39120  protected void composeDocumentReferenceDocumentReferenceContentComponent(String name, DocumentReference.DocumentReferenceContentComponent element) throws IOException {
39121    if (element != null) {
39122      open(name);
39123      composeDocumentReferenceDocumentReferenceContentComponentInner(element);
39124      close();
39125    }
39126  }
39127
39128  protected void composeDocumentReferenceDocumentReferenceContentComponentInner(DocumentReference.DocumentReferenceContentComponent element) throws IOException {
39129      composeBackbone(element);
39130      if (element.hasAttachment()) {
39131        composeAttachment("attachment", element.getAttachment());
39132      }
39133      if (element.hasFormat()) {
39134        composeCoding("format", element.getFormat());
39135      }
39136  }
39137
39138  protected void composeDocumentReferenceDocumentReferenceContextComponent(String name, DocumentReference.DocumentReferenceContextComponent element) throws IOException {
39139    if (element != null) {
39140      open(name);
39141      composeDocumentReferenceDocumentReferenceContextComponentInner(element);
39142      close();
39143    }
39144  }
39145
39146  protected void composeDocumentReferenceDocumentReferenceContextComponentInner(DocumentReference.DocumentReferenceContextComponent element) throws IOException {
39147      composeBackbone(element);
39148      if (element.hasEncounter()) {
39149        openArray("encounter");
39150        for (Reference e : element.getEncounter()) 
39151          composeReference(null, e);
39152        closeArray();
39153      };
39154      if (element.hasEvent()) {
39155        openArray("event");
39156        for (CodeableConcept e : element.getEvent()) 
39157          composeCodeableConcept(null, e);
39158        closeArray();
39159      };
39160      if (element.hasPeriod()) {
39161        composePeriod("period", element.getPeriod());
39162      }
39163      if (element.hasFacilityType()) {
39164        composeCodeableConcept("facilityType", element.getFacilityType());
39165      }
39166      if (element.hasPracticeSetting()) {
39167        composeCodeableConcept("practiceSetting", element.getPracticeSetting());
39168      }
39169      if (element.hasSourcePatientInfo()) {
39170        composeReference("sourcePatientInfo", element.getSourcePatientInfo());
39171      }
39172      if (element.hasRelated()) {
39173        openArray("related");
39174        for (Reference e : element.getRelated()) 
39175          composeReference(null, e);
39176        closeArray();
39177      };
39178  }
39179
39180  protected void composeEffectEvidenceSynthesis(String name, EffectEvidenceSynthesis element) throws IOException {
39181    if (element != null) {
39182      prop("resourceType", name);
39183      composeEffectEvidenceSynthesisInner(element);
39184    }
39185  }
39186
39187  protected void composeEffectEvidenceSynthesisInner(EffectEvidenceSynthesis element) throws IOException {
39188      composeDomainResourceElements(element);
39189      if (element.hasUrlElement()) {
39190        composeUriCore("url", element.getUrlElement(), false);
39191        composeUriExtras("url", element.getUrlElement(), false);
39192      }
39193      if (element.hasIdentifier()) {
39194        openArray("identifier");
39195        for (Identifier e : element.getIdentifier()) 
39196          composeIdentifier(null, e);
39197        closeArray();
39198      };
39199      if (element.hasVersionElement()) {
39200        composeStringCore("version", element.getVersionElement(), false);
39201        composeStringExtras("version", element.getVersionElement(), false);
39202      }
39203      if (element.hasNameElement()) {
39204        composeStringCore("name", element.getNameElement(), false);
39205        composeStringExtras("name", element.getNameElement(), false);
39206      }
39207      if (element.hasTitleElement()) {
39208        composeStringCore("title", element.getTitleElement(), false);
39209        composeStringExtras("title", element.getTitleElement(), false);
39210      }
39211      if (element.hasStatusElement()) {
39212        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39213        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39214      }
39215      if (element.hasDateElement()) {
39216        composeDateTimeCore("date", element.getDateElement(), false);
39217        composeDateTimeExtras("date", element.getDateElement(), false);
39218      }
39219      if (element.hasPublisherElement()) {
39220        composeStringCore("publisher", element.getPublisherElement(), false);
39221        composeStringExtras("publisher", element.getPublisherElement(), false);
39222      }
39223      if (element.hasContact()) {
39224        openArray("contact");
39225        for (ContactDetail e : element.getContact()) 
39226          composeContactDetail(null, e);
39227        closeArray();
39228      };
39229      if (element.hasDescriptionElement()) {
39230        composeMarkdownCore("description", element.getDescriptionElement(), false);
39231        composeMarkdownExtras("description", element.getDescriptionElement(), false);
39232      }
39233      if (element.hasNote()) {
39234        openArray("note");
39235        for (Annotation e : element.getNote()) 
39236          composeAnnotation(null, e);
39237        closeArray();
39238      };
39239      if (element.hasUseContext()) {
39240        openArray("useContext");
39241        for (UsageContext e : element.getUseContext()) 
39242          composeUsageContext(null, e);
39243        closeArray();
39244      };
39245      if (element.hasJurisdiction()) {
39246        openArray("jurisdiction");
39247        for (CodeableConcept e : element.getJurisdiction()) 
39248          composeCodeableConcept(null, e);
39249        closeArray();
39250      };
39251      if (element.hasCopyrightElement()) {
39252        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
39253        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
39254      }
39255      if (element.hasApprovalDateElement()) {
39256        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
39257        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
39258      }
39259      if (element.hasLastReviewDateElement()) {
39260        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
39261        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
39262      }
39263      if (element.hasEffectivePeriod()) {
39264        composePeriod("effectivePeriod", element.getEffectivePeriod());
39265      }
39266      if (element.hasTopic()) {
39267        openArray("topic");
39268        for (CodeableConcept e : element.getTopic()) 
39269          composeCodeableConcept(null, e);
39270        closeArray();
39271      };
39272      if (element.hasAuthor()) {
39273        openArray("author");
39274        for (ContactDetail e : element.getAuthor()) 
39275          composeContactDetail(null, e);
39276        closeArray();
39277      };
39278      if (element.hasEditor()) {
39279        openArray("editor");
39280        for (ContactDetail e : element.getEditor()) 
39281          composeContactDetail(null, e);
39282        closeArray();
39283      };
39284      if (element.hasReviewer()) {
39285        openArray("reviewer");
39286        for (ContactDetail e : element.getReviewer()) 
39287          composeContactDetail(null, e);
39288        closeArray();
39289      };
39290      if (element.hasEndorser()) {
39291        openArray("endorser");
39292        for (ContactDetail e : element.getEndorser()) 
39293          composeContactDetail(null, e);
39294        closeArray();
39295      };
39296      if (element.hasRelatedArtifact()) {
39297        openArray("relatedArtifact");
39298        for (RelatedArtifact e : element.getRelatedArtifact()) 
39299          composeRelatedArtifact(null, e);
39300        closeArray();
39301      };
39302      if (element.hasSynthesisType()) {
39303        composeCodeableConcept("synthesisType", element.getSynthesisType());
39304      }
39305      if (element.hasStudyType()) {
39306        composeCodeableConcept("studyType", element.getStudyType());
39307      }
39308      if (element.hasPopulation()) {
39309        composeReference("population", element.getPopulation());
39310      }
39311      if (element.hasExposure()) {
39312        composeReference("exposure", element.getExposure());
39313      }
39314      if (element.hasExposureAlternative()) {
39315        composeReference("exposureAlternative", element.getExposureAlternative());
39316      }
39317      if (element.hasOutcome()) {
39318        composeReference("outcome", element.getOutcome());
39319      }
39320      if (element.hasSampleSize()) {
39321        composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent("sampleSize", element.getSampleSize());
39322      }
39323      if (element.hasResultsByExposure()) {
39324        openArray("resultsByExposure");
39325        for (EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent e : element.getResultsByExposure()) 
39326          composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(null, e);
39327        closeArray();
39328      };
39329      if (element.hasEffectEstimate()) {
39330        openArray("effectEstimate");
39331        for (EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent e : element.getEffectEstimate()) 
39332          composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(null, e);
39333        closeArray();
39334      };
39335      if (element.hasCertainty()) {
39336        openArray("certainty");
39337        for (EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent e : element.getCertainty()) 
39338          composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(null, e);
39339        closeArray();
39340      };
39341  }
39342
39343  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent element) throws IOException {
39344    if (element != null) {
39345      open(name);
39346      composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentInner(element);
39347      close();
39348    }
39349  }
39350
39351  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent element) throws IOException {
39352      composeBackbone(element);
39353      if (element.hasDescriptionElement()) {
39354        composeStringCore("description", element.getDescriptionElement(), false);
39355        composeStringExtras("description", element.getDescriptionElement(), false);
39356      }
39357      if (element.hasNumberOfStudiesElement()) {
39358        composeIntegerCore("numberOfStudies", element.getNumberOfStudiesElement(), false);
39359        composeIntegerExtras("numberOfStudies", element.getNumberOfStudiesElement(), false);
39360      }
39361      if (element.hasNumberOfParticipantsElement()) {
39362        composeIntegerCore("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
39363        composeIntegerExtras("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
39364      }
39365  }
39366
39367  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent element) throws IOException {
39368    if (element != null) {
39369      open(name);
39370      composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentInner(element);
39371      close();
39372    }
39373  }
39374
39375  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent element) throws IOException {
39376      composeBackbone(element);
39377      if (element.hasDescriptionElement()) {
39378        composeStringCore("description", element.getDescriptionElement(), false);
39379        composeStringExtras("description", element.getDescriptionElement(), false);
39380      }
39381      if (element.hasExposureStateElement()) {
39382        composeEnumerationCore("exposureState", element.getExposureStateElement(), new EffectEvidenceSynthesis.ExposureStateEnumFactory(), false);
39383        composeEnumerationExtras("exposureState", element.getExposureStateElement(), new EffectEvidenceSynthesis.ExposureStateEnumFactory(), false);
39384      }
39385      if (element.hasVariantState()) {
39386        composeCodeableConcept("variantState", element.getVariantState());
39387      }
39388      if (element.hasRiskEvidenceSynthesis()) {
39389        composeReference("riskEvidenceSynthesis", element.getRiskEvidenceSynthesis());
39390      }
39391  }
39392
39393  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent element) throws IOException {
39394    if (element != null) {
39395      open(name);
39396      composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentInner(element);
39397      close();
39398    }
39399  }
39400
39401  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent element) throws IOException {
39402      composeBackbone(element);
39403      if (element.hasDescriptionElement()) {
39404        composeStringCore("description", element.getDescriptionElement(), false);
39405        composeStringExtras("description", element.getDescriptionElement(), false);
39406      }
39407      if (element.hasType()) {
39408        composeCodeableConcept("type", element.getType());
39409      }
39410      if (element.hasVariantState()) {
39411        composeCodeableConcept("variantState", element.getVariantState());
39412      }
39413      if (element.hasValueElement()) {
39414        composeDecimalCore("value", element.getValueElement(), false);
39415        composeDecimalExtras("value", element.getValueElement(), false);
39416      }
39417      if (element.hasUnitOfMeasure()) {
39418        composeCodeableConcept("unitOfMeasure", element.getUnitOfMeasure());
39419      }
39420      if (element.hasPrecisionEstimate()) {
39421        openArray("precisionEstimate");
39422        for (EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent e : element.getPrecisionEstimate()) 
39423          composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(null, e);
39424        closeArray();
39425      };
39426  }
39427
39428  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent element) throws IOException {
39429    if (element != null) {
39430      open(name);
39431      composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentInner(element);
39432      close();
39433    }
39434  }
39435
39436  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent element) throws IOException {
39437      composeBackbone(element);
39438      if (element.hasType()) {
39439        composeCodeableConcept("type", element.getType());
39440      }
39441      if (element.hasLevelElement()) {
39442        composeDecimalCore("level", element.getLevelElement(), false);
39443        composeDecimalExtras("level", element.getLevelElement(), false);
39444      }
39445      if (element.hasFromElement()) {
39446        composeDecimalCore("from", element.getFromElement(), false);
39447        composeDecimalExtras("from", element.getFromElement(), false);
39448      }
39449      if (element.hasToElement()) {
39450        composeDecimalCore("to", element.getToElement(), false);
39451        composeDecimalExtras("to", element.getToElement(), false);
39452      }
39453  }
39454
39455  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent element) throws IOException {
39456    if (element != null) {
39457      open(name);
39458      composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentInner(element);
39459      close();
39460    }
39461  }
39462
39463  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent element) throws IOException {
39464      composeBackbone(element);
39465      if (element.hasRating()) {
39466        openArray("rating");
39467        for (CodeableConcept e : element.getRating()) 
39468          composeCodeableConcept(null, e);
39469        closeArray();
39470      };
39471      if (element.hasNote()) {
39472        openArray("note");
39473        for (Annotation e : element.getNote()) 
39474          composeAnnotation(null, e);
39475        closeArray();
39476      };
39477      if (element.hasCertaintySubcomponent()) {
39478        openArray("certaintySubcomponent");
39479        for (EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent e : element.getCertaintySubcomponent()) 
39480          composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(null, e);
39481        closeArray();
39482      };
39483  }
39484
39485  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent element) throws IOException {
39486    if (element != null) {
39487      open(name);
39488      composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentInner(element);
39489      close();
39490    }
39491  }
39492
39493  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent element) throws IOException {
39494      composeBackbone(element);
39495      if (element.hasType()) {
39496        composeCodeableConcept("type", element.getType());
39497      }
39498      if (element.hasRating()) {
39499        openArray("rating");
39500        for (CodeableConcept e : element.getRating()) 
39501          composeCodeableConcept(null, e);
39502        closeArray();
39503      };
39504      if (element.hasNote()) {
39505        openArray("note");
39506        for (Annotation e : element.getNote()) 
39507          composeAnnotation(null, e);
39508        closeArray();
39509      };
39510  }
39511
39512  protected void composeEncounter(String name, Encounter element) throws IOException {
39513    if (element != null) {
39514      prop("resourceType", name);
39515      composeEncounterInner(element);
39516    }
39517  }
39518
39519  protected void composeEncounterInner(Encounter element) throws IOException {
39520      composeDomainResourceElements(element);
39521      if (element.hasIdentifier()) {
39522        openArray("identifier");
39523        for (Identifier e : element.getIdentifier()) 
39524          composeIdentifier(null, e);
39525        closeArray();
39526      };
39527      if (element.hasStatusElement()) {
39528        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
39529        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
39530      }
39531      if (element.hasStatusHistory()) {
39532        openArray("statusHistory");
39533        for (Encounter.StatusHistoryComponent e : element.getStatusHistory()) 
39534          composeEncounterStatusHistoryComponent(null, e);
39535        closeArray();
39536      };
39537      if (element.hasClass_()) {
39538        composeCoding("class", element.getClass_());
39539      }
39540      if (element.hasClassHistory()) {
39541        openArray("classHistory");
39542        for (Encounter.ClassHistoryComponent e : element.getClassHistory()) 
39543          composeEncounterClassHistoryComponent(null, e);
39544        closeArray();
39545      };
39546      if (element.hasType()) {
39547        openArray("type");
39548        for (CodeableConcept e : element.getType()) 
39549          composeCodeableConcept(null, e);
39550        closeArray();
39551      };
39552      if (element.hasServiceType()) {
39553        composeCodeableConcept("serviceType", element.getServiceType());
39554      }
39555      if (element.hasPriority()) {
39556        composeCodeableConcept("priority", element.getPriority());
39557      }
39558      if (element.hasSubject()) {
39559        composeReference("subject", element.getSubject());
39560      }
39561      if (element.hasEpisodeOfCare()) {
39562        openArray("episodeOfCare");
39563        for (Reference e : element.getEpisodeOfCare()) 
39564          composeReference(null, e);
39565        closeArray();
39566      };
39567      if (element.hasBasedOn()) {
39568        openArray("basedOn");
39569        for (Reference e : element.getBasedOn()) 
39570          composeReference(null, e);
39571        closeArray();
39572      };
39573      if (element.hasParticipant()) {
39574        openArray("participant");
39575        for (Encounter.EncounterParticipantComponent e : element.getParticipant()) 
39576          composeEncounterEncounterParticipantComponent(null, e);
39577        closeArray();
39578      };
39579      if (element.hasAppointment()) {
39580        openArray("appointment");
39581        for (Reference e : element.getAppointment()) 
39582          composeReference(null, e);
39583        closeArray();
39584      };
39585      if (element.hasPeriod()) {
39586        composePeriod("period", element.getPeriod());
39587      }
39588      if (element.hasLength()) {
39589        composeDuration("length", element.getLength());
39590      }
39591      if (element.hasReasonCode()) {
39592        openArray("reasonCode");
39593        for (CodeableConcept e : element.getReasonCode()) 
39594          composeCodeableConcept(null, e);
39595        closeArray();
39596      };
39597      if (element.hasReasonReference()) {
39598        openArray("reasonReference");
39599        for (Reference e : element.getReasonReference()) 
39600          composeReference(null, e);
39601        closeArray();
39602      };
39603      if (element.hasDiagnosis()) {
39604        openArray("diagnosis");
39605        for (Encounter.DiagnosisComponent e : element.getDiagnosis()) 
39606          composeEncounterDiagnosisComponent(null, e);
39607        closeArray();
39608      };
39609      if (element.hasAccount()) {
39610        openArray("account");
39611        for (Reference e : element.getAccount()) 
39612          composeReference(null, e);
39613        closeArray();
39614      };
39615      if (element.hasHospitalization()) {
39616        composeEncounterEncounterHospitalizationComponent("hospitalization", element.getHospitalization());
39617      }
39618      if (element.hasLocation()) {
39619        openArray("location");
39620        for (Encounter.EncounterLocationComponent e : element.getLocation()) 
39621          composeEncounterEncounterLocationComponent(null, e);
39622        closeArray();
39623      };
39624      if (element.hasServiceProvider()) {
39625        composeReference("serviceProvider", element.getServiceProvider());
39626      }
39627      if (element.hasPartOf()) {
39628        composeReference("partOf", element.getPartOf());
39629      }
39630  }
39631
39632  protected void composeEncounterStatusHistoryComponent(String name, Encounter.StatusHistoryComponent element) throws IOException {
39633    if (element != null) {
39634      open(name);
39635      composeEncounterStatusHistoryComponentInner(element);
39636      close();
39637    }
39638  }
39639
39640  protected void composeEncounterStatusHistoryComponentInner(Encounter.StatusHistoryComponent element) throws IOException {
39641      composeBackbone(element);
39642      if (element.hasStatusElement()) {
39643        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
39644        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
39645      }
39646      if (element.hasPeriod()) {
39647        composePeriod("period", element.getPeriod());
39648      }
39649  }
39650
39651  protected void composeEncounterClassHistoryComponent(String name, Encounter.ClassHistoryComponent element) throws IOException {
39652    if (element != null) {
39653      open(name);
39654      composeEncounterClassHistoryComponentInner(element);
39655      close();
39656    }
39657  }
39658
39659  protected void composeEncounterClassHistoryComponentInner(Encounter.ClassHistoryComponent element) throws IOException {
39660      composeBackbone(element);
39661      if (element.hasClass_()) {
39662        composeCoding("class", element.getClass_());
39663      }
39664      if (element.hasPeriod()) {
39665        composePeriod("period", element.getPeriod());
39666      }
39667  }
39668
39669  protected void composeEncounterEncounterParticipantComponent(String name, Encounter.EncounterParticipantComponent element) throws IOException {
39670    if (element != null) {
39671      open(name);
39672      composeEncounterEncounterParticipantComponentInner(element);
39673      close();
39674    }
39675  }
39676
39677  protected void composeEncounterEncounterParticipantComponentInner(Encounter.EncounterParticipantComponent element) throws IOException {
39678      composeBackbone(element);
39679      if (element.hasType()) {
39680        openArray("type");
39681        for (CodeableConcept e : element.getType()) 
39682          composeCodeableConcept(null, e);
39683        closeArray();
39684      };
39685      if (element.hasPeriod()) {
39686        composePeriod("period", element.getPeriod());
39687      }
39688      if (element.hasIndividual()) {
39689        composeReference("individual", element.getIndividual());
39690      }
39691  }
39692
39693  protected void composeEncounterDiagnosisComponent(String name, Encounter.DiagnosisComponent element) throws IOException {
39694    if (element != null) {
39695      open(name);
39696      composeEncounterDiagnosisComponentInner(element);
39697      close();
39698    }
39699  }
39700
39701  protected void composeEncounterDiagnosisComponentInner(Encounter.DiagnosisComponent element) throws IOException {
39702      composeBackbone(element);
39703      if (element.hasCondition()) {
39704        composeReference("condition", element.getCondition());
39705      }
39706      if (element.hasUse()) {
39707        composeCodeableConcept("use", element.getUse());
39708      }
39709      if (element.hasRankElement()) {
39710        composePositiveIntCore("rank", element.getRankElement(), false);
39711        composePositiveIntExtras("rank", element.getRankElement(), false);
39712      }
39713  }
39714
39715  protected void composeEncounterEncounterHospitalizationComponent(String name, Encounter.EncounterHospitalizationComponent element) throws IOException {
39716    if (element != null) {
39717      open(name);
39718      composeEncounterEncounterHospitalizationComponentInner(element);
39719      close();
39720    }
39721  }
39722
39723  protected void composeEncounterEncounterHospitalizationComponentInner(Encounter.EncounterHospitalizationComponent element) throws IOException {
39724      composeBackbone(element);
39725      if (element.hasPreAdmissionIdentifier()) {
39726        composeIdentifier("preAdmissionIdentifier", element.getPreAdmissionIdentifier());
39727      }
39728      if (element.hasOrigin()) {
39729        composeReference("origin", element.getOrigin());
39730      }
39731      if (element.hasAdmitSource()) {
39732        composeCodeableConcept("admitSource", element.getAdmitSource());
39733      }
39734      if (element.hasReAdmission()) {
39735        composeCodeableConcept("reAdmission", element.getReAdmission());
39736      }
39737      if (element.hasDietPreference()) {
39738        openArray("dietPreference");
39739        for (CodeableConcept e : element.getDietPreference()) 
39740          composeCodeableConcept(null, e);
39741        closeArray();
39742      };
39743      if (element.hasSpecialCourtesy()) {
39744        openArray("specialCourtesy");
39745        for (CodeableConcept e : element.getSpecialCourtesy()) 
39746          composeCodeableConcept(null, e);
39747        closeArray();
39748      };
39749      if (element.hasSpecialArrangement()) {
39750        openArray("specialArrangement");
39751        for (CodeableConcept e : element.getSpecialArrangement()) 
39752          composeCodeableConcept(null, e);
39753        closeArray();
39754      };
39755      if (element.hasDestination()) {
39756        composeReference("destination", element.getDestination());
39757      }
39758      if (element.hasDischargeDisposition()) {
39759        composeCodeableConcept("dischargeDisposition", element.getDischargeDisposition());
39760      }
39761  }
39762
39763  protected void composeEncounterEncounterLocationComponent(String name, Encounter.EncounterLocationComponent element) throws IOException {
39764    if (element != null) {
39765      open(name);
39766      composeEncounterEncounterLocationComponentInner(element);
39767      close();
39768    }
39769  }
39770
39771  protected void composeEncounterEncounterLocationComponentInner(Encounter.EncounterLocationComponent element) throws IOException {
39772      composeBackbone(element);
39773      if (element.hasLocation()) {
39774        composeReference("location", element.getLocation());
39775      }
39776      if (element.hasStatusElement()) {
39777        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
39778        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
39779      }
39780      if (element.hasPhysicalType()) {
39781        composeCodeableConcept("physicalType", element.getPhysicalType());
39782      }
39783      if (element.hasPeriod()) {
39784        composePeriod("period", element.getPeriod());
39785      }
39786  }
39787
39788  protected void composeEndpoint(String name, Endpoint element) throws IOException {
39789    if (element != null) {
39790      prop("resourceType", name);
39791      composeEndpointInner(element);
39792    }
39793  }
39794
39795  protected void composeEndpointInner(Endpoint element) throws IOException {
39796      composeDomainResourceElements(element);
39797      if (element.hasIdentifier()) {
39798        openArray("identifier");
39799        for (Identifier e : element.getIdentifier()) 
39800          composeIdentifier(null, e);
39801        closeArray();
39802      };
39803      if (element.hasStatusElement()) {
39804        composeEnumerationCore("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
39805        composeEnumerationExtras("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
39806      }
39807      if (element.hasConnectionType()) {
39808        composeCoding("connectionType", element.getConnectionType());
39809      }
39810      if (element.hasNameElement()) {
39811        composeStringCore("name", element.getNameElement(), false);
39812        composeStringExtras("name", element.getNameElement(), false);
39813      }
39814      if (element.hasManagingOrganization()) {
39815        composeReference("managingOrganization", element.getManagingOrganization());
39816      }
39817      if (element.hasContact()) {
39818        openArray("contact");
39819        for (ContactPoint e : element.getContact()) 
39820          composeContactPoint(null, e);
39821        closeArray();
39822      };
39823      if (element.hasPeriod()) {
39824        composePeriod("period", element.getPeriod());
39825      }
39826      if (element.hasPayloadType()) {
39827        openArray("payloadType");
39828        for (CodeableConcept e : element.getPayloadType()) 
39829          composeCodeableConcept(null, e);
39830        closeArray();
39831      };
39832      if (element.hasPayloadMimeType()) {
39833        openArray("payloadMimeType");
39834        for (CodeType e : element.getPayloadMimeType()) 
39835          composeCodeCore(null, e, true);
39836        closeArray();
39837        if (anyHasExtras(element.getPayloadMimeType())) {
39838          openArray("_payloadMimeType");
39839          for (CodeType e : element.getPayloadMimeType()) 
39840            composeCodeExtras(null, e, true);
39841          closeArray();
39842        }
39843      };
39844      if (element.hasAddressElement()) {
39845        composeUrlCore("address", element.getAddressElement(), false);
39846        composeUrlExtras("address", element.getAddressElement(), false);
39847      }
39848      if (element.hasHeader()) {
39849        openArray("header");
39850        for (StringType e : element.getHeader()) 
39851          composeStringCore(null, e, true);
39852        closeArray();
39853        if (anyHasExtras(element.getHeader())) {
39854          openArray("_header");
39855          for (StringType e : element.getHeader()) 
39856            composeStringExtras(null, e, true);
39857          closeArray();
39858        }
39859      };
39860  }
39861
39862  protected void composeEnrollmentRequest(String name, EnrollmentRequest element) throws IOException {
39863    if (element != null) {
39864      prop("resourceType", name);
39865      composeEnrollmentRequestInner(element);
39866    }
39867  }
39868
39869  protected void composeEnrollmentRequestInner(EnrollmentRequest element) throws IOException {
39870      composeDomainResourceElements(element);
39871      if (element.hasIdentifier()) {
39872        openArray("identifier");
39873        for (Identifier e : element.getIdentifier()) 
39874          composeIdentifier(null, e);
39875        closeArray();
39876      };
39877      if (element.hasStatusElement()) {
39878        composeEnumerationCore("status", element.getStatusElement(), new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
39879        composeEnumerationExtras("status", element.getStatusElement(), new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
39880      }
39881      if (element.hasCreatedElement()) {
39882        composeDateTimeCore("created", element.getCreatedElement(), false);
39883        composeDateTimeExtras("created", element.getCreatedElement(), false);
39884      }
39885      if (element.hasInsurer()) {
39886        composeReference("insurer", element.getInsurer());
39887      }
39888      if (element.hasProvider()) {
39889        composeReference("provider", element.getProvider());
39890      }
39891      if (element.hasCandidate()) {
39892        composeReference("candidate", element.getCandidate());
39893      }
39894      if (element.hasCoverage()) {
39895        composeReference("coverage", element.getCoverage());
39896      }
39897  }
39898
39899  protected void composeEnrollmentResponse(String name, EnrollmentResponse element) throws IOException {
39900    if (element != null) {
39901      prop("resourceType", name);
39902      composeEnrollmentResponseInner(element);
39903    }
39904  }
39905
39906  protected void composeEnrollmentResponseInner(EnrollmentResponse element) throws IOException {
39907      composeDomainResourceElements(element);
39908      if (element.hasIdentifier()) {
39909        openArray("identifier");
39910        for (Identifier e : element.getIdentifier()) 
39911          composeIdentifier(null, e);
39912        closeArray();
39913      };
39914      if (element.hasStatusElement()) {
39915        composeEnumerationCore("status", element.getStatusElement(), new EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
39916        composeEnumerationExtras("status", element.getStatusElement(), new EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
39917      }
39918      if (element.hasRequest()) {
39919        composeReference("request", element.getRequest());
39920      }
39921      if (element.hasOutcomeElement()) {
39922        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
39923        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
39924      }
39925      if (element.hasDispositionElement()) {
39926        composeStringCore("disposition", element.getDispositionElement(), false);
39927        composeStringExtras("disposition", element.getDispositionElement(), false);
39928      }
39929      if (element.hasCreatedElement()) {
39930        composeDateTimeCore("created", element.getCreatedElement(), false);
39931        composeDateTimeExtras("created", element.getCreatedElement(), false);
39932      }
39933      if (element.hasOrganization()) {
39934        composeReference("organization", element.getOrganization());
39935      }
39936      if (element.hasRequestProvider()) {
39937        composeReference("requestProvider", element.getRequestProvider());
39938      }
39939  }
39940
39941  protected void composeEpisodeOfCare(String name, EpisodeOfCare element) throws IOException {
39942    if (element != null) {
39943      prop("resourceType", name);
39944      composeEpisodeOfCareInner(element);
39945    }
39946  }
39947
39948  protected void composeEpisodeOfCareInner(EpisodeOfCare element) throws IOException {
39949      composeDomainResourceElements(element);
39950      if (element.hasIdentifier()) {
39951        openArray("identifier");
39952        for (Identifier e : element.getIdentifier()) 
39953          composeIdentifier(null, e);
39954        closeArray();
39955      };
39956      if (element.hasStatusElement()) {
39957        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
39958        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
39959      }
39960      if (element.hasStatusHistory()) {
39961        openArray("statusHistory");
39962        for (EpisodeOfCare.EpisodeOfCareStatusHistoryComponent e : element.getStatusHistory()) 
39963          composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(null, e);
39964        closeArray();
39965      };
39966      if (element.hasType()) {
39967        openArray("type");
39968        for (CodeableConcept e : element.getType()) 
39969          composeCodeableConcept(null, e);
39970        closeArray();
39971      };
39972      if (element.hasDiagnosis()) {
39973        openArray("diagnosis");
39974        for (EpisodeOfCare.DiagnosisComponent e : element.getDiagnosis()) 
39975          composeEpisodeOfCareDiagnosisComponent(null, e);
39976        closeArray();
39977      };
39978      if (element.hasPatient()) {
39979        composeReference("patient", element.getPatient());
39980      }
39981      if (element.hasManagingOrganization()) {
39982        composeReference("managingOrganization", element.getManagingOrganization());
39983      }
39984      if (element.hasPeriod()) {
39985        composePeriod("period", element.getPeriod());
39986      }
39987      if (element.hasReferralRequest()) {
39988        openArray("referralRequest");
39989        for (Reference e : element.getReferralRequest()) 
39990          composeReference(null, e);
39991        closeArray();
39992      };
39993      if (element.hasCareManager()) {
39994        composeReference("careManager", element.getCareManager());
39995      }
39996      if (element.hasTeam()) {
39997        openArray("team");
39998        for (Reference e : element.getTeam()) 
39999          composeReference(null, e);
40000        closeArray();
40001      };
40002      if (element.hasAccount()) {
40003        openArray("account");
40004        for (Reference e : element.getAccount()) 
40005          composeReference(null, e);
40006        closeArray();
40007      };
40008  }
40009
40010  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(String name, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
40011    if (element != null) {
40012      open(name);
40013      composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(element);
40014      close();
40015    }
40016  }
40017
40018  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
40019      composeBackbone(element);
40020      if (element.hasStatusElement()) {
40021        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
40022        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
40023      }
40024      if (element.hasPeriod()) {
40025        composePeriod("period", element.getPeriod());
40026      }
40027  }
40028
40029  protected void composeEpisodeOfCareDiagnosisComponent(String name, EpisodeOfCare.DiagnosisComponent element) throws IOException {
40030    if (element != null) {
40031      open(name);
40032      composeEpisodeOfCareDiagnosisComponentInner(element);
40033      close();
40034    }
40035  }
40036
40037  protected void composeEpisodeOfCareDiagnosisComponentInner(EpisodeOfCare.DiagnosisComponent element) throws IOException {
40038      composeBackbone(element);
40039      if (element.hasCondition()) {
40040        composeReference("condition", element.getCondition());
40041      }
40042      if (element.hasRole()) {
40043        composeCodeableConcept("role", element.getRole());
40044      }
40045      if (element.hasRankElement()) {
40046        composePositiveIntCore("rank", element.getRankElement(), false);
40047        composePositiveIntExtras("rank", element.getRankElement(), false);
40048      }
40049  }
40050
40051  protected void composeEventDefinition(String name, EventDefinition element) throws IOException {
40052    if (element != null) {
40053      prop("resourceType", name);
40054      composeEventDefinitionInner(element);
40055    }
40056  }
40057
40058  protected void composeEventDefinitionInner(EventDefinition element) throws IOException {
40059      composeDomainResourceElements(element);
40060      if (element.hasUrlElement()) {
40061        composeUriCore("url", element.getUrlElement(), false);
40062        composeUriExtras("url", element.getUrlElement(), false);
40063      }
40064      if (element.hasIdentifier()) {
40065        openArray("identifier");
40066        for (Identifier e : element.getIdentifier()) 
40067          composeIdentifier(null, e);
40068        closeArray();
40069      };
40070      if (element.hasVersionElement()) {
40071        composeStringCore("version", element.getVersionElement(), false);
40072        composeStringExtras("version", element.getVersionElement(), false);
40073      }
40074      if (element.hasNameElement()) {
40075        composeStringCore("name", element.getNameElement(), false);
40076        composeStringExtras("name", element.getNameElement(), false);
40077      }
40078      if (element.hasTitleElement()) {
40079        composeStringCore("title", element.getTitleElement(), false);
40080        composeStringExtras("title", element.getTitleElement(), false);
40081      }
40082      if (element.hasSubtitleElement()) {
40083        composeStringCore("subtitle", element.getSubtitleElement(), false);
40084        composeStringExtras("subtitle", element.getSubtitleElement(), false);
40085      }
40086      if (element.hasStatusElement()) {
40087        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40088        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40089      }
40090      if (element.hasExperimentalElement()) {
40091        composeBooleanCore("experimental", element.getExperimentalElement(), false);
40092        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
40093      }
40094      if (element.hasSubject()) {
40095        composeType("subject", element.getSubject());
40096      }
40097      if (element.hasDateElement()) {
40098        composeDateTimeCore("date", element.getDateElement(), false);
40099        composeDateTimeExtras("date", element.getDateElement(), false);
40100      }
40101      if (element.hasPublisherElement()) {
40102        composeStringCore("publisher", element.getPublisherElement(), false);
40103        composeStringExtras("publisher", element.getPublisherElement(), false);
40104      }
40105      if (element.hasContact()) {
40106        openArray("contact");
40107        for (ContactDetail e : element.getContact()) 
40108          composeContactDetail(null, e);
40109        closeArray();
40110      };
40111      if (element.hasDescriptionElement()) {
40112        composeMarkdownCore("description", element.getDescriptionElement(), false);
40113        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40114      }
40115      if (element.hasUseContext()) {
40116        openArray("useContext");
40117        for (UsageContext e : element.getUseContext()) 
40118          composeUsageContext(null, e);
40119        closeArray();
40120      };
40121      if (element.hasJurisdiction()) {
40122        openArray("jurisdiction");
40123        for (CodeableConcept e : element.getJurisdiction()) 
40124          composeCodeableConcept(null, e);
40125        closeArray();
40126      };
40127      if (element.hasPurposeElement()) {
40128        composeMarkdownCore("purpose", element.getPurposeElement(), false);
40129        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
40130      }
40131      if (element.hasUsageElement()) {
40132        composeStringCore("usage", element.getUsageElement(), false);
40133        composeStringExtras("usage", element.getUsageElement(), false);
40134      }
40135      if (element.hasCopyrightElement()) {
40136        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
40137        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
40138      }
40139      if (element.hasApprovalDateElement()) {
40140        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
40141        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
40142      }
40143      if (element.hasLastReviewDateElement()) {
40144        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
40145        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
40146      }
40147      if (element.hasEffectivePeriod()) {
40148        composePeriod("effectivePeriod", element.getEffectivePeriod());
40149      }
40150      if (element.hasTopic()) {
40151        openArray("topic");
40152        for (CodeableConcept e : element.getTopic()) 
40153          composeCodeableConcept(null, e);
40154        closeArray();
40155      };
40156      if (element.hasAuthor()) {
40157        openArray("author");
40158        for (ContactDetail e : element.getAuthor()) 
40159          composeContactDetail(null, e);
40160        closeArray();
40161      };
40162      if (element.hasEditor()) {
40163        openArray("editor");
40164        for (ContactDetail e : element.getEditor()) 
40165          composeContactDetail(null, e);
40166        closeArray();
40167      };
40168      if (element.hasReviewer()) {
40169        openArray("reviewer");
40170        for (ContactDetail e : element.getReviewer()) 
40171          composeContactDetail(null, e);
40172        closeArray();
40173      };
40174      if (element.hasEndorser()) {
40175        openArray("endorser");
40176        for (ContactDetail e : element.getEndorser()) 
40177          composeContactDetail(null, e);
40178        closeArray();
40179      };
40180      if (element.hasRelatedArtifact()) {
40181        openArray("relatedArtifact");
40182        for (RelatedArtifact e : element.getRelatedArtifact()) 
40183          composeRelatedArtifact(null, e);
40184        closeArray();
40185      };
40186      if (element.hasTrigger()) {
40187        openArray("trigger");
40188        for (TriggerDefinition e : element.getTrigger()) 
40189          composeTriggerDefinition(null, e);
40190        closeArray();
40191      };
40192  }
40193
40194  protected void composeEvidence(String name, Evidence element) throws IOException {
40195    if (element != null) {
40196      prop("resourceType", name);
40197      composeEvidenceInner(element);
40198    }
40199  }
40200
40201  protected void composeEvidenceInner(Evidence element) throws IOException {
40202      composeDomainResourceElements(element);
40203      if (element.hasUrlElement()) {
40204        composeUriCore("url", element.getUrlElement(), false);
40205        composeUriExtras("url", element.getUrlElement(), false);
40206      }
40207      if (element.hasIdentifier()) {
40208        openArray("identifier");
40209        for (Identifier e : element.getIdentifier()) 
40210          composeIdentifier(null, e);
40211        closeArray();
40212      };
40213      if (element.hasVersionElement()) {
40214        composeStringCore("version", element.getVersionElement(), false);
40215        composeStringExtras("version", element.getVersionElement(), false);
40216      }
40217      if (element.hasNameElement()) {
40218        composeStringCore("name", element.getNameElement(), false);
40219        composeStringExtras("name", element.getNameElement(), false);
40220      }
40221      if (element.hasTitleElement()) {
40222        composeStringCore("title", element.getTitleElement(), false);
40223        composeStringExtras("title", element.getTitleElement(), false);
40224      }
40225      if (element.hasShortTitleElement()) {
40226        composeStringCore("shortTitle", element.getShortTitleElement(), false);
40227        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
40228      }
40229      if (element.hasSubtitleElement()) {
40230        composeStringCore("subtitle", element.getSubtitleElement(), false);
40231        composeStringExtras("subtitle", element.getSubtitleElement(), false);
40232      }
40233      if (element.hasStatusElement()) {
40234        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40235        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40236      }
40237      if (element.hasDateElement()) {
40238        composeDateTimeCore("date", element.getDateElement(), false);
40239        composeDateTimeExtras("date", element.getDateElement(), false);
40240      }
40241      if (element.hasPublisherElement()) {
40242        composeStringCore("publisher", element.getPublisherElement(), false);
40243        composeStringExtras("publisher", element.getPublisherElement(), false);
40244      }
40245      if (element.hasContact()) {
40246        openArray("contact");
40247        for (ContactDetail e : element.getContact()) 
40248          composeContactDetail(null, e);
40249        closeArray();
40250      };
40251      if (element.hasDescriptionElement()) {
40252        composeMarkdownCore("description", element.getDescriptionElement(), false);
40253        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40254      }
40255      if (element.hasNote()) {
40256        openArray("note");
40257        for (Annotation e : element.getNote()) 
40258          composeAnnotation(null, e);
40259        closeArray();
40260      };
40261      if (element.hasUseContext()) {
40262        openArray("useContext");
40263        for (UsageContext e : element.getUseContext()) 
40264          composeUsageContext(null, e);
40265        closeArray();
40266      };
40267      if (element.hasJurisdiction()) {
40268        openArray("jurisdiction");
40269        for (CodeableConcept e : element.getJurisdiction()) 
40270          composeCodeableConcept(null, e);
40271        closeArray();
40272      };
40273      if (element.hasCopyrightElement()) {
40274        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
40275        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
40276      }
40277      if (element.hasApprovalDateElement()) {
40278        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
40279        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
40280      }
40281      if (element.hasLastReviewDateElement()) {
40282        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
40283        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
40284      }
40285      if (element.hasEffectivePeriod()) {
40286        composePeriod("effectivePeriod", element.getEffectivePeriod());
40287      }
40288      if (element.hasTopic()) {
40289        openArray("topic");
40290        for (CodeableConcept e : element.getTopic()) 
40291          composeCodeableConcept(null, e);
40292        closeArray();
40293      };
40294      if (element.hasAuthor()) {
40295        openArray("author");
40296        for (ContactDetail e : element.getAuthor()) 
40297          composeContactDetail(null, e);
40298        closeArray();
40299      };
40300      if (element.hasEditor()) {
40301        openArray("editor");
40302        for (ContactDetail e : element.getEditor()) 
40303          composeContactDetail(null, e);
40304        closeArray();
40305      };
40306      if (element.hasReviewer()) {
40307        openArray("reviewer");
40308        for (ContactDetail e : element.getReviewer()) 
40309          composeContactDetail(null, e);
40310        closeArray();
40311      };
40312      if (element.hasEndorser()) {
40313        openArray("endorser");
40314        for (ContactDetail e : element.getEndorser()) 
40315          composeContactDetail(null, e);
40316        closeArray();
40317      };
40318      if (element.hasRelatedArtifact()) {
40319        openArray("relatedArtifact");
40320        for (RelatedArtifact e : element.getRelatedArtifact()) 
40321          composeRelatedArtifact(null, e);
40322        closeArray();
40323      };
40324      if (element.hasExposureBackground()) {
40325        composeReference("exposureBackground", element.getExposureBackground());
40326      }
40327      if (element.hasExposureVariant()) {
40328        openArray("exposureVariant");
40329        for (Reference e : element.getExposureVariant()) 
40330          composeReference(null, e);
40331        closeArray();
40332      };
40333      if (element.hasOutcome()) {
40334        openArray("outcome");
40335        for (Reference e : element.getOutcome()) 
40336          composeReference(null, e);
40337        closeArray();
40338      };
40339  }
40340
40341  protected void composeEvidenceVariable(String name, EvidenceVariable element) throws IOException {
40342    if (element != null) {
40343      prop("resourceType", name);
40344      composeEvidenceVariableInner(element);
40345    }
40346  }
40347
40348  protected void composeEvidenceVariableInner(EvidenceVariable element) throws IOException {
40349      composeDomainResourceElements(element);
40350      if (element.hasUrlElement()) {
40351        composeUriCore("url", element.getUrlElement(), false);
40352        composeUriExtras("url", element.getUrlElement(), false);
40353      }
40354      if (element.hasIdentifier()) {
40355        openArray("identifier");
40356        for (Identifier e : element.getIdentifier()) 
40357          composeIdentifier(null, e);
40358        closeArray();
40359      };
40360      if (element.hasVersionElement()) {
40361        composeStringCore("version", element.getVersionElement(), false);
40362        composeStringExtras("version", element.getVersionElement(), false);
40363      }
40364      if (element.hasNameElement()) {
40365        composeStringCore("name", element.getNameElement(), false);
40366        composeStringExtras("name", element.getNameElement(), false);
40367      }
40368      if (element.hasTitleElement()) {
40369        composeStringCore("title", element.getTitleElement(), false);
40370        composeStringExtras("title", element.getTitleElement(), false);
40371      }
40372      if (element.hasShortTitleElement()) {
40373        composeStringCore("shortTitle", element.getShortTitleElement(), false);
40374        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
40375      }
40376      if (element.hasSubtitleElement()) {
40377        composeStringCore("subtitle", element.getSubtitleElement(), false);
40378        composeStringExtras("subtitle", element.getSubtitleElement(), false);
40379      }
40380      if (element.hasStatusElement()) {
40381        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40382        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40383      }
40384      if (element.hasDateElement()) {
40385        composeDateTimeCore("date", element.getDateElement(), false);
40386        composeDateTimeExtras("date", element.getDateElement(), false);
40387      }
40388      if (element.hasPublisherElement()) {
40389        composeStringCore("publisher", element.getPublisherElement(), false);
40390        composeStringExtras("publisher", element.getPublisherElement(), false);
40391      }
40392      if (element.hasContact()) {
40393        openArray("contact");
40394        for (ContactDetail e : element.getContact()) 
40395          composeContactDetail(null, e);
40396        closeArray();
40397      };
40398      if (element.hasDescriptionElement()) {
40399        composeMarkdownCore("description", element.getDescriptionElement(), false);
40400        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40401      }
40402      if (element.hasNote()) {
40403        openArray("note");
40404        for (Annotation e : element.getNote()) 
40405          composeAnnotation(null, e);
40406        closeArray();
40407      };
40408      if (element.hasUseContext()) {
40409        openArray("useContext");
40410        for (UsageContext e : element.getUseContext()) 
40411          composeUsageContext(null, e);
40412        closeArray();
40413      };
40414      if (element.hasJurisdiction()) {
40415        openArray("jurisdiction");
40416        for (CodeableConcept e : element.getJurisdiction()) 
40417          composeCodeableConcept(null, e);
40418        closeArray();
40419      };
40420      if (element.hasCopyrightElement()) {
40421        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
40422        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
40423      }
40424      if (element.hasApprovalDateElement()) {
40425        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
40426        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
40427      }
40428      if (element.hasLastReviewDateElement()) {
40429        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
40430        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
40431      }
40432      if (element.hasEffectivePeriod()) {
40433        composePeriod("effectivePeriod", element.getEffectivePeriod());
40434      }
40435      if (element.hasTopic()) {
40436        openArray("topic");
40437        for (CodeableConcept e : element.getTopic()) 
40438          composeCodeableConcept(null, e);
40439        closeArray();
40440      };
40441      if (element.hasAuthor()) {
40442        openArray("author");
40443        for (ContactDetail e : element.getAuthor()) 
40444          composeContactDetail(null, e);
40445        closeArray();
40446      };
40447      if (element.hasEditor()) {
40448        openArray("editor");
40449        for (ContactDetail e : element.getEditor()) 
40450          composeContactDetail(null, e);
40451        closeArray();
40452      };
40453      if (element.hasReviewer()) {
40454        openArray("reviewer");
40455        for (ContactDetail e : element.getReviewer()) 
40456          composeContactDetail(null, e);
40457        closeArray();
40458      };
40459      if (element.hasEndorser()) {
40460        openArray("endorser");
40461        for (ContactDetail e : element.getEndorser()) 
40462          composeContactDetail(null, e);
40463        closeArray();
40464      };
40465      if (element.hasRelatedArtifact()) {
40466        openArray("relatedArtifact");
40467        for (RelatedArtifact e : element.getRelatedArtifact()) 
40468          composeRelatedArtifact(null, e);
40469        closeArray();
40470      };
40471      if (element.hasTypeElement()) {
40472        composeEnumerationCore("type", element.getTypeElement(), new EvidenceVariable.EvidenceVariableTypeEnumFactory(), false);
40473        composeEnumerationExtras("type", element.getTypeElement(), new EvidenceVariable.EvidenceVariableTypeEnumFactory(), false);
40474      }
40475      if (element.hasCharacteristic()) {
40476        openArray("characteristic");
40477        for (EvidenceVariable.EvidenceVariableCharacteristicComponent e : element.getCharacteristic()) 
40478          composeEvidenceVariableEvidenceVariableCharacteristicComponent(null, e);
40479        closeArray();
40480      };
40481  }
40482
40483  protected void composeEvidenceVariableEvidenceVariableCharacteristicComponent(String name, EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
40484    if (element != null) {
40485      open(name);
40486      composeEvidenceVariableEvidenceVariableCharacteristicComponentInner(element);
40487      close();
40488    }
40489  }
40490
40491  protected void composeEvidenceVariableEvidenceVariableCharacteristicComponentInner(EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
40492      composeBackbone(element);
40493      if (element.hasDescriptionElement()) {
40494        composeStringCore("description", element.getDescriptionElement(), false);
40495        composeStringExtras("description", element.getDescriptionElement(), false);
40496      }
40497      if (element.hasDefinition()) {
40498        composeType("definition", element.getDefinition());
40499      }
40500      if (element.hasUsageContext()) {
40501        openArray("usageContext");
40502        for (UsageContext e : element.getUsageContext()) 
40503          composeUsageContext(null, e);
40504        closeArray();
40505      };
40506      if (element.hasExcludeElement()) {
40507        composeBooleanCore("exclude", element.getExcludeElement(), false);
40508        composeBooleanExtras("exclude", element.getExcludeElement(), false);
40509      }
40510      if (element.hasParticipantEffective()) {
40511        composeType("participantEffective", element.getParticipantEffective());
40512      }
40513      if (element.hasTimeFromStart()) {
40514        composeDuration("timeFromStart", element.getTimeFromStart());
40515      }
40516      if (element.hasGroupMeasureElement()) {
40517        composeEnumerationCore("groupMeasure", element.getGroupMeasureElement(), new EvidenceVariable.GroupMeasureEnumFactory(), false);
40518        composeEnumerationExtras("groupMeasure", element.getGroupMeasureElement(), new EvidenceVariable.GroupMeasureEnumFactory(), false);
40519      }
40520  }
40521
40522  protected void composeExampleScenario(String name, ExampleScenario element) throws IOException {
40523    if (element != null) {
40524      prop("resourceType", name);
40525      composeExampleScenarioInner(element);
40526    }
40527  }
40528
40529  protected void composeExampleScenarioInner(ExampleScenario element) throws IOException {
40530      composeDomainResourceElements(element);
40531      if (element.hasUrlElement()) {
40532        composeUriCore("url", element.getUrlElement(), false);
40533        composeUriExtras("url", element.getUrlElement(), false);
40534      }
40535      if (element.hasIdentifier()) {
40536        openArray("identifier");
40537        for (Identifier e : element.getIdentifier()) 
40538          composeIdentifier(null, e);
40539        closeArray();
40540      };
40541      if (element.hasVersionElement()) {
40542        composeStringCore("version", element.getVersionElement(), false);
40543        composeStringExtras("version", element.getVersionElement(), false);
40544      }
40545      if (element.hasNameElement()) {
40546        composeStringCore("name", element.getNameElement(), false);
40547        composeStringExtras("name", element.getNameElement(), false);
40548      }
40549      if (element.hasStatusElement()) {
40550        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40551        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40552      }
40553      if (element.hasExperimentalElement()) {
40554        composeBooleanCore("experimental", element.getExperimentalElement(), false);
40555        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
40556      }
40557      if (element.hasDateElement()) {
40558        composeDateTimeCore("date", element.getDateElement(), false);
40559        composeDateTimeExtras("date", element.getDateElement(), false);
40560      }
40561      if (element.hasPublisherElement()) {
40562        composeStringCore("publisher", element.getPublisherElement(), false);
40563        composeStringExtras("publisher", element.getPublisherElement(), false);
40564      }
40565      if (element.hasContact()) {
40566        openArray("contact");
40567        for (ContactDetail e : element.getContact()) 
40568          composeContactDetail(null, e);
40569        closeArray();
40570      };
40571      if (element.hasUseContext()) {
40572        openArray("useContext");
40573        for (UsageContext e : element.getUseContext()) 
40574          composeUsageContext(null, e);
40575        closeArray();
40576      };
40577      if (element.hasJurisdiction()) {
40578        openArray("jurisdiction");
40579        for (CodeableConcept e : element.getJurisdiction()) 
40580          composeCodeableConcept(null, e);
40581        closeArray();
40582      };
40583      if (element.hasCopyrightElement()) {
40584        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
40585        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
40586      }
40587      if (element.hasPurposeElement()) {
40588        composeMarkdownCore("purpose", element.getPurposeElement(), false);
40589        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
40590      }
40591      if (element.hasActor()) {
40592        openArray("actor");
40593        for (ExampleScenario.ExampleScenarioActorComponent e : element.getActor()) 
40594          composeExampleScenarioExampleScenarioActorComponent(null, e);
40595        closeArray();
40596      };
40597      if (element.hasInstance()) {
40598        openArray("instance");
40599        for (ExampleScenario.ExampleScenarioInstanceComponent e : element.getInstance()) 
40600          composeExampleScenarioExampleScenarioInstanceComponent(null, e);
40601        closeArray();
40602      };
40603      if (element.hasProcess()) {
40604        openArray("process");
40605        for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess()) 
40606          composeExampleScenarioExampleScenarioProcessComponent(null, e);
40607        closeArray();
40608      };
40609      if (element.hasWorkflow()) {
40610        openArray("workflow");
40611        for (CanonicalType e : element.getWorkflow()) 
40612          composeCanonicalCore(null, e, true);
40613        closeArray();
40614        if (anyHasExtras(element.getWorkflow())) {
40615          openArray("_workflow");
40616          for (CanonicalType e : element.getWorkflow()) 
40617            composeCanonicalExtras(null, e, true);
40618          closeArray();
40619        }
40620      };
40621  }
40622
40623  protected void composeExampleScenarioExampleScenarioActorComponent(String name, ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
40624    if (element != null) {
40625      open(name);
40626      composeExampleScenarioExampleScenarioActorComponentInner(element);
40627      close();
40628    }
40629  }
40630
40631  protected void composeExampleScenarioExampleScenarioActorComponentInner(ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
40632      composeBackbone(element);
40633      if (element.hasActorIdElement()) {
40634        composeStringCore("actorId", element.getActorIdElement(), false);
40635        composeStringExtras("actorId", element.getActorIdElement(), false);
40636      }
40637      if (element.hasTypeElement()) {
40638        composeEnumerationCore("type", element.getTypeElement(), new ExampleScenario.ExampleScenarioActorTypeEnumFactory(), false);
40639        composeEnumerationExtras("type", element.getTypeElement(), new ExampleScenario.ExampleScenarioActorTypeEnumFactory(), false);
40640      }
40641      if (element.hasNameElement()) {
40642        composeStringCore("name", element.getNameElement(), false);
40643        composeStringExtras("name", element.getNameElement(), false);
40644      }
40645      if (element.hasDescriptionElement()) {
40646        composeMarkdownCore("description", element.getDescriptionElement(), false);
40647        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40648      }
40649  }
40650
40651  protected void composeExampleScenarioExampleScenarioInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
40652    if (element != null) {
40653      open(name);
40654      composeExampleScenarioExampleScenarioInstanceComponentInner(element);
40655      close();
40656    }
40657  }
40658
40659  protected void composeExampleScenarioExampleScenarioInstanceComponentInner(ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
40660      composeBackbone(element);
40661      if (element.hasResourceIdElement()) {
40662        composeStringCore("resourceId", element.getResourceIdElement(), false);
40663        composeStringExtras("resourceId", element.getResourceIdElement(), false);
40664      }
40665      if (element.hasResourceTypeElement()) {
40666        composeEnumerationCore("resourceType", element.getResourceTypeElement(), new ExampleScenario.FHIRResourceTypeEnumFactory(), false);
40667        composeEnumerationExtras("resourceType", element.getResourceTypeElement(), new ExampleScenario.FHIRResourceTypeEnumFactory(), false);
40668      }
40669      if (element.hasNameElement()) {
40670        composeStringCore("name", element.getNameElement(), false);
40671        composeStringExtras("name", element.getNameElement(), false);
40672      }
40673      if (element.hasDescriptionElement()) {
40674        composeMarkdownCore("description", element.getDescriptionElement(), false);
40675        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40676      }
40677      if (element.hasVersion()) {
40678        openArray("version");
40679        for (ExampleScenario.ExampleScenarioInstanceVersionComponent e : element.getVersion()) 
40680          composeExampleScenarioExampleScenarioInstanceVersionComponent(null, e);
40681        closeArray();
40682      };
40683      if (element.hasContainedInstance()) {
40684        openArray("containedInstance");
40685        for (ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent e : element.getContainedInstance()) 
40686          composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent(null, e);
40687        closeArray();
40688      };
40689  }
40690
40691  protected void composeExampleScenarioExampleScenarioInstanceVersionComponent(String name, ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
40692    if (element != null) {
40693      open(name);
40694      composeExampleScenarioExampleScenarioInstanceVersionComponentInner(element);
40695      close();
40696    }
40697  }
40698
40699  protected void composeExampleScenarioExampleScenarioInstanceVersionComponentInner(ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
40700      composeBackbone(element);
40701      if (element.hasVersionIdElement()) {
40702        composeStringCore("versionId", element.getVersionIdElement(), false);
40703        composeStringExtras("versionId", element.getVersionIdElement(), false);
40704      }
40705      if (element.hasDescriptionElement()) {
40706        composeMarkdownCore("description", element.getDescriptionElement(), false);
40707        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40708      }
40709  }
40710
40711  protected void composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
40712    if (element != null) {
40713      open(name);
40714      composeExampleScenarioExampleScenarioInstanceContainedInstanceComponentInner(element);
40715      close();
40716    }
40717  }
40718
40719  protected void composeExampleScenarioExampleScenarioInstanceContainedInstanceComponentInner(ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
40720      composeBackbone(element);
40721      if (element.hasResourceIdElement()) {
40722        composeStringCore("resourceId", element.getResourceIdElement(), false);
40723        composeStringExtras("resourceId", element.getResourceIdElement(), false);
40724      }
40725      if (element.hasVersionIdElement()) {
40726        composeStringCore("versionId", element.getVersionIdElement(), false);
40727        composeStringExtras("versionId", element.getVersionIdElement(), false);
40728      }
40729  }
40730
40731  protected void composeExampleScenarioExampleScenarioProcessComponent(String name, ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
40732    if (element != null) {
40733      open(name);
40734      composeExampleScenarioExampleScenarioProcessComponentInner(element);
40735      close();
40736    }
40737  }
40738
40739  protected void composeExampleScenarioExampleScenarioProcessComponentInner(ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
40740      composeBackbone(element);
40741      if (element.hasTitleElement()) {
40742        composeStringCore("title", element.getTitleElement(), false);
40743        composeStringExtras("title", element.getTitleElement(), false);
40744      }
40745      if (element.hasDescriptionElement()) {
40746        composeMarkdownCore("description", element.getDescriptionElement(), false);
40747        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40748      }
40749      if (element.hasPreConditionsElement()) {
40750        composeMarkdownCore("preConditions", element.getPreConditionsElement(), false);
40751        composeMarkdownExtras("preConditions", element.getPreConditionsElement(), false);
40752      }
40753      if (element.hasPostConditionsElement()) {
40754        composeMarkdownCore("postConditions", element.getPostConditionsElement(), false);
40755        composeMarkdownExtras("postConditions", element.getPostConditionsElement(), false);
40756      }
40757      if (element.hasStep()) {
40758        openArray("step");
40759        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
40760          composeExampleScenarioExampleScenarioProcessStepComponent(null, e);
40761        closeArray();
40762      };
40763  }
40764
40765  protected void composeExampleScenarioExampleScenarioProcessStepComponent(String name, ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
40766    if (element != null) {
40767      open(name);
40768      composeExampleScenarioExampleScenarioProcessStepComponentInner(element);
40769      close();
40770    }
40771  }
40772
40773  protected void composeExampleScenarioExampleScenarioProcessStepComponentInner(ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
40774      composeBackbone(element);
40775      if (element.hasProcess()) {
40776        openArray("process");
40777        for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess()) 
40778          composeExampleScenarioExampleScenarioProcessComponent(null, e);
40779        closeArray();
40780      };
40781      if (element.hasPauseElement()) {
40782        composeBooleanCore("pause", element.getPauseElement(), false);
40783        composeBooleanExtras("pause", element.getPauseElement(), false);
40784      }
40785      if (element.hasOperation()) {
40786        composeExampleScenarioExampleScenarioProcessStepOperationComponent("operation", element.getOperation());
40787      }
40788      if (element.hasAlternative()) {
40789        openArray("alternative");
40790        for (ExampleScenario.ExampleScenarioProcessStepAlternativeComponent e : element.getAlternative()) 
40791          composeExampleScenarioExampleScenarioProcessStepAlternativeComponent(null, e);
40792        closeArray();
40793      };
40794  }
40795
40796  protected void composeExampleScenarioExampleScenarioProcessStepOperationComponent(String name, ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
40797    if (element != null) {
40798      open(name);
40799      composeExampleScenarioExampleScenarioProcessStepOperationComponentInner(element);
40800      close();
40801    }
40802  }
40803
40804  protected void composeExampleScenarioExampleScenarioProcessStepOperationComponentInner(ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
40805      composeBackbone(element);
40806      if (element.hasNumberElement()) {
40807        composeStringCore("number", element.getNumberElement(), false);
40808        composeStringExtras("number", element.getNumberElement(), false);
40809      }
40810      if (element.hasTypeElement()) {
40811        composeStringCore("type", element.getTypeElement(), false);
40812        composeStringExtras("type", element.getTypeElement(), false);
40813      }
40814      if (element.hasNameElement()) {
40815        composeStringCore("name", element.getNameElement(), false);
40816        composeStringExtras("name", element.getNameElement(), false);
40817      }
40818      if (element.hasInitiatorElement()) {
40819        composeStringCore("initiator", element.getInitiatorElement(), false);
40820        composeStringExtras("initiator", element.getInitiatorElement(), false);
40821      }
40822      if (element.hasReceiverElement()) {
40823        composeStringCore("receiver", element.getReceiverElement(), false);
40824        composeStringExtras("receiver", element.getReceiverElement(), false);
40825      }
40826      if (element.hasDescriptionElement()) {
40827        composeMarkdownCore("description", element.getDescriptionElement(), false);
40828        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40829      }
40830      if (element.hasInitiatorActiveElement()) {
40831        composeBooleanCore("initiatorActive", element.getInitiatorActiveElement(), false);
40832        composeBooleanExtras("initiatorActive", element.getInitiatorActiveElement(), false);
40833      }
40834      if (element.hasReceiverActiveElement()) {
40835        composeBooleanCore("receiverActive", element.getReceiverActiveElement(), false);
40836        composeBooleanExtras("receiverActive", element.getReceiverActiveElement(), false);
40837      }
40838      if (element.hasRequest()) {
40839        composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent("request", element.getRequest());
40840      }
40841      if (element.hasResponse()) {
40842        composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent("response", element.getResponse());
40843      }
40844  }
40845
40846  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeComponent(String name, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
40847    if (element != null) {
40848      open(name);
40849      composeExampleScenarioExampleScenarioProcessStepAlternativeComponentInner(element);
40850      close();
40851    }
40852  }
40853
40854  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeComponentInner(ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
40855      composeBackbone(element);
40856      if (element.hasTitleElement()) {
40857        composeStringCore("title", element.getTitleElement(), false);
40858        composeStringExtras("title", element.getTitleElement(), false);
40859      }
40860      if (element.hasDescriptionElement()) {
40861        composeMarkdownCore("description", element.getDescriptionElement(), false);
40862        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40863      }
40864      if (element.hasStep()) {
40865        openArray("step");
40866        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
40867          composeExampleScenarioExampleScenarioProcessStepComponent(null, e);
40868        closeArray();
40869      };
40870  }
40871
40872  protected void composeExplanationOfBenefit(String name, ExplanationOfBenefit element) throws IOException {
40873    if (element != null) {
40874      prop("resourceType", name);
40875      composeExplanationOfBenefitInner(element);
40876    }
40877  }
40878
40879  protected void composeExplanationOfBenefitInner(ExplanationOfBenefit element) throws IOException {
40880      composeDomainResourceElements(element);
40881      if (element.hasIdentifier()) {
40882        openArray("identifier");
40883        for (Identifier e : element.getIdentifier()) 
40884          composeIdentifier(null, e);
40885        closeArray();
40886      };
40887      if (element.hasStatusElement()) {
40888        composeEnumerationCore("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
40889        composeEnumerationExtras("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
40890      }
40891      if (element.hasType()) {
40892        composeCodeableConcept("type", element.getType());
40893      }
40894      if (element.hasSubType()) {
40895        composeCodeableConcept("subType", element.getSubType());
40896      }
40897      if (element.hasUseElement()) {
40898        composeEnumerationCore("use", element.getUseElement(), new ExplanationOfBenefit.UseEnumFactory(), false);
40899        composeEnumerationExtras("use", element.getUseElement(), new ExplanationOfBenefit.UseEnumFactory(), false);
40900      }
40901      if (element.hasPatient()) {
40902        composeReference("patient", element.getPatient());
40903      }
40904      if (element.hasBillablePeriod()) {
40905        composePeriod("billablePeriod", element.getBillablePeriod());
40906      }
40907      if (element.hasCreatedElement()) {
40908        composeDateTimeCore("created", element.getCreatedElement(), false);
40909        composeDateTimeExtras("created", element.getCreatedElement(), false);
40910      }
40911      if (element.hasEnterer()) {
40912        composeReference("enterer", element.getEnterer());
40913      }
40914      if (element.hasInsurer()) {
40915        composeReference("insurer", element.getInsurer());
40916      }
40917      if (element.hasProvider()) {
40918        composeReference("provider", element.getProvider());
40919      }
40920      if (element.hasPriority()) {
40921        composeCodeableConcept("priority", element.getPriority());
40922      }
40923      if (element.hasFundsReserveRequested()) {
40924        composeCodeableConcept("fundsReserveRequested", element.getFundsReserveRequested());
40925      }
40926      if (element.hasFundsReserve()) {
40927        composeCodeableConcept("fundsReserve", element.getFundsReserve());
40928      }
40929      if (element.hasRelated()) {
40930        openArray("related");
40931        for (ExplanationOfBenefit.RelatedClaimComponent e : element.getRelated()) 
40932          composeExplanationOfBenefitRelatedClaimComponent(null, e);
40933        closeArray();
40934      };
40935      if (element.hasPrescription()) {
40936        composeReference("prescription", element.getPrescription());
40937      }
40938      if (element.hasOriginalPrescription()) {
40939        composeReference("originalPrescription", element.getOriginalPrescription());
40940      }
40941      if (element.hasPayee()) {
40942        composeExplanationOfBenefitPayeeComponent("payee", element.getPayee());
40943      }
40944      if (element.hasReferral()) {
40945        composeReference("referral", element.getReferral());
40946      }
40947      if (element.hasFacility()) {
40948        composeReference("facility", element.getFacility());
40949      }
40950      if (element.hasClaim()) {
40951        composeReference("claim", element.getClaim());
40952      }
40953      if (element.hasClaimResponse()) {
40954        composeReference("claimResponse", element.getClaimResponse());
40955      }
40956      if (element.hasOutcomeElement()) {
40957        composeEnumerationCore("outcome", element.getOutcomeElement(), new ExplanationOfBenefit.RemittanceOutcomeEnumFactory(), false);
40958        composeEnumerationExtras("outcome", element.getOutcomeElement(), new ExplanationOfBenefit.RemittanceOutcomeEnumFactory(), false);
40959      }
40960      if (element.hasDispositionElement()) {
40961        composeStringCore("disposition", element.getDispositionElement(), false);
40962        composeStringExtras("disposition", element.getDispositionElement(), false);
40963      }
40964      if (element.hasPreAuthRef()) {
40965        openArray("preAuthRef");
40966        for (StringType e : element.getPreAuthRef()) 
40967          composeStringCore(null, e, true);
40968        closeArray();
40969        if (anyHasExtras(element.getPreAuthRef())) {
40970          openArray("_preAuthRef");
40971          for (StringType e : element.getPreAuthRef()) 
40972            composeStringExtras(null, e, true);
40973        closeArray();
40974        }
40975      };
40976      if (element.hasPreAuthRefPeriod()) {
40977        openArray("preAuthRefPeriod");
40978        for (Period e : element.getPreAuthRefPeriod()) 
40979          composePeriod(null, e);
40980        closeArray();
40981      };
40982      if (element.hasCareTeam()) {
40983        openArray("careTeam");
40984        for (ExplanationOfBenefit.CareTeamComponent e : element.getCareTeam()) 
40985          composeExplanationOfBenefitCareTeamComponent(null, e);
40986        closeArray();
40987      };
40988      if (element.hasSupportingInfo()) {
40989        openArray("supportingInfo");
40990        for (ExplanationOfBenefit.SupportingInformationComponent e : element.getSupportingInfo()) 
40991          composeExplanationOfBenefitSupportingInformationComponent(null, e);
40992        closeArray();
40993      };
40994      if (element.hasDiagnosis()) {
40995        openArray("diagnosis");
40996        for (ExplanationOfBenefit.DiagnosisComponent e : element.getDiagnosis()) 
40997          composeExplanationOfBenefitDiagnosisComponent(null, e);
40998        closeArray();
40999      };
41000      if (element.hasProcedure()) {
41001        openArray("procedure");
41002        for (ExplanationOfBenefit.ProcedureComponent e : element.getProcedure()) 
41003          composeExplanationOfBenefitProcedureComponent(null, e);
41004        closeArray();
41005      };
41006      if (element.hasPrecedenceElement()) {
41007        composePositiveIntCore("precedence", element.getPrecedenceElement(), false);
41008        composePositiveIntExtras("precedence", element.getPrecedenceElement(), false);
41009      }
41010      if (element.hasInsurance()) {
41011        openArray("insurance");
41012        for (ExplanationOfBenefit.InsuranceComponent e : element.getInsurance()) 
41013          composeExplanationOfBenefitInsuranceComponent(null, e);
41014        closeArray();
41015      };
41016      if (element.hasAccident()) {
41017        composeExplanationOfBenefitAccidentComponent("accident", element.getAccident());
41018      }
41019      if (element.hasItem()) {
41020        openArray("item");
41021        for (ExplanationOfBenefit.ItemComponent e : element.getItem()) 
41022          composeExplanationOfBenefitItemComponent(null, e);
41023        closeArray();
41024      };
41025      if (element.hasAddItem()) {
41026        openArray("addItem");
41027        for (ExplanationOfBenefit.AddedItemComponent e : element.getAddItem()) 
41028          composeExplanationOfBenefitAddedItemComponent(null, e);
41029        closeArray();
41030      };
41031      if (element.hasAdjudication()) {
41032        openArray("adjudication");
41033        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41034          composeExplanationOfBenefitAdjudicationComponent(null, e);
41035        closeArray();
41036      };
41037      if (element.hasTotal()) {
41038        openArray("total");
41039        for (ExplanationOfBenefit.TotalComponent e : element.getTotal()) 
41040          composeExplanationOfBenefitTotalComponent(null, e);
41041        closeArray();
41042      };
41043      if (element.hasPayment()) {
41044        composeExplanationOfBenefitPaymentComponent("payment", element.getPayment());
41045      }
41046      if (element.hasFormCode()) {
41047        composeCodeableConcept("formCode", element.getFormCode());
41048      }
41049      if (element.hasForm()) {
41050        composeAttachment("form", element.getForm());
41051      }
41052      if (element.hasProcessNote()) {
41053        openArray("processNote");
41054        for (ExplanationOfBenefit.NoteComponent e : element.getProcessNote()) 
41055          composeExplanationOfBenefitNoteComponent(null, e);
41056        closeArray();
41057      };
41058      if (element.hasBenefitPeriod()) {
41059        composePeriod("benefitPeriod", element.getBenefitPeriod());
41060      }
41061      if (element.hasBenefitBalance()) {
41062        openArray("benefitBalance");
41063        for (ExplanationOfBenefit.BenefitBalanceComponent e : element.getBenefitBalance()) 
41064          composeExplanationOfBenefitBenefitBalanceComponent(null, e);
41065        closeArray();
41066      };
41067  }
41068
41069  protected void composeExplanationOfBenefitRelatedClaimComponent(String name, ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
41070    if (element != null) {
41071      open(name);
41072      composeExplanationOfBenefitRelatedClaimComponentInner(element);
41073      close();
41074    }
41075  }
41076
41077  protected void composeExplanationOfBenefitRelatedClaimComponentInner(ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
41078      composeBackbone(element);
41079      if (element.hasClaim()) {
41080        composeReference("claim", element.getClaim());
41081      }
41082      if (element.hasRelationship()) {
41083        composeCodeableConcept("relationship", element.getRelationship());
41084      }
41085      if (element.hasReference()) {
41086        composeIdentifier("reference", element.getReference());
41087      }
41088  }
41089
41090  protected void composeExplanationOfBenefitPayeeComponent(String name, ExplanationOfBenefit.PayeeComponent element) throws IOException {
41091    if (element != null) {
41092      open(name);
41093      composeExplanationOfBenefitPayeeComponentInner(element);
41094      close();
41095    }
41096  }
41097
41098  protected void composeExplanationOfBenefitPayeeComponentInner(ExplanationOfBenefit.PayeeComponent element) throws IOException {
41099      composeBackbone(element);
41100      if (element.hasType()) {
41101        composeCodeableConcept("type", element.getType());
41102      }
41103      if (element.hasParty()) {
41104        composeReference("party", element.getParty());
41105      }
41106  }
41107
41108  protected void composeExplanationOfBenefitCareTeamComponent(String name, ExplanationOfBenefit.CareTeamComponent element) throws IOException {
41109    if (element != null) {
41110      open(name);
41111      composeExplanationOfBenefitCareTeamComponentInner(element);
41112      close();
41113    }
41114  }
41115
41116  protected void composeExplanationOfBenefitCareTeamComponentInner(ExplanationOfBenefit.CareTeamComponent element) throws IOException {
41117      composeBackbone(element);
41118      if (element.hasSequenceElement()) {
41119        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41120        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41121      }
41122      if (element.hasProvider()) {
41123        composeReference("provider", element.getProvider());
41124      }
41125      if (element.hasResponsibleElement()) {
41126        composeBooleanCore("responsible", element.getResponsibleElement(), false);
41127        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
41128      }
41129      if (element.hasRole()) {
41130        composeCodeableConcept("role", element.getRole());
41131      }
41132      if (element.hasQualification()) {
41133        composeCodeableConcept("qualification", element.getQualification());
41134      }
41135  }
41136
41137  protected void composeExplanationOfBenefitSupportingInformationComponent(String name, ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
41138    if (element != null) {
41139      open(name);
41140      composeExplanationOfBenefitSupportingInformationComponentInner(element);
41141      close();
41142    }
41143  }
41144
41145  protected void composeExplanationOfBenefitSupportingInformationComponentInner(ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
41146      composeBackbone(element);
41147      if (element.hasSequenceElement()) {
41148        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41149        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41150      }
41151      if (element.hasCategory()) {
41152        composeCodeableConcept("category", element.getCategory());
41153      }
41154      if (element.hasCode()) {
41155        composeCodeableConcept("code", element.getCode());
41156      }
41157      if (element.hasTiming()) {
41158        composeType("timing", element.getTiming());
41159      }
41160      if (element.hasValue()) {
41161        composeType("value", element.getValue());
41162      }
41163      if (element.hasReason()) {
41164        composeCoding("reason", element.getReason());
41165      }
41166  }
41167
41168  protected void composeExplanationOfBenefitDiagnosisComponent(String name, ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
41169    if (element != null) {
41170      open(name);
41171      composeExplanationOfBenefitDiagnosisComponentInner(element);
41172      close();
41173    }
41174  }
41175
41176  protected void composeExplanationOfBenefitDiagnosisComponentInner(ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
41177      composeBackbone(element);
41178      if (element.hasSequenceElement()) {
41179        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41180        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41181      }
41182      if (element.hasDiagnosis()) {
41183        composeType("diagnosis", element.getDiagnosis());
41184      }
41185      if (element.hasType()) {
41186        openArray("type");
41187        for (CodeableConcept e : element.getType()) 
41188          composeCodeableConcept(null, e);
41189        closeArray();
41190      };
41191      if (element.hasOnAdmission()) {
41192        composeCodeableConcept("onAdmission", element.getOnAdmission());
41193      }
41194      if (element.hasPackageCode()) {
41195        composeCodeableConcept("packageCode", element.getPackageCode());
41196      }
41197  }
41198
41199  protected void composeExplanationOfBenefitProcedureComponent(String name, ExplanationOfBenefit.ProcedureComponent element) throws IOException {
41200    if (element != null) {
41201      open(name);
41202      composeExplanationOfBenefitProcedureComponentInner(element);
41203      close();
41204    }
41205  }
41206
41207  protected void composeExplanationOfBenefitProcedureComponentInner(ExplanationOfBenefit.ProcedureComponent element) throws IOException {
41208      composeBackbone(element);
41209      if (element.hasSequenceElement()) {
41210        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41211        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41212      }
41213      if (element.hasType()) {
41214        openArray("type");
41215        for (CodeableConcept e : element.getType()) 
41216          composeCodeableConcept(null, e);
41217        closeArray();
41218      };
41219      if (element.hasDateElement()) {
41220        composeDateTimeCore("date", element.getDateElement(), false);
41221        composeDateTimeExtras("date", element.getDateElement(), false);
41222      }
41223      if (element.hasProcedure()) {
41224        composeType("procedure", element.getProcedure());
41225      }
41226      if (element.hasUdi()) {
41227        openArray("udi");
41228        for (Reference e : element.getUdi()) 
41229          composeReference(null, e);
41230        closeArray();
41231      };
41232  }
41233
41234  protected void composeExplanationOfBenefitInsuranceComponent(String name, ExplanationOfBenefit.InsuranceComponent element) throws IOException {
41235    if (element != null) {
41236      open(name);
41237      composeExplanationOfBenefitInsuranceComponentInner(element);
41238      close();
41239    }
41240  }
41241
41242  protected void composeExplanationOfBenefitInsuranceComponentInner(ExplanationOfBenefit.InsuranceComponent element) throws IOException {
41243      composeBackbone(element);
41244      if (element.hasFocalElement()) {
41245        composeBooleanCore("focal", element.getFocalElement(), false);
41246        composeBooleanExtras("focal", element.getFocalElement(), false);
41247      }
41248      if (element.hasCoverage()) {
41249        composeReference("coverage", element.getCoverage());
41250      }
41251      if (element.hasPreAuthRef()) {
41252        openArray("preAuthRef");
41253        for (StringType e : element.getPreAuthRef()) 
41254          composeStringCore(null, e, true);
41255        closeArray();
41256        if (anyHasExtras(element.getPreAuthRef())) {
41257          openArray("_preAuthRef");
41258          for (StringType e : element.getPreAuthRef()) 
41259            composeStringExtras(null, e, true);
41260          closeArray();
41261        }
41262      };
41263  }
41264
41265  protected void composeExplanationOfBenefitAccidentComponent(String name, ExplanationOfBenefit.AccidentComponent element) throws IOException {
41266    if (element != null) {
41267      open(name);
41268      composeExplanationOfBenefitAccidentComponentInner(element);
41269      close();
41270    }
41271  }
41272
41273  protected void composeExplanationOfBenefitAccidentComponentInner(ExplanationOfBenefit.AccidentComponent element) throws IOException {
41274      composeBackbone(element);
41275      if (element.hasDateElement()) {
41276        composeDateCore("date", element.getDateElement(), false);
41277        composeDateExtras("date", element.getDateElement(), false);
41278      }
41279      if (element.hasType()) {
41280        composeCodeableConcept("type", element.getType());
41281      }
41282      if (element.hasLocation()) {
41283        composeType("location", element.getLocation());
41284      }
41285  }
41286
41287  protected void composeExplanationOfBenefitItemComponent(String name, ExplanationOfBenefit.ItemComponent element) throws IOException {
41288    if (element != null) {
41289      open(name);
41290      composeExplanationOfBenefitItemComponentInner(element);
41291      close();
41292    }
41293  }
41294
41295  protected void composeExplanationOfBenefitItemComponentInner(ExplanationOfBenefit.ItemComponent element) throws IOException {
41296      composeBackbone(element);
41297      if (element.hasSequenceElement()) {
41298        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41299        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41300      }
41301      if (element.hasCareTeamSequence()) {
41302        openArray("careTeamSequence");
41303        for (PositiveIntType e : element.getCareTeamSequence()) 
41304          composePositiveIntCore(null, e, true);
41305        closeArray();
41306        if (anyHasExtras(element.getCareTeamSequence())) {
41307          openArray("_careTeamSequence");
41308          for (PositiveIntType e : element.getCareTeamSequence()) 
41309            composePositiveIntExtras(null, e, true);
41310          closeArray();
41311        }
41312      };
41313      if (element.hasDiagnosisSequence()) {
41314        openArray("diagnosisSequence");
41315        for (PositiveIntType e : element.getDiagnosisSequence()) 
41316          composePositiveIntCore(null, e, true);
41317        closeArray();
41318        if (anyHasExtras(element.getDiagnosisSequence())) {
41319          openArray("_diagnosisSequence");
41320          for (PositiveIntType e : element.getDiagnosisSequence()) 
41321            composePositiveIntExtras(null, e, true);
41322          closeArray();
41323        }
41324      };
41325      if (element.hasProcedureSequence()) {
41326        openArray("procedureSequence");
41327        for (PositiveIntType e : element.getProcedureSequence()) 
41328          composePositiveIntCore(null, e, true);
41329        closeArray();
41330        if (anyHasExtras(element.getProcedureSequence())) {
41331          openArray("_procedureSequence");
41332          for (PositiveIntType e : element.getProcedureSequence()) 
41333            composePositiveIntExtras(null, e, true);
41334          closeArray();
41335        }
41336      };
41337      if (element.hasInformationSequence()) {
41338        openArray("informationSequence");
41339        for (PositiveIntType e : element.getInformationSequence()) 
41340          composePositiveIntCore(null, e, true);
41341        closeArray();
41342        if (anyHasExtras(element.getInformationSequence())) {
41343          openArray("_informationSequence");
41344          for (PositiveIntType e : element.getInformationSequence()) 
41345            composePositiveIntExtras(null, e, true);
41346          closeArray();
41347        }
41348      };
41349      if (element.hasRevenue()) {
41350        composeCodeableConcept("revenue", element.getRevenue());
41351      }
41352      if (element.hasCategory()) {
41353        composeCodeableConcept("category", element.getCategory());
41354      }
41355      if (element.hasProductOrService()) {
41356        composeCodeableConcept("productOrService", element.getProductOrService());
41357      }
41358      if (element.hasModifier()) {
41359        openArray("modifier");
41360        for (CodeableConcept e : element.getModifier()) 
41361          composeCodeableConcept(null, e);
41362        closeArray();
41363      };
41364      if (element.hasProgramCode()) {
41365        openArray("programCode");
41366        for (CodeableConcept e : element.getProgramCode()) 
41367          composeCodeableConcept(null, e);
41368        closeArray();
41369      };
41370      if (element.hasServiced()) {
41371        composeType("serviced", element.getServiced());
41372      }
41373      if (element.hasLocation()) {
41374        composeType("location", element.getLocation());
41375      }
41376      if (element.hasQuantity()) {
41377        composeQuantity("quantity", element.getQuantity());
41378      }
41379      if (element.hasUnitPrice()) {
41380        composeMoney("unitPrice", element.getUnitPrice());
41381      }
41382      if (element.hasFactorElement()) {
41383        composeDecimalCore("factor", element.getFactorElement(), false);
41384        composeDecimalExtras("factor", element.getFactorElement(), false);
41385      }
41386      if (element.hasNet()) {
41387        composeMoney("net", element.getNet());
41388      }
41389      if (element.hasUdi()) {
41390        openArray("udi");
41391        for (Reference e : element.getUdi()) 
41392          composeReference(null, e);
41393        closeArray();
41394      };
41395      if (element.hasBodySite()) {
41396        composeCodeableConcept("bodySite", element.getBodySite());
41397      }
41398      if (element.hasSubSite()) {
41399        openArray("subSite");
41400        for (CodeableConcept e : element.getSubSite()) 
41401          composeCodeableConcept(null, e);
41402        closeArray();
41403      };
41404      if (element.hasEncounter()) {
41405        openArray("encounter");
41406        for (Reference e : element.getEncounter()) 
41407          composeReference(null, e);
41408        closeArray();
41409      };
41410      if (element.hasNoteNumber()) {
41411        openArray("noteNumber");
41412        for (PositiveIntType e : element.getNoteNumber()) 
41413          composePositiveIntCore(null, e, true);
41414        closeArray();
41415        if (anyHasExtras(element.getNoteNumber())) {
41416          openArray("_noteNumber");
41417          for (PositiveIntType e : element.getNoteNumber()) 
41418            composePositiveIntExtras(null, e, true);
41419          closeArray();
41420        }
41421      };
41422      if (element.hasAdjudication()) {
41423        openArray("adjudication");
41424        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41425          composeExplanationOfBenefitAdjudicationComponent(null, e);
41426        closeArray();
41427      };
41428      if (element.hasDetail()) {
41429        openArray("detail");
41430        for (ExplanationOfBenefit.DetailComponent e : element.getDetail()) 
41431          composeExplanationOfBenefitDetailComponent(null, e);
41432        closeArray();
41433      };
41434  }
41435
41436  protected void composeExplanationOfBenefitAdjudicationComponent(String name, ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
41437    if (element != null) {
41438      open(name);
41439      composeExplanationOfBenefitAdjudicationComponentInner(element);
41440      close();
41441    }
41442  }
41443
41444  protected void composeExplanationOfBenefitAdjudicationComponentInner(ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
41445      composeBackbone(element);
41446      if (element.hasCategory()) {
41447        composeCodeableConcept("category", element.getCategory());
41448      }
41449      if (element.hasReason()) {
41450        composeCodeableConcept("reason", element.getReason());
41451      }
41452      if (element.hasAmount()) {
41453        composeMoney("amount", element.getAmount());
41454      }
41455      if (element.hasValueElement()) {
41456        composeDecimalCore("value", element.getValueElement(), false);
41457        composeDecimalExtras("value", element.getValueElement(), false);
41458      }
41459  }
41460
41461  protected void composeExplanationOfBenefitDetailComponent(String name, ExplanationOfBenefit.DetailComponent element) throws IOException {
41462    if (element != null) {
41463      open(name);
41464      composeExplanationOfBenefitDetailComponentInner(element);
41465      close();
41466    }
41467  }
41468
41469  protected void composeExplanationOfBenefitDetailComponentInner(ExplanationOfBenefit.DetailComponent element) throws IOException {
41470      composeBackbone(element);
41471      if (element.hasSequenceElement()) {
41472        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41473        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41474      }
41475      if (element.hasRevenue()) {
41476        composeCodeableConcept("revenue", element.getRevenue());
41477      }
41478      if (element.hasCategory()) {
41479        composeCodeableConcept("category", element.getCategory());
41480      }
41481      if (element.hasProductOrService()) {
41482        composeCodeableConcept("productOrService", element.getProductOrService());
41483      }
41484      if (element.hasModifier()) {
41485        openArray("modifier");
41486        for (CodeableConcept e : element.getModifier()) 
41487          composeCodeableConcept(null, e);
41488        closeArray();
41489      };
41490      if (element.hasProgramCode()) {
41491        openArray("programCode");
41492        for (CodeableConcept e : element.getProgramCode()) 
41493          composeCodeableConcept(null, e);
41494        closeArray();
41495      };
41496      if (element.hasQuantity()) {
41497        composeQuantity("quantity", element.getQuantity());
41498      }
41499      if (element.hasUnitPrice()) {
41500        composeMoney("unitPrice", element.getUnitPrice());
41501      }
41502      if (element.hasFactorElement()) {
41503        composeDecimalCore("factor", element.getFactorElement(), false);
41504        composeDecimalExtras("factor", element.getFactorElement(), false);
41505      }
41506      if (element.hasNet()) {
41507        composeMoney("net", element.getNet());
41508      }
41509      if (element.hasUdi()) {
41510        openArray("udi");
41511        for (Reference e : element.getUdi()) 
41512          composeReference(null, e);
41513        closeArray();
41514      };
41515      if (element.hasNoteNumber()) {
41516        openArray("noteNumber");
41517        for (PositiveIntType e : element.getNoteNumber()) 
41518          composePositiveIntCore(null, e, true);
41519        closeArray();
41520        if (anyHasExtras(element.getNoteNumber())) {
41521          openArray("_noteNumber");
41522          for (PositiveIntType e : element.getNoteNumber()) 
41523            composePositiveIntExtras(null, e, true);
41524          closeArray();
41525        }
41526      };
41527      if (element.hasAdjudication()) {
41528        openArray("adjudication");
41529        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41530          composeExplanationOfBenefitAdjudicationComponent(null, e);
41531        closeArray();
41532      };
41533      if (element.hasSubDetail()) {
41534        openArray("subDetail");
41535        for (ExplanationOfBenefit.SubDetailComponent e : element.getSubDetail()) 
41536          composeExplanationOfBenefitSubDetailComponent(null, e);
41537        closeArray();
41538      };
41539  }
41540
41541  protected void composeExplanationOfBenefitSubDetailComponent(String name, ExplanationOfBenefit.SubDetailComponent element) throws IOException {
41542    if (element != null) {
41543      open(name);
41544      composeExplanationOfBenefitSubDetailComponentInner(element);
41545      close();
41546    }
41547  }
41548
41549  protected void composeExplanationOfBenefitSubDetailComponentInner(ExplanationOfBenefit.SubDetailComponent element) throws IOException {
41550      composeBackbone(element);
41551      if (element.hasSequenceElement()) {
41552        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41553        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41554      }
41555      if (element.hasRevenue()) {
41556        composeCodeableConcept("revenue", element.getRevenue());
41557      }
41558      if (element.hasCategory()) {
41559        composeCodeableConcept("category", element.getCategory());
41560      }
41561      if (element.hasProductOrService()) {
41562        composeCodeableConcept("productOrService", element.getProductOrService());
41563      }
41564      if (element.hasModifier()) {
41565        openArray("modifier");
41566        for (CodeableConcept e : element.getModifier()) 
41567          composeCodeableConcept(null, e);
41568        closeArray();
41569      };
41570      if (element.hasProgramCode()) {
41571        openArray("programCode");
41572        for (CodeableConcept e : element.getProgramCode()) 
41573          composeCodeableConcept(null, e);
41574        closeArray();
41575      };
41576      if (element.hasQuantity()) {
41577        composeQuantity("quantity", element.getQuantity());
41578      }
41579      if (element.hasUnitPrice()) {
41580        composeMoney("unitPrice", element.getUnitPrice());
41581      }
41582      if (element.hasFactorElement()) {
41583        composeDecimalCore("factor", element.getFactorElement(), false);
41584        composeDecimalExtras("factor", element.getFactorElement(), false);
41585      }
41586      if (element.hasNet()) {
41587        composeMoney("net", element.getNet());
41588      }
41589      if (element.hasUdi()) {
41590        openArray("udi");
41591        for (Reference e : element.getUdi()) 
41592          composeReference(null, e);
41593        closeArray();
41594      };
41595      if (element.hasNoteNumber()) {
41596        openArray("noteNumber");
41597        for (PositiveIntType e : element.getNoteNumber()) 
41598          composePositiveIntCore(null, e, true);
41599        closeArray();
41600        if (anyHasExtras(element.getNoteNumber())) {
41601          openArray("_noteNumber");
41602          for (PositiveIntType e : element.getNoteNumber()) 
41603            composePositiveIntExtras(null, e, true);
41604          closeArray();
41605        }
41606      };
41607      if (element.hasAdjudication()) {
41608        openArray("adjudication");
41609        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41610          composeExplanationOfBenefitAdjudicationComponent(null, e);
41611        closeArray();
41612      };
41613  }
41614
41615  protected void composeExplanationOfBenefitAddedItemComponent(String name, ExplanationOfBenefit.AddedItemComponent element) throws IOException {
41616    if (element != null) {
41617      open(name);
41618      composeExplanationOfBenefitAddedItemComponentInner(element);
41619      close();
41620    }
41621  }
41622
41623  protected void composeExplanationOfBenefitAddedItemComponentInner(ExplanationOfBenefit.AddedItemComponent element) throws IOException {
41624      composeBackbone(element);
41625      if (element.hasItemSequence()) {
41626        openArray("itemSequence");
41627        for (PositiveIntType e : element.getItemSequence()) 
41628          composePositiveIntCore(null, e, true);
41629        closeArray();
41630        if (anyHasExtras(element.getItemSequence())) {
41631          openArray("_itemSequence");
41632          for (PositiveIntType e : element.getItemSequence()) 
41633            composePositiveIntExtras(null, e, true);
41634          closeArray();
41635        }
41636      };
41637      if (element.hasDetailSequence()) {
41638        openArray("detailSequence");
41639        for (PositiveIntType e : element.getDetailSequence()) 
41640          composePositiveIntCore(null, e, true);
41641        closeArray();
41642        if (anyHasExtras(element.getDetailSequence())) {
41643          openArray("_detailSequence");
41644          for (PositiveIntType e : element.getDetailSequence()) 
41645            composePositiveIntExtras(null, e, true);
41646          closeArray();
41647        }
41648      };
41649      if (element.hasSubDetailSequence()) {
41650        openArray("subDetailSequence");
41651        for (PositiveIntType e : element.getSubDetailSequence()) 
41652          composePositiveIntCore(null, e, true);
41653        closeArray();
41654        if (anyHasExtras(element.getSubDetailSequence())) {
41655          openArray("_subDetailSequence");
41656          for (PositiveIntType e : element.getSubDetailSequence()) 
41657            composePositiveIntExtras(null, e, true);
41658          closeArray();
41659        }
41660      };
41661      if (element.hasProvider()) {
41662        openArray("provider");
41663        for (Reference e : element.getProvider()) 
41664          composeReference(null, e);
41665        closeArray();
41666      };
41667      if (element.hasProductOrService()) {
41668        composeCodeableConcept("productOrService", element.getProductOrService());
41669      }
41670      if (element.hasModifier()) {
41671        openArray("modifier");
41672        for (CodeableConcept e : element.getModifier()) 
41673          composeCodeableConcept(null, e);
41674        closeArray();
41675      };
41676      if (element.hasProgramCode()) {
41677        openArray("programCode");
41678        for (CodeableConcept e : element.getProgramCode()) 
41679          composeCodeableConcept(null, e);
41680        closeArray();
41681      };
41682      if (element.hasServiced()) {
41683        composeType("serviced", element.getServiced());
41684      }
41685      if (element.hasLocation()) {
41686        composeType("location", element.getLocation());
41687      }
41688      if (element.hasQuantity()) {
41689        composeQuantity("quantity", element.getQuantity());
41690      }
41691      if (element.hasUnitPrice()) {
41692        composeMoney("unitPrice", element.getUnitPrice());
41693      }
41694      if (element.hasFactorElement()) {
41695        composeDecimalCore("factor", element.getFactorElement(), false);
41696        composeDecimalExtras("factor", element.getFactorElement(), false);
41697      }
41698      if (element.hasNet()) {
41699        composeMoney("net", element.getNet());
41700      }
41701      if (element.hasBodySite()) {
41702        composeCodeableConcept("bodySite", element.getBodySite());
41703      }
41704      if (element.hasSubSite()) {
41705        openArray("subSite");
41706        for (CodeableConcept e : element.getSubSite()) 
41707          composeCodeableConcept(null, e);
41708        closeArray();
41709      };
41710      if (element.hasNoteNumber()) {
41711        openArray("noteNumber");
41712        for (PositiveIntType e : element.getNoteNumber()) 
41713          composePositiveIntCore(null, e, true);
41714        closeArray();
41715        if (anyHasExtras(element.getNoteNumber())) {
41716          openArray("_noteNumber");
41717          for (PositiveIntType e : element.getNoteNumber()) 
41718            composePositiveIntExtras(null, e, true);
41719          closeArray();
41720        }
41721      };
41722      if (element.hasAdjudication()) {
41723        openArray("adjudication");
41724        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41725          composeExplanationOfBenefitAdjudicationComponent(null, e);
41726        closeArray();
41727      };
41728      if (element.hasDetail()) {
41729        openArray("detail");
41730        for (ExplanationOfBenefit.AddedItemDetailComponent e : element.getDetail()) 
41731          composeExplanationOfBenefitAddedItemDetailComponent(null, e);
41732        closeArray();
41733      };
41734  }
41735
41736  protected void composeExplanationOfBenefitAddedItemDetailComponent(String name, ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
41737    if (element != null) {
41738      open(name);
41739      composeExplanationOfBenefitAddedItemDetailComponentInner(element);
41740      close();
41741    }
41742  }
41743
41744  protected void composeExplanationOfBenefitAddedItemDetailComponentInner(ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
41745      composeBackbone(element);
41746      if (element.hasProductOrService()) {
41747        composeCodeableConcept("productOrService", element.getProductOrService());
41748      }
41749      if (element.hasModifier()) {
41750        openArray("modifier");
41751        for (CodeableConcept e : element.getModifier()) 
41752          composeCodeableConcept(null, e);
41753        closeArray();
41754      };
41755      if (element.hasQuantity()) {
41756        composeQuantity("quantity", element.getQuantity());
41757      }
41758      if (element.hasUnitPrice()) {
41759        composeMoney("unitPrice", element.getUnitPrice());
41760      }
41761      if (element.hasFactorElement()) {
41762        composeDecimalCore("factor", element.getFactorElement(), false);
41763        composeDecimalExtras("factor", element.getFactorElement(), false);
41764      }
41765      if (element.hasNet()) {
41766        composeMoney("net", element.getNet());
41767      }
41768      if (element.hasNoteNumber()) {
41769        openArray("noteNumber");
41770        for (PositiveIntType e : element.getNoteNumber()) 
41771          composePositiveIntCore(null, e, true);
41772        closeArray();
41773        if (anyHasExtras(element.getNoteNumber())) {
41774          openArray("_noteNumber");
41775          for (PositiveIntType e : element.getNoteNumber()) 
41776            composePositiveIntExtras(null, e, true);
41777          closeArray();
41778        }
41779      };
41780      if (element.hasAdjudication()) {
41781        openArray("adjudication");
41782        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41783          composeExplanationOfBenefitAdjudicationComponent(null, e);
41784        closeArray();
41785      };
41786      if (element.hasSubDetail()) {
41787        openArray("subDetail");
41788        for (ExplanationOfBenefit.AddedItemDetailSubDetailComponent e : element.getSubDetail()) 
41789          composeExplanationOfBenefitAddedItemDetailSubDetailComponent(null, e);
41790        closeArray();
41791      };
41792  }
41793
41794  protected void composeExplanationOfBenefitAddedItemDetailSubDetailComponent(String name, ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
41795    if (element != null) {
41796      open(name);
41797      composeExplanationOfBenefitAddedItemDetailSubDetailComponentInner(element);
41798      close();
41799    }
41800  }
41801
41802  protected void composeExplanationOfBenefitAddedItemDetailSubDetailComponentInner(ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
41803      composeBackbone(element);
41804      if (element.hasProductOrService()) {
41805        composeCodeableConcept("productOrService", element.getProductOrService());
41806      }
41807      if (element.hasModifier()) {
41808        openArray("modifier");
41809        for (CodeableConcept e : element.getModifier()) 
41810          composeCodeableConcept(null, e);
41811        closeArray();
41812      };
41813      if (element.hasQuantity()) {
41814        composeQuantity("quantity", element.getQuantity());
41815      }
41816      if (element.hasUnitPrice()) {
41817        composeMoney("unitPrice", element.getUnitPrice());
41818      }
41819      if (element.hasFactorElement()) {
41820        composeDecimalCore("factor", element.getFactorElement(), false);
41821        composeDecimalExtras("factor", element.getFactorElement(), false);
41822      }
41823      if (element.hasNet()) {
41824        composeMoney("net", element.getNet());
41825      }
41826      if (element.hasNoteNumber()) {
41827        openArray("noteNumber");
41828        for (PositiveIntType e : element.getNoteNumber()) 
41829          composePositiveIntCore(null, e, true);
41830        closeArray();
41831        if (anyHasExtras(element.getNoteNumber())) {
41832          openArray("_noteNumber");
41833          for (PositiveIntType e : element.getNoteNumber()) 
41834            composePositiveIntExtras(null, e, true);
41835          closeArray();
41836        }
41837      };
41838      if (element.hasAdjudication()) {
41839        openArray("adjudication");
41840        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41841          composeExplanationOfBenefitAdjudicationComponent(null, e);
41842        closeArray();
41843      };
41844  }
41845
41846  protected void composeExplanationOfBenefitTotalComponent(String name, ExplanationOfBenefit.TotalComponent element) throws IOException {
41847    if (element != null) {
41848      open(name);
41849      composeExplanationOfBenefitTotalComponentInner(element);
41850      close();
41851    }
41852  }
41853
41854  protected void composeExplanationOfBenefitTotalComponentInner(ExplanationOfBenefit.TotalComponent element) throws IOException {
41855      composeBackbone(element);
41856      if (element.hasCategory()) {
41857        composeCodeableConcept("category", element.getCategory());
41858      }
41859      if (element.hasAmount()) {
41860        composeMoney("amount", element.getAmount());
41861      }
41862  }
41863
41864  protected void composeExplanationOfBenefitPaymentComponent(String name, ExplanationOfBenefit.PaymentComponent element) throws IOException {
41865    if (element != null) {
41866      open(name);
41867      composeExplanationOfBenefitPaymentComponentInner(element);
41868      close();
41869    }
41870  }
41871
41872  protected void composeExplanationOfBenefitPaymentComponentInner(ExplanationOfBenefit.PaymentComponent element) throws IOException {
41873      composeBackbone(element);
41874      if (element.hasType()) {
41875        composeCodeableConcept("type", element.getType());
41876      }
41877      if (element.hasAdjustment()) {
41878        composeMoney("adjustment", element.getAdjustment());
41879      }
41880      if (element.hasAdjustmentReason()) {
41881        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
41882      }
41883      if (element.hasDateElement()) {
41884        composeDateCore("date", element.getDateElement(), false);
41885        composeDateExtras("date", element.getDateElement(), false);
41886      }
41887      if (element.hasAmount()) {
41888        composeMoney("amount", element.getAmount());
41889      }
41890      if (element.hasIdentifier()) {
41891        composeIdentifier("identifier", element.getIdentifier());
41892      }
41893  }
41894
41895  protected void composeExplanationOfBenefitNoteComponent(String name, ExplanationOfBenefit.NoteComponent element) throws IOException {
41896    if (element != null) {
41897      open(name);
41898      composeExplanationOfBenefitNoteComponentInner(element);
41899      close();
41900    }
41901  }
41902
41903  protected void composeExplanationOfBenefitNoteComponentInner(ExplanationOfBenefit.NoteComponent element) throws IOException {
41904      composeBackbone(element);
41905      if (element.hasNumberElement()) {
41906        composePositiveIntCore("number", element.getNumberElement(), false);
41907        composePositiveIntExtras("number", element.getNumberElement(), false);
41908      }
41909      if (element.hasTypeElement()) {
41910        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
41911        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
41912      }
41913      if (element.hasTextElement()) {
41914        composeStringCore("text", element.getTextElement(), false);
41915        composeStringExtras("text", element.getTextElement(), false);
41916      }
41917      if (element.hasLanguage()) {
41918        composeCodeableConcept("language", element.getLanguage());
41919      }
41920  }
41921
41922  protected void composeExplanationOfBenefitBenefitBalanceComponent(String name, ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
41923    if (element != null) {
41924      open(name);
41925      composeExplanationOfBenefitBenefitBalanceComponentInner(element);
41926      close();
41927    }
41928  }
41929
41930  protected void composeExplanationOfBenefitBenefitBalanceComponentInner(ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
41931      composeBackbone(element);
41932      if (element.hasCategory()) {
41933        composeCodeableConcept("category", element.getCategory());
41934      }
41935      if (element.hasExcludedElement()) {
41936        composeBooleanCore("excluded", element.getExcludedElement(), false);
41937        composeBooleanExtras("excluded", element.getExcludedElement(), false);
41938      }
41939      if (element.hasNameElement()) {
41940        composeStringCore("name", element.getNameElement(), false);
41941        composeStringExtras("name", element.getNameElement(), false);
41942      }
41943      if (element.hasDescriptionElement()) {
41944        composeStringCore("description", element.getDescriptionElement(), false);
41945        composeStringExtras("description", element.getDescriptionElement(), false);
41946      }
41947      if (element.hasNetwork()) {
41948        composeCodeableConcept("network", element.getNetwork());
41949      }
41950      if (element.hasUnit()) {
41951        composeCodeableConcept("unit", element.getUnit());
41952      }
41953      if (element.hasTerm()) {
41954        composeCodeableConcept("term", element.getTerm());
41955      }
41956      if (element.hasFinancial()) {
41957        openArray("financial");
41958        for (ExplanationOfBenefit.BenefitComponent e : element.getFinancial()) 
41959          composeExplanationOfBenefitBenefitComponent(null, e);
41960        closeArray();
41961      };
41962  }
41963
41964  protected void composeExplanationOfBenefitBenefitComponent(String name, ExplanationOfBenefit.BenefitComponent element) throws IOException {
41965    if (element != null) {
41966      open(name);
41967      composeExplanationOfBenefitBenefitComponentInner(element);
41968      close();
41969    }
41970  }
41971
41972  protected void composeExplanationOfBenefitBenefitComponentInner(ExplanationOfBenefit.BenefitComponent element) throws IOException {
41973      composeBackbone(element);
41974      if (element.hasType()) {
41975        composeCodeableConcept("type", element.getType());
41976      }
41977      if (element.hasAllowed()) {
41978        composeType("allowed", element.getAllowed());
41979      }
41980      if (element.hasUsed()) {
41981        composeType("used", element.getUsed());
41982      }
41983  }
41984
41985  protected void composeFamilyMemberHistory(String name, FamilyMemberHistory element) throws IOException {
41986    if (element != null) {
41987      prop("resourceType", name);
41988      composeFamilyMemberHistoryInner(element);
41989    }
41990  }
41991
41992  protected void composeFamilyMemberHistoryInner(FamilyMemberHistory element) throws IOException {
41993      composeDomainResourceElements(element);
41994      if (element.hasIdentifier()) {
41995        openArray("identifier");
41996        for (Identifier e : element.getIdentifier()) 
41997          composeIdentifier(null, e);
41998        closeArray();
41999      };
42000      if (element.hasInstantiatesCanonical()) {
42001        openArray("instantiatesCanonical");
42002        for (CanonicalType e : element.getInstantiatesCanonical()) 
42003          composeCanonicalCore(null, e, true);
42004        closeArray();
42005        if (anyHasExtras(element.getInstantiatesCanonical())) {
42006          openArray("_instantiatesCanonical");
42007          for (CanonicalType e : element.getInstantiatesCanonical()) 
42008            composeCanonicalExtras(null, e, true);
42009          closeArray();
42010        }
42011      };
42012      if (element.hasInstantiatesUri()) {
42013        openArray("instantiatesUri");
42014        for (UriType e : element.getInstantiatesUri()) 
42015          composeUriCore(null, e, true);
42016        closeArray();
42017        if (anyHasExtras(element.getInstantiatesUri())) {
42018          openArray("_instantiatesUri");
42019          for (UriType e : element.getInstantiatesUri()) 
42020            composeUriExtras(null, e, true);
42021          closeArray();
42022        }
42023      };
42024      if (element.hasStatusElement()) {
42025        composeEnumerationCore("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
42026        composeEnumerationExtras("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
42027      }
42028      if (element.hasDataAbsentReason()) {
42029        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
42030      }
42031      if (element.hasPatient()) {
42032        composeReference("patient", element.getPatient());
42033      }
42034      if (element.hasDateElement()) {
42035        composeDateTimeCore("date", element.getDateElement(), false);
42036        composeDateTimeExtras("date", element.getDateElement(), false);
42037      }
42038      if (element.hasNameElement()) {
42039        composeStringCore("name", element.getNameElement(), false);
42040        composeStringExtras("name", element.getNameElement(), false);
42041      }
42042      if (element.hasRelationship()) {
42043        composeCodeableConcept("relationship", element.getRelationship());
42044      }
42045      if (element.hasSex()) {
42046        composeCodeableConcept("sex", element.getSex());
42047      }
42048      if (element.hasBorn()) {
42049        composeType("born", element.getBorn());
42050      }
42051      if (element.hasAge()) {
42052        composeType("age", element.getAge());
42053      }
42054      if (element.hasEstimatedAgeElement()) {
42055        composeBooleanCore("estimatedAge", element.getEstimatedAgeElement(), false);
42056        composeBooleanExtras("estimatedAge", element.getEstimatedAgeElement(), false);
42057      }
42058      if (element.hasDeceased()) {
42059        composeType("deceased", element.getDeceased());
42060      }
42061      if (element.hasReasonCode()) {
42062        openArray("reasonCode");
42063        for (CodeableConcept e : element.getReasonCode()) 
42064          composeCodeableConcept(null, e);
42065        closeArray();
42066      };
42067      if (element.hasReasonReference()) {
42068        openArray("reasonReference");
42069        for (Reference e : element.getReasonReference()) 
42070          composeReference(null, e);
42071        closeArray();
42072      };
42073      if (element.hasNote()) {
42074        openArray("note");
42075        for (Annotation e : element.getNote()) 
42076          composeAnnotation(null, e);
42077        closeArray();
42078      };
42079      if (element.hasCondition()) {
42080        openArray("condition");
42081        for (FamilyMemberHistory.FamilyMemberHistoryConditionComponent e : element.getCondition()) 
42082          composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(null, e);
42083        closeArray();
42084      };
42085  }
42086
42087  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
42088    if (element != null) {
42089      open(name);
42090      composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(element);
42091      close();
42092    }
42093  }
42094
42095  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
42096      composeBackbone(element);
42097      if (element.hasCode()) {
42098        composeCodeableConcept("code", element.getCode());
42099      }
42100      if (element.hasOutcome()) {
42101        composeCodeableConcept("outcome", element.getOutcome());
42102      }
42103      if (element.hasContributedToDeathElement()) {
42104        composeBooleanCore("contributedToDeath", element.getContributedToDeathElement(), false);
42105        composeBooleanExtras("contributedToDeath", element.getContributedToDeathElement(), false);
42106      }
42107      if (element.hasOnset()) {
42108        composeType("onset", element.getOnset());
42109      }
42110      if (element.hasNote()) {
42111        openArray("note");
42112        for (Annotation e : element.getNote()) 
42113          composeAnnotation(null, e);
42114        closeArray();
42115      };
42116  }
42117
42118  protected void composeFlag(String name, Flag element) throws IOException {
42119    if (element != null) {
42120      prop("resourceType", name);
42121      composeFlagInner(element);
42122    }
42123  }
42124
42125  protected void composeFlagInner(Flag element) throws IOException {
42126      composeDomainResourceElements(element);
42127      if (element.hasIdentifier()) {
42128        openArray("identifier");
42129        for (Identifier e : element.getIdentifier()) 
42130          composeIdentifier(null, e);
42131        closeArray();
42132      };
42133      if (element.hasStatusElement()) {
42134        composeEnumerationCore("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
42135        composeEnumerationExtras("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
42136      }
42137      if (element.hasCategory()) {
42138        openArray("category");
42139        for (CodeableConcept e : element.getCategory()) 
42140          composeCodeableConcept(null, e);
42141        closeArray();
42142      };
42143      if (element.hasCode()) {
42144        composeCodeableConcept("code", element.getCode());
42145      }
42146      if (element.hasSubject()) {
42147        composeReference("subject", element.getSubject());
42148      }
42149      if (element.hasPeriod()) {
42150        composePeriod("period", element.getPeriod());
42151      }
42152      if (element.hasEncounter()) {
42153        composeReference("encounter", element.getEncounter());
42154      }
42155      if (element.hasAuthor()) {
42156        composeReference("author", element.getAuthor());
42157      }
42158  }
42159
42160  protected void composeGoal(String name, Goal element) throws IOException {
42161    if (element != null) {
42162      prop("resourceType", name);
42163      composeGoalInner(element);
42164    }
42165  }
42166
42167  protected void composeGoalInner(Goal element) throws IOException {
42168      composeDomainResourceElements(element);
42169      if (element.hasIdentifier()) {
42170        openArray("identifier");
42171        for (Identifier e : element.getIdentifier()) 
42172          composeIdentifier(null, e);
42173        closeArray();
42174      };
42175      if (element.hasLifecycleStatusElement()) {
42176        composeEnumerationCore("lifecycleStatus", element.getLifecycleStatusElement(), new Goal.GoalLifecycleStatusEnumFactory(), false);
42177        composeEnumerationExtras("lifecycleStatus", element.getLifecycleStatusElement(), new Goal.GoalLifecycleStatusEnumFactory(), false);
42178      }
42179      if (element.hasAchievementStatus()) {
42180        composeCodeableConcept("achievementStatus", element.getAchievementStatus());
42181      }
42182      if (element.hasCategory()) {
42183        openArray("category");
42184        for (CodeableConcept e : element.getCategory()) 
42185          composeCodeableConcept(null, e);
42186        closeArray();
42187      };
42188      if (element.hasPriority()) {
42189        composeCodeableConcept("priority", element.getPriority());
42190      }
42191      if (element.hasDescription()) {
42192        composeCodeableConcept("description", element.getDescription());
42193      }
42194      if (element.hasSubject()) {
42195        composeReference("subject", element.getSubject());
42196      }
42197      if (element.hasStart()) {
42198        composeType("start", element.getStart());
42199      }
42200      if (element.hasTarget()) {
42201        openArray("target");
42202        for (Goal.GoalTargetComponent e : element.getTarget()) 
42203          composeGoalGoalTargetComponent(null, e);
42204        closeArray();
42205      };
42206      if (element.hasStatusDateElement()) {
42207        composeDateCore("statusDate", element.getStatusDateElement(), false);
42208        composeDateExtras("statusDate", element.getStatusDateElement(), false);
42209      }
42210      if (element.hasStatusReasonElement()) {
42211        composeStringCore("statusReason", element.getStatusReasonElement(), false);
42212        composeStringExtras("statusReason", element.getStatusReasonElement(), false);
42213      }
42214      if (element.hasExpressedBy()) {
42215        composeReference("expressedBy", element.getExpressedBy());
42216      }
42217      if (element.hasAddresses()) {
42218        openArray("addresses");
42219        for (Reference e : element.getAddresses()) 
42220          composeReference(null, e);
42221        closeArray();
42222      };
42223      if (element.hasNote()) {
42224        openArray("note");
42225        for (Annotation e : element.getNote()) 
42226          composeAnnotation(null, e);
42227        closeArray();
42228      };
42229      if (element.hasOutcomeCode()) {
42230        openArray("outcomeCode");
42231        for (CodeableConcept e : element.getOutcomeCode()) 
42232          composeCodeableConcept(null, e);
42233        closeArray();
42234      };
42235      if (element.hasOutcomeReference()) {
42236        openArray("outcomeReference");
42237        for (Reference e : element.getOutcomeReference()) 
42238          composeReference(null, e);
42239        closeArray();
42240      };
42241  }
42242
42243  protected void composeGoalGoalTargetComponent(String name, Goal.GoalTargetComponent element) throws IOException {
42244    if (element != null) {
42245      open(name);
42246      composeGoalGoalTargetComponentInner(element);
42247      close();
42248    }
42249  }
42250
42251  protected void composeGoalGoalTargetComponentInner(Goal.GoalTargetComponent element) throws IOException {
42252      composeBackbone(element);
42253      if (element.hasMeasure()) {
42254        composeCodeableConcept("measure", element.getMeasure());
42255      }
42256      if (element.hasDetail()) {
42257        composeType("detail", element.getDetail());
42258      }
42259      if (element.hasDue()) {
42260        composeType("due", element.getDue());
42261      }
42262  }
42263
42264  protected void composeGraphDefinition(String name, GraphDefinition element) throws IOException {
42265    if (element != null) {
42266      prop("resourceType", name);
42267      composeGraphDefinitionInner(element);
42268    }
42269  }
42270
42271  protected void composeGraphDefinitionInner(GraphDefinition element) throws IOException {
42272      composeDomainResourceElements(element);
42273      if (element.hasUrlElement()) {
42274        composeUriCore("url", element.getUrlElement(), false);
42275        composeUriExtras("url", element.getUrlElement(), false);
42276      }
42277      if (element.hasVersionElement()) {
42278        composeStringCore("version", element.getVersionElement(), false);
42279        composeStringExtras("version", element.getVersionElement(), false);
42280      }
42281      if (element.hasNameElement()) {
42282        composeStringCore("name", element.getNameElement(), false);
42283        composeStringExtras("name", element.getNameElement(), false);
42284      }
42285      if (element.hasStatusElement()) {
42286        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42287        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42288      }
42289      if (element.hasExperimentalElement()) {
42290        composeBooleanCore("experimental", element.getExperimentalElement(), false);
42291        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
42292      }
42293      if (element.hasDateElement()) {
42294        composeDateTimeCore("date", element.getDateElement(), false);
42295        composeDateTimeExtras("date", element.getDateElement(), false);
42296      }
42297      if (element.hasPublisherElement()) {
42298        composeStringCore("publisher", element.getPublisherElement(), false);
42299        composeStringExtras("publisher", element.getPublisherElement(), false);
42300      }
42301      if (element.hasContact()) {
42302        openArray("contact");
42303        for (ContactDetail e : element.getContact()) 
42304          composeContactDetail(null, e);
42305        closeArray();
42306      };
42307      if (element.hasDescriptionElement()) {
42308        composeMarkdownCore("description", element.getDescriptionElement(), false);
42309        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42310      }
42311      if (element.hasUseContext()) {
42312        openArray("useContext");
42313        for (UsageContext e : element.getUseContext()) 
42314          composeUsageContext(null, e);
42315        closeArray();
42316      };
42317      if (element.hasJurisdiction()) {
42318        openArray("jurisdiction");
42319        for (CodeableConcept e : element.getJurisdiction()) 
42320          composeCodeableConcept(null, e);
42321        closeArray();
42322      };
42323      if (element.hasPurposeElement()) {
42324        composeMarkdownCore("purpose", element.getPurposeElement(), false);
42325        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
42326      }
42327      if (element.hasStartElement()) {
42328        composeCodeCore("start", element.getStartElement(), false);
42329        composeCodeExtras("start", element.getStartElement(), false);
42330      }
42331      if (element.hasProfileElement()) {
42332        composeCanonicalCore("profile", element.getProfileElement(), false);
42333        composeCanonicalExtras("profile", element.getProfileElement(), false);
42334      }
42335      if (element.hasLink()) {
42336        openArray("link");
42337        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
42338          composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
42339        closeArray();
42340      };
42341  }
42342
42343  protected void composeGraphDefinitionGraphDefinitionLinkComponent(String name, GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
42344    if (element != null) {
42345      open(name);
42346      composeGraphDefinitionGraphDefinitionLinkComponentInner(element);
42347      close();
42348    }
42349  }
42350
42351  protected void composeGraphDefinitionGraphDefinitionLinkComponentInner(GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
42352      composeBackbone(element);
42353      if (element.hasPathElement()) {
42354        composeStringCore("path", element.getPathElement(), false);
42355        composeStringExtras("path", element.getPathElement(), false);
42356      }
42357      if (element.hasSliceNameElement()) {
42358        composeStringCore("sliceName", element.getSliceNameElement(), false);
42359        composeStringExtras("sliceName", element.getSliceNameElement(), false);
42360      }
42361      if (element.hasMinElement()) {
42362        composeIntegerCore("min", element.getMinElement(), false);
42363        composeIntegerExtras("min", element.getMinElement(), false);
42364      }
42365      if (element.hasMaxElement()) {
42366        composeStringCore("max", element.getMaxElement(), false);
42367        composeStringExtras("max", element.getMaxElement(), false);
42368      }
42369      if (element.hasDescriptionElement()) {
42370        composeStringCore("description", element.getDescriptionElement(), false);
42371        composeStringExtras("description", element.getDescriptionElement(), false);
42372      }
42373      if (element.hasTarget()) {
42374        openArray("target");
42375        for (GraphDefinition.GraphDefinitionLinkTargetComponent e : element.getTarget()) 
42376          composeGraphDefinitionGraphDefinitionLinkTargetComponent(null, e);
42377        closeArray();
42378      };
42379  }
42380
42381  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponent(String name, GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
42382    if (element != null) {
42383      open(name);
42384      composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(element);
42385      close();
42386    }
42387  }
42388
42389  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
42390      composeBackbone(element);
42391      if (element.hasTypeElement()) {
42392        composeCodeCore("type", element.getTypeElement(), false);
42393        composeCodeExtras("type", element.getTypeElement(), false);
42394      }
42395      if (element.hasParamsElement()) {
42396        composeStringCore("params", element.getParamsElement(), false);
42397        composeStringExtras("params", element.getParamsElement(), false);
42398      }
42399      if (element.hasProfileElement()) {
42400        composeCanonicalCore("profile", element.getProfileElement(), false);
42401        composeCanonicalExtras("profile", element.getProfileElement(), false);
42402      }
42403      if (element.hasCompartment()) {
42404        openArray("compartment");
42405        for (GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent e : element.getCompartment()) 
42406          composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(null, e);
42407        closeArray();
42408      };
42409      if (element.hasLink()) {
42410        openArray("link");
42411        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
42412          composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
42413        closeArray();
42414      };
42415  }
42416
42417  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(String name, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
42418    if (element != null) {
42419      open(name);
42420      composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(element);
42421      close();
42422    }
42423  }
42424
42425  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
42426      composeBackbone(element);
42427      if (element.hasUseElement()) {
42428        composeEnumerationCore("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
42429        composeEnumerationExtras("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
42430      }
42431      if (element.hasCodeElement()) {
42432        composeEnumerationCore("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(), false);
42433        composeEnumerationExtras("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(), false);
42434      }
42435      if (element.hasRuleElement()) {
42436        composeEnumerationCore("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
42437        composeEnumerationExtras("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
42438      }
42439      if (element.hasExpressionElement()) {
42440        composeStringCore("expression", element.getExpressionElement(), false);
42441        composeStringExtras("expression", element.getExpressionElement(), false);
42442      }
42443      if (element.hasDescriptionElement()) {
42444        composeStringCore("description", element.getDescriptionElement(), false);
42445        composeStringExtras("description", element.getDescriptionElement(), false);
42446      }
42447  }
42448
42449  protected void composeGroup(String name, Group element) throws IOException {
42450    if (element != null) {
42451      prop("resourceType", name);
42452      composeGroupInner(element);
42453    }
42454  }
42455
42456  protected void composeGroupInner(Group element) throws IOException {
42457      composeDomainResourceElements(element);
42458      if (element.hasIdentifier()) {
42459        openArray("identifier");
42460        for (Identifier e : element.getIdentifier()) 
42461          composeIdentifier(null, e);
42462        closeArray();
42463      };
42464      if (element.hasActiveElement()) {
42465        composeBooleanCore("active", element.getActiveElement(), false);
42466        composeBooleanExtras("active", element.getActiveElement(), false);
42467      }
42468      if (element.hasTypeElement()) {
42469        composeEnumerationCore("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
42470        composeEnumerationExtras("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
42471      }
42472      if (element.hasActualElement()) {
42473        composeBooleanCore("actual", element.getActualElement(), false);
42474        composeBooleanExtras("actual", element.getActualElement(), false);
42475      }
42476      if (element.hasCode()) {
42477        composeCodeableConcept("code", element.getCode());
42478      }
42479      if (element.hasNameElement()) {
42480        composeStringCore("name", element.getNameElement(), false);
42481        composeStringExtras("name", element.getNameElement(), false);
42482      }
42483      if (element.hasQuantityElement()) {
42484        composeUnsignedIntCore("quantity", element.getQuantityElement(), false);
42485        composeUnsignedIntExtras("quantity", element.getQuantityElement(), false);
42486      }
42487      if (element.hasManagingEntity()) {
42488        composeReference("managingEntity", element.getManagingEntity());
42489      }
42490      if (element.hasCharacteristic()) {
42491        openArray("characteristic");
42492        for (Group.GroupCharacteristicComponent e : element.getCharacteristic()) 
42493          composeGroupGroupCharacteristicComponent(null, e);
42494        closeArray();
42495      };
42496      if (element.hasMember()) {
42497        openArray("member");
42498        for (Group.GroupMemberComponent e : element.getMember()) 
42499          composeGroupGroupMemberComponent(null, e);
42500        closeArray();
42501      };
42502  }
42503
42504  protected void composeGroupGroupCharacteristicComponent(String name, Group.GroupCharacteristicComponent element) throws IOException {
42505    if (element != null) {
42506      open(name);
42507      composeGroupGroupCharacteristicComponentInner(element);
42508      close();
42509    }
42510  }
42511
42512  protected void composeGroupGroupCharacteristicComponentInner(Group.GroupCharacteristicComponent element) throws IOException {
42513      composeBackbone(element);
42514      if (element.hasCode()) {
42515        composeCodeableConcept("code", element.getCode());
42516      }
42517      if (element.hasValue()) {
42518        composeType("value", element.getValue());
42519      }
42520      if (element.hasExcludeElement()) {
42521        composeBooleanCore("exclude", element.getExcludeElement(), false);
42522        composeBooleanExtras("exclude", element.getExcludeElement(), false);
42523      }
42524      if (element.hasPeriod()) {
42525        composePeriod("period", element.getPeriod());
42526      }
42527  }
42528
42529  protected void composeGroupGroupMemberComponent(String name, Group.GroupMemberComponent element) throws IOException {
42530    if (element != null) {
42531      open(name);
42532      composeGroupGroupMemberComponentInner(element);
42533      close();
42534    }
42535  }
42536
42537  protected void composeGroupGroupMemberComponentInner(Group.GroupMemberComponent element) throws IOException {
42538      composeBackbone(element);
42539      if (element.hasEntity()) {
42540        composeReference("entity", element.getEntity());
42541      }
42542      if (element.hasPeriod()) {
42543        composePeriod("period", element.getPeriod());
42544      }
42545      if (element.hasInactiveElement()) {
42546        composeBooleanCore("inactive", element.getInactiveElement(), false);
42547        composeBooleanExtras("inactive", element.getInactiveElement(), false);
42548      }
42549  }
42550
42551  protected void composeGuidanceResponse(String name, GuidanceResponse element) throws IOException {
42552    if (element != null) {
42553      prop("resourceType", name);
42554      composeGuidanceResponseInner(element);
42555    }
42556  }
42557
42558  protected void composeGuidanceResponseInner(GuidanceResponse element) throws IOException {
42559      composeDomainResourceElements(element);
42560      if (element.hasRequestIdentifier()) {
42561        composeIdentifier("requestIdentifier", element.getRequestIdentifier());
42562      }
42563      if (element.hasIdentifier()) {
42564        openArray("identifier");
42565        for (Identifier e : element.getIdentifier()) 
42566          composeIdentifier(null, e);
42567        closeArray();
42568      };
42569      if (element.hasModule()) {
42570        composeType("module", element.getModule());
42571      }
42572      if (element.hasStatusElement()) {
42573        composeEnumerationCore("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
42574        composeEnumerationExtras("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
42575      }
42576      if (element.hasSubject()) {
42577        composeReference("subject", element.getSubject());
42578      }
42579      if (element.hasEncounter()) {
42580        composeReference("encounter", element.getEncounter());
42581      }
42582      if (element.hasOccurrenceDateTimeElement()) {
42583        composeDateTimeCore("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
42584        composeDateTimeExtras("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
42585      }
42586      if (element.hasPerformer()) {
42587        composeReference("performer", element.getPerformer());
42588      }
42589      if (element.hasReasonCode()) {
42590        openArray("reasonCode");
42591        for (CodeableConcept e : element.getReasonCode()) 
42592          composeCodeableConcept(null, e);
42593        closeArray();
42594      };
42595      if (element.hasReasonReference()) {
42596        openArray("reasonReference");
42597        for (Reference e : element.getReasonReference()) 
42598          composeReference(null, e);
42599        closeArray();
42600      };
42601      if (element.hasNote()) {
42602        openArray("note");
42603        for (Annotation e : element.getNote()) 
42604          composeAnnotation(null, e);
42605        closeArray();
42606      };
42607      if (element.hasEvaluationMessage()) {
42608        openArray("evaluationMessage");
42609        for (Reference e : element.getEvaluationMessage()) 
42610          composeReference(null, e);
42611        closeArray();
42612      };
42613      if (element.hasOutputParameters()) {
42614        composeReference("outputParameters", element.getOutputParameters());
42615      }
42616      if (element.hasResult()) {
42617        composeReference("result", element.getResult());
42618      }
42619      if (element.hasDataRequirement()) {
42620        openArray("dataRequirement");
42621        for (DataRequirement e : element.getDataRequirement()) 
42622          composeDataRequirement(null, e);
42623        closeArray();
42624      };
42625  }
42626
42627  protected void composeHealthcareService(String name, HealthcareService element) throws IOException {
42628    if (element != null) {
42629      prop("resourceType", name);
42630      composeHealthcareServiceInner(element);
42631    }
42632  }
42633
42634  protected void composeHealthcareServiceInner(HealthcareService element) throws IOException {
42635      composeDomainResourceElements(element);
42636      if (element.hasIdentifier()) {
42637        openArray("identifier");
42638        for (Identifier e : element.getIdentifier()) 
42639          composeIdentifier(null, e);
42640        closeArray();
42641      };
42642      if (element.hasActiveElement()) {
42643        composeBooleanCore("active", element.getActiveElement(), false);
42644        composeBooleanExtras("active", element.getActiveElement(), false);
42645      }
42646      if (element.hasProvidedBy()) {
42647        composeReference("providedBy", element.getProvidedBy());
42648      }
42649      if (element.hasCategory()) {
42650        openArray("category");
42651        for (CodeableConcept e : element.getCategory()) 
42652          composeCodeableConcept(null, e);
42653        closeArray();
42654      };
42655      if (element.hasType()) {
42656        openArray("type");
42657        for (CodeableConcept e : element.getType()) 
42658          composeCodeableConcept(null, e);
42659        closeArray();
42660      };
42661      if (element.hasSpecialty()) {
42662        openArray("specialty");
42663        for (CodeableConcept e : element.getSpecialty()) 
42664          composeCodeableConcept(null, e);
42665        closeArray();
42666      };
42667      if (element.hasLocation()) {
42668        openArray("location");
42669        for (Reference e : element.getLocation()) 
42670          composeReference(null, e);
42671        closeArray();
42672      };
42673      if (element.hasNameElement()) {
42674        composeStringCore("name", element.getNameElement(), false);
42675        composeStringExtras("name", element.getNameElement(), false);
42676      }
42677      if (element.hasCommentElement()) {
42678        composeStringCore("comment", element.getCommentElement(), false);
42679        composeStringExtras("comment", element.getCommentElement(), false);
42680      }
42681      if (element.hasExtraDetailsElement()) {
42682        composeMarkdownCore("extraDetails", element.getExtraDetailsElement(), false);
42683        composeMarkdownExtras("extraDetails", element.getExtraDetailsElement(), false);
42684      }
42685      if (element.hasPhoto()) {
42686        composeAttachment("photo", element.getPhoto());
42687      }
42688      if (element.hasTelecom()) {
42689        openArray("telecom");
42690        for (ContactPoint e : element.getTelecom()) 
42691          composeContactPoint(null, e);
42692        closeArray();
42693      };
42694      if (element.hasCoverageArea()) {
42695        openArray("coverageArea");
42696        for (Reference e : element.getCoverageArea()) 
42697          composeReference(null, e);
42698        closeArray();
42699      };
42700      if (element.hasServiceProvisionCode()) {
42701        openArray("serviceProvisionCode");
42702        for (CodeableConcept e : element.getServiceProvisionCode()) 
42703          composeCodeableConcept(null, e);
42704        closeArray();
42705      };
42706      if (element.hasEligibility()) {
42707        openArray("eligibility");
42708        for (HealthcareService.HealthcareServiceEligibilityComponent e : element.getEligibility()) 
42709          composeHealthcareServiceHealthcareServiceEligibilityComponent(null, e);
42710        closeArray();
42711      };
42712      if (element.hasProgram()) {
42713        openArray("program");
42714        for (CodeableConcept e : element.getProgram()) 
42715          composeCodeableConcept(null, e);
42716        closeArray();
42717      };
42718      if (element.hasCharacteristic()) {
42719        openArray("characteristic");
42720        for (CodeableConcept e : element.getCharacteristic()) 
42721          composeCodeableConcept(null, e);
42722        closeArray();
42723      };
42724      if (element.hasCommunication()) {
42725        openArray("communication");
42726        for (CodeableConcept e : element.getCommunication()) 
42727          composeCodeableConcept(null, e);
42728        closeArray();
42729      };
42730      if (element.hasReferralMethod()) {
42731        openArray("referralMethod");
42732        for (CodeableConcept e : element.getReferralMethod()) 
42733          composeCodeableConcept(null, e);
42734        closeArray();
42735      };
42736      if (element.hasAppointmentRequiredElement()) {
42737        composeBooleanCore("appointmentRequired", element.getAppointmentRequiredElement(), false);
42738        composeBooleanExtras("appointmentRequired", element.getAppointmentRequiredElement(), false);
42739      }
42740      if (element.hasAvailableTime()) {
42741        openArray("availableTime");
42742        for (HealthcareService.HealthcareServiceAvailableTimeComponent e : element.getAvailableTime()) 
42743          composeHealthcareServiceHealthcareServiceAvailableTimeComponent(null, e);
42744        closeArray();
42745      };
42746      if (element.hasNotAvailable()) {
42747        openArray("notAvailable");
42748        for (HealthcareService.HealthcareServiceNotAvailableComponent e : element.getNotAvailable()) 
42749          composeHealthcareServiceHealthcareServiceNotAvailableComponent(null, e);
42750        closeArray();
42751      };
42752      if (element.hasAvailabilityExceptionsElement()) {
42753        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
42754        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
42755      }
42756      if (element.hasEndpoint()) {
42757        openArray("endpoint");
42758        for (Reference e : element.getEndpoint()) 
42759          composeReference(null, e);
42760        closeArray();
42761      };
42762  }
42763
42764  protected void composeHealthcareServiceHealthcareServiceEligibilityComponent(String name, HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
42765    if (element != null) {
42766      open(name);
42767      composeHealthcareServiceHealthcareServiceEligibilityComponentInner(element);
42768      close();
42769    }
42770  }
42771
42772  protected void composeHealthcareServiceHealthcareServiceEligibilityComponentInner(HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
42773      composeBackbone(element);
42774      if (element.hasCode()) {
42775        composeCodeableConcept("code", element.getCode());
42776      }
42777      if (element.hasCommentElement()) {
42778        composeMarkdownCore("comment", element.getCommentElement(), false);
42779        composeMarkdownExtras("comment", element.getCommentElement(), false);
42780      }
42781  }
42782
42783  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponent(String name, HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
42784    if (element != null) {
42785      open(name);
42786      composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(element);
42787      close();
42788    }
42789  }
42790
42791  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
42792      composeBackbone(element);
42793      if (element.hasDaysOfWeek()) {
42794        openArray("daysOfWeek");
42795        for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
42796          composeEnumerationCore(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
42797        closeArray();
42798        if (anyHasExtras(element.getDaysOfWeek())) {
42799          openArray("_daysOfWeek");
42800          for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
42801            composeEnumerationExtras(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
42802          closeArray();
42803        }
42804      };
42805      if (element.hasAllDayElement()) {
42806        composeBooleanCore("allDay", element.getAllDayElement(), false);
42807        composeBooleanExtras("allDay", element.getAllDayElement(), false);
42808      }
42809      if (element.hasAvailableStartTimeElement()) {
42810        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
42811        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
42812      }
42813      if (element.hasAvailableEndTimeElement()) {
42814        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
42815        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
42816      }
42817  }
42818
42819  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponent(String name, HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
42820    if (element != null) {
42821      open(name);
42822      composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(element);
42823      close();
42824    }
42825  }
42826
42827  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
42828      composeBackbone(element);
42829      if (element.hasDescriptionElement()) {
42830        composeStringCore("description", element.getDescriptionElement(), false);
42831        composeStringExtras("description", element.getDescriptionElement(), false);
42832      }
42833      if (element.hasDuring()) {
42834        composePeriod("during", element.getDuring());
42835      }
42836  }
42837
42838  protected void composeImagingStudy(String name, ImagingStudy element) throws IOException {
42839    if (element != null) {
42840      prop("resourceType", name);
42841      composeImagingStudyInner(element);
42842    }
42843  }
42844
42845  protected void composeImagingStudyInner(ImagingStudy element) throws IOException {
42846      composeDomainResourceElements(element);
42847      if (element.hasIdentifier()) {
42848        openArray("identifier");
42849        for (Identifier e : element.getIdentifier()) 
42850          composeIdentifier(null, e);
42851        closeArray();
42852      };
42853      if (element.hasStatusElement()) {
42854        composeEnumerationCore("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
42855        composeEnumerationExtras("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
42856      }
42857      if (element.hasModality()) {
42858        openArray("modality");
42859        for (Coding e : element.getModality()) 
42860          composeCoding(null, e);
42861        closeArray();
42862      };
42863      if (element.hasSubject()) {
42864        composeReference("subject", element.getSubject());
42865      }
42866      if (element.hasEncounter()) {
42867        composeReference("encounter", element.getEncounter());
42868      }
42869      if (element.hasStartedElement()) {
42870        composeDateTimeCore("started", element.getStartedElement(), false);
42871        composeDateTimeExtras("started", element.getStartedElement(), false);
42872      }
42873      if (element.hasBasedOn()) {
42874        openArray("basedOn");
42875        for (Reference e : element.getBasedOn()) 
42876          composeReference(null, e);
42877        closeArray();
42878      };
42879      if (element.hasReferrer()) {
42880        composeReference("referrer", element.getReferrer());
42881      }
42882      if (element.hasInterpreter()) {
42883        openArray("interpreter");
42884        for (Reference e : element.getInterpreter()) 
42885          composeReference(null, e);
42886        closeArray();
42887      };
42888      if (element.hasEndpoint()) {
42889        openArray("endpoint");
42890        for (Reference e : element.getEndpoint()) 
42891          composeReference(null, e);
42892        closeArray();
42893      };
42894      if (element.hasNumberOfSeriesElement()) {
42895        composeUnsignedIntCore("numberOfSeries", element.getNumberOfSeriesElement(), false);
42896        composeUnsignedIntExtras("numberOfSeries", element.getNumberOfSeriesElement(), false);
42897      }
42898      if (element.hasNumberOfInstancesElement()) {
42899        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
42900        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
42901      }
42902      if (element.hasProcedureReference()) {
42903        composeReference("procedureReference", element.getProcedureReference());
42904      }
42905      if (element.hasProcedureCode()) {
42906        openArray("procedureCode");
42907        for (CodeableConcept e : element.getProcedureCode()) 
42908          composeCodeableConcept(null, e);
42909        closeArray();
42910      };
42911      if (element.hasLocation()) {
42912        composeReference("location", element.getLocation());
42913      }
42914      if (element.hasReasonCode()) {
42915        openArray("reasonCode");
42916        for (CodeableConcept e : element.getReasonCode()) 
42917          composeCodeableConcept(null, e);
42918        closeArray();
42919      };
42920      if (element.hasReasonReference()) {
42921        openArray("reasonReference");
42922        for (Reference e : element.getReasonReference()) 
42923          composeReference(null, e);
42924        closeArray();
42925      };
42926      if (element.hasNote()) {
42927        openArray("note");
42928        for (Annotation e : element.getNote()) 
42929          composeAnnotation(null, e);
42930        closeArray();
42931      };
42932      if (element.hasDescriptionElement()) {
42933        composeStringCore("description", element.getDescriptionElement(), false);
42934        composeStringExtras("description", element.getDescriptionElement(), false);
42935      }
42936      if (element.hasSeries()) {
42937        openArray("series");
42938        for (ImagingStudy.ImagingStudySeriesComponent e : element.getSeries()) 
42939          composeImagingStudyImagingStudySeriesComponent(null, e);
42940        closeArray();
42941      };
42942  }
42943
42944  protected void composeImagingStudyImagingStudySeriesComponent(String name, ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
42945    if (element != null) {
42946      open(name);
42947      composeImagingStudyImagingStudySeriesComponentInner(element);
42948      close();
42949    }
42950  }
42951
42952  protected void composeImagingStudyImagingStudySeriesComponentInner(ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
42953      composeBackbone(element);
42954      if (element.hasUidElement()) {
42955        composeIdCore("uid", element.getUidElement(), false);
42956        composeIdExtras("uid", element.getUidElement(), false);
42957      }
42958      if (element.hasNumberElement()) {
42959        composeUnsignedIntCore("number", element.getNumberElement(), false);
42960        composeUnsignedIntExtras("number", element.getNumberElement(), false);
42961      }
42962      if (element.hasModality()) {
42963        composeCoding("modality", element.getModality());
42964      }
42965      if (element.hasDescriptionElement()) {
42966        composeStringCore("description", element.getDescriptionElement(), false);
42967        composeStringExtras("description", element.getDescriptionElement(), false);
42968      }
42969      if (element.hasNumberOfInstancesElement()) {
42970        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
42971        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
42972      }
42973      if (element.hasEndpoint()) {
42974        openArray("endpoint");
42975        for (Reference e : element.getEndpoint()) 
42976          composeReference(null, e);
42977        closeArray();
42978      };
42979      if (element.hasBodySite()) {
42980        composeCoding("bodySite", element.getBodySite());
42981      }
42982      if (element.hasLaterality()) {
42983        composeCoding("laterality", element.getLaterality());
42984      }
42985      if (element.hasSpecimen()) {
42986        openArray("specimen");
42987        for (Reference e : element.getSpecimen()) 
42988          composeReference(null, e);
42989        closeArray();
42990      };
42991      if (element.hasStartedElement()) {
42992        composeDateTimeCore("started", element.getStartedElement(), false);
42993        composeDateTimeExtras("started", element.getStartedElement(), false);
42994      }
42995      if (element.hasPerformer()) {
42996        openArray("performer");
42997        for (ImagingStudy.ImagingStudySeriesPerformerComponent e : element.getPerformer()) 
42998          composeImagingStudyImagingStudySeriesPerformerComponent(null, e);
42999        closeArray();
43000      };
43001      if (element.hasInstance()) {
43002        openArray("instance");
43003        for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance()) 
43004          composeImagingStudyImagingStudySeriesInstanceComponent(null, e);
43005        closeArray();
43006      };
43007  }
43008
43009  protected void composeImagingStudyImagingStudySeriesPerformerComponent(String name, ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
43010    if (element != null) {
43011      open(name);
43012      composeImagingStudyImagingStudySeriesPerformerComponentInner(element);
43013      close();
43014    }
43015  }
43016
43017  protected void composeImagingStudyImagingStudySeriesPerformerComponentInner(ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
43018      composeBackbone(element);
43019      if (element.hasFunction()) {
43020        composeCodeableConcept("function", element.getFunction());
43021      }
43022      if (element.hasActor()) {
43023        composeReference("actor", element.getActor());
43024      }
43025  }
43026
43027  protected void composeImagingStudyImagingStudySeriesInstanceComponent(String name, ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
43028    if (element != null) {
43029      open(name);
43030      composeImagingStudyImagingStudySeriesInstanceComponentInner(element);
43031      close();
43032    }
43033  }
43034
43035  protected void composeImagingStudyImagingStudySeriesInstanceComponentInner(ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
43036      composeBackbone(element);
43037      if (element.hasUidElement()) {
43038        composeIdCore("uid", element.getUidElement(), false);
43039        composeIdExtras("uid", element.getUidElement(), false);
43040      }
43041      if (element.hasSopClass()) {
43042        composeCoding("sopClass", element.getSopClass());
43043      }
43044      if (element.hasNumberElement()) {
43045        composeUnsignedIntCore("number", element.getNumberElement(), false);
43046        composeUnsignedIntExtras("number", element.getNumberElement(), false);
43047      }
43048      if (element.hasTitleElement()) {
43049        composeStringCore("title", element.getTitleElement(), false);
43050        composeStringExtras("title", element.getTitleElement(), false);
43051      }
43052  }
43053
43054  protected void composeImmunization(String name, Immunization element) throws IOException {
43055    if (element != null) {
43056      prop("resourceType", name);
43057      composeImmunizationInner(element);
43058    }
43059  }
43060
43061  protected void composeImmunizationInner(Immunization element) throws IOException {
43062      composeDomainResourceElements(element);
43063      if (element.hasIdentifier()) {
43064        openArray("identifier");
43065        for (Identifier e : element.getIdentifier()) 
43066          composeIdentifier(null, e);
43067        closeArray();
43068      };
43069      if (element.hasStatusElement()) {
43070        composeEnumerationCore("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(), false);
43071        composeEnumerationExtras("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(), false);
43072      }
43073      if (element.hasStatusReason()) {
43074        composeCodeableConcept("statusReason", element.getStatusReason());
43075      }
43076      if (element.hasVaccineCode()) {
43077        composeCodeableConcept("vaccineCode", element.getVaccineCode());
43078      }
43079      if (element.hasPatient()) {
43080        composeReference("patient", element.getPatient());
43081      }
43082      if (element.hasEncounter()) {
43083        composeReference("encounter", element.getEncounter());
43084      }
43085      if (element.hasOccurrence()) {
43086        composeType("occurrence", element.getOccurrence());
43087      }
43088      if (element.hasRecordedElement()) {
43089        composeDateTimeCore("recorded", element.getRecordedElement(), false);
43090        composeDateTimeExtras("recorded", element.getRecordedElement(), false);
43091      }
43092      if (element.hasPrimarySourceElement()) {
43093        composeBooleanCore("primarySource", element.getPrimarySourceElement(), false);
43094        composeBooleanExtras("primarySource", element.getPrimarySourceElement(), false);
43095      }
43096      if (element.hasReportOrigin()) {
43097        composeCodeableConcept("reportOrigin", element.getReportOrigin());
43098      }
43099      if (element.hasLocation()) {
43100        composeReference("location", element.getLocation());
43101      }
43102      if (element.hasManufacturer()) {
43103        composeReference("manufacturer", element.getManufacturer());
43104      }
43105      if (element.hasLotNumberElement()) {
43106        composeStringCore("lotNumber", element.getLotNumberElement(), false);
43107        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
43108      }
43109      if (element.hasExpirationDateElement()) {
43110        composeDateCore("expirationDate", element.getExpirationDateElement(), false);
43111        composeDateExtras("expirationDate", element.getExpirationDateElement(), false);
43112      }
43113      if (element.hasSite()) {
43114        composeCodeableConcept("site", element.getSite());
43115      }
43116      if (element.hasRoute()) {
43117        composeCodeableConcept("route", element.getRoute());
43118      }
43119      if (element.hasDoseQuantity()) {
43120        composeQuantity("doseQuantity", element.getDoseQuantity());
43121      }
43122      if (element.hasPerformer()) {
43123        openArray("performer");
43124        for (Immunization.ImmunizationPerformerComponent e : element.getPerformer()) 
43125          composeImmunizationImmunizationPerformerComponent(null, e);
43126        closeArray();
43127      };
43128      if (element.hasNote()) {
43129        openArray("note");
43130        for (Annotation e : element.getNote()) 
43131          composeAnnotation(null, e);
43132        closeArray();
43133      };
43134      if (element.hasReasonCode()) {
43135        openArray("reasonCode");
43136        for (CodeableConcept e : element.getReasonCode()) 
43137          composeCodeableConcept(null, e);
43138        closeArray();
43139      };
43140      if (element.hasReasonReference()) {
43141        openArray("reasonReference");
43142        for (Reference e : element.getReasonReference()) 
43143          composeReference(null, e);
43144        closeArray();
43145      };
43146      if (element.hasIsSubpotentElement()) {
43147        composeBooleanCore("isSubpotent", element.getIsSubpotentElement(), false);
43148        composeBooleanExtras("isSubpotent", element.getIsSubpotentElement(), false);
43149      }
43150      if (element.hasSubpotentReason()) {
43151        openArray("subpotentReason");
43152        for (CodeableConcept e : element.getSubpotentReason()) 
43153          composeCodeableConcept(null, e);
43154        closeArray();
43155      };
43156      if (element.hasEducation()) {
43157        openArray("education");
43158        for (Immunization.ImmunizationEducationComponent e : element.getEducation()) 
43159          composeImmunizationImmunizationEducationComponent(null, e);
43160        closeArray();
43161      };
43162      if (element.hasProgramEligibility()) {
43163        openArray("programEligibility");
43164        for (CodeableConcept e : element.getProgramEligibility()) 
43165          composeCodeableConcept(null, e);
43166        closeArray();
43167      };
43168      if (element.hasFundingSource()) {
43169        composeCodeableConcept("fundingSource", element.getFundingSource());
43170      }
43171      if (element.hasReaction()) {
43172        openArray("reaction");
43173        for (Immunization.ImmunizationReactionComponent e : element.getReaction()) 
43174          composeImmunizationImmunizationReactionComponent(null, e);
43175        closeArray();
43176      };
43177      if (element.hasProtocolApplied()) {
43178        openArray("protocolApplied");
43179        for (Immunization.ImmunizationProtocolAppliedComponent e : element.getProtocolApplied()) 
43180          composeImmunizationImmunizationProtocolAppliedComponent(null, e);
43181        closeArray();
43182      };
43183  }
43184
43185  protected void composeImmunizationImmunizationPerformerComponent(String name, Immunization.ImmunizationPerformerComponent element) throws IOException {
43186    if (element != null) {
43187      open(name);
43188      composeImmunizationImmunizationPerformerComponentInner(element);
43189      close();
43190    }
43191  }
43192
43193  protected void composeImmunizationImmunizationPerformerComponentInner(Immunization.ImmunizationPerformerComponent element) throws IOException {
43194      composeBackbone(element);
43195      if (element.hasFunction()) {
43196        composeCodeableConcept("function", element.getFunction());
43197      }
43198      if (element.hasActor()) {
43199        composeReference("actor", element.getActor());
43200      }
43201  }
43202
43203  protected void composeImmunizationImmunizationEducationComponent(String name, Immunization.ImmunizationEducationComponent element) throws IOException {
43204    if (element != null) {
43205      open(name);
43206      composeImmunizationImmunizationEducationComponentInner(element);
43207      close();
43208    }
43209  }
43210
43211  protected void composeImmunizationImmunizationEducationComponentInner(Immunization.ImmunizationEducationComponent element) throws IOException {
43212      composeBackbone(element);
43213      if (element.hasDocumentTypeElement()) {
43214        composeStringCore("documentType", element.getDocumentTypeElement(), false);
43215        composeStringExtras("documentType", element.getDocumentTypeElement(), false);
43216      }
43217      if (element.hasReferenceElement()) {
43218        composeUriCore("reference", element.getReferenceElement(), false);
43219        composeUriExtras("reference", element.getReferenceElement(), false);
43220      }
43221      if (element.hasPublicationDateElement()) {
43222        composeDateTimeCore("publicationDate", element.getPublicationDateElement(), false);
43223        composeDateTimeExtras("publicationDate", element.getPublicationDateElement(), false);
43224      }
43225      if (element.hasPresentationDateElement()) {
43226        composeDateTimeCore("presentationDate", element.getPresentationDateElement(), false);
43227        composeDateTimeExtras("presentationDate", element.getPresentationDateElement(), false);
43228      }
43229  }
43230
43231  protected void composeImmunizationImmunizationReactionComponent(String name, Immunization.ImmunizationReactionComponent element) throws IOException {
43232    if (element != null) {
43233      open(name);
43234      composeImmunizationImmunizationReactionComponentInner(element);
43235      close();
43236    }
43237  }
43238
43239  protected void composeImmunizationImmunizationReactionComponentInner(Immunization.ImmunizationReactionComponent element) throws IOException {
43240      composeBackbone(element);
43241      if (element.hasDateElement()) {
43242        composeDateTimeCore("date", element.getDateElement(), false);
43243        composeDateTimeExtras("date", element.getDateElement(), false);
43244      }
43245      if (element.hasDetail()) {
43246        composeReference("detail", element.getDetail());
43247      }
43248      if (element.hasReportedElement()) {
43249        composeBooleanCore("reported", element.getReportedElement(), false);
43250        composeBooleanExtras("reported", element.getReportedElement(), false);
43251      }
43252  }
43253
43254  protected void composeImmunizationImmunizationProtocolAppliedComponent(String name, Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
43255    if (element != null) {
43256      open(name);
43257      composeImmunizationImmunizationProtocolAppliedComponentInner(element);
43258      close();
43259    }
43260  }
43261
43262  protected void composeImmunizationImmunizationProtocolAppliedComponentInner(Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
43263      composeBackbone(element);
43264      if (element.hasSeriesElement()) {
43265        composeStringCore("series", element.getSeriesElement(), false);
43266        composeStringExtras("series", element.getSeriesElement(), false);
43267      }
43268      if (element.hasAuthority()) {
43269        composeReference("authority", element.getAuthority());
43270      }
43271      if (element.hasTargetDisease()) {
43272        openArray("targetDisease");
43273        for (CodeableConcept e : element.getTargetDisease()) 
43274          composeCodeableConcept(null, e);
43275        closeArray();
43276      };
43277      if (element.hasDoseNumber()) {
43278        composeType("doseNumber", element.getDoseNumber());
43279      }
43280      if (element.hasSeriesDoses()) {
43281        composeType("seriesDoses", element.getSeriesDoses());
43282      }
43283  }
43284
43285  protected void composeImmunizationEvaluation(String name, ImmunizationEvaluation element) throws IOException {
43286    if (element != null) {
43287      prop("resourceType", name);
43288      composeImmunizationEvaluationInner(element);
43289    }
43290  }
43291
43292  protected void composeImmunizationEvaluationInner(ImmunizationEvaluation element) throws IOException {
43293      composeDomainResourceElements(element);
43294      if (element.hasIdentifier()) {
43295        openArray("identifier");
43296        for (Identifier e : element.getIdentifier()) 
43297          composeIdentifier(null, e);
43298        closeArray();
43299      };
43300      if (element.hasStatusElement()) {
43301        composeEnumerationCore("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory(), false);
43302        composeEnumerationExtras("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory(), false);
43303      }
43304      if (element.hasPatient()) {
43305        composeReference("patient", element.getPatient());
43306      }
43307      if (element.hasDateElement()) {
43308        composeDateTimeCore("date", element.getDateElement(), false);
43309        composeDateTimeExtras("date", element.getDateElement(), false);
43310      }
43311      if (element.hasAuthority()) {
43312        composeReference("authority", element.getAuthority());
43313      }
43314      if (element.hasTargetDisease()) {
43315        composeCodeableConcept("targetDisease", element.getTargetDisease());
43316      }
43317      if (element.hasImmunizationEvent()) {
43318        composeReference("immunizationEvent", element.getImmunizationEvent());
43319      }
43320      if (element.hasDoseStatus()) {
43321        composeCodeableConcept("doseStatus", element.getDoseStatus());
43322      }
43323      if (element.hasDoseStatusReason()) {
43324        openArray("doseStatusReason");
43325        for (CodeableConcept e : element.getDoseStatusReason()) 
43326          composeCodeableConcept(null, e);
43327        closeArray();
43328      };
43329      if (element.hasDescriptionElement()) {
43330        composeStringCore("description", element.getDescriptionElement(), false);
43331        composeStringExtras("description", element.getDescriptionElement(), false);
43332      }
43333      if (element.hasSeriesElement()) {
43334        composeStringCore("series", element.getSeriesElement(), false);
43335        composeStringExtras("series", element.getSeriesElement(), false);
43336      }
43337      if (element.hasDoseNumber()) {
43338        composeType("doseNumber", element.getDoseNumber());
43339      }
43340      if (element.hasSeriesDoses()) {
43341        composeType("seriesDoses", element.getSeriesDoses());
43342      }
43343  }
43344
43345  protected void composeImmunizationRecommendation(String name, ImmunizationRecommendation element) throws IOException {
43346    if (element != null) {
43347      prop("resourceType", name);
43348      composeImmunizationRecommendationInner(element);
43349    }
43350  }
43351
43352  protected void composeImmunizationRecommendationInner(ImmunizationRecommendation element) throws IOException {
43353      composeDomainResourceElements(element);
43354      if (element.hasIdentifier()) {
43355        openArray("identifier");
43356        for (Identifier e : element.getIdentifier()) 
43357          composeIdentifier(null, e);
43358        closeArray();
43359      };
43360      if (element.hasPatient()) {
43361        composeReference("patient", element.getPatient());
43362      }
43363      if (element.hasDateElement()) {
43364        composeDateTimeCore("date", element.getDateElement(), false);
43365        composeDateTimeExtras("date", element.getDateElement(), false);
43366      }
43367      if (element.hasAuthority()) {
43368        composeReference("authority", element.getAuthority());
43369      }
43370      if (element.hasRecommendation()) {
43371        openArray("recommendation");
43372        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent e : element.getRecommendation()) 
43373          composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(null, e);
43374        closeArray();
43375      };
43376  }
43377
43378  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
43379    if (element != null) {
43380      open(name);
43381      composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(element);
43382      close();
43383    }
43384  }
43385
43386  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
43387      composeBackbone(element);
43388      if (element.hasVaccineCode()) {
43389        openArray("vaccineCode");
43390        for (CodeableConcept e : element.getVaccineCode()) 
43391          composeCodeableConcept(null, e);
43392        closeArray();
43393      };
43394      if (element.hasTargetDisease()) {
43395        composeCodeableConcept("targetDisease", element.getTargetDisease());
43396      }
43397      if (element.hasContraindicatedVaccineCode()) {
43398        openArray("contraindicatedVaccineCode");
43399        for (CodeableConcept e : element.getContraindicatedVaccineCode()) 
43400          composeCodeableConcept(null, e);
43401        closeArray();
43402      };
43403      if (element.hasForecastStatus()) {
43404        composeCodeableConcept("forecastStatus", element.getForecastStatus());
43405      }
43406      if (element.hasForecastReason()) {
43407        openArray("forecastReason");
43408        for (CodeableConcept e : element.getForecastReason()) 
43409          composeCodeableConcept(null, e);
43410        closeArray();
43411      };
43412      if (element.hasDateCriterion()) {
43413        openArray("dateCriterion");
43414        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent e : element.getDateCriterion()) 
43415          composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(null, e);
43416        closeArray();
43417      };
43418      if (element.hasDescriptionElement()) {
43419        composeStringCore("description", element.getDescriptionElement(), false);
43420        composeStringExtras("description", element.getDescriptionElement(), false);
43421      }
43422      if (element.hasSeriesElement()) {
43423        composeStringCore("series", element.getSeriesElement(), false);
43424        composeStringExtras("series", element.getSeriesElement(), false);
43425      }
43426      if (element.hasDoseNumber()) {
43427        composeType("doseNumber", element.getDoseNumber());
43428      }
43429      if (element.hasSeriesDoses()) {
43430        composeType("seriesDoses", element.getSeriesDoses());
43431      }
43432      if (element.hasSupportingImmunization()) {
43433        openArray("supportingImmunization");
43434        for (Reference e : element.getSupportingImmunization()) 
43435          composeReference(null, e);
43436        closeArray();
43437      };
43438      if (element.hasSupportingPatientInformation()) {
43439        openArray("supportingPatientInformation");
43440        for (Reference e : element.getSupportingPatientInformation()) 
43441          composeReference(null, e);
43442        closeArray();
43443      };
43444  }
43445
43446  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
43447    if (element != null) {
43448      open(name);
43449      composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(element);
43450      close();
43451    }
43452  }
43453
43454  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
43455      composeBackbone(element);
43456      if (element.hasCode()) {
43457        composeCodeableConcept("code", element.getCode());
43458      }
43459      if (element.hasValueElement()) {
43460        composeDateTimeCore("value", element.getValueElement(), false);
43461        composeDateTimeExtras("value", element.getValueElement(), false);
43462      }
43463  }
43464
43465  protected void composeImplementationGuide(String name, ImplementationGuide element) throws IOException {
43466    if (element != null) {
43467      prop("resourceType", name);
43468      composeImplementationGuideInner(element);
43469    }
43470  }
43471
43472  protected void composeImplementationGuideInner(ImplementationGuide element) throws IOException {
43473      composeDomainResourceElements(element);
43474      if (element.hasUrlElement()) {
43475        composeUriCore("url", element.getUrlElement(), false);
43476        composeUriExtras("url", element.getUrlElement(), false);
43477      }
43478      if (element.hasVersionElement()) {
43479        composeStringCore("version", element.getVersionElement(), false);
43480        composeStringExtras("version", element.getVersionElement(), false);
43481      }
43482      if (element.hasNameElement()) {
43483        composeStringCore("name", element.getNameElement(), false);
43484        composeStringExtras("name", element.getNameElement(), false);
43485      }
43486      if (element.hasTitleElement()) {
43487        composeStringCore("title", element.getTitleElement(), false);
43488        composeStringExtras("title", element.getTitleElement(), false);
43489      }
43490      if (element.hasStatusElement()) {
43491        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43492        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43493      }
43494      if (element.hasExperimentalElement()) {
43495        composeBooleanCore("experimental", element.getExperimentalElement(), false);
43496        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
43497      }
43498      if (element.hasDateElement()) {
43499        composeDateTimeCore("date", element.getDateElement(), false);
43500        composeDateTimeExtras("date", element.getDateElement(), false);
43501      }
43502      if (element.hasPublisherElement()) {
43503        composeStringCore("publisher", element.getPublisherElement(), false);
43504        composeStringExtras("publisher", element.getPublisherElement(), false);
43505      }
43506      if (element.hasContact()) {
43507        openArray("contact");
43508        for (ContactDetail e : element.getContact()) 
43509          composeContactDetail(null, e);
43510        closeArray();
43511      };
43512      if (element.hasDescriptionElement()) {
43513        composeMarkdownCore("description", element.getDescriptionElement(), false);
43514        composeMarkdownExtras("description", element.getDescriptionElement(), false);
43515      }
43516      if (element.hasUseContext()) {
43517        openArray("useContext");
43518        for (UsageContext e : element.getUseContext()) 
43519          composeUsageContext(null, e);
43520        closeArray();
43521      };
43522      if (element.hasJurisdiction()) {
43523        openArray("jurisdiction");
43524        for (CodeableConcept e : element.getJurisdiction()) 
43525          composeCodeableConcept(null, e);
43526        closeArray();
43527      };
43528      if (element.hasCopyrightElement()) {
43529        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
43530        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
43531      }
43532      if (element.hasPackageIdElement()) {
43533        composeIdCore("packageId", element.getPackageIdElement(), false);
43534        composeIdExtras("packageId", element.getPackageIdElement(), false);
43535      }
43536      if (element.hasLicenseElement()) {
43537        composeEnumerationCore("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(), false);
43538        composeEnumerationExtras("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(), false);
43539      }
43540      if (element.hasFhirVersion()) {
43541        openArray("fhirVersion");
43542        for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
43543          composeEnumerationCore(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
43544        closeArray();
43545        if (anyHasExtras(element.getFhirVersion())) {
43546          openArray("_fhirVersion");
43547          for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
43548            composeEnumerationExtras(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
43549          closeArray();
43550        }
43551      };
43552      if (element.hasDependsOn()) {
43553        openArray("dependsOn");
43554        for (ImplementationGuide.ImplementationGuideDependsOnComponent e : element.getDependsOn()) 
43555          composeImplementationGuideImplementationGuideDependsOnComponent(null, e);
43556        closeArray();
43557      };
43558      if (element.hasGlobal()) {
43559        openArray("global");
43560        for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal()) 
43561          composeImplementationGuideImplementationGuideGlobalComponent(null, e);
43562        closeArray();
43563      };
43564      if (element.hasDefinition()) {
43565        composeImplementationGuideImplementationGuideDefinitionComponent("definition", element.getDefinition());
43566      }
43567      if (element.hasManifest()) {
43568        composeImplementationGuideImplementationGuideManifestComponent("manifest", element.getManifest());
43569      }
43570  }
43571
43572  protected void composeImplementationGuideImplementationGuideDependsOnComponent(String name, ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
43573    if (element != null) {
43574      open(name);
43575      composeImplementationGuideImplementationGuideDependsOnComponentInner(element);
43576      close();
43577    }
43578  }
43579
43580  protected void composeImplementationGuideImplementationGuideDependsOnComponentInner(ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
43581      composeBackbone(element);
43582      if (element.hasUriElement()) {
43583        composeCanonicalCore("uri", element.getUriElement(), false);
43584        composeCanonicalExtras("uri", element.getUriElement(), false);
43585      }
43586      if (element.hasPackageIdElement()) {
43587        composeIdCore("packageId", element.getPackageIdElement(), false);
43588        composeIdExtras("packageId", element.getPackageIdElement(), false);
43589      }
43590      if (element.hasVersionElement()) {
43591        composeStringCore("version", element.getVersionElement(), false);
43592        composeStringExtras("version", element.getVersionElement(), false);
43593      }
43594  }
43595
43596  protected void composeImplementationGuideImplementationGuideGlobalComponent(String name, ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
43597    if (element != null) {
43598      open(name);
43599      composeImplementationGuideImplementationGuideGlobalComponentInner(element);
43600      close();
43601    }
43602  }
43603
43604  protected void composeImplementationGuideImplementationGuideGlobalComponentInner(ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
43605      composeBackbone(element);
43606      if (element.hasTypeElement()) {
43607        composeCodeCore("type", element.getTypeElement(), false);
43608        composeCodeExtras("type", element.getTypeElement(), false);
43609      }
43610      if (element.hasProfileElement()) {
43611        composeCanonicalCore("profile", element.getProfileElement(), false);
43612        composeCanonicalExtras("profile", element.getProfileElement(), false);
43613      }
43614  }
43615
43616  protected void composeImplementationGuideImplementationGuideDefinitionComponent(String name, ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
43617    if (element != null) {
43618      open(name);
43619      composeImplementationGuideImplementationGuideDefinitionComponentInner(element);
43620      close();
43621    }
43622  }
43623
43624  protected void composeImplementationGuideImplementationGuideDefinitionComponentInner(ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
43625      composeBackbone(element);
43626      if (element.hasGrouping()) {
43627        openArray("grouping");
43628        for (ImplementationGuide.ImplementationGuideDefinitionGroupingComponent e : element.getGrouping()) 
43629          composeImplementationGuideImplementationGuideDefinitionGroupingComponent(null, e);
43630        closeArray();
43631      };
43632      if (element.hasResource()) {
43633        openArray("resource");
43634        for (ImplementationGuide.ImplementationGuideDefinitionResourceComponent e : element.getResource()) 
43635          composeImplementationGuideImplementationGuideDefinitionResourceComponent(null, e);
43636        closeArray();
43637      };
43638      if (element.hasPage()) {
43639        composeImplementationGuideImplementationGuideDefinitionPageComponent("page", element.getPage());
43640      }
43641      if (element.hasParameter()) {
43642        openArray("parameter");
43643        for (ImplementationGuide.ImplementationGuideDefinitionParameterComponent e : element.getParameter()) 
43644          composeImplementationGuideImplementationGuideDefinitionParameterComponent(null, e);
43645        closeArray();
43646      };
43647      if (element.hasTemplate()) {
43648        openArray("template");
43649        for (ImplementationGuide.ImplementationGuideDefinitionTemplateComponent e : element.getTemplate()) 
43650          composeImplementationGuideImplementationGuideDefinitionTemplateComponent(null, e);
43651        closeArray();
43652      };
43653  }
43654
43655  protected void composeImplementationGuideImplementationGuideDefinitionGroupingComponent(String name, ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
43656    if (element != null) {
43657      open(name);
43658      composeImplementationGuideImplementationGuideDefinitionGroupingComponentInner(element);
43659      close();
43660    }
43661  }
43662
43663  protected void composeImplementationGuideImplementationGuideDefinitionGroupingComponentInner(ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
43664      composeBackbone(element);
43665      if (element.hasNameElement()) {
43666        composeStringCore("name", element.getNameElement(), false);
43667        composeStringExtras("name", element.getNameElement(), false);
43668      }
43669      if (element.hasDescriptionElement()) {
43670        composeStringCore("description", element.getDescriptionElement(), false);
43671        composeStringExtras("description", element.getDescriptionElement(), false);
43672      }
43673  }
43674
43675  protected void composeImplementationGuideImplementationGuideDefinitionResourceComponent(String name, ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
43676    if (element != null) {
43677      open(name);
43678      composeImplementationGuideImplementationGuideDefinitionResourceComponentInner(element);
43679      close();
43680    }
43681  }
43682
43683  protected void composeImplementationGuideImplementationGuideDefinitionResourceComponentInner(ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
43684      composeBackbone(element);
43685      if (element.hasReference()) {
43686        composeReference("reference", element.getReference());
43687      }
43688      if (element.hasFhirVersion()) {
43689        openArray("fhirVersion");
43690        for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
43691          composeEnumerationCore(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
43692        closeArray();
43693        if (anyHasExtras(element.getFhirVersion())) {
43694          openArray("_fhirVersion");
43695          for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
43696            composeEnumerationExtras(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
43697          closeArray();
43698        }
43699      };
43700      if (element.hasNameElement()) {
43701        composeStringCore("name", element.getNameElement(), false);
43702        composeStringExtras("name", element.getNameElement(), false);
43703      }
43704      if (element.hasDescriptionElement()) {
43705        composeStringCore("description", element.getDescriptionElement(), false);
43706        composeStringExtras("description", element.getDescriptionElement(), false);
43707      }
43708      if (element.hasExample()) {
43709        composeType("example", element.getExample());
43710      }
43711      if (element.hasGroupingIdElement()) {
43712        composeIdCore("groupingId", element.getGroupingIdElement(), false);
43713        composeIdExtras("groupingId", element.getGroupingIdElement(), false);
43714      }
43715  }
43716
43717  protected void composeImplementationGuideImplementationGuideDefinitionPageComponent(String name, ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
43718    if (element != null) {
43719      open(name);
43720      composeImplementationGuideImplementationGuideDefinitionPageComponentInner(element);
43721      close();
43722    }
43723  }
43724
43725  protected void composeImplementationGuideImplementationGuideDefinitionPageComponentInner(ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
43726      composeBackbone(element);
43727      if (element.hasName()) {
43728        composeType("name", element.getName());
43729      }
43730      if (element.hasTitleElement()) {
43731        composeStringCore("title", element.getTitleElement(), false);
43732        composeStringExtras("title", element.getTitleElement(), false);
43733      }
43734      if (element.hasGenerationElement()) {
43735        composeEnumerationCore("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
43736        composeEnumerationExtras("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
43737      }
43738      if (element.hasPage()) {
43739        openArray("page");
43740        for (ImplementationGuide.ImplementationGuideDefinitionPageComponent e : element.getPage()) 
43741          composeImplementationGuideImplementationGuideDefinitionPageComponent(null, e);
43742        closeArray();
43743      };
43744  }
43745
43746  protected void composeImplementationGuideImplementationGuideDefinitionParameterComponent(String name, ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
43747    if (element != null) {
43748      open(name);
43749      composeImplementationGuideImplementationGuideDefinitionParameterComponentInner(element);
43750      close();
43751    }
43752  }
43753
43754  protected void composeImplementationGuideImplementationGuideDefinitionParameterComponentInner(ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
43755      composeBackbone(element);
43756      if (element.hasCodeElement()) {
43757        composeStringCore("code", element.getCodeElement(), false);
43758        composeStringExtras("code", element.getCodeElement(), false);
43759      }
43760      if (element.hasValueElement()) {
43761        composeStringCore("value", element.getValueElement(), false);
43762        composeStringExtras("value", element.getValueElement(), false);
43763      }
43764  }
43765
43766  protected void composeImplementationGuideImplementationGuideDefinitionTemplateComponent(String name, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
43767    if (element != null) {
43768      open(name);
43769      composeImplementationGuideImplementationGuideDefinitionTemplateComponentInner(element);
43770      close();
43771    }
43772  }
43773
43774  protected void composeImplementationGuideImplementationGuideDefinitionTemplateComponentInner(ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
43775      composeBackbone(element);
43776      if (element.hasCodeElement()) {
43777        composeCodeCore("code", element.getCodeElement(), false);
43778        composeCodeExtras("code", element.getCodeElement(), false);
43779      }
43780      if (element.hasSourceElement()) {
43781        composeStringCore("source", element.getSourceElement(), false);
43782        composeStringExtras("source", element.getSourceElement(), false);
43783      }
43784      if (element.hasScopeElement()) {
43785        composeStringCore("scope", element.getScopeElement(), false);
43786        composeStringExtras("scope", element.getScopeElement(), false);
43787      }
43788  }
43789
43790  protected void composeImplementationGuideImplementationGuideManifestComponent(String name, ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
43791    if (element != null) {
43792      open(name);
43793      composeImplementationGuideImplementationGuideManifestComponentInner(element);
43794      close();
43795    }
43796  }
43797
43798  protected void composeImplementationGuideImplementationGuideManifestComponentInner(ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
43799      composeBackbone(element);
43800      if (element.hasRenderingElement()) {
43801        composeUrlCore("rendering", element.getRenderingElement(), false);
43802        composeUrlExtras("rendering", element.getRenderingElement(), false);
43803      }
43804      if (element.hasResource()) {
43805        openArray("resource");
43806        for (ImplementationGuide.ManifestResourceComponent e : element.getResource()) 
43807          composeImplementationGuideManifestResourceComponent(null, e);
43808        closeArray();
43809      };
43810      if (element.hasPage()) {
43811        openArray("page");
43812        for (ImplementationGuide.ManifestPageComponent e : element.getPage()) 
43813          composeImplementationGuideManifestPageComponent(null, e);
43814        closeArray();
43815      };
43816      if (element.hasImage()) {
43817        openArray("image");
43818        for (StringType e : element.getImage()) 
43819          composeStringCore(null, e, true);
43820        closeArray();
43821        if (anyHasExtras(element.getImage())) {
43822          openArray("_image");
43823          for (StringType e : element.getImage()) 
43824            composeStringExtras(null, e, true);
43825          closeArray();
43826        }
43827      };
43828      if (element.hasOther()) {
43829        openArray("other");
43830        for (StringType e : element.getOther()) 
43831          composeStringCore(null, e, true);
43832        closeArray();
43833        if (anyHasExtras(element.getOther())) {
43834          openArray("_other");
43835          for (StringType e : element.getOther()) 
43836            composeStringExtras(null, e, true);
43837          closeArray();
43838        }
43839      };
43840  }
43841
43842  protected void composeImplementationGuideManifestResourceComponent(String name, ImplementationGuide.ManifestResourceComponent element) throws IOException {
43843    if (element != null) {
43844      open(name);
43845      composeImplementationGuideManifestResourceComponentInner(element);
43846      close();
43847    }
43848  }
43849
43850  protected void composeImplementationGuideManifestResourceComponentInner(ImplementationGuide.ManifestResourceComponent element) throws IOException {
43851      composeBackbone(element);
43852      if (element.hasReference()) {
43853        composeReference("reference", element.getReference());
43854      }
43855      if (element.hasExample()) {
43856        composeType("example", element.getExample());
43857      }
43858      if (element.hasRelativePathElement()) {
43859        composeUrlCore("relativePath", element.getRelativePathElement(), false);
43860        composeUrlExtras("relativePath", element.getRelativePathElement(), false);
43861      }
43862  }
43863
43864  protected void composeImplementationGuideManifestPageComponent(String name, ImplementationGuide.ManifestPageComponent element) throws IOException {
43865    if (element != null) {
43866      open(name);
43867      composeImplementationGuideManifestPageComponentInner(element);
43868      close();
43869    }
43870  }
43871
43872  protected void composeImplementationGuideManifestPageComponentInner(ImplementationGuide.ManifestPageComponent element) throws IOException {
43873      composeBackbone(element);
43874      if (element.hasNameElement()) {
43875        composeStringCore("name", element.getNameElement(), false);
43876        composeStringExtras("name", element.getNameElement(), false);
43877      }
43878      if (element.hasTitleElement()) {
43879        composeStringCore("title", element.getTitleElement(), false);
43880        composeStringExtras("title", element.getTitleElement(), false);
43881      }
43882      if (element.hasAnchor()) {
43883        openArray("anchor");
43884        for (StringType e : element.getAnchor()) 
43885          composeStringCore(null, e, true);
43886        closeArray();
43887        if (anyHasExtras(element.getAnchor())) {
43888          openArray("_anchor");
43889          for (StringType e : element.getAnchor()) 
43890            composeStringExtras(null, e, true);
43891          closeArray();
43892        }
43893      };
43894  }
43895
43896  protected void composeInsurancePlan(String name, InsurancePlan element) throws IOException {
43897    if (element != null) {
43898      prop("resourceType", name);
43899      composeInsurancePlanInner(element);
43900    }
43901  }
43902
43903  protected void composeInsurancePlanInner(InsurancePlan element) throws IOException {
43904      composeDomainResourceElements(element);
43905      if (element.hasIdentifier()) {
43906        openArray("identifier");
43907        for (Identifier e : element.getIdentifier()) 
43908          composeIdentifier(null, e);
43909        closeArray();
43910      };
43911      if (element.hasStatusElement()) {
43912        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43913        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43914      }
43915      if (element.hasType()) {
43916        openArray("type");
43917        for (CodeableConcept e : element.getType()) 
43918          composeCodeableConcept(null, e);
43919        closeArray();
43920      };
43921      if (element.hasNameElement()) {
43922        composeStringCore("name", element.getNameElement(), false);
43923        composeStringExtras("name", element.getNameElement(), false);
43924      }
43925      if (element.hasAlias()) {
43926        openArray("alias");
43927        for (StringType e : element.getAlias()) 
43928          composeStringCore(null, e, true);
43929        closeArray();
43930        if (anyHasExtras(element.getAlias())) {
43931          openArray("_alias");
43932          for (StringType e : element.getAlias()) 
43933            composeStringExtras(null, e, true);
43934          closeArray();
43935        }
43936      };
43937      if (element.hasPeriod()) {
43938        composePeriod("period", element.getPeriod());
43939      }
43940      if (element.hasOwnedBy()) {
43941        composeReference("ownedBy", element.getOwnedBy());
43942      }
43943      if (element.hasAdministeredBy()) {
43944        composeReference("administeredBy", element.getAdministeredBy());
43945      }
43946      if (element.hasCoverageArea()) {
43947        openArray("coverageArea");
43948        for (Reference e : element.getCoverageArea()) 
43949          composeReference(null, e);
43950        closeArray();
43951      };
43952      if (element.hasContact()) {
43953        openArray("contact");
43954        for (InsurancePlan.InsurancePlanContactComponent e : element.getContact()) 
43955          composeInsurancePlanInsurancePlanContactComponent(null, e);
43956        closeArray();
43957      };
43958      if (element.hasEndpoint()) {
43959        openArray("endpoint");
43960        for (Reference e : element.getEndpoint()) 
43961          composeReference(null, e);
43962        closeArray();
43963      };
43964      if (element.hasNetwork()) {
43965        openArray("network");
43966        for (Reference e : element.getNetwork()) 
43967          composeReference(null, e);
43968        closeArray();
43969      };
43970      if (element.hasCoverage()) {
43971        openArray("coverage");
43972        for (InsurancePlan.InsurancePlanCoverageComponent e : element.getCoverage()) 
43973          composeInsurancePlanInsurancePlanCoverageComponent(null, e);
43974        closeArray();
43975      };
43976      if (element.hasPlan()) {
43977        openArray("plan");
43978        for (InsurancePlan.InsurancePlanPlanComponent e : element.getPlan()) 
43979          composeInsurancePlanInsurancePlanPlanComponent(null, e);
43980        closeArray();
43981      };
43982  }
43983
43984  protected void composeInsurancePlanInsurancePlanContactComponent(String name, InsurancePlan.InsurancePlanContactComponent element) throws IOException {
43985    if (element != null) {
43986      open(name);
43987      composeInsurancePlanInsurancePlanContactComponentInner(element);
43988      close();
43989    }
43990  }
43991
43992  protected void composeInsurancePlanInsurancePlanContactComponentInner(InsurancePlan.InsurancePlanContactComponent element) throws IOException {
43993      composeBackbone(element);
43994      if (element.hasPurpose()) {
43995        composeCodeableConcept("purpose", element.getPurpose());
43996      }
43997      if (element.hasName()) {
43998        composeHumanName("name", element.getName());
43999      }
44000      if (element.hasTelecom()) {
44001        openArray("telecom");
44002        for (ContactPoint e : element.getTelecom()) 
44003          composeContactPoint(null, e);
44004        closeArray();
44005      };
44006      if (element.hasAddress()) {
44007        composeAddress("address", element.getAddress());
44008      }
44009  }
44010
44011  protected void composeInsurancePlanInsurancePlanCoverageComponent(String name, InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
44012    if (element != null) {
44013      open(name);
44014      composeInsurancePlanInsurancePlanCoverageComponentInner(element);
44015      close();
44016    }
44017  }
44018
44019  protected void composeInsurancePlanInsurancePlanCoverageComponentInner(InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
44020      composeBackbone(element);
44021      if (element.hasType()) {
44022        composeCodeableConcept("type", element.getType());
44023      }
44024      if (element.hasNetwork()) {
44025        openArray("network");
44026        for (Reference e : element.getNetwork()) 
44027          composeReference(null, e);
44028        closeArray();
44029      };
44030      if (element.hasBenefit()) {
44031        openArray("benefit");
44032        for (InsurancePlan.CoverageBenefitComponent e : element.getBenefit()) 
44033          composeInsurancePlanCoverageBenefitComponent(null, e);
44034        closeArray();
44035      };
44036  }
44037
44038  protected void composeInsurancePlanCoverageBenefitComponent(String name, InsurancePlan.CoverageBenefitComponent element) throws IOException {
44039    if (element != null) {
44040      open(name);
44041      composeInsurancePlanCoverageBenefitComponentInner(element);
44042      close();
44043    }
44044  }
44045
44046  protected void composeInsurancePlanCoverageBenefitComponentInner(InsurancePlan.CoverageBenefitComponent element) throws IOException {
44047      composeBackbone(element);
44048      if (element.hasType()) {
44049        composeCodeableConcept("type", element.getType());
44050      }
44051      if (element.hasRequirementElement()) {
44052        composeStringCore("requirement", element.getRequirementElement(), false);
44053        composeStringExtras("requirement", element.getRequirementElement(), false);
44054      }
44055      if (element.hasLimit()) {
44056        openArray("limit");
44057        for (InsurancePlan.CoverageBenefitLimitComponent e : element.getLimit()) 
44058          composeInsurancePlanCoverageBenefitLimitComponent(null, e);
44059        closeArray();
44060      };
44061  }
44062
44063  protected void composeInsurancePlanCoverageBenefitLimitComponent(String name, InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
44064    if (element != null) {
44065      open(name);
44066      composeInsurancePlanCoverageBenefitLimitComponentInner(element);
44067      close();
44068    }
44069  }
44070
44071  protected void composeInsurancePlanCoverageBenefitLimitComponentInner(InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
44072      composeBackbone(element);
44073      if (element.hasValue()) {
44074        composeQuantity("value", element.getValue());
44075      }
44076      if (element.hasCode()) {
44077        composeCodeableConcept("code", element.getCode());
44078      }
44079  }
44080
44081  protected void composeInsurancePlanInsurancePlanPlanComponent(String name, InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
44082    if (element != null) {
44083      open(name);
44084      composeInsurancePlanInsurancePlanPlanComponentInner(element);
44085      close();
44086    }
44087  }
44088
44089  protected void composeInsurancePlanInsurancePlanPlanComponentInner(InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
44090      composeBackbone(element);
44091      if (element.hasIdentifier()) {
44092        openArray("identifier");
44093        for (Identifier e : element.getIdentifier()) 
44094          composeIdentifier(null, e);
44095        closeArray();
44096      };
44097      if (element.hasType()) {
44098        composeCodeableConcept("type", element.getType());
44099      }
44100      if (element.hasCoverageArea()) {
44101        openArray("coverageArea");
44102        for (Reference e : element.getCoverageArea()) 
44103          composeReference(null, e);
44104        closeArray();
44105      };
44106      if (element.hasNetwork()) {
44107        openArray("network");
44108        for (Reference e : element.getNetwork()) 
44109          composeReference(null, e);
44110        closeArray();
44111      };
44112      if (element.hasGeneralCost()) {
44113        openArray("generalCost");
44114        for (InsurancePlan.InsurancePlanPlanGeneralCostComponent e : element.getGeneralCost()) 
44115          composeInsurancePlanInsurancePlanPlanGeneralCostComponent(null, e);
44116        closeArray();
44117      };
44118      if (element.hasSpecificCost()) {
44119        openArray("specificCost");
44120        for (InsurancePlan.InsurancePlanPlanSpecificCostComponent e : element.getSpecificCost()) 
44121          composeInsurancePlanInsurancePlanPlanSpecificCostComponent(null, e);
44122        closeArray();
44123      };
44124  }
44125
44126  protected void composeInsurancePlanInsurancePlanPlanGeneralCostComponent(String name, InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
44127    if (element != null) {
44128      open(name);
44129      composeInsurancePlanInsurancePlanPlanGeneralCostComponentInner(element);
44130      close();
44131    }
44132  }
44133
44134  protected void composeInsurancePlanInsurancePlanPlanGeneralCostComponentInner(InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
44135      composeBackbone(element);
44136      if (element.hasType()) {
44137        composeCodeableConcept("type", element.getType());
44138      }
44139      if (element.hasGroupSizeElement()) {
44140        composePositiveIntCore("groupSize", element.getGroupSizeElement(), false);
44141        composePositiveIntExtras("groupSize", element.getGroupSizeElement(), false);
44142      }
44143      if (element.hasCost()) {
44144        composeMoney("cost", element.getCost());
44145      }
44146      if (element.hasCommentElement()) {
44147        composeStringCore("comment", element.getCommentElement(), false);
44148        composeStringExtras("comment", element.getCommentElement(), false);
44149      }
44150  }
44151
44152  protected void composeInsurancePlanInsurancePlanPlanSpecificCostComponent(String name, InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
44153    if (element != null) {
44154      open(name);
44155      composeInsurancePlanInsurancePlanPlanSpecificCostComponentInner(element);
44156      close();
44157    }
44158  }
44159
44160  protected void composeInsurancePlanInsurancePlanPlanSpecificCostComponentInner(InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
44161      composeBackbone(element);
44162      if (element.hasCategory()) {
44163        composeCodeableConcept("category", element.getCategory());
44164      }
44165      if (element.hasBenefit()) {
44166        openArray("benefit");
44167        for (InsurancePlan.PlanBenefitComponent e : element.getBenefit()) 
44168          composeInsurancePlanPlanBenefitComponent(null, e);
44169        closeArray();
44170      };
44171  }
44172
44173  protected void composeInsurancePlanPlanBenefitComponent(String name, InsurancePlan.PlanBenefitComponent element) throws IOException {
44174    if (element != null) {
44175      open(name);
44176      composeInsurancePlanPlanBenefitComponentInner(element);
44177      close();
44178    }
44179  }
44180
44181  protected void composeInsurancePlanPlanBenefitComponentInner(InsurancePlan.PlanBenefitComponent element) throws IOException {
44182      composeBackbone(element);
44183      if (element.hasType()) {
44184        composeCodeableConcept("type", element.getType());
44185      }
44186      if (element.hasCost()) {
44187        openArray("cost");
44188        for (InsurancePlan.PlanBenefitCostComponent e : element.getCost()) 
44189          composeInsurancePlanPlanBenefitCostComponent(null, e);
44190        closeArray();
44191      };
44192  }
44193
44194  protected void composeInsurancePlanPlanBenefitCostComponent(String name, InsurancePlan.PlanBenefitCostComponent element) throws IOException {
44195    if (element != null) {
44196      open(name);
44197      composeInsurancePlanPlanBenefitCostComponentInner(element);
44198      close();
44199    }
44200  }
44201
44202  protected void composeInsurancePlanPlanBenefitCostComponentInner(InsurancePlan.PlanBenefitCostComponent element) throws IOException {
44203      composeBackbone(element);
44204      if (element.hasType()) {
44205        composeCodeableConcept("type", element.getType());
44206      }
44207      if (element.hasApplicability()) {
44208        composeCodeableConcept("applicability", element.getApplicability());
44209      }
44210      if (element.hasQualifiers()) {
44211        openArray("qualifiers");
44212        for (CodeableConcept e : element.getQualifiers()) 
44213          composeCodeableConcept(null, e);
44214        closeArray();
44215      };
44216      if (element.hasValue()) {
44217        composeQuantity("value", element.getValue());
44218      }
44219  }
44220
44221  protected void composeInvoice(String name, Invoice element) throws IOException {
44222    if (element != null) {
44223      prop("resourceType", name);
44224      composeInvoiceInner(element);
44225    }
44226  }
44227
44228  protected void composeInvoiceInner(Invoice element) throws IOException {
44229      composeDomainResourceElements(element);
44230      if (element.hasIdentifier()) {
44231        openArray("identifier");
44232        for (Identifier e : element.getIdentifier()) 
44233          composeIdentifier(null, e);
44234        closeArray();
44235      };
44236      if (element.hasStatusElement()) {
44237        composeEnumerationCore("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
44238        composeEnumerationExtras("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
44239      }
44240      if (element.hasCancelledReasonElement()) {
44241        composeStringCore("cancelledReason", element.getCancelledReasonElement(), false);
44242        composeStringExtras("cancelledReason", element.getCancelledReasonElement(), false);
44243      }
44244      if (element.hasType()) {
44245        composeCodeableConcept("type", element.getType());
44246      }
44247      if (element.hasSubject()) {
44248        composeReference("subject", element.getSubject());
44249      }
44250      if (element.hasRecipient()) {
44251        composeReference("recipient", element.getRecipient());
44252      }
44253      if (element.hasDateElement()) {
44254        composeDateTimeCore("date", element.getDateElement(), false);
44255        composeDateTimeExtras("date", element.getDateElement(), false);
44256      }
44257      if (element.hasParticipant()) {
44258        openArray("participant");
44259        for (Invoice.InvoiceParticipantComponent e : element.getParticipant()) 
44260          composeInvoiceInvoiceParticipantComponent(null, e);
44261        closeArray();
44262      };
44263      if (element.hasIssuer()) {
44264        composeReference("issuer", element.getIssuer());
44265      }
44266      if (element.hasAccount()) {
44267        composeReference("account", element.getAccount());
44268      }
44269      if (element.hasLineItem()) {
44270        openArray("lineItem");
44271        for (Invoice.InvoiceLineItemComponent e : element.getLineItem()) 
44272          composeInvoiceInvoiceLineItemComponent(null, e);
44273        closeArray();
44274      };
44275      if (element.hasTotalPriceComponent()) {
44276        openArray("totalPriceComponent");
44277        for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getTotalPriceComponent()) 
44278          composeInvoiceInvoiceLineItemPriceComponentComponent(null, e);
44279        closeArray();
44280      };
44281      if (element.hasTotalNet()) {
44282        composeMoney("totalNet", element.getTotalNet());
44283      }
44284      if (element.hasTotalGross()) {
44285        composeMoney("totalGross", element.getTotalGross());
44286      }
44287      if (element.hasPaymentTermsElement()) {
44288        composeMarkdownCore("paymentTerms", element.getPaymentTermsElement(), false);
44289        composeMarkdownExtras("paymentTerms", element.getPaymentTermsElement(), false);
44290      }
44291      if (element.hasNote()) {
44292        openArray("note");
44293        for (Annotation e : element.getNote()) 
44294          composeAnnotation(null, e);
44295        closeArray();
44296      };
44297  }
44298
44299  protected void composeInvoiceInvoiceParticipantComponent(String name, Invoice.InvoiceParticipantComponent element) throws IOException {
44300    if (element != null) {
44301      open(name);
44302      composeInvoiceInvoiceParticipantComponentInner(element);
44303      close();
44304    }
44305  }
44306
44307  protected void composeInvoiceInvoiceParticipantComponentInner(Invoice.InvoiceParticipantComponent element) throws IOException {
44308      composeBackbone(element);
44309      if (element.hasRole()) {
44310        composeCodeableConcept("role", element.getRole());
44311      }
44312      if (element.hasActor()) {
44313        composeReference("actor", element.getActor());
44314      }
44315  }
44316
44317  protected void composeInvoiceInvoiceLineItemComponent(String name, Invoice.InvoiceLineItemComponent element) throws IOException {
44318    if (element != null) {
44319      open(name);
44320      composeInvoiceInvoiceLineItemComponentInner(element);
44321      close();
44322    }
44323  }
44324
44325  protected void composeInvoiceInvoiceLineItemComponentInner(Invoice.InvoiceLineItemComponent element) throws IOException {
44326      composeBackbone(element);
44327      if (element.hasSequenceElement()) {
44328        composePositiveIntCore("sequence", element.getSequenceElement(), false);
44329        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
44330      }
44331      if (element.hasChargeItem()) {
44332        composeType("chargeItem", element.getChargeItem());
44333      }
44334      if (element.hasPriceComponent()) {
44335        openArray("priceComponent");
44336        for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getPriceComponent()) 
44337          composeInvoiceInvoiceLineItemPriceComponentComponent(null, e);
44338        closeArray();
44339      };
44340  }
44341
44342  protected void composeInvoiceInvoiceLineItemPriceComponentComponent(String name, Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
44343    if (element != null) {
44344      open(name);
44345      composeInvoiceInvoiceLineItemPriceComponentComponentInner(element);
44346      close();
44347    }
44348  }
44349
44350  protected void composeInvoiceInvoiceLineItemPriceComponentComponentInner(Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
44351      composeBackbone(element);
44352      if (element.hasTypeElement()) {
44353        composeEnumerationCore("type", element.getTypeElement(), new Invoice.InvoicePriceComponentTypeEnumFactory(), false);
44354        composeEnumerationExtras("type", element.getTypeElement(), new Invoice.InvoicePriceComponentTypeEnumFactory(), false);
44355      }
44356      if (element.hasCode()) {
44357        composeCodeableConcept("code", element.getCode());
44358      }
44359      if (element.hasFactorElement()) {
44360        composeDecimalCore("factor", element.getFactorElement(), false);
44361        composeDecimalExtras("factor", element.getFactorElement(), false);
44362      }
44363      if (element.hasAmount()) {
44364        composeMoney("amount", element.getAmount());
44365      }
44366  }
44367
44368  protected void composeLibrary(String name, Library element) throws IOException {
44369    if (element != null) {
44370      prop("resourceType", name);
44371      composeLibraryInner(element);
44372    }
44373  }
44374
44375  protected void composeLibraryInner(Library element) throws IOException {
44376      composeDomainResourceElements(element);
44377      if (element.hasUrlElement()) {
44378        composeUriCore("url", element.getUrlElement(), false);
44379        composeUriExtras("url", element.getUrlElement(), false);
44380      }
44381      if (element.hasIdentifier()) {
44382        openArray("identifier");
44383        for (Identifier e : element.getIdentifier()) 
44384          composeIdentifier(null, e);
44385        closeArray();
44386      };
44387      if (element.hasVersionElement()) {
44388        composeStringCore("version", element.getVersionElement(), false);
44389        composeStringExtras("version", element.getVersionElement(), false);
44390      }
44391      if (element.hasNameElement()) {
44392        composeStringCore("name", element.getNameElement(), false);
44393        composeStringExtras("name", element.getNameElement(), false);
44394      }
44395      if (element.hasTitleElement()) {
44396        composeStringCore("title", element.getTitleElement(), false);
44397        composeStringExtras("title", element.getTitleElement(), false);
44398      }
44399      if (element.hasSubtitleElement()) {
44400        composeStringCore("subtitle", element.getSubtitleElement(), false);
44401        composeStringExtras("subtitle", element.getSubtitleElement(), false);
44402      }
44403      if (element.hasStatusElement()) {
44404        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
44405        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
44406      }
44407      if (element.hasExperimentalElement()) {
44408        composeBooleanCore("experimental", element.getExperimentalElement(), false);
44409        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
44410      }
44411      if (element.hasType()) {
44412        composeCodeableConcept("type", element.getType());
44413      }
44414      if (element.hasSubject()) {
44415        composeType("subject", element.getSubject());
44416      }
44417      if (element.hasDateElement()) {
44418        composeDateTimeCore("date", element.getDateElement(), false);
44419        composeDateTimeExtras("date", element.getDateElement(), false);
44420      }
44421      if (element.hasPublisherElement()) {
44422        composeStringCore("publisher", element.getPublisherElement(), false);
44423        composeStringExtras("publisher", element.getPublisherElement(), false);
44424      }
44425      if (element.hasContact()) {
44426        openArray("contact");
44427        for (ContactDetail e : element.getContact()) 
44428          composeContactDetail(null, e);
44429        closeArray();
44430      };
44431      if (element.hasDescriptionElement()) {
44432        composeMarkdownCore("description", element.getDescriptionElement(), false);
44433        composeMarkdownExtras("description", element.getDescriptionElement(), false);
44434      }
44435      if (element.hasUseContext()) {
44436        openArray("useContext");
44437        for (UsageContext e : element.getUseContext()) 
44438          composeUsageContext(null, e);
44439        closeArray();
44440      };
44441      if (element.hasJurisdiction()) {
44442        openArray("jurisdiction");
44443        for (CodeableConcept e : element.getJurisdiction()) 
44444          composeCodeableConcept(null, e);
44445        closeArray();
44446      };
44447      if (element.hasPurposeElement()) {
44448        composeMarkdownCore("purpose", element.getPurposeElement(), false);
44449        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
44450      }
44451      if (element.hasUsageElement()) {
44452        composeStringCore("usage", element.getUsageElement(), false);
44453        composeStringExtras("usage", element.getUsageElement(), false);
44454      }
44455      if (element.hasCopyrightElement()) {
44456        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
44457        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
44458      }
44459      if (element.hasApprovalDateElement()) {
44460        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
44461        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
44462      }
44463      if (element.hasLastReviewDateElement()) {
44464        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
44465        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
44466      }
44467      if (element.hasEffectivePeriod()) {
44468        composePeriod("effectivePeriod", element.getEffectivePeriod());
44469      }
44470      if (element.hasTopic()) {
44471        openArray("topic");
44472        for (CodeableConcept e : element.getTopic()) 
44473          composeCodeableConcept(null, e);
44474        closeArray();
44475      };
44476      if (element.hasAuthor()) {
44477        openArray("author");
44478        for (ContactDetail e : element.getAuthor()) 
44479          composeContactDetail(null, e);
44480        closeArray();
44481      };
44482      if (element.hasEditor()) {
44483        openArray("editor");
44484        for (ContactDetail e : element.getEditor()) 
44485          composeContactDetail(null, e);
44486        closeArray();
44487      };
44488      if (element.hasReviewer()) {
44489        openArray("reviewer");
44490        for (ContactDetail e : element.getReviewer()) 
44491          composeContactDetail(null, e);
44492        closeArray();
44493      };
44494      if (element.hasEndorser()) {
44495        openArray("endorser");
44496        for (ContactDetail e : element.getEndorser()) 
44497          composeContactDetail(null, e);
44498        closeArray();
44499      };
44500      if (element.hasRelatedArtifact()) {
44501        openArray("relatedArtifact");
44502        for (RelatedArtifact e : element.getRelatedArtifact()) 
44503          composeRelatedArtifact(null, e);
44504        closeArray();
44505      };
44506      if (element.hasParameter()) {
44507        openArray("parameter");
44508        for (ParameterDefinition e : element.getParameter()) 
44509          composeParameterDefinition(null, e);
44510        closeArray();
44511      };
44512      if (element.hasDataRequirement()) {
44513        openArray("dataRequirement");
44514        for (DataRequirement e : element.getDataRequirement()) 
44515          composeDataRequirement(null, e);
44516        closeArray();
44517      };
44518      if (element.hasContent()) {
44519        openArray("content");
44520        for (Attachment e : element.getContent()) 
44521          composeAttachment(null, e);
44522        closeArray();
44523      };
44524  }
44525
44526  protected void composeLinkage(String name, Linkage element) throws IOException {
44527    if (element != null) {
44528      prop("resourceType", name);
44529      composeLinkageInner(element);
44530    }
44531  }
44532
44533  protected void composeLinkageInner(Linkage element) throws IOException {
44534      composeDomainResourceElements(element);
44535      if (element.hasActiveElement()) {
44536        composeBooleanCore("active", element.getActiveElement(), false);
44537        composeBooleanExtras("active", element.getActiveElement(), false);
44538      }
44539      if (element.hasAuthor()) {
44540        composeReference("author", element.getAuthor());
44541      }
44542      if (element.hasItem()) {
44543        openArray("item");
44544        for (Linkage.LinkageItemComponent e : element.getItem()) 
44545          composeLinkageLinkageItemComponent(null, e);
44546        closeArray();
44547      };
44548  }
44549
44550  protected void composeLinkageLinkageItemComponent(String name, Linkage.LinkageItemComponent element) throws IOException {
44551    if (element != null) {
44552      open(name);
44553      composeLinkageLinkageItemComponentInner(element);
44554      close();
44555    }
44556  }
44557
44558  protected void composeLinkageLinkageItemComponentInner(Linkage.LinkageItemComponent element) throws IOException {
44559      composeBackbone(element);
44560      if (element.hasTypeElement()) {
44561        composeEnumerationCore("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
44562        composeEnumerationExtras("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
44563      }
44564      if (element.hasResource()) {
44565        composeReference("resource", element.getResource());
44566      }
44567  }
44568
44569  protected void composeListResource(String name, ListResource element) throws IOException {
44570    if (element != null) {
44571      prop("resourceType", name);
44572      composeListResourceInner(element);
44573    }
44574  }
44575
44576  protected void composeListResourceInner(ListResource element) throws IOException {
44577      composeDomainResourceElements(element);
44578      if (element.hasIdentifier()) {
44579        openArray("identifier");
44580        for (Identifier e : element.getIdentifier()) 
44581          composeIdentifier(null, e);
44582        closeArray();
44583      };
44584      if (element.hasStatusElement()) {
44585        composeEnumerationCore("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
44586        composeEnumerationExtras("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
44587      }
44588      if (element.hasModeElement()) {
44589        composeEnumerationCore("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
44590        composeEnumerationExtras("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
44591      }
44592      if (element.hasTitleElement()) {
44593        composeStringCore("title", element.getTitleElement(), false);
44594        composeStringExtras("title", element.getTitleElement(), false);
44595      }
44596      if (element.hasCode()) {
44597        composeCodeableConcept("code", element.getCode());
44598      }
44599      if (element.hasSubject()) {
44600        composeReference("subject", element.getSubject());
44601      }
44602      if (element.hasEncounter()) {
44603        composeReference("encounter", element.getEncounter());
44604      }
44605      if (element.hasDateElement()) {
44606        composeDateTimeCore("date", element.getDateElement(), false);
44607        composeDateTimeExtras("date", element.getDateElement(), false);
44608      }
44609      if (element.hasSource()) {
44610        composeReference("source", element.getSource());
44611      }
44612      if (element.hasOrderedBy()) {
44613        composeCodeableConcept("orderedBy", element.getOrderedBy());
44614      }
44615      if (element.hasNote()) {
44616        openArray("note");
44617        for (Annotation e : element.getNote()) 
44618          composeAnnotation(null, e);
44619        closeArray();
44620      };
44621      if (element.hasEntry()) {
44622        openArray("entry");
44623        for (ListResource.ListEntryComponent e : element.getEntry()) 
44624          composeListResourceListEntryComponent(null, e);
44625        closeArray();
44626      };
44627      if (element.hasEmptyReason()) {
44628        composeCodeableConcept("emptyReason", element.getEmptyReason());
44629      }
44630  }
44631
44632  protected void composeListResourceListEntryComponent(String name, ListResource.ListEntryComponent element) throws IOException {
44633    if (element != null) {
44634      open(name);
44635      composeListResourceListEntryComponentInner(element);
44636      close();
44637    }
44638  }
44639
44640  protected void composeListResourceListEntryComponentInner(ListResource.ListEntryComponent element) throws IOException {
44641      composeBackbone(element);
44642      if (element.hasFlag()) {
44643        composeCodeableConcept("flag", element.getFlag());
44644      }
44645      if (element.hasDeletedElement()) {
44646        composeBooleanCore("deleted", element.getDeletedElement(), false);
44647        composeBooleanExtras("deleted", element.getDeletedElement(), false);
44648      }
44649      if (element.hasDateElement()) {
44650        composeDateTimeCore("date", element.getDateElement(), false);
44651        composeDateTimeExtras("date", element.getDateElement(), false);
44652      }
44653      if (element.hasItem()) {
44654        composeReference("item", element.getItem());
44655      }
44656  }
44657
44658  protected void composeLocation(String name, Location element) throws IOException {
44659    if (element != null) {
44660      prop("resourceType", name);
44661      composeLocationInner(element);
44662    }
44663  }
44664
44665  protected void composeLocationInner(Location element) throws IOException {
44666      composeDomainResourceElements(element);
44667      if (element.hasIdentifier()) {
44668        openArray("identifier");
44669        for (Identifier e : element.getIdentifier()) 
44670          composeIdentifier(null, e);
44671        closeArray();
44672      };
44673      if (element.hasStatusElement()) {
44674        composeEnumerationCore("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
44675        composeEnumerationExtras("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
44676      }
44677      if (element.hasOperationalStatus()) {
44678        composeCoding("operationalStatus", element.getOperationalStatus());
44679      }
44680      if (element.hasNameElement()) {
44681        composeStringCore("name", element.getNameElement(), false);
44682        composeStringExtras("name", element.getNameElement(), false);
44683      }
44684      if (element.hasAlias()) {
44685        openArray("alias");
44686        for (StringType e : element.getAlias()) 
44687          composeStringCore(null, e, true);
44688        closeArray();
44689        if (anyHasExtras(element.getAlias())) {
44690          openArray("_alias");
44691          for (StringType e : element.getAlias()) 
44692            composeStringExtras(null, e, true);
44693          closeArray();
44694        }
44695      };
44696      if (element.hasDescriptionElement()) {
44697        composeStringCore("description", element.getDescriptionElement(), false);
44698        composeStringExtras("description", element.getDescriptionElement(), false);
44699      }
44700      if (element.hasModeElement()) {
44701        composeEnumerationCore("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
44702        composeEnumerationExtras("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
44703      }
44704      if (element.hasType()) {
44705        openArray("type");
44706        for (CodeableConcept e : element.getType()) 
44707          composeCodeableConcept(null, e);
44708        closeArray();
44709      };
44710      if (element.hasTelecom()) {
44711        openArray("telecom");
44712        for (ContactPoint e : element.getTelecom()) 
44713          composeContactPoint(null, e);
44714        closeArray();
44715      };
44716      if (element.hasAddress()) {
44717        composeAddress("address", element.getAddress());
44718      }
44719      if (element.hasPhysicalType()) {
44720        composeCodeableConcept("physicalType", element.getPhysicalType());
44721      }
44722      if (element.hasPosition()) {
44723        composeLocationLocationPositionComponent("position", element.getPosition());
44724      }
44725      if (element.hasManagingOrganization()) {
44726        composeReference("managingOrganization", element.getManagingOrganization());
44727      }
44728      if (element.hasPartOf()) {
44729        composeReference("partOf", element.getPartOf());
44730      }
44731      if (element.hasHoursOfOperation()) {
44732        openArray("hoursOfOperation");
44733        for (Location.LocationHoursOfOperationComponent e : element.getHoursOfOperation()) 
44734          composeLocationLocationHoursOfOperationComponent(null, e);
44735        closeArray();
44736      };
44737      if (element.hasAvailabilityExceptionsElement()) {
44738        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
44739        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
44740      }
44741      if (element.hasEndpoint()) {
44742        openArray("endpoint");
44743        for (Reference e : element.getEndpoint()) 
44744          composeReference(null, e);
44745        closeArray();
44746      };
44747  }
44748
44749  protected void composeLocationLocationPositionComponent(String name, Location.LocationPositionComponent element) throws IOException {
44750    if (element != null) {
44751      open(name);
44752      composeLocationLocationPositionComponentInner(element);
44753      close();
44754    }
44755  }
44756
44757  protected void composeLocationLocationPositionComponentInner(Location.LocationPositionComponent element) throws IOException {
44758      composeBackbone(element);
44759      if (element.hasLongitudeElement()) {
44760        composeDecimalCore("longitude", element.getLongitudeElement(), false);
44761        composeDecimalExtras("longitude", element.getLongitudeElement(), false);
44762      }
44763      if (element.hasLatitudeElement()) {
44764        composeDecimalCore("latitude", element.getLatitudeElement(), false);
44765        composeDecimalExtras("latitude", element.getLatitudeElement(), false);
44766      }
44767      if (element.hasAltitudeElement()) {
44768        composeDecimalCore("altitude", element.getAltitudeElement(), false);
44769        composeDecimalExtras("altitude", element.getAltitudeElement(), false);
44770      }
44771  }
44772
44773  protected void composeLocationLocationHoursOfOperationComponent(String name, Location.LocationHoursOfOperationComponent element) throws IOException {
44774    if (element != null) {
44775      open(name);
44776      composeLocationLocationHoursOfOperationComponentInner(element);
44777      close();
44778    }
44779  }
44780
44781  protected void composeLocationLocationHoursOfOperationComponentInner(Location.LocationHoursOfOperationComponent element) throws IOException {
44782      composeBackbone(element);
44783      if (element.hasDaysOfWeek()) {
44784        openArray("daysOfWeek");
44785        for (Enumeration<Location.DaysOfWeek> e : element.getDaysOfWeek()) 
44786          composeEnumerationCore(null, e, new Location.DaysOfWeekEnumFactory(), true);
44787        closeArray();
44788        if (anyHasExtras(element.getDaysOfWeek())) {
44789          openArray("_daysOfWeek");
44790          for (Enumeration<Location.DaysOfWeek> e : element.getDaysOfWeek()) 
44791            composeEnumerationExtras(null, e, new Location.DaysOfWeekEnumFactory(), true);
44792          closeArray();
44793        }
44794      };
44795      if (element.hasAllDayElement()) {
44796        composeBooleanCore("allDay", element.getAllDayElement(), false);
44797        composeBooleanExtras("allDay", element.getAllDayElement(), false);
44798      }
44799      if (element.hasOpeningTimeElement()) {
44800        composeTimeCore("openingTime", element.getOpeningTimeElement(), false);
44801        composeTimeExtras("openingTime", element.getOpeningTimeElement(), false);
44802      }
44803      if (element.hasClosingTimeElement()) {
44804        composeTimeCore("closingTime", element.getClosingTimeElement(), false);
44805        composeTimeExtras("closingTime", element.getClosingTimeElement(), false);
44806      }
44807  }
44808
44809  protected void composeMeasure(String name, Measure element) throws IOException {
44810    if (element != null) {
44811      prop("resourceType", name);
44812      composeMeasureInner(element);
44813    }
44814  }
44815
44816  protected void composeMeasureInner(Measure element) throws IOException {
44817      composeDomainResourceElements(element);
44818      if (element.hasUrlElement()) {
44819        composeUriCore("url", element.getUrlElement(), false);
44820        composeUriExtras("url", element.getUrlElement(), false);
44821      }
44822      if (element.hasIdentifier()) {
44823        openArray("identifier");
44824        for (Identifier e : element.getIdentifier()) 
44825          composeIdentifier(null, e);
44826        closeArray();
44827      };
44828      if (element.hasVersionElement()) {
44829        composeStringCore("version", element.getVersionElement(), false);
44830        composeStringExtras("version", element.getVersionElement(), false);
44831      }
44832      if (element.hasNameElement()) {
44833        composeStringCore("name", element.getNameElement(), false);
44834        composeStringExtras("name", element.getNameElement(), false);
44835      }
44836      if (element.hasTitleElement()) {
44837        composeStringCore("title", element.getTitleElement(), false);
44838        composeStringExtras("title", element.getTitleElement(), false);
44839      }
44840      if (element.hasSubtitleElement()) {
44841        composeStringCore("subtitle", element.getSubtitleElement(), false);
44842        composeStringExtras("subtitle", element.getSubtitleElement(), false);
44843      }
44844      if (element.hasStatusElement()) {
44845        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
44846        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
44847      }
44848      if (element.hasExperimentalElement()) {
44849        composeBooleanCore("experimental", element.getExperimentalElement(), false);
44850        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
44851      }
44852      if (element.hasSubject()) {
44853        composeType("subject", element.getSubject());
44854      }
44855      if (element.hasDateElement()) {
44856        composeDateTimeCore("date", element.getDateElement(), false);
44857        composeDateTimeExtras("date", element.getDateElement(), false);
44858      }
44859      if (element.hasPublisherElement()) {
44860        composeStringCore("publisher", element.getPublisherElement(), false);
44861        composeStringExtras("publisher", element.getPublisherElement(), false);
44862      }
44863      if (element.hasContact()) {
44864        openArray("contact");
44865        for (ContactDetail e : element.getContact()) 
44866          composeContactDetail(null, e);
44867        closeArray();
44868      };
44869      if (element.hasDescriptionElement()) {
44870        composeMarkdownCore("description", element.getDescriptionElement(), false);
44871        composeMarkdownExtras("description", element.getDescriptionElement(), false);
44872      }
44873      if (element.hasUseContext()) {
44874        openArray("useContext");
44875        for (UsageContext e : element.getUseContext()) 
44876          composeUsageContext(null, e);
44877        closeArray();
44878      };
44879      if (element.hasJurisdiction()) {
44880        openArray("jurisdiction");
44881        for (CodeableConcept e : element.getJurisdiction()) 
44882          composeCodeableConcept(null, e);
44883        closeArray();
44884      };
44885      if (element.hasPurposeElement()) {
44886        composeMarkdownCore("purpose", element.getPurposeElement(), false);
44887        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
44888      }
44889      if (element.hasUsageElement()) {
44890        composeStringCore("usage", element.getUsageElement(), false);
44891        composeStringExtras("usage", element.getUsageElement(), false);
44892      }
44893      if (element.hasCopyrightElement()) {
44894        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
44895        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
44896      }
44897      if (element.hasApprovalDateElement()) {
44898        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
44899        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
44900      }
44901      if (element.hasLastReviewDateElement()) {
44902        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
44903        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
44904      }
44905      if (element.hasEffectivePeriod()) {
44906        composePeriod("effectivePeriod", element.getEffectivePeriod());
44907      }
44908      if (element.hasTopic()) {
44909        openArray("topic");
44910        for (CodeableConcept e : element.getTopic()) 
44911          composeCodeableConcept(null, e);
44912        closeArray();
44913      };
44914      if (element.hasAuthor()) {
44915        openArray("author");
44916        for (ContactDetail e : element.getAuthor()) 
44917          composeContactDetail(null, e);
44918        closeArray();
44919      };
44920      if (element.hasEditor()) {
44921        openArray("editor");
44922        for (ContactDetail e : element.getEditor()) 
44923          composeContactDetail(null, e);
44924        closeArray();
44925      };
44926      if (element.hasReviewer()) {
44927        openArray("reviewer");
44928        for (ContactDetail e : element.getReviewer()) 
44929          composeContactDetail(null, e);
44930        closeArray();
44931      };
44932      if (element.hasEndorser()) {
44933        openArray("endorser");
44934        for (ContactDetail e : element.getEndorser()) 
44935          composeContactDetail(null, e);
44936        closeArray();
44937      };
44938      if (element.hasRelatedArtifact()) {
44939        openArray("relatedArtifact");
44940        for (RelatedArtifact e : element.getRelatedArtifact()) 
44941          composeRelatedArtifact(null, e);
44942        closeArray();
44943      };
44944      if (element.hasLibrary()) {
44945        openArray("library");
44946        for (CanonicalType e : element.getLibrary()) 
44947          composeCanonicalCore(null, e, true);
44948        closeArray();
44949        if (anyHasExtras(element.getLibrary())) {
44950          openArray("_library");
44951          for (CanonicalType e : element.getLibrary()) 
44952            composeCanonicalExtras(null, e, true);
44953          closeArray();
44954        }
44955      };
44956      if (element.hasDisclaimerElement()) {
44957        composeMarkdownCore("disclaimer", element.getDisclaimerElement(), false);
44958        composeMarkdownExtras("disclaimer", element.getDisclaimerElement(), false);
44959      }
44960      if (element.hasScoring()) {
44961        composeCodeableConcept("scoring", element.getScoring());
44962      }
44963      if (element.hasCompositeScoring()) {
44964        composeCodeableConcept("compositeScoring", element.getCompositeScoring());
44965      }
44966      if (element.hasType()) {
44967        openArray("type");
44968        for (CodeableConcept e : element.getType()) 
44969          composeCodeableConcept(null, e);
44970        closeArray();
44971      };
44972      if (element.hasRiskAdjustmentElement()) {
44973        composeStringCore("riskAdjustment", element.getRiskAdjustmentElement(), false);
44974        composeStringExtras("riskAdjustment", element.getRiskAdjustmentElement(), false);
44975      }
44976      if (element.hasRateAggregationElement()) {
44977        composeStringCore("rateAggregation", element.getRateAggregationElement(), false);
44978        composeStringExtras("rateAggregation", element.getRateAggregationElement(), false);
44979      }
44980      if (element.hasRationaleElement()) {
44981        composeMarkdownCore("rationale", element.getRationaleElement(), false);
44982        composeMarkdownExtras("rationale", element.getRationaleElement(), false);
44983      }
44984      if (element.hasClinicalRecommendationStatementElement()) {
44985        composeMarkdownCore("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
44986        composeMarkdownExtras("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
44987      }
44988      if (element.hasImprovementNotation()) {
44989        composeCodeableConcept("improvementNotation", element.getImprovementNotation());
44990      }
44991      if (element.hasDefinition()) {
44992        openArray("definition");
44993        for (MarkdownType e : element.getDefinition()) 
44994          composeMarkdownCore(null, e, true);
44995        closeArray();
44996        if (anyHasExtras(element.getDefinition())) {
44997          openArray("_definition");
44998          for (MarkdownType e : element.getDefinition()) 
44999            composeMarkdownExtras(null, e, true);
45000          closeArray();
45001        }
45002      };
45003      if (element.hasGuidanceElement()) {
45004        composeMarkdownCore("guidance", element.getGuidanceElement(), false);
45005        composeMarkdownExtras("guidance", element.getGuidanceElement(), false);
45006      }
45007      if (element.hasGroup()) {
45008        openArray("group");
45009        for (Measure.MeasureGroupComponent e : element.getGroup()) 
45010          composeMeasureMeasureGroupComponent(null, e);
45011        closeArray();
45012      };
45013      if (element.hasSupplementalData()) {
45014        openArray("supplementalData");
45015        for (Measure.MeasureSupplementalDataComponent e : element.getSupplementalData()) 
45016          composeMeasureMeasureSupplementalDataComponent(null, e);
45017        closeArray();
45018      };
45019  }
45020
45021  protected void composeMeasureMeasureGroupComponent(String name, Measure.MeasureGroupComponent element) throws IOException {
45022    if (element != null) {
45023      open(name);
45024      composeMeasureMeasureGroupComponentInner(element);
45025      close();
45026    }
45027  }
45028
45029  protected void composeMeasureMeasureGroupComponentInner(Measure.MeasureGroupComponent element) throws IOException {
45030      composeBackbone(element);
45031      if (element.hasCode()) {
45032        composeCodeableConcept("code", element.getCode());
45033      }
45034      if (element.hasDescriptionElement()) {
45035        composeStringCore("description", element.getDescriptionElement(), false);
45036        composeStringExtras("description", element.getDescriptionElement(), false);
45037      }
45038      if (element.hasPopulation()) {
45039        openArray("population");
45040        for (Measure.MeasureGroupPopulationComponent e : element.getPopulation()) 
45041          composeMeasureMeasureGroupPopulationComponent(null, e);
45042        closeArray();
45043      };
45044      if (element.hasStratifier()) {
45045        openArray("stratifier");
45046        for (Measure.MeasureGroupStratifierComponent e : element.getStratifier()) 
45047          composeMeasureMeasureGroupStratifierComponent(null, e);
45048        closeArray();
45049      };
45050  }
45051
45052  protected void composeMeasureMeasureGroupPopulationComponent(String name, Measure.MeasureGroupPopulationComponent element) throws IOException {
45053    if (element != null) {
45054      open(name);
45055      composeMeasureMeasureGroupPopulationComponentInner(element);
45056      close();
45057    }
45058  }
45059
45060  protected void composeMeasureMeasureGroupPopulationComponentInner(Measure.MeasureGroupPopulationComponent element) throws IOException {
45061      composeBackbone(element);
45062      if (element.hasCode()) {
45063        composeCodeableConcept("code", element.getCode());
45064      }
45065      if (element.hasDescriptionElement()) {
45066        composeStringCore("description", element.getDescriptionElement(), false);
45067        composeStringExtras("description", element.getDescriptionElement(), false);
45068      }
45069      if (element.hasCriteria()) {
45070        composeExpression("criteria", element.getCriteria());
45071      }
45072  }
45073
45074  protected void composeMeasureMeasureGroupStratifierComponent(String name, Measure.MeasureGroupStratifierComponent element) throws IOException {
45075    if (element != null) {
45076      open(name);
45077      composeMeasureMeasureGroupStratifierComponentInner(element);
45078      close();
45079    }
45080  }
45081
45082  protected void composeMeasureMeasureGroupStratifierComponentInner(Measure.MeasureGroupStratifierComponent element) throws IOException {
45083      composeBackbone(element);
45084      if (element.hasCode()) {
45085        composeCodeableConcept("code", element.getCode());
45086      }
45087      if (element.hasDescriptionElement()) {
45088        composeStringCore("description", element.getDescriptionElement(), false);
45089        composeStringExtras("description", element.getDescriptionElement(), false);
45090      }
45091      if (element.hasCriteria()) {
45092        composeExpression("criteria", element.getCriteria());
45093      }
45094      if (element.hasComponent()) {
45095        openArray("component");
45096        for (Measure.MeasureGroupStratifierComponentComponent e : element.getComponent()) 
45097          composeMeasureMeasureGroupStratifierComponentComponent(null, e);
45098        closeArray();
45099      };
45100  }
45101
45102  protected void composeMeasureMeasureGroupStratifierComponentComponent(String name, Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
45103    if (element != null) {
45104      open(name);
45105      composeMeasureMeasureGroupStratifierComponentComponentInner(element);
45106      close();
45107    }
45108  }
45109
45110  protected void composeMeasureMeasureGroupStratifierComponentComponentInner(Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
45111      composeBackbone(element);
45112      if (element.hasCode()) {
45113        composeCodeableConcept("code", element.getCode());
45114      }
45115      if (element.hasDescriptionElement()) {
45116        composeStringCore("description", element.getDescriptionElement(), false);
45117        composeStringExtras("description", element.getDescriptionElement(), false);
45118      }
45119      if (element.hasCriteria()) {
45120        composeExpression("criteria", element.getCriteria());
45121      }
45122  }
45123
45124  protected void composeMeasureMeasureSupplementalDataComponent(String name, Measure.MeasureSupplementalDataComponent element) throws IOException {
45125    if (element != null) {
45126      open(name);
45127      composeMeasureMeasureSupplementalDataComponentInner(element);
45128      close();
45129    }
45130  }
45131
45132  protected void composeMeasureMeasureSupplementalDataComponentInner(Measure.MeasureSupplementalDataComponent element) throws IOException {
45133      composeBackbone(element);
45134      if (element.hasCode()) {
45135        composeCodeableConcept("code", element.getCode());
45136      }
45137      if (element.hasUsage()) {
45138        openArray("usage");
45139        for (CodeableConcept e : element.getUsage()) 
45140          composeCodeableConcept(null, e);
45141        closeArray();
45142      };
45143      if (element.hasDescriptionElement()) {
45144        composeStringCore("description", element.getDescriptionElement(), false);
45145        composeStringExtras("description", element.getDescriptionElement(), false);
45146      }
45147      if (element.hasCriteria()) {
45148        composeExpression("criteria", element.getCriteria());
45149      }
45150  }
45151
45152  protected void composeMeasureReport(String name, MeasureReport element) throws IOException {
45153    if (element != null) {
45154      prop("resourceType", name);
45155      composeMeasureReportInner(element);
45156    }
45157  }
45158
45159  protected void composeMeasureReportInner(MeasureReport element) throws IOException {
45160      composeDomainResourceElements(element);
45161      if (element.hasIdentifier()) {
45162        openArray("identifier");
45163        for (Identifier e : element.getIdentifier()) 
45164          composeIdentifier(null, e);
45165        closeArray();
45166      };
45167      if (element.hasStatusElement()) {
45168        composeEnumerationCore("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
45169        composeEnumerationExtras("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
45170      }
45171      if (element.hasTypeElement()) {
45172        composeEnumerationCore("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
45173        composeEnumerationExtras("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
45174      }
45175      if (element.hasMeasureElement()) {
45176        composeCanonicalCore("measure", element.getMeasureElement(), false);
45177        composeCanonicalExtras("measure", element.getMeasureElement(), false);
45178      }
45179      if (element.hasSubject()) {
45180        composeReference("subject", element.getSubject());
45181      }
45182      if (element.hasDateElement()) {
45183        composeDateTimeCore("date", element.getDateElement(), false);
45184        composeDateTimeExtras("date", element.getDateElement(), false);
45185      }
45186      if (element.hasReporter()) {
45187        composeReference("reporter", element.getReporter());
45188      }
45189      if (element.hasPeriod()) {
45190        composePeriod("period", element.getPeriod());
45191      }
45192      if (element.hasImprovementNotation()) {
45193        composeCodeableConcept("improvementNotation", element.getImprovementNotation());
45194      }
45195      if (element.hasGroup()) {
45196        openArray("group");
45197        for (MeasureReport.MeasureReportGroupComponent e : element.getGroup()) 
45198          composeMeasureReportMeasureReportGroupComponent(null, e);
45199        closeArray();
45200      };
45201      if (element.hasEvaluatedResource()) {
45202        openArray("evaluatedResource");
45203        for (Reference e : element.getEvaluatedResource()) 
45204          composeReference(null, e);
45205        closeArray();
45206      };
45207  }
45208
45209  protected void composeMeasureReportMeasureReportGroupComponent(String name, MeasureReport.MeasureReportGroupComponent element) throws IOException {
45210    if (element != null) {
45211      open(name);
45212      composeMeasureReportMeasureReportGroupComponentInner(element);
45213      close();
45214    }
45215  }
45216
45217  protected void composeMeasureReportMeasureReportGroupComponentInner(MeasureReport.MeasureReportGroupComponent element) throws IOException {
45218      composeBackbone(element);
45219      if (element.hasCode()) {
45220        composeCodeableConcept("code", element.getCode());
45221      }
45222      if (element.hasPopulation()) {
45223        openArray("population");
45224        for (MeasureReport.MeasureReportGroupPopulationComponent e : element.getPopulation()) 
45225          composeMeasureReportMeasureReportGroupPopulationComponent(null, e);
45226        closeArray();
45227      };
45228      if (element.hasMeasureScore()) {
45229        composeQuantity("measureScore", element.getMeasureScore());
45230      }
45231      if (element.hasStratifier()) {
45232        openArray("stratifier");
45233        for (MeasureReport.MeasureReportGroupStratifierComponent e : element.getStratifier()) 
45234          composeMeasureReportMeasureReportGroupStratifierComponent(null, e);
45235        closeArray();
45236      };
45237  }
45238
45239  protected void composeMeasureReportMeasureReportGroupPopulationComponent(String name, MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
45240    if (element != null) {
45241      open(name);
45242      composeMeasureReportMeasureReportGroupPopulationComponentInner(element);
45243      close();
45244    }
45245  }
45246
45247  protected void composeMeasureReportMeasureReportGroupPopulationComponentInner(MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
45248      composeBackbone(element);
45249      if (element.hasCode()) {
45250        composeCodeableConcept("code", element.getCode());
45251      }
45252      if (element.hasCountElement()) {
45253        composeIntegerCore("count", element.getCountElement(), false);
45254        composeIntegerExtras("count", element.getCountElement(), false);
45255      }
45256      if (element.hasSubjectResults()) {
45257        composeReference("subjectResults", element.getSubjectResults());
45258      }
45259  }
45260
45261  protected void composeMeasureReportMeasureReportGroupStratifierComponent(String name, MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
45262    if (element != null) {
45263      open(name);
45264      composeMeasureReportMeasureReportGroupStratifierComponentInner(element);
45265      close();
45266    }
45267  }
45268
45269  protected void composeMeasureReportMeasureReportGroupStratifierComponentInner(MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
45270      composeBackbone(element);
45271      if (element.hasCode()) {
45272        openArray("code");
45273        for (CodeableConcept e : element.getCode()) 
45274          composeCodeableConcept(null, e);
45275        closeArray();
45276      };
45277      if (element.hasStratum()) {
45278        openArray("stratum");
45279        for (MeasureReport.StratifierGroupComponent e : element.getStratum()) 
45280          composeMeasureReportStratifierGroupComponent(null, e);
45281        closeArray();
45282      };
45283  }
45284
45285  protected void composeMeasureReportStratifierGroupComponent(String name, MeasureReport.StratifierGroupComponent element) throws IOException {
45286    if (element != null) {
45287      open(name);
45288      composeMeasureReportStratifierGroupComponentInner(element);
45289      close();
45290    }
45291  }
45292
45293  protected void composeMeasureReportStratifierGroupComponentInner(MeasureReport.StratifierGroupComponent element) throws IOException {
45294      composeBackbone(element);
45295      if (element.hasValue()) {
45296        composeCodeableConcept("value", element.getValue());
45297      }
45298      if (element.hasComponent()) {
45299        openArray("component");
45300        for (MeasureReport.StratifierGroupComponentComponent e : element.getComponent()) 
45301          composeMeasureReportStratifierGroupComponentComponent(null, e);
45302        closeArray();
45303      };
45304      if (element.hasPopulation()) {
45305        openArray("population");
45306        for (MeasureReport.StratifierGroupPopulationComponent e : element.getPopulation()) 
45307          composeMeasureReportStratifierGroupPopulationComponent(null, e);
45308        closeArray();
45309      };
45310      if (element.hasMeasureScore()) {
45311        composeQuantity("measureScore", element.getMeasureScore());
45312      }
45313  }
45314
45315  protected void composeMeasureReportStratifierGroupComponentComponent(String name, MeasureReport.StratifierGroupComponentComponent element) throws IOException {
45316    if (element != null) {
45317      open(name);
45318      composeMeasureReportStratifierGroupComponentComponentInner(element);
45319      close();
45320    }
45321  }
45322
45323  protected void composeMeasureReportStratifierGroupComponentComponentInner(MeasureReport.StratifierGroupComponentComponent element) throws IOException {
45324      composeBackbone(element);
45325      if (element.hasCode()) {
45326        composeCodeableConcept("code", element.getCode());
45327      }
45328      if (element.hasValue()) {
45329        composeCodeableConcept("value", element.getValue());
45330      }
45331  }
45332
45333  protected void composeMeasureReportStratifierGroupPopulationComponent(String name, MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
45334    if (element != null) {
45335      open(name);
45336      composeMeasureReportStratifierGroupPopulationComponentInner(element);
45337      close();
45338    }
45339  }
45340
45341  protected void composeMeasureReportStratifierGroupPopulationComponentInner(MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
45342      composeBackbone(element);
45343      if (element.hasCode()) {
45344        composeCodeableConcept("code", element.getCode());
45345      }
45346      if (element.hasCountElement()) {
45347        composeIntegerCore("count", element.getCountElement(), false);
45348        composeIntegerExtras("count", element.getCountElement(), false);
45349      }
45350      if (element.hasSubjectResults()) {
45351        composeReference("subjectResults", element.getSubjectResults());
45352      }
45353  }
45354
45355  protected void composeMedia(String name, Media element) throws IOException {
45356    if (element != null) {
45357      prop("resourceType", name);
45358      composeMediaInner(element);
45359    }
45360  }
45361
45362  protected void composeMediaInner(Media element) throws IOException {
45363      composeDomainResourceElements(element);
45364      if (element.hasIdentifier()) {
45365        openArray("identifier");
45366        for (Identifier e : element.getIdentifier()) 
45367          composeIdentifier(null, e);
45368        closeArray();
45369      };
45370      if (element.hasBasedOn()) {
45371        openArray("basedOn");
45372        for (Reference e : element.getBasedOn()) 
45373          composeReference(null, e);
45374        closeArray();
45375      };
45376      if (element.hasPartOf()) {
45377        openArray("partOf");
45378        for (Reference e : element.getPartOf()) 
45379          composeReference(null, e);
45380        closeArray();
45381      };
45382      if (element.hasStatusElement()) {
45383        composeEnumerationCore("status", element.getStatusElement(), new Media.MediaStatusEnumFactory(), false);
45384        composeEnumerationExtras("status", element.getStatusElement(), new Media.MediaStatusEnumFactory(), false);
45385      }
45386      if (element.hasType()) {
45387        composeCodeableConcept("type", element.getType());
45388      }
45389      if (element.hasModality()) {
45390        composeCodeableConcept("modality", element.getModality());
45391      }
45392      if (element.hasView()) {
45393        composeCodeableConcept("view", element.getView());
45394      }
45395      if (element.hasSubject()) {
45396        composeReference("subject", element.getSubject());
45397      }
45398      if (element.hasEncounter()) {
45399        composeReference("encounter", element.getEncounter());
45400      }
45401      if (element.hasCreated()) {
45402        composeType("created", element.getCreated());
45403      }
45404      if (element.hasIssuedElement()) {
45405        composeInstantCore("issued", element.getIssuedElement(), false);
45406        composeInstantExtras("issued", element.getIssuedElement(), false);
45407      }
45408      if (element.hasOperator()) {
45409        composeReference("operator", element.getOperator());
45410      }
45411      if (element.hasReasonCode()) {
45412        openArray("reasonCode");
45413        for (CodeableConcept e : element.getReasonCode()) 
45414          composeCodeableConcept(null, e);
45415        closeArray();
45416      };
45417      if (element.hasBodySite()) {
45418        composeCodeableConcept("bodySite", element.getBodySite());
45419      }
45420      if (element.hasDeviceNameElement()) {
45421        composeStringCore("deviceName", element.getDeviceNameElement(), false);
45422        composeStringExtras("deviceName", element.getDeviceNameElement(), false);
45423      }
45424      if (element.hasDevice()) {
45425        composeReference("device", element.getDevice());
45426      }
45427      if (element.hasHeightElement()) {
45428        composePositiveIntCore("height", element.getHeightElement(), false);
45429        composePositiveIntExtras("height", element.getHeightElement(), false);
45430      }
45431      if (element.hasWidthElement()) {
45432        composePositiveIntCore("width", element.getWidthElement(), false);
45433        composePositiveIntExtras("width", element.getWidthElement(), false);
45434      }
45435      if (element.hasFramesElement()) {
45436        composePositiveIntCore("frames", element.getFramesElement(), false);
45437        composePositiveIntExtras("frames", element.getFramesElement(), false);
45438      }
45439      if (element.hasDurationElement()) {
45440        composeDecimalCore("duration", element.getDurationElement(), false);
45441        composeDecimalExtras("duration", element.getDurationElement(), false);
45442      }
45443      if (element.hasContent()) {
45444        composeAttachment("content", element.getContent());
45445      }
45446      if (element.hasNote()) {
45447        openArray("note");
45448        for (Annotation e : element.getNote()) 
45449          composeAnnotation(null, e);
45450        closeArray();
45451      };
45452  }
45453
45454  protected void composeMedication(String name, Medication element) throws IOException {
45455    if (element != null) {
45456      prop("resourceType", name);
45457      composeMedicationInner(element);
45458    }
45459  }
45460
45461  protected void composeMedicationInner(Medication element) throws IOException {
45462      composeDomainResourceElements(element);
45463      if (element.hasIdentifier()) {
45464        openArray("identifier");
45465        for (Identifier e : element.getIdentifier()) 
45466          composeIdentifier(null, e);
45467        closeArray();
45468      };
45469      if (element.hasCode()) {
45470        composeCodeableConcept("code", element.getCode());
45471      }
45472      if (element.hasStatusElement()) {
45473        composeEnumerationCore("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(), false);
45474        composeEnumerationExtras("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(), false);
45475      }
45476      if (element.hasManufacturer()) {
45477        composeReference("manufacturer", element.getManufacturer());
45478      }
45479      if (element.hasForm()) {
45480        composeCodeableConcept("form", element.getForm());
45481      }
45482      if (element.hasAmount()) {
45483        composeRatio("amount", element.getAmount());
45484      }
45485      if (element.hasIngredient()) {
45486        openArray("ingredient");
45487        for (Medication.MedicationIngredientComponent e : element.getIngredient()) 
45488          composeMedicationMedicationIngredientComponent(null, e);
45489        closeArray();
45490      };
45491      if (element.hasBatch()) {
45492        composeMedicationMedicationBatchComponent("batch", element.getBatch());
45493      }
45494  }
45495
45496  protected void composeMedicationMedicationIngredientComponent(String name, Medication.MedicationIngredientComponent element) throws IOException {
45497    if (element != null) {
45498      open(name);
45499      composeMedicationMedicationIngredientComponentInner(element);
45500      close();
45501    }
45502  }
45503
45504  protected void composeMedicationMedicationIngredientComponentInner(Medication.MedicationIngredientComponent element) throws IOException {
45505      composeBackbone(element);
45506      if (element.hasItem()) {
45507        composeType("item", element.getItem());
45508      }
45509      if (element.hasIsActiveElement()) {
45510        composeBooleanCore("isActive", element.getIsActiveElement(), false);
45511        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
45512      }
45513      if (element.hasStrength()) {
45514        composeRatio("strength", element.getStrength());
45515      }
45516  }
45517
45518  protected void composeMedicationMedicationBatchComponent(String name, Medication.MedicationBatchComponent element) throws IOException {
45519    if (element != null) {
45520      open(name);
45521      composeMedicationMedicationBatchComponentInner(element);
45522      close();
45523    }
45524  }
45525
45526  protected void composeMedicationMedicationBatchComponentInner(Medication.MedicationBatchComponent element) throws IOException {
45527      composeBackbone(element);
45528      if (element.hasLotNumberElement()) {
45529        composeStringCore("lotNumber", element.getLotNumberElement(), false);
45530        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
45531      }
45532      if (element.hasExpirationDateElement()) {
45533        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
45534        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
45535      }
45536  }
45537
45538  protected void composeMedicationAdministration(String name, MedicationAdministration element) throws IOException {
45539    if (element != null) {
45540      prop("resourceType", name);
45541      composeMedicationAdministrationInner(element);
45542    }
45543  }
45544
45545  protected void composeMedicationAdministrationInner(MedicationAdministration element) throws IOException {
45546      composeDomainResourceElements(element);
45547      if (element.hasIdentifier()) {
45548        openArray("identifier");
45549        for (Identifier e : element.getIdentifier()) 
45550          composeIdentifier(null, e);
45551        closeArray();
45552      };
45553      if (element.hasInstantiates()) {
45554        openArray("instantiates");
45555        for (UriType e : element.getInstantiates()) 
45556          composeUriCore(null, e, true);
45557        closeArray();
45558        if (anyHasExtras(element.getInstantiates())) {
45559          openArray("_instantiates");
45560          for (UriType e : element.getInstantiates()) 
45561            composeUriExtras(null, e, true);
45562          closeArray();
45563        }
45564      };
45565      if (element.hasPartOf()) {
45566        openArray("partOf");
45567        for (Reference e : element.getPartOf()) 
45568          composeReference(null, e);
45569        closeArray();
45570      };
45571      if (element.hasStatusElement()) {
45572        composeEnumerationCore("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
45573        composeEnumerationExtras("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
45574      }
45575      if (element.hasStatusReason()) {
45576        openArray("statusReason");
45577        for (CodeableConcept e : element.getStatusReason()) 
45578          composeCodeableConcept(null, e);
45579        closeArray();
45580      };
45581      if (element.hasCategory()) {
45582        composeCodeableConcept("category", element.getCategory());
45583      }
45584      if (element.hasMedication()) {
45585        composeType("medication", element.getMedication());
45586      }
45587      if (element.hasSubject()) {
45588        composeReference("subject", element.getSubject());
45589      }
45590      if (element.hasContext()) {
45591        composeReference("context", element.getContext());
45592      }
45593      if (element.hasSupportingInformation()) {
45594        openArray("supportingInformation");
45595        for (Reference e : element.getSupportingInformation()) 
45596          composeReference(null, e);
45597        closeArray();
45598      };
45599      if (element.hasEffective()) {
45600        composeType("effective", element.getEffective());
45601      }
45602      if (element.hasPerformer()) {
45603        openArray("performer");
45604        for (MedicationAdministration.MedicationAdministrationPerformerComponent e : element.getPerformer()) 
45605          composeMedicationAdministrationMedicationAdministrationPerformerComponent(null, e);
45606        closeArray();
45607      };
45608      if (element.hasReasonCode()) {
45609        openArray("reasonCode");
45610        for (CodeableConcept e : element.getReasonCode()) 
45611          composeCodeableConcept(null, e);
45612        closeArray();
45613      };
45614      if (element.hasReasonReference()) {
45615        openArray("reasonReference");
45616        for (Reference e : element.getReasonReference()) 
45617          composeReference(null, e);
45618        closeArray();
45619      };
45620      if (element.hasRequest()) {
45621        composeReference("request", element.getRequest());
45622      }
45623      if (element.hasDevice()) {
45624        openArray("device");
45625        for (Reference e : element.getDevice()) 
45626          composeReference(null, e);
45627        closeArray();
45628      };
45629      if (element.hasNote()) {
45630        openArray("note");
45631        for (Annotation e : element.getNote()) 
45632          composeAnnotation(null, e);
45633        closeArray();
45634      };
45635      if (element.hasDosage()) {
45636        composeMedicationAdministrationMedicationAdministrationDosageComponent("dosage", element.getDosage());
45637      }
45638      if (element.hasEventHistory()) {
45639        openArray("eventHistory");
45640        for (Reference e : element.getEventHistory()) 
45641          composeReference(null, e);
45642        closeArray();
45643      };
45644  }
45645
45646  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponent(String name, MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
45647    if (element != null) {
45648      open(name);
45649      composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(element);
45650      close();
45651    }
45652  }
45653
45654  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
45655      composeBackbone(element);
45656      if (element.hasFunction()) {
45657        composeCodeableConcept("function", element.getFunction());
45658      }
45659      if (element.hasActor()) {
45660        composeReference("actor", element.getActor());
45661      }
45662  }
45663
45664  protected void composeMedicationAdministrationMedicationAdministrationDosageComponent(String name, MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
45665    if (element != null) {
45666      open(name);
45667      composeMedicationAdministrationMedicationAdministrationDosageComponentInner(element);
45668      close();
45669    }
45670  }
45671
45672  protected void composeMedicationAdministrationMedicationAdministrationDosageComponentInner(MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
45673      composeBackbone(element);
45674      if (element.hasTextElement()) {
45675        composeStringCore("text", element.getTextElement(), false);
45676        composeStringExtras("text", element.getTextElement(), false);
45677      }
45678      if (element.hasSite()) {
45679        composeCodeableConcept("site", element.getSite());
45680      }
45681      if (element.hasRoute()) {
45682        composeCodeableConcept("route", element.getRoute());
45683      }
45684      if (element.hasMethod()) {
45685        composeCodeableConcept("method", element.getMethod());
45686      }
45687      if (element.hasDose()) {
45688        composeQuantity("dose", element.getDose());
45689      }
45690      if (element.hasRate()) {
45691        composeType("rate", element.getRate());
45692      }
45693  }
45694
45695  protected void composeMedicationDispense(String name, MedicationDispense element) throws IOException {
45696    if (element != null) {
45697      prop("resourceType", name);
45698      composeMedicationDispenseInner(element);
45699    }
45700  }
45701
45702  protected void composeMedicationDispenseInner(MedicationDispense element) throws IOException {
45703      composeDomainResourceElements(element);
45704      if (element.hasIdentifier()) {
45705        openArray("identifier");
45706        for (Identifier e : element.getIdentifier()) 
45707          composeIdentifier(null, e);
45708        closeArray();
45709      };
45710      if (element.hasPartOf()) {
45711        openArray("partOf");
45712        for (Reference e : element.getPartOf()) 
45713          composeReference(null, e);
45714        closeArray();
45715      };
45716      if (element.hasStatusElement()) {
45717        composeEnumerationCore("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
45718        composeEnumerationExtras("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
45719      }
45720      if (element.hasStatusReason()) {
45721        composeType("statusReason", element.getStatusReason());
45722      }
45723      if (element.hasCategory()) {
45724        composeCodeableConcept("category", element.getCategory());
45725      }
45726      if (element.hasMedication()) {
45727        composeType("medication", element.getMedication());
45728      }
45729      if (element.hasSubject()) {
45730        composeReference("subject", element.getSubject());
45731      }
45732      if (element.hasContext()) {
45733        composeReference("context", element.getContext());
45734      }
45735      if (element.hasSupportingInformation()) {
45736        openArray("supportingInformation");
45737        for (Reference e : element.getSupportingInformation()) 
45738          composeReference(null, e);
45739        closeArray();
45740      };
45741      if (element.hasPerformer()) {
45742        openArray("performer");
45743        for (MedicationDispense.MedicationDispensePerformerComponent e : element.getPerformer()) 
45744          composeMedicationDispenseMedicationDispensePerformerComponent(null, e);
45745        closeArray();
45746      };
45747      if (element.hasLocation()) {
45748        composeReference("location", element.getLocation());
45749      }
45750      if (element.hasAuthorizingPrescription()) {
45751        openArray("authorizingPrescription");
45752        for (Reference e : element.getAuthorizingPrescription()) 
45753          composeReference(null, e);
45754        closeArray();
45755      };
45756      if (element.hasType()) {
45757        composeCodeableConcept("type", element.getType());
45758      }
45759      if (element.hasQuantity()) {
45760        composeQuantity("quantity", element.getQuantity());
45761      }
45762      if (element.hasDaysSupply()) {
45763        composeQuantity("daysSupply", element.getDaysSupply());
45764      }
45765      if (element.hasWhenPreparedElement()) {
45766        composeDateTimeCore("whenPrepared", element.getWhenPreparedElement(), false);
45767        composeDateTimeExtras("whenPrepared", element.getWhenPreparedElement(), false);
45768      }
45769      if (element.hasWhenHandedOverElement()) {
45770        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
45771        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
45772      }
45773      if (element.hasDestination()) {
45774        composeReference("destination", element.getDestination());
45775      }
45776      if (element.hasReceiver()) {
45777        openArray("receiver");
45778        for (Reference e : element.getReceiver()) 
45779          composeReference(null, e);
45780        closeArray();
45781      };
45782      if (element.hasNote()) {
45783        openArray("note");
45784        for (Annotation e : element.getNote()) 
45785          composeAnnotation(null, e);
45786        closeArray();
45787      };
45788      if (element.hasDosageInstruction()) {
45789        openArray("dosageInstruction");
45790        for (Dosage e : element.getDosageInstruction()) 
45791          composeDosage(null, e);
45792        closeArray();
45793      };
45794      if (element.hasSubstitution()) {
45795        composeMedicationDispenseMedicationDispenseSubstitutionComponent("substitution", element.getSubstitution());
45796      }
45797      if (element.hasDetectedIssue()) {
45798        openArray("detectedIssue");
45799        for (Reference e : element.getDetectedIssue()) 
45800          composeReference(null, e);
45801        closeArray();
45802      };
45803      if (element.hasEventHistory()) {
45804        openArray("eventHistory");
45805        for (Reference e : element.getEventHistory()) 
45806          composeReference(null, e);
45807        closeArray();
45808      };
45809  }
45810
45811  protected void composeMedicationDispenseMedicationDispensePerformerComponent(String name, MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
45812    if (element != null) {
45813      open(name);
45814      composeMedicationDispenseMedicationDispensePerformerComponentInner(element);
45815      close();
45816    }
45817  }
45818
45819  protected void composeMedicationDispenseMedicationDispensePerformerComponentInner(MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
45820      composeBackbone(element);
45821      if (element.hasFunction()) {
45822        composeCodeableConcept("function", element.getFunction());
45823      }
45824      if (element.hasActor()) {
45825        composeReference("actor", element.getActor());
45826      }
45827  }
45828
45829  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponent(String name, MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
45830    if (element != null) {
45831      open(name);
45832      composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(element);
45833      close();
45834    }
45835  }
45836
45837  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
45838      composeBackbone(element);
45839      if (element.hasWasSubstitutedElement()) {
45840        composeBooleanCore("wasSubstituted", element.getWasSubstitutedElement(), false);
45841        composeBooleanExtras("wasSubstituted", element.getWasSubstitutedElement(), false);
45842      }
45843      if (element.hasType()) {
45844        composeCodeableConcept("type", element.getType());
45845      }
45846      if (element.hasReason()) {
45847        openArray("reason");
45848        for (CodeableConcept e : element.getReason()) 
45849          composeCodeableConcept(null, e);
45850        closeArray();
45851      };
45852      if (element.hasResponsibleParty()) {
45853        openArray("responsibleParty");
45854        for (Reference e : element.getResponsibleParty()) 
45855          composeReference(null, e);
45856        closeArray();
45857      };
45858  }
45859
45860  protected void composeMedicationKnowledge(String name, MedicationKnowledge element) throws IOException {
45861    if (element != null) {
45862      prop("resourceType", name);
45863      composeMedicationKnowledgeInner(element);
45864    }
45865  }
45866
45867  protected void composeMedicationKnowledgeInner(MedicationKnowledge element) throws IOException {
45868      composeDomainResourceElements(element);
45869      if (element.hasCode()) {
45870        composeCodeableConcept("code", element.getCode());
45871      }
45872      if (element.hasStatusElement()) {
45873        composeEnumerationCore("status", element.getStatusElement(), new MedicationKnowledge.MedicationKnowledgeStatusEnumFactory(), false);
45874        composeEnumerationExtras("status", element.getStatusElement(), new MedicationKnowledge.MedicationKnowledgeStatusEnumFactory(), false);
45875      }
45876      if (element.hasManufacturer()) {
45877        composeReference("manufacturer", element.getManufacturer());
45878      }
45879      if (element.hasDoseForm()) {
45880        composeCodeableConcept("doseForm", element.getDoseForm());
45881      }
45882      if (element.hasAmount()) {
45883        composeQuantity("amount", element.getAmount());
45884      }
45885      if (element.hasSynonym()) {
45886        openArray("synonym");
45887        for (StringType e : element.getSynonym()) 
45888          composeStringCore(null, e, true);
45889        closeArray();
45890        if (anyHasExtras(element.getSynonym())) {
45891          openArray("_synonym");
45892          for (StringType e : element.getSynonym()) 
45893            composeStringExtras(null, e, true);
45894          closeArray();
45895        }
45896      };
45897      if (element.hasRelatedMedicationKnowledge()) {
45898        openArray("relatedMedicationKnowledge");
45899        for (MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent e : element.getRelatedMedicationKnowledge()) 
45900          composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(null, e);
45901        closeArray();
45902      };
45903      if (element.hasAssociatedMedication()) {
45904        openArray("associatedMedication");
45905        for (Reference e : element.getAssociatedMedication()) 
45906          composeReference(null, e);
45907        closeArray();
45908      };
45909      if (element.hasProductType()) {
45910        openArray("productType");
45911        for (CodeableConcept e : element.getProductType()) 
45912          composeCodeableConcept(null, e);
45913        closeArray();
45914      };
45915      if (element.hasMonograph()) {
45916        openArray("monograph");
45917        for (MedicationKnowledge.MedicationKnowledgeMonographComponent e : element.getMonograph()) 
45918          composeMedicationKnowledgeMedicationKnowledgeMonographComponent(null, e);
45919        closeArray();
45920      };
45921      if (element.hasIngredient()) {
45922        openArray("ingredient");
45923        for (MedicationKnowledge.MedicationKnowledgeIngredientComponent e : element.getIngredient()) 
45924          composeMedicationKnowledgeMedicationKnowledgeIngredientComponent(null, e);
45925        closeArray();
45926      };
45927      if (element.hasPreparationInstructionElement()) {
45928        composeMarkdownCore("preparationInstruction", element.getPreparationInstructionElement(), false);
45929        composeMarkdownExtras("preparationInstruction", element.getPreparationInstructionElement(), false);
45930      }
45931      if (element.hasIntendedRoute()) {
45932        openArray("intendedRoute");
45933        for (CodeableConcept e : element.getIntendedRoute()) 
45934          composeCodeableConcept(null, e);
45935        closeArray();
45936      };
45937      if (element.hasCost()) {
45938        openArray("cost");
45939        for (MedicationKnowledge.MedicationKnowledgeCostComponent e : element.getCost()) 
45940          composeMedicationKnowledgeMedicationKnowledgeCostComponent(null, e);
45941        closeArray();
45942      };
45943      if (element.hasMonitoringProgram()) {
45944        openArray("monitoringProgram");
45945        for (MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent e : element.getMonitoringProgram()) 
45946          composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(null, e);
45947        closeArray();
45948      };
45949      if (element.hasAdministrationGuidelines()) {
45950        openArray("administrationGuidelines");
45951        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent e : element.getAdministrationGuidelines()) 
45952          composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(null, e);
45953        closeArray();
45954      };
45955      if (element.hasMedicineClassification()) {
45956        openArray("medicineClassification");
45957        for (MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent e : element.getMedicineClassification()) 
45958          composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(null, e);
45959        closeArray();
45960      };
45961      if (element.hasPackaging()) {
45962        composeMedicationKnowledgeMedicationKnowledgePackagingComponent("packaging", element.getPackaging());
45963      }
45964      if (element.hasDrugCharacteristic()) {
45965        openArray("drugCharacteristic");
45966        for (MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent e : element.getDrugCharacteristic()) 
45967          composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(null, e);
45968        closeArray();
45969      };
45970      if (element.hasContraindication()) {
45971        openArray("contraindication");
45972        for (Reference e : element.getContraindication()) 
45973          composeReference(null, e);
45974        closeArray();
45975      };
45976      if (element.hasRegulatory()) {
45977        openArray("regulatory");
45978        for (MedicationKnowledge.MedicationKnowledgeRegulatoryComponent e : element.getRegulatory()) 
45979          composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(null, e);
45980        closeArray();
45981      };
45982      if (element.hasKinetics()) {
45983        openArray("kinetics");
45984        for (MedicationKnowledge.MedicationKnowledgeKineticsComponent e : element.getKinetics()) 
45985          composeMedicationKnowledgeMedicationKnowledgeKineticsComponent(null, e);
45986        closeArray();
45987      };
45988  }
45989
45990  protected void composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(String name, MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
45991    if (element != null) {
45992      open(name);
45993      composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentInner(element);
45994      close();
45995    }
45996  }
45997
45998  protected void composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentInner(MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
45999      composeBackbone(element);
46000      if (element.hasType()) {
46001        composeCodeableConcept("type", element.getType());
46002      }
46003      if (element.hasReference()) {
46004        openArray("reference");
46005        for (Reference e : element.getReference()) 
46006          composeReference(null, e);
46007        closeArray();
46008      };
46009  }
46010
46011  protected void composeMedicationKnowledgeMedicationKnowledgeMonographComponent(String name, MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
46012    if (element != null) {
46013      open(name);
46014      composeMedicationKnowledgeMedicationKnowledgeMonographComponentInner(element);
46015      close();
46016    }
46017  }
46018
46019  protected void composeMedicationKnowledgeMedicationKnowledgeMonographComponentInner(MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
46020      composeBackbone(element);
46021      if (element.hasType()) {
46022        composeCodeableConcept("type", element.getType());
46023      }
46024      if (element.hasSource()) {
46025        composeReference("source", element.getSource());
46026      }
46027  }
46028
46029  protected void composeMedicationKnowledgeMedicationKnowledgeIngredientComponent(String name, MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
46030    if (element != null) {
46031      open(name);
46032      composeMedicationKnowledgeMedicationKnowledgeIngredientComponentInner(element);
46033      close();
46034    }
46035  }
46036
46037  protected void composeMedicationKnowledgeMedicationKnowledgeIngredientComponentInner(MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
46038      composeBackbone(element);
46039      if (element.hasItem()) {
46040        composeType("item", element.getItem());
46041      }
46042      if (element.hasIsActiveElement()) {
46043        composeBooleanCore("isActive", element.getIsActiveElement(), false);
46044        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
46045      }
46046      if (element.hasStrength()) {
46047        composeRatio("strength", element.getStrength());
46048      }
46049  }
46050
46051  protected void composeMedicationKnowledgeMedicationKnowledgeCostComponent(String name, MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
46052    if (element != null) {
46053      open(name);
46054      composeMedicationKnowledgeMedicationKnowledgeCostComponentInner(element);
46055      close();
46056    }
46057  }
46058
46059  protected void composeMedicationKnowledgeMedicationKnowledgeCostComponentInner(MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
46060      composeBackbone(element);
46061      if (element.hasType()) {
46062        composeCodeableConcept("type", element.getType());
46063      }
46064      if (element.hasSourceElement()) {
46065        composeStringCore("source", element.getSourceElement(), false);
46066        composeStringExtras("source", element.getSourceElement(), false);
46067      }
46068      if (element.hasCost()) {
46069        composeMoney("cost", element.getCost());
46070      }
46071  }
46072
46073  protected void composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(String name, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
46074    if (element != null) {
46075      open(name);
46076      composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentInner(element);
46077      close();
46078    }
46079  }
46080
46081  protected void composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentInner(MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
46082      composeBackbone(element);
46083      if (element.hasType()) {
46084        composeCodeableConcept("type", element.getType());
46085      }
46086      if (element.hasNameElement()) {
46087        composeStringCore("name", element.getNameElement(), false);
46088        composeStringExtras("name", element.getNameElement(), false);
46089      }
46090  }
46091
46092  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent element) throws IOException {
46093    if (element != null) {
46094      open(name);
46095      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentInner(element);
46096      close();
46097    }
46098  }
46099
46100  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentInner(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent element) throws IOException {
46101      composeBackbone(element);
46102      if (element.hasDosage()) {
46103        openArray("dosage");
46104        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent e : element.getDosage()) 
46105          composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(null, e);
46106        closeArray();
46107      };
46108      if (element.hasIndication()) {
46109        composeType("indication", element.getIndication());
46110      }
46111      if (element.hasPatientCharacteristics()) {
46112        openArray("patientCharacteristics");
46113        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent e : element.getPatientCharacteristics()) 
46114          composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(null, e);
46115        closeArray();
46116      };
46117  }
46118
46119  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent element) throws IOException {
46120    if (element != null) {
46121      open(name);
46122      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentInner(element);
46123      close();
46124    }
46125  }
46126
46127  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentInner(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent element) throws IOException {
46128      composeBackbone(element);
46129      if (element.hasType()) {
46130        composeCodeableConcept("type", element.getType());
46131      }
46132      if (element.hasDosage()) {
46133        openArray("dosage");
46134        for (Dosage e : element.getDosage()) 
46135          composeDosage(null, e);
46136        closeArray();
46137      };
46138  }
46139
46140  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent element) throws IOException {
46141    if (element != null) {
46142      open(name);
46143      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentInner(element);
46144      close();
46145    }
46146  }
46147
46148  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentInner(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent element) throws IOException {
46149      composeBackbone(element);
46150      if (element.hasCharacteristic()) {
46151        composeType("characteristic", element.getCharacteristic());
46152      }
46153      if (element.hasValue()) {
46154        openArray("value");
46155        for (StringType e : element.getValue()) 
46156          composeStringCore(null, e, true);
46157        closeArray();
46158        if (anyHasExtras(element.getValue())) {
46159          openArray("_value");
46160          for (StringType e : element.getValue()) 
46161            composeStringExtras(null, e, true);
46162          closeArray();
46163        }
46164      };
46165  }
46166
46167  protected void composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(String name, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
46168    if (element != null) {
46169      open(name);
46170      composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentInner(element);
46171      close();
46172    }
46173  }
46174
46175  protected void composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentInner(MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
46176      composeBackbone(element);
46177      if (element.hasType()) {
46178        composeCodeableConcept("type", element.getType());
46179      }
46180      if (element.hasClassification()) {
46181        openArray("classification");
46182        for (CodeableConcept e : element.getClassification()) 
46183          composeCodeableConcept(null, e);
46184        closeArray();
46185      };
46186  }
46187
46188  protected void composeMedicationKnowledgeMedicationKnowledgePackagingComponent(String name, MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
46189    if (element != null) {
46190      open(name);
46191      composeMedicationKnowledgeMedicationKnowledgePackagingComponentInner(element);
46192      close();
46193    }
46194  }
46195
46196  protected void composeMedicationKnowledgeMedicationKnowledgePackagingComponentInner(MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
46197      composeBackbone(element);
46198      if (element.hasType()) {
46199        composeCodeableConcept("type", element.getType());
46200      }
46201      if (element.hasQuantity()) {
46202        composeQuantity("quantity", element.getQuantity());
46203      }
46204  }
46205
46206  protected void composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(String name, MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
46207    if (element != null) {
46208      open(name);
46209      composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentInner(element);
46210      close();
46211    }
46212  }
46213
46214  protected void composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentInner(MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
46215      composeBackbone(element);
46216      if (element.hasType()) {
46217        composeCodeableConcept("type", element.getType());
46218      }
46219      if (element.hasValue()) {
46220        composeType("value", element.getValue());
46221      }
46222  }
46223
46224  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
46225    if (element != null) {
46226      open(name);
46227      composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponentInner(element);
46228      close();
46229    }
46230  }
46231
46232  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
46233      composeBackbone(element);
46234      if (element.hasRegulatoryAuthority()) {
46235        composeReference("regulatoryAuthority", element.getRegulatoryAuthority());
46236      }
46237      if (element.hasSubstitution()) {
46238        openArray("substitution");
46239        for (MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent e : element.getSubstitution()) 
46240          composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(null, e);
46241        closeArray();
46242      };
46243      if (element.hasSchedule()) {
46244        openArray("schedule");
46245        for (MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent e : element.getSchedule()) 
46246          composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(null, e);
46247        closeArray();
46248      };
46249      if (element.hasMaxDispense()) {
46250        composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent("maxDispense", element.getMaxDispense());
46251      }
46252  }
46253
46254  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
46255    if (element != null) {
46256      open(name);
46257      composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentInner(element);
46258      close();
46259    }
46260  }
46261
46262  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
46263      composeBackbone(element);
46264      if (element.hasType()) {
46265        composeCodeableConcept("type", element.getType());
46266      }
46267      if (element.hasAllowedElement()) {
46268        composeBooleanCore("allowed", element.getAllowedElement(), false);
46269        composeBooleanExtras("allowed", element.getAllowedElement(), false);
46270      }
46271  }
46272
46273  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent element) throws IOException {
46274    if (element != null) {
46275      open(name);
46276      composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentInner(element);
46277      close();
46278    }
46279  }
46280
46281  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent element) throws IOException {
46282      composeBackbone(element);
46283      if (element.hasSchedule()) {
46284        composeCodeableConcept("schedule", element.getSchedule());
46285      }
46286  }
46287
46288  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
46289    if (element != null) {
46290      open(name);
46291      composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentInner(element);
46292      close();
46293    }
46294  }
46295
46296  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
46297      composeBackbone(element);
46298      if (element.hasQuantity()) {
46299        composeQuantity("quantity", element.getQuantity());
46300      }
46301      if (element.hasPeriod()) {
46302        composeDuration("period", element.getPeriod());
46303      }
46304  }
46305
46306  protected void composeMedicationKnowledgeMedicationKnowledgeKineticsComponent(String name, MedicationKnowledge.MedicationKnowledgeKineticsComponent element) throws IOException {
46307    if (element != null) {
46308      open(name);
46309      composeMedicationKnowledgeMedicationKnowledgeKineticsComponentInner(element);
46310      close();
46311    }
46312  }
46313
46314  protected void composeMedicationKnowledgeMedicationKnowledgeKineticsComponentInner(MedicationKnowledge.MedicationKnowledgeKineticsComponent element) throws IOException {
46315      composeBackbone(element);
46316      if (element.hasAreaUnderCurve()) {
46317        openArray("areaUnderCurve");
46318        for (Quantity e : element.getAreaUnderCurve()) 
46319          composeQuantity(null, e);
46320        closeArray();
46321      };
46322      if (element.hasLethalDose50()) {
46323        openArray("lethalDose50");
46324        for (Quantity e : element.getLethalDose50()) 
46325          composeQuantity(null, e);
46326        closeArray();
46327      };
46328      if (element.hasHalfLifePeriod()) {
46329        composeDuration("halfLifePeriod", element.getHalfLifePeriod());
46330      }
46331  }
46332
46333  protected void composeMedicationRequest(String name, MedicationRequest element) throws IOException {
46334    if (element != null) {
46335      prop("resourceType", name);
46336      composeMedicationRequestInner(element);
46337    }
46338  }
46339
46340  protected void composeMedicationRequestInner(MedicationRequest element) throws IOException {
46341      composeDomainResourceElements(element);
46342      if (element.hasIdentifier()) {
46343        openArray("identifier");
46344        for (Identifier e : element.getIdentifier()) 
46345          composeIdentifier(null, e);
46346        closeArray();
46347      };
46348      if (element.hasStatusElement()) {
46349        composeEnumerationCore("status", element.getStatusElement(), new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
46350        composeEnumerationExtras("status", element.getStatusElement(), new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
46351      }
46352      if (element.hasStatusReason()) {
46353        composeCodeableConcept("statusReason", element.getStatusReason());
46354      }
46355      if (element.hasIntentElement()) {
46356        composeEnumerationCore("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
46357        composeEnumerationExtras("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
46358      }
46359      if (element.hasCategory()) {
46360        openArray("category");
46361        for (CodeableConcept e : element.getCategory()) 
46362          composeCodeableConcept(null, e);
46363        closeArray();
46364      };
46365      if (element.hasPriorityElement()) {
46366        composeEnumerationCore("priority", element.getPriorityElement(), new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
46367        composeEnumerationExtras("priority", element.getPriorityElement(), new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
46368      }
46369      if (element.hasDoNotPerformElement()) {
46370        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
46371        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
46372      }
46373      if (element.hasReported()) {
46374        composeType("reported", element.getReported());
46375      }
46376      if (element.hasMedication()) {
46377        composeType("medication", element.getMedication());
46378      }
46379      if (element.hasSubject()) {
46380        composeReference("subject", element.getSubject());
46381      }
46382      if (element.hasEncounter()) {
46383        composeReference("encounter", element.getEncounter());
46384      }
46385      if (element.hasSupportingInformation()) {
46386        openArray("supportingInformation");
46387        for (Reference e : element.getSupportingInformation()) 
46388          composeReference(null, e);
46389        closeArray();
46390      };
46391      if (element.hasAuthoredOnElement()) {
46392        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
46393        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
46394      }
46395      if (element.hasRequester()) {
46396        composeReference("requester", element.getRequester());
46397      }
46398      if (element.hasPerformer()) {
46399        composeReference("performer", element.getPerformer());
46400      }
46401      if (element.hasPerformerType()) {
46402        composeCodeableConcept("performerType", element.getPerformerType());
46403      }
46404      if (element.hasRecorder()) {
46405        composeReference("recorder", element.getRecorder());
46406      }
46407      if (element.hasReasonCode()) {
46408        openArray("reasonCode");
46409        for (CodeableConcept e : element.getReasonCode()) 
46410          composeCodeableConcept(null, e);
46411        closeArray();
46412      };
46413      if (element.hasReasonReference()) {
46414        openArray("reasonReference");
46415        for (Reference e : element.getReasonReference()) 
46416          composeReference(null, e);
46417        closeArray();
46418      };
46419      if (element.hasInstantiatesCanonical()) {
46420        openArray("instantiatesCanonical");
46421        for (CanonicalType e : element.getInstantiatesCanonical()) 
46422          composeCanonicalCore(null, e, true);
46423        closeArray();
46424        if (anyHasExtras(element.getInstantiatesCanonical())) {
46425          openArray("_instantiatesCanonical");
46426          for (CanonicalType e : element.getInstantiatesCanonical()) 
46427            composeCanonicalExtras(null, e, true);
46428          closeArray();
46429        }
46430      };
46431      if (element.hasInstantiatesUri()) {
46432        openArray("instantiatesUri");
46433        for (UriType e : element.getInstantiatesUri()) 
46434          composeUriCore(null, e, true);
46435        closeArray();
46436        if (anyHasExtras(element.getInstantiatesUri())) {
46437          openArray("_instantiatesUri");
46438          for (UriType e : element.getInstantiatesUri()) 
46439            composeUriExtras(null, e, true);
46440          closeArray();
46441        }
46442      };
46443      if (element.hasBasedOn()) {
46444        openArray("basedOn");
46445        for (Reference e : element.getBasedOn()) 
46446          composeReference(null, e);
46447        closeArray();
46448      };
46449      if (element.hasGroupIdentifier()) {
46450        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
46451      }
46452      if (element.hasCourseOfTherapyType()) {
46453        composeCodeableConcept("courseOfTherapyType", element.getCourseOfTherapyType());
46454      }
46455      if (element.hasInsurance()) {
46456        openArray("insurance");
46457        for (Reference e : element.getInsurance()) 
46458          composeReference(null, e);
46459        closeArray();
46460      };
46461      if (element.hasNote()) {
46462        openArray("note");
46463        for (Annotation e : element.getNote()) 
46464          composeAnnotation(null, e);
46465        closeArray();
46466      };
46467      if (element.hasDosageInstruction()) {
46468        openArray("dosageInstruction");
46469        for (Dosage e : element.getDosageInstruction()) 
46470          composeDosage(null, e);
46471        closeArray();
46472      };
46473      if (element.hasDispenseRequest()) {
46474        composeMedicationRequestMedicationRequestDispenseRequestComponent("dispenseRequest", element.getDispenseRequest());
46475      }
46476      if (element.hasSubstitution()) {
46477        composeMedicationRequestMedicationRequestSubstitutionComponent("substitution", element.getSubstitution());
46478      }
46479      if (element.hasPriorPrescription()) {
46480        composeReference("priorPrescription", element.getPriorPrescription());
46481      }
46482      if (element.hasDetectedIssue()) {
46483        openArray("detectedIssue");
46484        for (Reference e : element.getDetectedIssue()) 
46485          composeReference(null, e);
46486        closeArray();
46487      };
46488      if (element.hasEventHistory()) {
46489        openArray("eventHistory");
46490        for (Reference e : element.getEventHistory()) 
46491          composeReference(null, e);
46492        closeArray();
46493      };
46494  }
46495
46496  protected void composeMedicationRequestMedicationRequestDispenseRequestComponent(String name, MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
46497    if (element != null) {
46498      open(name);
46499      composeMedicationRequestMedicationRequestDispenseRequestComponentInner(element);
46500      close();
46501    }
46502  }
46503
46504  protected void composeMedicationRequestMedicationRequestDispenseRequestComponentInner(MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
46505      composeBackbone(element);
46506      if (element.hasInitialFill()) {
46507        composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponent("initialFill", element.getInitialFill());
46508      }
46509      if (element.hasDispenseInterval()) {
46510        composeDuration("dispenseInterval", element.getDispenseInterval());
46511      }
46512      if (element.hasValidityPeriod()) {
46513        composePeriod("validityPeriod", element.getValidityPeriod());
46514      }
46515      if (element.hasNumberOfRepeatsAllowedElement()) {
46516        composeUnsignedIntCore("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
46517        composeUnsignedIntExtras("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
46518      }
46519      if (element.hasQuantity()) {
46520        composeQuantity("quantity", element.getQuantity());
46521      }
46522      if (element.hasExpectedSupplyDuration()) {
46523        composeDuration("expectedSupplyDuration", element.getExpectedSupplyDuration());
46524      }
46525      if (element.hasPerformer()) {
46526        composeReference("performer", element.getPerformer());
46527      }
46528  }
46529
46530  protected void composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(String name, MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
46531    if (element != null) {
46532      open(name);
46533      composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponentInner(element);
46534      close();
46535    }
46536  }
46537
46538  protected void composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponentInner(MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
46539      composeBackbone(element);
46540      if (element.hasQuantity()) {
46541        composeQuantity("quantity", element.getQuantity());
46542      }
46543      if (element.hasDuration()) {
46544        composeDuration("duration", element.getDuration());
46545      }
46546  }
46547
46548  protected void composeMedicationRequestMedicationRequestSubstitutionComponent(String name, MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
46549    if (element != null) {
46550      open(name);
46551      composeMedicationRequestMedicationRequestSubstitutionComponentInner(element);
46552      close();
46553    }
46554  }
46555
46556  protected void composeMedicationRequestMedicationRequestSubstitutionComponentInner(MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
46557      composeBackbone(element);
46558      if (element.hasAllowed()) {
46559        composeType("allowed", element.getAllowed());
46560      }
46561      if (element.hasReason()) {
46562        composeCodeableConcept("reason", element.getReason());
46563      }
46564  }
46565
46566  protected void composeMedicationStatement(String name, MedicationStatement element) throws IOException {
46567    if (element != null) {
46568      prop("resourceType", name);
46569      composeMedicationStatementInner(element);
46570    }
46571  }
46572
46573  protected void composeMedicationStatementInner(MedicationStatement element) throws IOException {
46574      composeDomainResourceElements(element);
46575      if (element.hasIdentifier()) {
46576        openArray("identifier");
46577        for (Identifier e : element.getIdentifier()) 
46578          composeIdentifier(null, e);
46579        closeArray();
46580      };
46581      if (element.hasBasedOn()) {
46582        openArray("basedOn");
46583        for (Reference e : element.getBasedOn()) 
46584          composeReference(null, e);
46585        closeArray();
46586      };
46587      if (element.hasPartOf()) {
46588        openArray("partOf");
46589        for (Reference e : element.getPartOf()) 
46590          composeReference(null, e);
46591        closeArray();
46592      };
46593      if (element.hasStatusElement()) {
46594        composeEnumerationCore("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
46595        composeEnumerationExtras("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
46596      }
46597      if (element.hasStatusReason()) {
46598        openArray("statusReason");
46599        for (CodeableConcept e : element.getStatusReason()) 
46600          composeCodeableConcept(null, e);
46601        closeArray();
46602      };
46603      if (element.hasCategory()) {
46604        composeCodeableConcept("category", element.getCategory());
46605      }
46606      if (element.hasMedication()) {
46607        composeType("medication", element.getMedication());
46608      }
46609      if (element.hasSubject()) {
46610        composeReference("subject", element.getSubject());
46611      }
46612      if (element.hasContext()) {
46613        composeReference("context", element.getContext());
46614      }
46615      if (element.hasEffective()) {
46616        composeType("effective", element.getEffective());
46617      }
46618      if (element.hasDateAssertedElement()) {
46619        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
46620        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
46621      }
46622      if (element.hasInformationSource()) {
46623        composeReference("informationSource", element.getInformationSource());
46624      }
46625      if (element.hasDerivedFrom()) {
46626        openArray("derivedFrom");
46627        for (Reference e : element.getDerivedFrom()) 
46628          composeReference(null, e);
46629        closeArray();
46630      };
46631      if (element.hasReasonCode()) {
46632        openArray("reasonCode");
46633        for (CodeableConcept e : element.getReasonCode()) 
46634          composeCodeableConcept(null, e);
46635        closeArray();
46636      };
46637      if (element.hasReasonReference()) {
46638        openArray("reasonReference");
46639        for (Reference e : element.getReasonReference()) 
46640          composeReference(null, e);
46641        closeArray();
46642      };
46643      if (element.hasNote()) {
46644        openArray("note");
46645        for (Annotation e : element.getNote()) 
46646          composeAnnotation(null, e);
46647        closeArray();
46648      };
46649      if (element.hasDosage()) {
46650        openArray("dosage");
46651        for (Dosage e : element.getDosage()) 
46652          composeDosage(null, e);
46653        closeArray();
46654      };
46655  }
46656
46657  protected void composeMedicinalProduct(String name, MedicinalProduct element) throws IOException {
46658    if (element != null) {
46659      prop("resourceType", name);
46660      composeMedicinalProductInner(element);
46661    }
46662  }
46663
46664  protected void composeMedicinalProductInner(MedicinalProduct element) throws IOException {
46665      composeDomainResourceElements(element);
46666      if (element.hasIdentifier()) {
46667        openArray("identifier");
46668        for (Identifier e : element.getIdentifier()) 
46669          composeIdentifier(null, e);
46670        closeArray();
46671      };
46672      if (element.hasType()) {
46673        composeCodeableConcept("type", element.getType());
46674      }
46675      if (element.hasDomain()) {
46676        composeCoding("domain", element.getDomain());
46677      }
46678      if (element.hasCombinedPharmaceuticalDoseForm()) {
46679        composeCodeableConcept("combinedPharmaceuticalDoseForm", element.getCombinedPharmaceuticalDoseForm());
46680      }
46681      if (element.hasLegalStatusOfSupply()) {
46682        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
46683      }
46684      if (element.hasAdditionalMonitoringIndicator()) {
46685        composeCodeableConcept("additionalMonitoringIndicator", element.getAdditionalMonitoringIndicator());
46686      }
46687      if (element.hasSpecialMeasures()) {
46688        openArray("specialMeasures");
46689        for (StringType e : element.getSpecialMeasures()) 
46690          composeStringCore(null, e, true);
46691        closeArray();
46692        if (anyHasExtras(element.getSpecialMeasures())) {
46693          openArray("_specialMeasures");
46694          for (StringType e : element.getSpecialMeasures()) 
46695            composeStringExtras(null, e, true);
46696          closeArray();
46697        }
46698      };
46699      if (element.hasPaediatricUseIndicator()) {
46700        composeCodeableConcept("paediatricUseIndicator", element.getPaediatricUseIndicator());
46701      }
46702      if (element.hasProductClassification()) {
46703        openArray("productClassification");
46704        for (CodeableConcept e : element.getProductClassification()) 
46705          composeCodeableConcept(null, e);
46706        closeArray();
46707      };
46708      if (element.hasMarketingStatus()) {
46709        openArray("marketingStatus");
46710        for (MarketingStatus e : element.getMarketingStatus()) 
46711          composeMarketingStatus(null, e);
46712        closeArray();
46713      };
46714      if (element.hasPharmaceuticalProduct()) {
46715        openArray("pharmaceuticalProduct");
46716        for (Reference e : element.getPharmaceuticalProduct()) 
46717          composeReference(null, e);
46718        closeArray();
46719      };
46720      if (element.hasPackagedMedicinalProduct()) {
46721        openArray("packagedMedicinalProduct");
46722        for (Reference e : element.getPackagedMedicinalProduct()) 
46723          composeReference(null, e);
46724        closeArray();
46725      };
46726      if (element.hasAttachedDocument()) {
46727        openArray("attachedDocument");
46728        for (Reference e : element.getAttachedDocument()) 
46729          composeReference(null, e);
46730        closeArray();
46731      };
46732      if (element.hasMasterFile()) {
46733        openArray("masterFile");
46734        for (Reference e : element.getMasterFile()) 
46735          composeReference(null, e);
46736        closeArray();
46737      };
46738      if (element.hasContact()) {
46739        openArray("contact");
46740        for (Reference e : element.getContact()) 
46741          composeReference(null, e);
46742        closeArray();
46743      };
46744      if (element.hasClinicalTrial()) {
46745        openArray("clinicalTrial");
46746        for (Reference e : element.getClinicalTrial()) 
46747          composeReference(null, e);
46748        closeArray();
46749      };
46750      if (element.hasName()) {
46751        openArray("name");
46752        for (MedicinalProduct.MedicinalProductNameComponent e : element.getName()) 
46753          composeMedicinalProductMedicinalProductNameComponent(null, e);
46754        closeArray();
46755      };
46756      if (element.hasCrossReference()) {
46757        openArray("crossReference");
46758        for (Identifier e : element.getCrossReference()) 
46759          composeIdentifier(null, e);
46760        closeArray();
46761      };
46762      if (element.hasManufacturingBusinessOperation()) {
46763        openArray("manufacturingBusinessOperation");
46764        for (MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent e : element.getManufacturingBusinessOperation()) 
46765          composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(null, e);
46766        closeArray();
46767      };
46768      if (element.hasSpecialDesignation()) {
46769        openArray("specialDesignation");
46770        for (MedicinalProduct.MedicinalProductSpecialDesignationComponent e : element.getSpecialDesignation()) 
46771          composeMedicinalProductMedicinalProductSpecialDesignationComponent(null, e);
46772        closeArray();
46773      };
46774  }
46775
46776  protected void composeMedicinalProductMedicinalProductNameComponent(String name, MedicinalProduct.MedicinalProductNameComponent element) throws IOException {
46777    if (element != null) {
46778      open(name);
46779      composeMedicinalProductMedicinalProductNameComponentInner(element);
46780      close();
46781    }
46782  }
46783
46784  protected void composeMedicinalProductMedicinalProductNameComponentInner(MedicinalProduct.MedicinalProductNameComponent element) throws IOException {
46785      composeBackbone(element);
46786      if (element.hasProductNameElement()) {
46787        composeStringCore("productName", element.getProductNameElement(), false);
46788        composeStringExtras("productName", element.getProductNameElement(), false);
46789      }
46790      if (element.hasNamePart()) {
46791        openArray("namePart");
46792        for (MedicinalProduct.MedicinalProductNameNamePartComponent e : element.getNamePart()) 
46793          composeMedicinalProductMedicinalProductNameNamePartComponent(null, e);
46794        closeArray();
46795      };
46796      if (element.hasCountryLanguage()) {
46797        openArray("countryLanguage");
46798        for (MedicinalProduct.MedicinalProductNameCountryLanguageComponent e : element.getCountryLanguage()) 
46799          composeMedicinalProductMedicinalProductNameCountryLanguageComponent(null, e);
46800        closeArray();
46801      };
46802  }
46803
46804  protected void composeMedicinalProductMedicinalProductNameNamePartComponent(String name, MedicinalProduct.MedicinalProductNameNamePartComponent element) throws IOException {
46805    if (element != null) {
46806      open(name);
46807      composeMedicinalProductMedicinalProductNameNamePartComponentInner(element);
46808      close();
46809    }
46810  }
46811
46812  protected void composeMedicinalProductMedicinalProductNameNamePartComponentInner(MedicinalProduct.MedicinalProductNameNamePartComponent element) throws IOException {
46813      composeBackbone(element);
46814      if (element.hasPartElement()) {
46815        composeStringCore("part", element.getPartElement(), false);
46816        composeStringExtras("part", element.getPartElement(), false);
46817      }
46818      if (element.hasType()) {
46819        composeCoding("type", element.getType());
46820      }
46821  }
46822
46823  protected void composeMedicinalProductMedicinalProductNameCountryLanguageComponent(String name, MedicinalProduct.MedicinalProductNameCountryLanguageComponent element) throws IOException {
46824    if (element != null) {
46825      open(name);
46826      composeMedicinalProductMedicinalProductNameCountryLanguageComponentInner(element);
46827      close();
46828    }
46829  }
46830
46831  protected void composeMedicinalProductMedicinalProductNameCountryLanguageComponentInner(MedicinalProduct.MedicinalProductNameCountryLanguageComponent element) throws IOException {
46832      composeBackbone(element);
46833      if (element.hasCountry()) {
46834        composeCodeableConcept("country", element.getCountry());
46835      }
46836      if (element.hasJurisdiction()) {
46837        composeCodeableConcept("jurisdiction", element.getJurisdiction());
46838      }
46839      if (element.hasLanguage()) {
46840        composeCodeableConcept("language", element.getLanguage());
46841      }
46842  }
46843
46844  protected void composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(String name, MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent element) throws IOException {
46845    if (element != null) {
46846      open(name);
46847      composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponentInner(element);
46848      close();
46849    }
46850  }
46851
46852  protected void composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponentInner(MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent element) throws IOException {
46853      composeBackbone(element);
46854      if (element.hasOperationType()) {
46855        composeCodeableConcept("operationType", element.getOperationType());
46856      }
46857      if (element.hasAuthorisationReferenceNumber()) {
46858        composeIdentifier("authorisationReferenceNumber", element.getAuthorisationReferenceNumber());
46859      }
46860      if (element.hasEffectiveDateElement()) {
46861        composeDateTimeCore("effectiveDate", element.getEffectiveDateElement(), false);
46862        composeDateTimeExtras("effectiveDate", element.getEffectiveDateElement(), false);
46863      }
46864      if (element.hasConfidentialityIndicator()) {
46865        composeCodeableConcept("confidentialityIndicator", element.getConfidentialityIndicator());
46866      }
46867      if (element.hasManufacturer()) {
46868        openArray("manufacturer");
46869        for (Reference e : element.getManufacturer()) 
46870          composeReference(null, e);
46871        closeArray();
46872      };
46873      if (element.hasRegulator()) {
46874        composeReference("regulator", element.getRegulator());
46875      }
46876  }
46877
46878  protected void composeMedicinalProductMedicinalProductSpecialDesignationComponent(String name, MedicinalProduct.MedicinalProductSpecialDesignationComponent element) throws IOException {
46879    if (element != null) {
46880      open(name);
46881      composeMedicinalProductMedicinalProductSpecialDesignationComponentInner(element);
46882      close();
46883    }
46884  }
46885
46886  protected void composeMedicinalProductMedicinalProductSpecialDesignationComponentInner(MedicinalProduct.MedicinalProductSpecialDesignationComponent element) throws IOException {
46887      composeBackbone(element);
46888      if (element.hasIdentifier()) {
46889        openArray("identifier");
46890        for (Identifier e : element.getIdentifier()) 
46891          composeIdentifier(null, e);
46892        closeArray();
46893      };
46894      if (element.hasType()) {
46895        composeCodeableConcept("type", element.getType());
46896      }
46897      if (element.hasIntendedUse()) {
46898        composeCodeableConcept("intendedUse", element.getIntendedUse());
46899      }
46900      if (element.hasIndication()) {
46901        composeType("indication", element.getIndication());
46902      }
46903      if (element.hasStatus()) {
46904        composeCodeableConcept("status", element.getStatus());
46905      }
46906      if (element.hasDateElement()) {
46907        composeDateTimeCore("date", element.getDateElement(), false);
46908        composeDateTimeExtras("date", element.getDateElement(), false);
46909      }
46910      if (element.hasSpecies()) {
46911        composeCodeableConcept("species", element.getSpecies());
46912      }
46913  }
46914
46915  protected void composeMedicinalProductAuthorization(String name, MedicinalProductAuthorization element) throws IOException {
46916    if (element != null) {
46917      prop("resourceType", name);
46918      composeMedicinalProductAuthorizationInner(element);
46919    }
46920  }
46921
46922  protected void composeMedicinalProductAuthorizationInner(MedicinalProductAuthorization element) throws IOException {
46923      composeDomainResourceElements(element);
46924      if (element.hasIdentifier()) {
46925        openArray("identifier");
46926        for (Identifier e : element.getIdentifier()) 
46927          composeIdentifier(null, e);
46928        closeArray();
46929      };
46930      if (element.hasSubject()) {
46931        composeReference("subject", element.getSubject());
46932      }
46933      if (element.hasCountry()) {
46934        openArray("country");
46935        for (CodeableConcept e : element.getCountry()) 
46936          composeCodeableConcept(null, e);
46937        closeArray();
46938      };
46939      if (element.hasJurisdiction()) {
46940        openArray("jurisdiction");
46941        for (CodeableConcept e : element.getJurisdiction()) 
46942          composeCodeableConcept(null, e);
46943        closeArray();
46944      };
46945      if (element.hasStatus()) {
46946        composeCodeableConcept("status", element.getStatus());
46947      }
46948      if (element.hasStatusDateElement()) {
46949        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
46950        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
46951      }
46952      if (element.hasRestoreDateElement()) {
46953        composeDateTimeCore("restoreDate", element.getRestoreDateElement(), false);
46954        composeDateTimeExtras("restoreDate", element.getRestoreDateElement(), false);
46955      }
46956      if (element.hasValidityPeriod()) {
46957        composePeriod("validityPeriod", element.getValidityPeriod());
46958      }
46959      if (element.hasDataExclusivityPeriod()) {
46960        composePeriod("dataExclusivityPeriod", element.getDataExclusivityPeriod());
46961      }
46962      if (element.hasDateOfFirstAuthorizationElement()) {
46963        composeDateTimeCore("dateOfFirstAuthorization", element.getDateOfFirstAuthorizationElement(), false);
46964        composeDateTimeExtras("dateOfFirstAuthorization", element.getDateOfFirstAuthorizationElement(), false);
46965      }
46966      if (element.hasInternationalBirthDateElement()) {
46967        composeDateTimeCore("internationalBirthDate", element.getInternationalBirthDateElement(), false);
46968        composeDateTimeExtras("internationalBirthDate", element.getInternationalBirthDateElement(), false);
46969      }
46970      if (element.hasLegalBasis()) {
46971        composeCodeableConcept("legalBasis", element.getLegalBasis());
46972      }
46973      if (element.hasJurisdictionalAuthorization()) {
46974        openArray("jurisdictionalAuthorization");
46975        for (MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent e : element.getJurisdictionalAuthorization()) 
46976          composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(null, e);
46977        closeArray();
46978      };
46979      if (element.hasHolder()) {
46980        composeReference("holder", element.getHolder());
46981      }
46982      if (element.hasRegulator()) {
46983        composeReference("regulator", element.getRegulator());
46984      }
46985      if (element.hasProcedure()) {
46986        composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent("procedure", element.getProcedure());
46987      }
46988  }
46989
46990  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(String name, MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent element) throws IOException {
46991    if (element != null) {
46992      open(name);
46993      composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentInner(element);
46994      close();
46995    }
46996  }
46997
46998  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentInner(MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent element) throws IOException {
46999      composeBackbone(element);
47000      if (element.hasIdentifier()) {
47001        openArray("identifier");
47002        for (Identifier e : element.getIdentifier()) 
47003          composeIdentifier(null, e);
47004        closeArray();
47005      };
47006      if (element.hasCountry()) {
47007        composeCodeableConcept("country", element.getCountry());
47008      }
47009      if (element.hasJurisdiction()) {
47010        openArray("jurisdiction");
47011        for (CodeableConcept e : element.getJurisdiction()) 
47012          composeCodeableConcept(null, e);
47013        closeArray();
47014      };
47015      if (element.hasLegalStatusOfSupply()) {
47016        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
47017      }
47018      if (element.hasValidityPeriod()) {
47019        composePeriod("validityPeriod", element.getValidityPeriod());
47020      }
47021  }
47022
47023  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(String name, MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent element) throws IOException {
47024    if (element != null) {
47025      open(name);
47026      composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentInner(element);
47027      close();
47028    }
47029  }
47030
47031  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentInner(MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent element) throws IOException {
47032      composeBackbone(element);
47033      if (element.hasIdentifier()) {
47034        composeIdentifier("identifier", element.getIdentifier());
47035      }
47036      if (element.hasType()) {
47037        composeCodeableConcept("type", element.getType());
47038      }
47039      if (element.hasDate()) {
47040        composeType("date", element.getDate());
47041      }
47042      if (element.hasApplication()) {
47043        openArray("application");
47044        for (MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent e : element.getApplication()) 
47045          composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(null, e);
47046        closeArray();
47047      };
47048  }
47049
47050  protected void composeMedicinalProductContraindication(String name, MedicinalProductContraindication element) throws IOException {
47051    if (element != null) {
47052      prop("resourceType", name);
47053      composeMedicinalProductContraindicationInner(element);
47054    }
47055  }
47056
47057  protected void composeMedicinalProductContraindicationInner(MedicinalProductContraindication element) throws IOException {
47058      composeDomainResourceElements(element);
47059      if (element.hasSubject()) {
47060        openArray("subject");
47061        for (Reference e : element.getSubject()) 
47062          composeReference(null, e);
47063        closeArray();
47064      };
47065      if (element.hasDisease()) {
47066        composeCodeableConcept("disease", element.getDisease());
47067      }
47068      if (element.hasDiseaseStatus()) {
47069        composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
47070      }
47071      if (element.hasComorbidity()) {
47072        openArray("comorbidity");
47073        for (CodeableConcept e : element.getComorbidity()) 
47074          composeCodeableConcept(null, e);
47075        closeArray();
47076      };
47077      if (element.hasTherapeuticIndication()) {
47078        openArray("therapeuticIndication");
47079        for (Reference e : element.getTherapeuticIndication()) 
47080          composeReference(null, e);
47081        closeArray();
47082      };
47083      if (element.hasOtherTherapy()) {
47084        openArray("otherTherapy");
47085        for (MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent e : element.getOtherTherapy()) 
47086          composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(null, e);
47087        closeArray();
47088      };
47089      if (element.hasPopulation()) {
47090        openArray("population");
47091        for (Population e : element.getPopulation()) 
47092          composePopulation(null, e);
47093        closeArray();
47094      };
47095  }
47096
47097  protected void composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(String name, MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent element) throws IOException {
47098    if (element != null) {
47099      open(name);
47100      composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentInner(element);
47101      close();
47102    }
47103  }
47104
47105  protected void composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentInner(MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent element) throws IOException {
47106      composeBackbone(element);
47107      if (element.hasTherapyRelationshipType()) {
47108        composeCodeableConcept("therapyRelationshipType", element.getTherapyRelationshipType());
47109      }
47110      if (element.hasMedication()) {
47111        composeType("medication", element.getMedication());
47112      }
47113  }
47114
47115  protected void composeMedicinalProductIndication(String name, MedicinalProductIndication element) throws IOException {
47116    if (element != null) {
47117      prop("resourceType", name);
47118      composeMedicinalProductIndicationInner(element);
47119    }
47120  }
47121
47122  protected void composeMedicinalProductIndicationInner(MedicinalProductIndication element) throws IOException {
47123      composeDomainResourceElements(element);
47124      if (element.hasSubject()) {
47125        openArray("subject");
47126        for (Reference e : element.getSubject()) 
47127          composeReference(null, e);
47128        closeArray();
47129      };
47130      if (element.hasDiseaseSymptomProcedure()) {
47131        composeCodeableConcept("diseaseSymptomProcedure", element.getDiseaseSymptomProcedure());
47132      }
47133      if (element.hasDiseaseStatus()) {
47134        composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
47135      }
47136      if (element.hasComorbidity()) {
47137        openArray("comorbidity");
47138        for (CodeableConcept e : element.getComorbidity()) 
47139          composeCodeableConcept(null, e);
47140        closeArray();
47141      };
47142      if (element.hasIntendedEffect()) {
47143        composeCodeableConcept("intendedEffect", element.getIntendedEffect());
47144      }
47145      if (element.hasDuration()) {
47146        composeQuantity("duration", element.getDuration());
47147      }
47148      if (element.hasOtherTherapy()) {
47149        openArray("otherTherapy");
47150        for (MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent e : element.getOtherTherapy()) 
47151          composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(null, e);
47152        closeArray();
47153      };
47154      if (element.hasUndesirableEffect()) {
47155        openArray("undesirableEffect");
47156        for (Reference e : element.getUndesirableEffect()) 
47157          composeReference(null, e);
47158        closeArray();
47159      };
47160      if (element.hasPopulation()) {
47161        openArray("population");
47162        for (Population e : element.getPopulation()) 
47163          composePopulation(null, e);
47164        closeArray();
47165      };
47166  }
47167
47168  protected void composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(String name, MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent element) throws IOException {
47169    if (element != null) {
47170      open(name);
47171      composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentInner(element);
47172      close();
47173    }
47174  }
47175
47176  protected void composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentInner(MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent element) throws IOException {
47177      composeBackbone(element);
47178      if (element.hasTherapyRelationshipType()) {
47179        composeCodeableConcept("therapyRelationshipType", element.getTherapyRelationshipType());
47180      }
47181      if (element.hasMedication()) {
47182        composeType("medication", element.getMedication());
47183      }
47184  }
47185
47186  protected void composeMedicinalProductIngredient(String name, MedicinalProductIngredient element) throws IOException {
47187    if (element != null) {
47188      prop("resourceType", name);
47189      composeMedicinalProductIngredientInner(element);
47190    }
47191  }
47192
47193  protected void composeMedicinalProductIngredientInner(MedicinalProductIngredient element) throws IOException {
47194      composeDomainResourceElements(element);
47195      if (element.hasIdentifier()) {
47196        composeIdentifier("identifier", element.getIdentifier());
47197      }
47198      if (element.hasRole()) {
47199        composeCodeableConcept("role", element.getRole());
47200      }
47201      if (element.hasAllergenicIndicatorElement()) {
47202        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
47203        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
47204      }
47205      if (element.hasManufacturer()) {
47206        openArray("manufacturer");
47207        for (Reference e : element.getManufacturer()) 
47208          composeReference(null, e);
47209        closeArray();
47210      };
47211      if (element.hasSpecifiedSubstance()) {
47212        openArray("specifiedSubstance");
47213        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent e : element.getSpecifiedSubstance()) 
47214          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(null, e);
47215        closeArray();
47216      };
47217      if (element.hasSubstance()) {
47218        composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent("substance", element.getSubstance());
47219      }
47220  }
47221
47222  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent element) throws IOException {
47223    if (element != null) {
47224      open(name);
47225      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentInner(element);
47226      close();
47227    }
47228  }
47229
47230  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent element) throws IOException {
47231      composeBackbone(element);
47232      if (element.hasCode()) {
47233        composeCodeableConcept("code", element.getCode());
47234      }
47235      if (element.hasGroup()) {
47236        composeCodeableConcept("group", element.getGroup());
47237      }
47238      if (element.hasConfidentiality()) {
47239        composeCodeableConcept("confidentiality", element.getConfidentiality());
47240      }
47241      if (element.hasStrength()) {
47242        openArray("strength");
47243        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent e : element.getStrength()) 
47244          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(null, e);
47245        closeArray();
47246      };
47247  }
47248
47249  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent element) throws IOException {
47250    if (element != null) {
47251      open(name);
47252      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentInner(element);
47253      close();
47254    }
47255  }
47256
47257  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent element) throws IOException {
47258      composeBackbone(element);
47259      if (element.hasPresentation()) {
47260        composeRatio("presentation", element.getPresentation());
47261      }
47262      if (element.hasPresentationLowLimit()) {
47263        composeRatio("presentationLowLimit", element.getPresentationLowLimit());
47264      }
47265      if (element.hasConcentration()) {
47266        composeRatio("concentration", element.getConcentration());
47267      }
47268      if (element.hasConcentrationLowLimit()) {
47269        composeRatio("concentrationLowLimit", element.getConcentrationLowLimit());
47270      }
47271      if (element.hasMeasurementPointElement()) {
47272        composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
47273        composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
47274      }
47275      if (element.hasCountry()) {
47276        openArray("country");
47277        for (CodeableConcept e : element.getCountry()) 
47278          composeCodeableConcept(null, e);
47279        closeArray();
47280      };
47281      if (element.hasReferenceStrength()) {
47282        openArray("referenceStrength");
47283        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent e : element.getReferenceStrength()) 
47284          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(null, e);
47285        closeArray();
47286      };
47287  }
47288
47289  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element) throws IOException {
47290    if (element != null) {
47291      open(name);
47292      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentInner(element);
47293      close();
47294    }
47295  }
47296
47297  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element) throws IOException {
47298      composeBackbone(element);
47299      if (element.hasSubstance()) {
47300        composeCodeableConcept("substance", element.getSubstance());
47301      }
47302      if (element.hasStrength()) {
47303        composeRatio("strength", element.getStrength());
47304      }
47305      if (element.hasStrengthLowLimit()) {
47306        composeRatio("strengthLowLimit", element.getStrengthLowLimit());
47307      }
47308      if (element.hasMeasurementPointElement()) {
47309        composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
47310        composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
47311      }
47312      if (element.hasCountry()) {
47313        openArray("country");
47314        for (CodeableConcept e : element.getCountry()) 
47315          composeCodeableConcept(null, e);
47316        closeArray();
47317      };
47318  }
47319
47320  protected void composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent element) throws IOException {
47321    if (element != null) {
47322      open(name);
47323      composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentInner(element);
47324      close();
47325    }
47326  }
47327
47328  protected void composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent element) throws IOException {
47329      composeBackbone(element);
47330      if (element.hasCode()) {
47331        composeCodeableConcept("code", element.getCode());
47332      }
47333      if (element.hasStrength()) {
47334        openArray("strength");
47335        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent e : element.getStrength()) 
47336          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(null, e);
47337        closeArray();
47338      };
47339  }
47340
47341  protected void composeMedicinalProductInteraction(String name, MedicinalProductInteraction element) throws IOException {
47342    if (element != null) {
47343      prop("resourceType", name);
47344      composeMedicinalProductInteractionInner(element);
47345    }
47346  }
47347
47348  protected void composeMedicinalProductInteractionInner(MedicinalProductInteraction element) throws IOException {
47349      composeDomainResourceElements(element);
47350      if (element.hasSubject()) {
47351        openArray("subject");
47352        for (Reference e : element.getSubject()) 
47353          composeReference(null, e);
47354        closeArray();
47355      };
47356      if (element.hasDescriptionElement()) {
47357        composeStringCore("description", element.getDescriptionElement(), false);
47358        composeStringExtras("description", element.getDescriptionElement(), false);
47359      }
47360      if (element.hasInteractant()) {
47361        openArray("interactant");
47362        for (MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent e : element.getInteractant()) 
47363          composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(null, e);
47364        closeArray();
47365      };
47366      if (element.hasType()) {
47367        composeCodeableConcept("type", element.getType());
47368      }
47369      if (element.hasEffect()) {
47370        composeCodeableConcept("effect", element.getEffect());
47371      }
47372      if (element.hasIncidence()) {
47373        composeCodeableConcept("incidence", element.getIncidence());
47374      }
47375      if (element.hasManagement()) {
47376        composeCodeableConcept("management", element.getManagement());
47377      }
47378  }
47379
47380  protected void composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(String name, MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent element) throws IOException {
47381    if (element != null) {
47382      open(name);
47383      composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponentInner(element);
47384      close();
47385    }
47386  }
47387
47388  protected void composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponentInner(MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent element) throws IOException {
47389      composeBackbone(element);
47390      if (element.hasItem()) {
47391        composeType("item", element.getItem());
47392      }
47393  }
47394
47395  protected void composeMedicinalProductManufactured(String name, MedicinalProductManufactured element) throws IOException {
47396    if (element != null) {
47397      prop("resourceType", name);
47398      composeMedicinalProductManufacturedInner(element);
47399    }
47400  }
47401
47402  protected void composeMedicinalProductManufacturedInner(MedicinalProductManufactured element) throws IOException {
47403      composeDomainResourceElements(element);
47404      if (element.hasManufacturedDoseForm()) {
47405        composeCodeableConcept("manufacturedDoseForm", element.getManufacturedDoseForm());
47406      }
47407      if (element.hasUnitOfPresentation()) {
47408        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
47409      }
47410      if (element.hasQuantity()) {
47411        composeQuantity("quantity", element.getQuantity());
47412      }
47413      if (element.hasManufacturer()) {
47414        openArray("manufacturer");
47415        for (Reference e : element.getManufacturer()) 
47416          composeReference(null, e);
47417        closeArray();
47418      };
47419      if (element.hasIngredient()) {
47420        openArray("ingredient");
47421        for (Reference e : element.getIngredient()) 
47422          composeReference(null, e);
47423        closeArray();
47424      };
47425      if (element.hasPhysicalCharacteristics()) {
47426        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
47427      }
47428      if (element.hasOtherCharacteristics()) {
47429        openArray("otherCharacteristics");
47430        for (CodeableConcept e : element.getOtherCharacteristics()) 
47431          composeCodeableConcept(null, e);
47432        closeArray();
47433      };
47434  }
47435
47436  protected void composeMedicinalProductPackaged(String name, MedicinalProductPackaged element) throws IOException {
47437    if (element != null) {
47438      prop("resourceType", name);
47439      composeMedicinalProductPackagedInner(element);
47440    }
47441  }
47442
47443  protected void composeMedicinalProductPackagedInner(MedicinalProductPackaged element) throws IOException {
47444      composeDomainResourceElements(element);
47445      if (element.hasIdentifier()) {
47446        openArray("identifier");
47447        for (Identifier e : element.getIdentifier()) 
47448          composeIdentifier(null, e);
47449        closeArray();
47450      };
47451      if (element.hasSubject()) {
47452        openArray("subject");
47453        for (Reference e : element.getSubject()) 
47454          composeReference(null, e);
47455        closeArray();
47456      };
47457      if (element.hasDescriptionElement()) {
47458        composeStringCore("description", element.getDescriptionElement(), false);
47459        composeStringExtras("description", element.getDescriptionElement(), false);
47460      }
47461      if (element.hasLegalStatusOfSupply()) {
47462        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
47463      }
47464      if (element.hasMarketingStatus()) {
47465        openArray("marketingStatus");
47466        for (MarketingStatus e : element.getMarketingStatus()) 
47467          composeMarketingStatus(null, e);
47468        closeArray();
47469      };
47470      if (element.hasMarketingAuthorization()) {
47471        composeReference("marketingAuthorization", element.getMarketingAuthorization());
47472      }
47473      if (element.hasManufacturer()) {
47474        openArray("manufacturer");
47475        for (Reference e : element.getManufacturer()) 
47476          composeReference(null, e);
47477        closeArray();
47478      };
47479      if (element.hasBatchIdentifier()) {
47480        openArray("batchIdentifier");
47481        for (MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent e : element.getBatchIdentifier()) 
47482          composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(null, e);
47483        closeArray();
47484      };
47485      if (element.hasPackageItem()) {
47486        openArray("packageItem");
47487        for (MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent e : element.getPackageItem()) 
47488          composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(null, e);
47489        closeArray();
47490      };
47491  }
47492
47493  protected void composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(String name, MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent element) throws IOException {
47494    if (element != null) {
47495      open(name);
47496      composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentInner(element);
47497      close();
47498    }
47499  }
47500
47501  protected void composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentInner(MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent element) throws IOException {
47502      composeBackbone(element);
47503      if (element.hasOuterPackaging()) {
47504        composeIdentifier("outerPackaging", element.getOuterPackaging());
47505      }
47506      if (element.hasImmediatePackaging()) {
47507        composeIdentifier("immediatePackaging", element.getImmediatePackaging());
47508      }
47509  }
47510
47511  protected void composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(String name, MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent element) throws IOException {
47512    if (element != null) {
47513      open(name);
47514      composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentInner(element);
47515      close();
47516    }
47517  }
47518
47519  protected void composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentInner(MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent element) throws IOException {
47520      composeBackbone(element);
47521      if (element.hasIdentifier()) {
47522        openArray("identifier");
47523        for (Identifier e : element.getIdentifier()) 
47524          composeIdentifier(null, e);
47525        closeArray();
47526      };
47527      if (element.hasType()) {
47528        composeCodeableConcept("type", element.getType());
47529      }
47530      if (element.hasQuantity()) {
47531        composeQuantity("quantity", element.getQuantity());
47532      }
47533      if (element.hasMaterial()) {
47534        openArray("material");
47535        for (CodeableConcept e : element.getMaterial()) 
47536          composeCodeableConcept(null, e);
47537        closeArray();
47538      };
47539      if (element.hasAlternateMaterial()) {
47540        openArray("alternateMaterial");
47541        for (CodeableConcept e : element.getAlternateMaterial()) 
47542          composeCodeableConcept(null, e);
47543        closeArray();
47544      };
47545      if (element.hasDevice()) {
47546        openArray("device");
47547        for (Reference e : element.getDevice()) 
47548          composeReference(null, e);
47549        closeArray();
47550      };
47551      if (element.hasManufacturedItem()) {
47552        openArray("manufacturedItem");
47553        for (Reference e : element.getManufacturedItem()) 
47554          composeReference(null, e);
47555        closeArray();
47556      };
47557      if (element.hasPackageItem()) {
47558        openArray("packageItem");
47559        for (MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent e : element.getPackageItem()) 
47560          composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(null, e);
47561        closeArray();
47562      };
47563      if (element.hasPhysicalCharacteristics()) {
47564        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
47565      }
47566      if (element.hasOtherCharacteristics()) {
47567        openArray("otherCharacteristics");
47568        for (CodeableConcept e : element.getOtherCharacteristics()) 
47569          composeCodeableConcept(null, e);
47570        closeArray();
47571      };
47572      if (element.hasShelfLifeStorage()) {
47573        openArray("shelfLifeStorage");
47574        for (ProductShelfLife e : element.getShelfLifeStorage()) 
47575          composeProductShelfLife(null, e);
47576        closeArray();
47577      };
47578      if (element.hasManufacturer()) {
47579        openArray("manufacturer");
47580        for (Reference e : element.getManufacturer()) 
47581          composeReference(null, e);
47582        closeArray();
47583      };
47584  }
47585
47586  protected void composeMedicinalProductPharmaceutical(String name, MedicinalProductPharmaceutical element) throws IOException {
47587    if (element != null) {
47588      prop("resourceType", name);
47589      composeMedicinalProductPharmaceuticalInner(element);
47590    }
47591  }
47592
47593  protected void composeMedicinalProductPharmaceuticalInner(MedicinalProductPharmaceutical element) throws IOException {
47594      composeDomainResourceElements(element);
47595      if (element.hasIdentifier()) {
47596        openArray("identifier");
47597        for (Identifier e : element.getIdentifier()) 
47598          composeIdentifier(null, e);
47599        closeArray();
47600      };
47601      if (element.hasAdministrableDoseForm()) {
47602        composeCodeableConcept("administrableDoseForm", element.getAdministrableDoseForm());
47603      }
47604      if (element.hasUnitOfPresentation()) {
47605        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
47606      }
47607      if (element.hasIngredient()) {
47608        openArray("ingredient");
47609        for (Reference e : element.getIngredient()) 
47610          composeReference(null, e);
47611        closeArray();
47612      };
47613      if (element.hasDevice()) {
47614        openArray("device");
47615        for (Reference e : element.getDevice()) 
47616          composeReference(null, e);
47617        closeArray();
47618      };
47619      if (element.hasCharacteristics()) {
47620        openArray("characteristics");
47621        for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent e : element.getCharacteristics()) 
47622          composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(null, e);
47623        closeArray();
47624      };
47625      if (element.hasRouteOfAdministration()) {
47626        openArray("routeOfAdministration");
47627        for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent e : element.getRouteOfAdministration()) 
47628          composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(null, e);
47629        closeArray();
47630      };
47631  }
47632
47633  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent element) throws IOException {
47634    if (element != null) {
47635      open(name);
47636      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentInner(element);
47637      close();
47638    }
47639  }
47640
47641  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentInner(MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent element) throws IOException {
47642      composeBackbone(element);
47643      if (element.hasCode()) {
47644        composeCodeableConcept("code", element.getCode());
47645      }
47646      if (element.hasStatus()) {
47647        composeCodeableConcept("status", element.getStatus());
47648      }
47649  }
47650
47651  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent element) throws IOException {
47652    if (element != null) {
47653      open(name);
47654      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentInner(element);
47655      close();
47656    }
47657  }
47658
47659  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentInner(MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent element) throws IOException {
47660      composeBackbone(element);
47661      if (element.hasCode()) {
47662        composeCodeableConcept("code", element.getCode());
47663      }
47664      if (element.hasFirstDose()) {
47665        composeQuantity("firstDose", element.getFirstDose());
47666      }
47667      if (element.hasMaxSingleDose()) {
47668        composeQuantity("maxSingleDose", element.getMaxSingleDose());
47669      }
47670      if (element.hasMaxDosePerDay()) {
47671        composeQuantity("maxDosePerDay", element.getMaxDosePerDay());
47672      }
47673      if (element.hasMaxDosePerTreatmentPeriod()) {
47674        composeRatio("maxDosePerTreatmentPeriod", element.getMaxDosePerTreatmentPeriod());
47675      }
47676      if (element.hasMaxTreatmentPeriod()) {
47677        composeDuration("maxTreatmentPeriod", element.getMaxTreatmentPeriod());
47678      }
47679      if (element.hasTargetSpecies()) {
47680        openArray("targetSpecies");
47681        for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent e : element.getTargetSpecies()) 
47682          composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(null, e);
47683        closeArray();
47684      };
47685  }
47686
47687  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
47688    if (element != null) {
47689      open(name);
47690      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentInner(element);
47691      close();
47692    }
47693  }
47694
47695  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentInner(MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
47696      composeBackbone(element);
47697      if (element.hasCode()) {
47698        composeCodeableConcept("code", element.getCode());
47699      }
47700      if (element.hasWithdrawalPeriod()) {
47701        openArray("withdrawalPeriod");
47702        for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent e : element.getWithdrawalPeriod()) 
47703          composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(null, e);
47704        closeArray();
47705      };
47706  }
47707
47708  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element) throws IOException {
47709    if (element != null) {
47710      open(name);
47711      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentInner(element);
47712      close();
47713    }
47714  }
47715
47716  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentInner(MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element) throws IOException {
47717      composeBackbone(element);
47718      if (element.hasTissue()) {
47719        composeCodeableConcept("tissue", element.getTissue());
47720      }
47721      if (element.hasValue()) {
47722        composeQuantity("value", element.getValue());
47723      }
47724      if (element.hasSupportingInformationElement()) {
47725        composeStringCore("supportingInformation", element.getSupportingInformationElement(), false);
47726        composeStringExtras("supportingInformation", element.getSupportingInformationElement(), false);
47727      }
47728  }
47729
47730  protected void composeMedicinalProductUndesirableEffect(String name, MedicinalProductUndesirableEffect element) throws IOException {
47731    if (element != null) {
47732      prop("resourceType", name);
47733      composeMedicinalProductUndesirableEffectInner(element);
47734    }
47735  }
47736
47737  protected void composeMedicinalProductUndesirableEffectInner(MedicinalProductUndesirableEffect element) throws IOException {
47738      composeDomainResourceElements(element);
47739      if (element.hasSubject()) {
47740        openArray("subject");
47741        for (Reference e : element.getSubject()) 
47742          composeReference(null, e);
47743        closeArray();
47744      };
47745      if (element.hasSymptomConditionEffect()) {
47746        composeCodeableConcept("symptomConditionEffect", element.getSymptomConditionEffect());
47747      }
47748      if (element.hasClassification()) {
47749        composeCodeableConcept("classification", element.getClassification());
47750      }
47751      if (element.hasFrequencyOfOccurrence()) {
47752        composeCodeableConcept("frequencyOfOccurrence", element.getFrequencyOfOccurrence());
47753      }
47754      if (element.hasPopulation()) {
47755        openArray("population");
47756        for (Population e : element.getPopulation()) 
47757          composePopulation(null, e);
47758        closeArray();
47759      };
47760  }
47761
47762  protected void composeMessageDefinition(String name, MessageDefinition element) throws IOException {
47763    if (element != null) {
47764      prop("resourceType", name);
47765      composeMessageDefinitionInner(element);
47766    }
47767  }
47768
47769  protected void composeMessageDefinitionInner(MessageDefinition element) throws IOException {
47770      composeDomainResourceElements(element);
47771      if (element.hasUrlElement()) {
47772        composeUriCore("url", element.getUrlElement(), false);
47773        composeUriExtras("url", element.getUrlElement(), false);
47774      }
47775      if (element.hasIdentifier()) {
47776        openArray("identifier");
47777        for (Identifier e : element.getIdentifier()) 
47778          composeIdentifier(null, e);
47779        closeArray();
47780      };
47781      if (element.hasVersionElement()) {
47782        composeStringCore("version", element.getVersionElement(), false);
47783        composeStringExtras("version", element.getVersionElement(), false);
47784      }
47785      if (element.hasNameElement()) {
47786        composeStringCore("name", element.getNameElement(), false);
47787        composeStringExtras("name", element.getNameElement(), false);
47788      }
47789      if (element.hasTitleElement()) {
47790        composeStringCore("title", element.getTitleElement(), false);
47791        composeStringExtras("title", element.getTitleElement(), false);
47792      }
47793      if (element.hasReplaces()) {
47794        openArray("replaces");
47795        for (CanonicalType e : element.getReplaces()) 
47796          composeCanonicalCore(null, e, true);
47797        closeArray();
47798        if (anyHasExtras(element.getReplaces())) {
47799          openArray("_replaces");
47800          for (CanonicalType e : element.getReplaces()) 
47801            composeCanonicalExtras(null, e, true);
47802          closeArray();
47803        }
47804      };
47805      if (element.hasStatusElement()) {
47806        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
47807        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
47808      }
47809      if (element.hasExperimentalElement()) {
47810        composeBooleanCore("experimental", element.getExperimentalElement(), false);
47811        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
47812      }
47813      if (element.hasDateElement()) {
47814        composeDateTimeCore("date", element.getDateElement(), false);
47815        composeDateTimeExtras("date", element.getDateElement(), false);
47816      }
47817      if (element.hasPublisherElement()) {
47818        composeStringCore("publisher", element.getPublisherElement(), false);
47819        composeStringExtras("publisher", element.getPublisherElement(), false);
47820      }
47821      if (element.hasContact()) {
47822        openArray("contact");
47823        for (ContactDetail e : element.getContact()) 
47824          composeContactDetail(null, e);
47825        closeArray();
47826      };
47827      if (element.hasDescriptionElement()) {
47828        composeMarkdownCore("description", element.getDescriptionElement(), false);
47829        composeMarkdownExtras("description", element.getDescriptionElement(), false);
47830      }
47831      if (element.hasUseContext()) {
47832        openArray("useContext");
47833        for (UsageContext e : element.getUseContext()) 
47834          composeUsageContext(null, e);
47835        closeArray();
47836      };
47837      if (element.hasJurisdiction()) {
47838        openArray("jurisdiction");
47839        for (CodeableConcept e : element.getJurisdiction()) 
47840          composeCodeableConcept(null, e);
47841        closeArray();
47842      };
47843      if (element.hasPurposeElement()) {
47844        composeMarkdownCore("purpose", element.getPurposeElement(), false);
47845        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
47846      }
47847      if (element.hasCopyrightElement()) {
47848        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
47849        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
47850      }
47851      if (element.hasBaseElement()) {
47852        composeCanonicalCore("base", element.getBaseElement(), false);
47853        composeCanonicalExtras("base", element.getBaseElement(), false);
47854      }
47855      if (element.hasParent()) {
47856        openArray("parent");
47857        for (CanonicalType e : element.getParent()) 
47858          composeCanonicalCore(null, e, true);
47859        closeArray();
47860        if (anyHasExtras(element.getParent())) {
47861          openArray("_parent");
47862          for (CanonicalType e : element.getParent()) 
47863            composeCanonicalExtras(null, e, true);
47864          closeArray();
47865        }
47866      };
47867      if (element.hasEvent()) {
47868        composeType("event", element.getEvent());
47869      }
47870      if (element.hasCategoryElement()) {
47871        composeEnumerationCore("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
47872        composeEnumerationExtras("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
47873      }
47874      if (element.hasFocus()) {
47875        openArray("focus");
47876        for (MessageDefinition.MessageDefinitionFocusComponent e : element.getFocus()) 
47877          composeMessageDefinitionMessageDefinitionFocusComponent(null, e);
47878        closeArray();
47879      };
47880      if (element.hasResponseRequiredElement()) {
47881        composeEnumerationCore("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
47882        composeEnumerationExtras("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
47883      }
47884      if (element.hasAllowedResponse()) {
47885        openArray("allowedResponse");
47886        for (MessageDefinition.MessageDefinitionAllowedResponseComponent e : element.getAllowedResponse()) 
47887          composeMessageDefinitionMessageDefinitionAllowedResponseComponent(null, e);
47888        closeArray();
47889      };
47890      if (element.hasGraph()) {
47891        openArray("graph");
47892        for (CanonicalType e : element.getGraph()) 
47893          composeCanonicalCore(null, e, true);
47894        closeArray();
47895        if (anyHasExtras(element.getGraph())) {
47896          openArray("_graph");
47897          for (CanonicalType e : element.getGraph()) 
47898            composeCanonicalExtras(null, e, true);
47899          closeArray();
47900        }
47901      };
47902  }
47903
47904  protected void composeMessageDefinitionMessageDefinitionFocusComponent(String name, MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
47905    if (element != null) {
47906      open(name);
47907      composeMessageDefinitionMessageDefinitionFocusComponentInner(element);
47908      close();
47909    }
47910  }
47911
47912  protected void composeMessageDefinitionMessageDefinitionFocusComponentInner(MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
47913      composeBackbone(element);
47914      if (element.hasCodeElement()) {
47915        composeCodeCore("code", element.getCodeElement(), false);
47916        composeCodeExtras("code", element.getCodeElement(), false);
47917      }
47918      if (element.hasProfileElement()) {
47919        composeCanonicalCore("profile", element.getProfileElement(), false);
47920        composeCanonicalExtras("profile", element.getProfileElement(), false);
47921      }
47922      if (element.hasMinElement()) {
47923        composeUnsignedIntCore("min", element.getMinElement(), false);
47924        composeUnsignedIntExtras("min", element.getMinElement(), false);
47925      }
47926      if (element.hasMaxElement()) {
47927        composeStringCore("max", element.getMaxElement(), false);
47928        composeStringExtras("max", element.getMaxElement(), false);
47929      }
47930  }
47931
47932  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponent(String name, MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
47933    if (element != null) {
47934      open(name);
47935      composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(element);
47936      close();
47937    }
47938  }
47939
47940  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
47941      composeBackbone(element);
47942      if (element.hasMessageElement()) {
47943        composeCanonicalCore("message", element.getMessageElement(), false);
47944        composeCanonicalExtras("message", element.getMessageElement(), false);
47945      }
47946      if (element.hasSituationElement()) {
47947        composeMarkdownCore("situation", element.getSituationElement(), false);
47948        composeMarkdownExtras("situation", element.getSituationElement(), false);
47949      }
47950  }
47951
47952  protected void composeMessageHeader(String name, MessageHeader element) throws IOException {
47953    if (element != null) {
47954      prop("resourceType", name);
47955      composeMessageHeaderInner(element);
47956    }
47957  }
47958
47959  protected void composeMessageHeaderInner(MessageHeader element) throws IOException {
47960      composeDomainResourceElements(element);
47961      if (element.hasEvent()) {
47962        composeType("event", element.getEvent());
47963      }
47964      if (element.hasDestination()) {
47965        openArray("destination");
47966        for (MessageHeader.MessageDestinationComponent e : element.getDestination()) 
47967          composeMessageHeaderMessageDestinationComponent(null, e);
47968        closeArray();
47969      };
47970      if (element.hasSender()) {
47971        composeReference("sender", element.getSender());
47972      }
47973      if (element.hasEnterer()) {
47974        composeReference("enterer", element.getEnterer());
47975      }
47976      if (element.hasAuthor()) {
47977        composeReference("author", element.getAuthor());
47978      }
47979      if (element.hasSource()) {
47980        composeMessageHeaderMessageSourceComponent("source", element.getSource());
47981      }
47982      if (element.hasResponsible()) {
47983        composeReference("responsible", element.getResponsible());
47984      }
47985      if (element.hasReason()) {
47986        composeCodeableConcept("reason", element.getReason());
47987      }
47988      if (element.hasResponse()) {
47989        composeMessageHeaderMessageHeaderResponseComponent("response", element.getResponse());
47990      }
47991      if (element.hasFocus()) {
47992        openArray("focus");
47993        for (Reference e : element.getFocus()) 
47994          composeReference(null, e);
47995        closeArray();
47996      };
47997      if (element.hasDefinitionElement()) {
47998        composeCanonicalCore("definition", element.getDefinitionElement(), false);
47999        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
48000      }
48001  }
48002
48003  protected void composeMessageHeaderMessageDestinationComponent(String name, MessageHeader.MessageDestinationComponent element) throws IOException {
48004    if (element != null) {
48005      open(name);
48006      composeMessageHeaderMessageDestinationComponentInner(element);
48007      close();
48008    }
48009  }
48010
48011  protected void composeMessageHeaderMessageDestinationComponentInner(MessageHeader.MessageDestinationComponent element) throws IOException {
48012      composeBackbone(element);
48013      if (element.hasNameElement()) {
48014        composeStringCore("name", element.getNameElement(), false);
48015        composeStringExtras("name", element.getNameElement(), false);
48016      }
48017      if (element.hasTarget()) {
48018        composeReference("target", element.getTarget());
48019      }
48020      if (element.hasEndpointElement()) {
48021        composeUrlCore("endpoint", element.getEndpointElement(), false);
48022        composeUrlExtras("endpoint", element.getEndpointElement(), false);
48023      }
48024      if (element.hasReceiver()) {
48025        composeReference("receiver", element.getReceiver());
48026      }
48027  }
48028
48029  protected void composeMessageHeaderMessageSourceComponent(String name, MessageHeader.MessageSourceComponent element) throws IOException {
48030    if (element != null) {
48031      open(name);
48032      composeMessageHeaderMessageSourceComponentInner(element);
48033      close();
48034    }
48035  }
48036
48037  protected void composeMessageHeaderMessageSourceComponentInner(MessageHeader.MessageSourceComponent element) throws IOException {
48038      composeBackbone(element);
48039      if (element.hasNameElement()) {
48040        composeStringCore("name", element.getNameElement(), false);
48041        composeStringExtras("name", element.getNameElement(), false);
48042      }
48043      if (element.hasSoftwareElement()) {
48044        composeStringCore("software", element.getSoftwareElement(), false);
48045        composeStringExtras("software", element.getSoftwareElement(), false);
48046      }
48047      if (element.hasVersionElement()) {
48048        composeStringCore("version", element.getVersionElement(), false);
48049        composeStringExtras("version", element.getVersionElement(), false);
48050      }
48051      if (element.hasContact()) {
48052        composeContactPoint("contact", element.getContact());
48053      }
48054      if (element.hasEndpointElement()) {
48055        composeUrlCore("endpoint", element.getEndpointElement(), false);
48056        composeUrlExtras("endpoint", element.getEndpointElement(), false);
48057      }
48058  }
48059
48060  protected void composeMessageHeaderMessageHeaderResponseComponent(String name, MessageHeader.MessageHeaderResponseComponent element) throws IOException {
48061    if (element != null) {
48062      open(name);
48063      composeMessageHeaderMessageHeaderResponseComponentInner(element);
48064      close();
48065    }
48066  }
48067
48068  protected void composeMessageHeaderMessageHeaderResponseComponentInner(MessageHeader.MessageHeaderResponseComponent element) throws IOException {
48069      composeBackbone(element);
48070      if (element.hasIdentifierElement()) {
48071        composeIdCore("identifier", element.getIdentifierElement(), false);
48072        composeIdExtras("identifier", element.getIdentifierElement(), false);
48073      }
48074      if (element.hasCodeElement()) {
48075        composeEnumerationCore("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
48076        composeEnumerationExtras("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
48077      }
48078      if (element.hasDetails()) {
48079        composeReference("details", element.getDetails());
48080      }
48081  }
48082
48083  protected void composeMolecularSequence(String name, MolecularSequence element) throws IOException {
48084    if (element != null) {
48085      prop("resourceType", name);
48086      composeMolecularSequenceInner(element);
48087    }
48088  }
48089
48090  protected void composeMolecularSequenceInner(MolecularSequence element) throws IOException {
48091      composeDomainResourceElements(element);
48092      if (element.hasIdentifier()) {
48093        openArray("identifier");
48094        for (Identifier e : element.getIdentifier()) 
48095          composeIdentifier(null, e);
48096        closeArray();
48097      };
48098      if (element.hasTypeElement()) {
48099        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.SequenceTypeEnumFactory(), false);
48100        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.SequenceTypeEnumFactory(), false);
48101      }
48102      if (element.hasCoordinateSystemElement()) {
48103        composeIntegerCore("coordinateSystem", element.getCoordinateSystemElement(), false);
48104        composeIntegerExtras("coordinateSystem", element.getCoordinateSystemElement(), false);
48105      }
48106      if (element.hasPatient()) {
48107        composeReference("patient", element.getPatient());
48108      }
48109      if (element.hasSpecimen()) {
48110        composeReference("specimen", element.getSpecimen());
48111      }
48112      if (element.hasDevice()) {
48113        composeReference("device", element.getDevice());
48114      }
48115      if (element.hasPerformer()) {
48116        composeReference("performer", element.getPerformer());
48117      }
48118      if (element.hasQuantity()) {
48119        composeQuantity("quantity", element.getQuantity());
48120      }
48121      if (element.hasReferenceSeq()) {
48122        composeMolecularSequenceMolecularSequenceReferenceSeqComponent("referenceSeq", element.getReferenceSeq());
48123      }
48124      if (element.hasVariant()) {
48125        openArray("variant");
48126        for (MolecularSequence.MolecularSequenceVariantComponent e : element.getVariant()) 
48127          composeMolecularSequenceMolecularSequenceVariantComponent(null, e);
48128        closeArray();
48129      };
48130      if (element.hasObservedSeqElement()) {
48131        composeStringCore("observedSeq", element.getObservedSeqElement(), false);
48132        composeStringExtras("observedSeq", element.getObservedSeqElement(), false);
48133      }
48134      if (element.hasQuality()) {
48135        openArray("quality");
48136        for (MolecularSequence.MolecularSequenceQualityComponent e : element.getQuality()) 
48137          composeMolecularSequenceMolecularSequenceQualityComponent(null, e);
48138        closeArray();
48139      };
48140      if (element.hasReadCoverageElement()) {
48141        composeIntegerCore("readCoverage", element.getReadCoverageElement(), false);
48142        composeIntegerExtras("readCoverage", element.getReadCoverageElement(), false);
48143      }
48144      if (element.hasRepository()) {
48145        openArray("repository");
48146        for (MolecularSequence.MolecularSequenceRepositoryComponent e : element.getRepository()) 
48147          composeMolecularSequenceMolecularSequenceRepositoryComponent(null, e);
48148        closeArray();
48149      };
48150      if (element.hasPointer()) {
48151        openArray("pointer");
48152        for (Reference e : element.getPointer()) 
48153          composeReference(null, e);
48154        closeArray();
48155      };
48156      if (element.hasStructureVariant()) {
48157        openArray("structureVariant");
48158        for (MolecularSequence.MolecularSequenceStructureVariantComponent e : element.getStructureVariant()) 
48159          composeMolecularSequenceMolecularSequenceStructureVariantComponent(null, e);
48160        closeArray();
48161      };
48162  }
48163
48164  protected void composeMolecularSequenceMolecularSequenceReferenceSeqComponent(String name, MolecularSequence.MolecularSequenceReferenceSeqComponent element) throws IOException {
48165    if (element != null) {
48166      open(name);
48167      composeMolecularSequenceMolecularSequenceReferenceSeqComponentInner(element);
48168      close();
48169    }
48170  }
48171
48172  protected void composeMolecularSequenceMolecularSequenceReferenceSeqComponentInner(MolecularSequence.MolecularSequenceReferenceSeqComponent element) throws IOException {
48173      composeBackbone(element);
48174      if (element.hasChromosome()) {
48175        composeCodeableConcept("chromosome", element.getChromosome());
48176      }
48177      if (element.hasGenomeBuildElement()) {
48178        composeStringCore("genomeBuild", element.getGenomeBuildElement(), false);
48179        composeStringExtras("genomeBuild", element.getGenomeBuildElement(), false);
48180      }
48181      if (element.hasOrientationElement()) {
48182        composeEnumerationCore("orientation", element.getOrientationElement(), new MolecularSequence.OrientationTypeEnumFactory(), false);
48183        composeEnumerationExtras("orientation", element.getOrientationElement(), new MolecularSequence.OrientationTypeEnumFactory(), false);
48184      }
48185      if (element.hasReferenceSeqId()) {
48186        composeCodeableConcept("referenceSeqId", element.getReferenceSeqId());
48187      }
48188      if (element.hasReferenceSeqPointer()) {
48189        composeReference("referenceSeqPointer", element.getReferenceSeqPointer());
48190      }
48191      if (element.hasReferenceSeqStringElement()) {
48192        composeStringCore("referenceSeqString", element.getReferenceSeqStringElement(), false);
48193        composeStringExtras("referenceSeqString", element.getReferenceSeqStringElement(), false);
48194      }
48195      if (element.hasStrandElement()) {
48196        composeEnumerationCore("strand", element.getStrandElement(), new MolecularSequence.StrandTypeEnumFactory(), false);
48197        composeEnumerationExtras("strand", element.getStrandElement(), new MolecularSequence.StrandTypeEnumFactory(), false);
48198      }
48199      if (element.hasWindowStartElement()) {
48200        composeIntegerCore("windowStart", element.getWindowStartElement(), false);
48201        composeIntegerExtras("windowStart", element.getWindowStartElement(), false);
48202      }
48203      if (element.hasWindowEndElement()) {
48204        composeIntegerCore("windowEnd", element.getWindowEndElement(), false);
48205        composeIntegerExtras("windowEnd", element.getWindowEndElement(), false);
48206      }
48207  }
48208
48209  protected void composeMolecularSequenceMolecularSequenceVariantComponent(String name, MolecularSequence.MolecularSequenceVariantComponent element) throws IOException {
48210    if (element != null) {
48211      open(name);
48212      composeMolecularSequenceMolecularSequenceVariantComponentInner(element);
48213      close();
48214    }
48215  }
48216
48217  protected void composeMolecularSequenceMolecularSequenceVariantComponentInner(MolecularSequence.MolecularSequenceVariantComponent element) throws IOException {
48218      composeBackbone(element);
48219      if (element.hasStartElement()) {
48220        composeIntegerCore("start", element.getStartElement(), false);
48221        composeIntegerExtras("start", element.getStartElement(), false);
48222      }
48223      if (element.hasEndElement()) {
48224        composeIntegerCore("end", element.getEndElement(), false);
48225        composeIntegerExtras("end", element.getEndElement(), false);
48226      }
48227      if (element.hasObservedAlleleElement()) {
48228        composeStringCore("observedAllele", element.getObservedAlleleElement(), false);
48229        composeStringExtras("observedAllele", element.getObservedAlleleElement(), false);
48230      }
48231      if (element.hasReferenceAlleleElement()) {
48232        composeStringCore("referenceAllele", element.getReferenceAlleleElement(), false);
48233        composeStringExtras("referenceAllele", element.getReferenceAlleleElement(), false);
48234      }
48235      if (element.hasCigarElement()) {
48236        composeStringCore("cigar", element.getCigarElement(), false);
48237        composeStringExtras("cigar", element.getCigarElement(), false);
48238      }
48239      if (element.hasVariantPointer()) {
48240        composeReference("variantPointer", element.getVariantPointer());
48241      }
48242  }
48243
48244  protected void composeMolecularSequenceMolecularSequenceQualityComponent(String name, MolecularSequence.MolecularSequenceQualityComponent element) throws IOException {
48245    if (element != null) {
48246      open(name);
48247      composeMolecularSequenceMolecularSequenceQualityComponentInner(element);
48248      close();
48249    }
48250  }
48251
48252  protected void composeMolecularSequenceMolecularSequenceQualityComponentInner(MolecularSequence.MolecularSequenceQualityComponent element) throws IOException {
48253      composeBackbone(element);
48254      if (element.hasTypeElement()) {
48255        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.QualityTypeEnumFactory(), false);
48256        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.QualityTypeEnumFactory(), false);
48257      }
48258      if (element.hasStandardSequence()) {
48259        composeCodeableConcept("standardSequence", element.getStandardSequence());
48260      }
48261      if (element.hasStartElement()) {
48262        composeIntegerCore("start", element.getStartElement(), false);
48263        composeIntegerExtras("start", element.getStartElement(), false);
48264      }
48265      if (element.hasEndElement()) {
48266        composeIntegerCore("end", element.getEndElement(), false);
48267        composeIntegerExtras("end", element.getEndElement(), false);
48268      }
48269      if (element.hasScore()) {
48270        composeQuantity("score", element.getScore());
48271      }
48272      if (element.hasMethod()) {
48273        composeCodeableConcept("method", element.getMethod());
48274      }
48275      if (element.hasTruthTPElement()) {
48276        composeDecimalCore("truthTP", element.getTruthTPElement(), false);
48277        composeDecimalExtras("truthTP", element.getTruthTPElement(), false);
48278      }
48279      if (element.hasQueryTPElement()) {
48280        composeDecimalCore("queryTP", element.getQueryTPElement(), false);
48281        composeDecimalExtras("queryTP", element.getQueryTPElement(), false);
48282      }
48283      if (element.hasTruthFNElement()) {
48284        composeDecimalCore("truthFN", element.getTruthFNElement(), false);
48285        composeDecimalExtras("truthFN", element.getTruthFNElement(), false);
48286      }
48287      if (element.hasQueryFPElement()) {
48288        composeDecimalCore("queryFP", element.getQueryFPElement(), false);
48289        composeDecimalExtras("queryFP", element.getQueryFPElement(), false);
48290      }
48291      if (element.hasGtFPElement()) {
48292        composeDecimalCore("gtFP", element.getGtFPElement(), false);
48293        composeDecimalExtras("gtFP", element.getGtFPElement(), false);
48294      }
48295      if (element.hasPrecisionElement()) {
48296        composeDecimalCore("precision", element.getPrecisionElement(), false);
48297        composeDecimalExtras("precision", element.getPrecisionElement(), false);
48298      }
48299      if (element.hasRecallElement()) {
48300        composeDecimalCore("recall", element.getRecallElement(), false);
48301        composeDecimalExtras("recall", element.getRecallElement(), false);
48302      }
48303      if (element.hasFScoreElement()) {
48304        composeDecimalCore("fScore", element.getFScoreElement(), false);
48305        composeDecimalExtras("fScore", element.getFScoreElement(), false);
48306      }
48307      if (element.hasRoc()) {
48308        composeMolecularSequenceMolecularSequenceQualityRocComponent("roc", element.getRoc());
48309      }
48310  }
48311
48312  protected void composeMolecularSequenceMolecularSequenceQualityRocComponent(String name, MolecularSequence.MolecularSequenceQualityRocComponent element) throws IOException {
48313    if (element != null) {
48314      open(name);
48315      composeMolecularSequenceMolecularSequenceQualityRocComponentInner(element);
48316      close();
48317    }
48318  }
48319
48320  protected void composeMolecularSequenceMolecularSequenceQualityRocComponentInner(MolecularSequence.MolecularSequenceQualityRocComponent element) throws IOException {
48321      composeBackbone(element);
48322      if (element.hasScore()) {
48323        openArray("score");
48324        for (IntegerType e : element.getScore()) 
48325          composeIntegerCore(null, e, true);
48326        closeArray();
48327        if (anyHasExtras(element.getScore())) {
48328          openArray("_score");
48329          for (IntegerType e : element.getScore()) 
48330            composeIntegerExtras(null, e, true);
48331          closeArray();
48332        }
48333      };
48334      if (element.hasNumTP()) {
48335        openArray("numTP");
48336        for (IntegerType e : element.getNumTP()) 
48337          composeIntegerCore(null, e, true);
48338        closeArray();
48339        if (anyHasExtras(element.getNumTP())) {
48340          openArray("_numTP");
48341          for (IntegerType e : element.getNumTP()) 
48342            composeIntegerExtras(null, e, true);
48343          closeArray();
48344        }
48345      };
48346      if (element.hasNumFP()) {
48347        openArray("numFP");
48348        for (IntegerType e : element.getNumFP()) 
48349          composeIntegerCore(null, e, true);
48350        closeArray();
48351        if (anyHasExtras(element.getNumFP())) {
48352          openArray("_numFP");
48353          for (IntegerType e : element.getNumFP()) 
48354            composeIntegerExtras(null, e, true);
48355          closeArray();
48356        }
48357      };
48358      if (element.hasNumFN()) {
48359        openArray("numFN");
48360        for (IntegerType e : element.getNumFN()) 
48361          composeIntegerCore(null, e, true);
48362        closeArray();
48363        if (anyHasExtras(element.getNumFN())) {
48364          openArray("_numFN");
48365          for (IntegerType e : element.getNumFN()) 
48366            composeIntegerExtras(null, e, true);
48367          closeArray();
48368        }
48369      };
48370      if (element.hasPrecision()) {
48371        openArray("precision");
48372        for (DecimalType e : element.getPrecision()) 
48373          composeDecimalCore(null, e, true);
48374        closeArray();
48375        if (anyHasExtras(element.getPrecision())) {
48376          openArray("_precision");
48377          for (DecimalType e : element.getPrecision()) 
48378            composeDecimalExtras(null, e, true);
48379          closeArray();
48380        }
48381      };
48382      if (element.hasSensitivity()) {
48383        openArray("sensitivity");
48384        for (DecimalType e : element.getSensitivity()) 
48385          composeDecimalCore(null, e, true);
48386        closeArray();
48387        if (anyHasExtras(element.getSensitivity())) {
48388          openArray("_sensitivity");
48389          for (DecimalType e : element.getSensitivity()) 
48390            composeDecimalExtras(null, e, true);
48391          closeArray();
48392        }
48393      };
48394      if (element.hasFMeasure()) {
48395        openArray("fMeasure");
48396        for (DecimalType e : element.getFMeasure()) 
48397          composeDecimalCore(null, e, true);
48398        closeArray();
48399        if (anyHasExtras(element.getFMeasure())) {
48400          openArray("_fMeasure");
48401          for (DecimalType e : element.getFMeasure()) 
48402            composeDecimalExtras(null, e, true);
48403          closeArray();
48404        }
48405      };
48406  }
48407
48408  protected void composeMolecularSequenceMolecularSequenceRepositoryComponent(String name, MolecularSequence.MolecularSequenceRepositoryComponent element) throws IOException {
48409    if (element != null) {
48410      open(name);
48411      composeMolecularSequenceMolecularSequenceRepositoryComponentInner(element);
48412      close();
48413    }
48414  }
48415
48416  protected void composeMolecularSequenceMolecularSequenceRepositoryComponentInner(MolecularSequence.MolecularSequenceRepositoryComponent element) throws IOException {
48417      composeBackbone(element);
48418      if (element.hasTypeElement()) {
48419        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.RepositoryTypeEnumFactory(), false);
48420        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.RepositoryTypeEnumFactory(), false);
48421      }
48422      if (element.hasUrlElement()) {
48423        composeUriCore("url", element.getUrlElement(), false);
48424        composeUriExtras("url", element.getUrlElement(), false);
48425      }
48426      if (element.hasNameElement()) {
48427        composeStringCore("name", element.getNameElement(), false);
48428        composeStringExtras("name", element.getNameElement(), false);
48429      }
48430      if (element.hasDatasetIdElement()) {
48431        composeStringCore("datasetId", element.getDatasetIdElement(), false);
48432        composeStringExtras("datasetId", element.getDatasetIdElement(), false);
48433      }
48434      if (element.hasVariantsetIdElement()) {
48435        composeStringCore("variantsetId", element.getVariantsetIdElement(), false);
48436        composeStringExtras("variantsetId", element.getVariantsetIdElement(), false);
48437      }
48438      if (element.hasReadsetIdElement()) {
48439        composeStringCore("readsetId", element.getReadsetIdElement(), false);
48440        composeStringExtras("readsetId", element.getReadsetIdElement(), false);
48441      }
48442  }
48443
48444  protected void composeMolecularSequenceMolecularSequenceStructureVariantComponent(String name, MolecularSequence.MolecularSequenceStructureVariantComponent element) throws IOException {
48445    if (element != null) {
48446      open(name);
48447      composeMolecularSequenceMolecularSequenceStructureVariantComponentInner(element);
48448      close();
48449    }
48450  }
48451
48452  protected void composeMolecularSequenceMolecularSequenceStructureVariantComponentInner(MolecularSequence.MolecularSequenceStructureVariantComponent element) throws IOException {
48453      composeBackbone(element);
48454      if (element.hasVariantType()) {
48455        composeCodeableConcept("variantType", element.getVariantType());
48456      }
48457      if (element.hasExactElement()) {
48458        composeBooleanCore("exact", element.getExactElement(), false);
48459        composeBooleanExtras("exact", element.getExactElement(), false);
48460      }
48461      if (element.hasLengthElement()) {
48462        composeIntegerCore("length", element.getLengthElement(), false);
48463        composeIntegerExtras("length", element.getLengthElement(), false);
48464      }
48465      if (element.hasOuter()) {
48466        composeMolecularSequenceMolecularSequenceStructureVariantOuterComponent("outer", element.getOuter());
48467      }
48468      if (element.hasInner()) {
48469        composeMolecularSequenceMolecularSequenceStructureVariantInnerComponent("inner", element.getInner());
48470      }
48471  }
48472
48473  protected void composeMolecularSequenceMolecularSequenceStructureVariantOuterComponent(String name, MolecularSequence.MolecularSequenceStructureVariantOuterComponent element) throws IOException {
48474    if (element != null) {
48475      open(name);
48476      composeMolecularSequenceMolecularSequenceStructureVariantOuterComponentInner(element);
48477      close();
48478    }
48479  }
48480
48481  protected void composeMolecularSequenceMolecularSequenceStructureVariantOuterComponentInner(MolecularSequence.MolecularSequenceStructureVariantOuterComponent element) throws IOException {
48482      composeBackbone(element);
48483      if (element.hasStartElement()) {
48484        composeIntegerCore("start", element.getStartElement(), false);
48485        composeIntegerExtras("start", element.getStartElement(), false);
48486      }
48487      if (element.hasEndElement()) {
48488        composeIntegerCore("end", element.getEndElement(), false);
48489        composeIntegerExtras("end", element.getEndElement(), false);
48490      }
48491  }
48492
48493  protected void composeMolecularSequenceMolecularSequenceStructureVariantInnerComponent(String name, MolecularSequence.MolecularSequenceStructureVariantInnerComponent element) throws IOException {
48494    if (element != null) {
48495      open(name);
48496      composeMolecularSequenceMolecularSequenceStructureVariantInnerComponentInner(element);
48497      close();
48498    }
48499  }
48500
48501  protected void composeMolecularSequenceMolecularSequenceStructureVariantInnerComponentInner(MolecularSequence.MolecularSequenceStructureVariantInnerComponent element) throws IOException {
48502      composeBackbone(element);
48503      if (element.hasStartElement()) {
48504        composeIntegerCore("start", element.getStartElement(), false);
48505        composeIntegerExtras("start", element.getStartElement(), false);
48506      }
48507      if (element.hasEndElement()) {
48508        composeIntegerCore("end", element.getEndElement(), false);
48509        composeIntegerExtras("end", element.getEndElement(), false);
48510      }
48511  }
48512
48513  protected void composeNamingSystem(String name, NamingSystem element) throws IOException {
48514    if (element != null) {
48515      prop("resourceType", name);
48516      composeNamingSystemInner(element);
48517    }
48518  }
48519
48520  protected void composeNamingSystemInner(NamingSystem element) throws IOException {
48521      composeDomainResourceElements(element);
48522      if (element.hasNameElement()) {
48523        composeStringCore("name", element.getNameElement(), false);
48524        composeStringExtras("name", element.getNameElement(), false);
48525      }
48526      if (element.hasStatusElement()) {
48527        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
48528        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
48529      }
48530      if (element.hasKindElement()) {
48531        composeEnumerationCore("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
48532        composeEnumerationExtras("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
48533      }
48534      if (element.hasDateElement()) {
48535        composeDateTimeCore("date", element.getDateElement(), false);
48536        composeDateTimeExtras("date", element.getDateElement(), false);
48537      }
48538      if (element.hasPublisherElement()) {
48539        composeStringCore("publisher", element.getPublisherElement(), false);
48540        composeStringExtras("publisher", element.getPublisherElement(), false);
48541      }
48542      if (element.hasContact()) {
48543        openArray("contact");
48544        for (ContactDetail e : element.getContact()) 
48545          composeContactDetail(null, e);
48546        closeArray();
48547      };
48548      if (element.hasResponsibleElement()) {
48549        composeStringCore("responsible", element.getResponsibleElement(), false);
48550        composeStringExtras("responsible", element.getResponsibleElement(), false);
48551      }
48552      if (element.hasType()) {
48553        composeCodeableConcept("type", element.getType());
48554      }
48555      if (element.hasDescriptionElement()) {
48556        composeMarkdownCore("description", element.getDescriptionElement(), false);
48557        composeMarkdownExtras("description", element.getDescriptionElement(), false);
48558      }
48559      if (element.hasUseContext()) {
48560        openArray("useContext");
48561        for (UsageContext e : element.getUseContext()) 
48562          composeUsageContext(null, e);
48563        closeArray();
48564      };
48565      if (element.hasJurisdiction()) {
48566        openArray("jurisdiction");
48567        for (CodeableConcept e : element.getJurisdiction()) 
48568          composeCodeableConcept(null, e);
48569        closeArray();
48570      };
48571      if (element.hasUsageElement()) {
48572        composeStringCore("usage", element.getUsageElement(), false);
48573        composeStringExtras("usage", element.getUsageElement(), false);
48574      }
48575      if (element.hasUniqueId()) {
48576        openArray("uniqueId");
48577        for (NamingSystem.NamingSystemUniqueIdComponent e : element.getUniqueId()) 
48578          composeNamingSystemNamingSystemUniqueIdComponent(null, e);
48579        closeArray();
48580      };
48581  }
48582
48583  protected void composeNamingSystemNamingSystemUniqueIdComponent(String name, NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
48584    if (element != null) {
48585      open(name);
48586      composeNamingSystemNamingSystemUniqueIdComponentInner(element);
48587      close();
48588    }
48589  }
48590
48591  protected void composeNamingSystemNamingSystemUniqueIdComponentInner(NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
48592      composeBackbone(element);
48593      if (element.hasTypeElement()) {
48594        composeEnumerationCore("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
48595        composeEnumerationExtras("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
48596      }
48597      if (element.hasValueElement()) {
48598        composeStringCore("value", element.getValueElement(), false);
48599        composeStringExtras("value", element.getValueElement(), false);
48600      }
48601      if (element.hasPreferredElement()) {
48602        composeBooleanCore("preferred", element.getPreferredElement(), false);
48603        composeBooleanExtras("preferred", element.getPreferredElement(), false);
48604      }
48605      if (element.hasCommentElement()) {
48606        composeStringCore("comment", element.getCommentElement(), false);
48607        composeStringExtras("comment", element.getCommentElement(), false);
48608      }
48609      if (element.hasPeriod()) {
48610        composePeriod("period", element.getPeriod());
48611      }
48612  }
48613
48614  protected void composeNutritionOrder(String name, NutritionOrder element) throws IOException {
48615    if (element != null) {
48616      prop("resourceType", name);
48617      composeNutritionOrderInner(element);
48618    }
48619  }
48620
48621  protected void composeNutritionOrderInner(NutritionOrder element) throws IOException {
48622      composeDomainResourceElements(element);
48623      if (element.hasIdentifier()) {
48624        openArray("identifier");
48625        for (Identifier e : element.getIdentifier()) 
48626          composeIdentifier(null, e);
48627        closeArray();
48628      };
48629      if (element.hasInstantiatesCanonical()) {
48630        openArray("instantiatesCanonical");
48631        for (CanonicalType e : element.getInstantiatesCanonical()) 
48632          composeCanonicalCore(null, e, true);
48633        closeArray();
48634        if (anyHasExtras(element.getInstantiatesCanonical())) {
48635          openArray("_instantiatesCanonical");
48636          for (CanonicalType e : element.getInstantiatesCanonical()) 
48637            composeCanonicalExtras(null, e, true);
48638          closeArray();
48639        }
48640      };
48641      if (element.hasInstantiatesUri()) {
48642        openArray("instantiatesUri");
48643        for (UriType e : element.getInstantiatesUri()) 
48644          composeUriCore(null, e, true);
48645        closeArray();
48646        if (anyHasExtras(element.getInstantiatesUri())) {
48647          openArray("_instantiatesUri");
48648          for (UriType e : element.getInstantiatesUri()) 
48649            composeUriExtras(null, e, true);
48650          closeArray();
48651        }
48652      };
48653      if (element.hasInstantiates()) {
48654        openArray("instantiates");
48655        for (UriType e : element.getInstantiates()) 
48656          composeUriCore(null, e, true);
48657        closeArray();
48658        if (anyHasExtras(element.getInstantiates())) {
48659          openArray("_instantiates");
48660          for (UriType e : element.getInstantiates()) 
48661            composeUriExtras(null, e, true);
48662          closeArray();
48663        }
48664      };
48665      if (element.hasStatusElement()) {
48666        composeEnumerationCore("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
48667        composeEnumerationExtras("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
48668      }
48669      if (element.hasIntentElement()) {
48670        composeEnumerationCore("intent", element.getIntentElement(), new NutritionOrder.NutritiionOrderIntentEnumFactory(), false);
48671        composeEnumerationExtras("intent", element.getIntentElement(), new NutritionOrder.NutritiionOrderIntentEnumFactory(), false);
48672      }
48673      if (element.hasPatient()) {
48674        composeReference("patient", element.getPatient());
48675      }
48676      if (element.hasEncounter()) {
48677        composeReference("encounter", element.getEncounter());
48678      }
48679      if (element.hasDateTimeElement()) {
48680        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
48681        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
48682      }
48683      if (element.hasOrderer()) {
48684        composeReference("orderer", element.getOrderer());
48685      }
48686      if (element.hasAllergyIntolerance()) {
48687        openArray("allergyIntolerance");
48688        for (Reference e : element.getAllergyIntolerance()) 
48689          composeReference(null, e);
48690        closeArray();
48691      };
48692      if (element.hasFoodPreferenceModifier()) {
48693        openArray("foodPreferenceModifier");
48694        for (CodeableConcept e : element.getFoodPreferenceModifier()) 
48695          composeCodeableConcept(null, e);
48696        closeArray();
48697      };
48698      if (element.hasExcludeFoodModifier()) {
48699        openArray("excludeFoodModifier");
48700        for (CodeableConcept e : element.getExcludeFoodModifier()) 
48701          composeCodeableConcept(null, e);
48702        closeArray();
48703      };
48704      if (element.hasOralDiet()) {
48705        composeNutritionOrderNutritionOrderOralDietComponent("oralDiet", element.getOralDiet());
48706      }
48707      if (element.hasSupplement()) {
48708        openArray("supplement");
48709        for (NutritionOrder.NutritionOrderSupplementComponent e : element.getSupplement()) 
48710          composeNutritionOrderNutritionOrderSupplementComponent(null, e);
48711        closeArray();
48712      };
48713      if (element.hasEnteralFormula()) {
48714        composeNutritionOrderNutritionOrderEnteralFormulaComponent("enteralFormula", element.getEnteralFormula());
48715      }
48716      if (element.hasNote()) {
48717        openArray("note");
48718        for (Annotation e : element.getNote()) 
48719          composeAnnotation(null, e);
48720        closeArray();
48721      };
48722  }
48723
48724  protected void composeNutritionOrderNutritionOrderOralDietComponent(String name, NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
48725    if (element != null) {
48726      open(name);
48727      composeNutritionOrderNutritionOrderOralDietComponentInner(element);
48728      close();
48729    }
48730  }
48731
48732  protected void composeNutritionOrderNutritionOrderOralDietComponentInner(NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
48733      composeBackbone(element);
48734      if (element.hasType()) {
48735        openArray("type");
48736        for (CodeableConcept e : element.getType()) 
48737          composeCodeableConcept(null, e);
48738        closeArray();
48739      };
48740      if (element.hasSchedule()) {
48741        openArray("schedule");
48742        for (Timing e : element.getSchedule()) 
48743          composeTiming(null, e);
48744        closeArray();
48745      };
48746      if (element.hasNutrient()) {
48747        openArray("nutrient");
48748        for (NutritionOrder.NutritionOrderOralDietNutrientComponent e : element.getNutrient()) 
48749          composeNutritionOrderNutritionOrderOralDietNutrientComponent(null, e);
48750        closeArray();
48751      };
48752      if (element.hasTexture()) {
48753        openArray("texture");
48754        for (NutritionOrder.NutritionOrderOralDietTextureComponent e : element.getTexture()) 
48755          composeNutritionOrderNutritionOrderOralDietTextureComponent(null, e);
48756        closeArray();
48757      };
48758      if (element.hasFluidConsistencyType()) {
48759        openArray("fluidConsistencyType");
48760        for (CodeableConcept e : element.getFluidConsistencyType()) 
48761          composeCodeableConcept(null, e);
48762        closeArray();
48763      };
48764      if (element.hasInstructionElement()) {
48765        composeStringCore("instruction", element.getInstructionElement(), false);
48766        composeStringExtras("instruction", element.getInstructionElement(), false);
48767      }
48768  }
48769
48770  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponent(String name, NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
48771    if (element != null) {
48772      open(name);
48773      composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(element);
48774      close();
48775    }
48776  }
48777
48778  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
48779      composeBackbone(element);
48780      if (element.hasModifier()) {
48781        composeCodeableConcept("modifier", element.getModifier());
48782      }
48783      if (element.hasAmount()) {
48784        composeQuantity("amount", element.getAmount());
48785      }
48786  }
48787
48788  protected void composeNutritionOrderNutritionOrderOralDietTextureComponent(String name, NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
48789    if (element != null) {
48790      open(name);
48791      composeNutritionOrderNutritionOrderOralDietTextureComponentInner(element);
48792      close();
48793    }
48794  }
48795
48796  protected void composeNutritionOrderNutritionOrderOralDietTextureComponentInner(NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
48797      composeBackbone(element);
48798      if (element.hasModifier()) {
48799        composeCodeableConcept("modifier", element.getModifier());
48800      }
48801      if (element.hasFoodType()) {
48802        composeCodeableConcept("foodType", element.getFoodType());
48803      }
48804  }
48805
48806  protected void composeNutritionOrderNutritionOrderSupplementComponent(String name, NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
48807    if (element != null) {
48808      open(name);
48809      composeNutritionOrderNutritionOrderSupplementComponentInner(element);
48810      close();
48811    }
48812  }
48813
48814  protected void composeNutritionOrderNutritionOrderSupplementComponentInner(NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
48815      composeBackbone(element);
48816      if (element.hasType()) {
48817        composeCodeableConcept("type", element.getType());
48818      }
48819      if (element.hasProductNameElement()) {
48820        composeStringCore("productName", element.getProductNameElement(), false);
48821        composeStringExtras("productName", element.getProductNameElement(), false);
48822      }
48823      if (element.hasSchedule()) {
48824        openArray("schedule");
48825        for (Timing e : element.getSchedule()) 
48826          composeTiming(null, e);
48827        closeArray();
48828      };
48829      if (element.hasQuantity()) {
48830        composeQuantity("quantity", element.getQuantity());
48831      }
48832      if (element.hasInstructionElement()) {
48833        composeStringCore("instruction", element.getInstructionElement(), false);
48834        composeStringExtras("instruction", element.getInstructionElement(), false);
48835      }
48836  }
48837
48838  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
48839    if (element != null) {
48840      open(name);
48841      composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(element);
48842      close();
48843    }
48844  }
48845
48846  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
48847      composeBackbone(element);
48848      if (element.hasBaseFormulaType()) {
48849        composeCodeableConcept("baseFormulaType", element.getBaseFormulaType());
48850      }
48851      if (element.hasBaseFormulaProductNameElement()) {
48852        composeStringCore("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
48853        composeStringExtras("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
48854      }
48855      if (element.hasAdditiveType()) {
48856        composeCodeableConcept("additiveType", element.getAdditiveType());
48857      }
48858      if (element.hasAdditiveProductNameElement()) {
48859        composeStringCore("additiveProductName", element.getAdditiveProductNameElement(), false);
48860        composeStringExtras("additiveProductName", element.getAdditiveProductNameElement(), false);
48861      }
48862      if (element.hasCaloricDensity()) {
48863        composeQuantity("caloricDensity", element.getCaloricDensity());
48864      }
48865      if (element.hasRouteofAdministration()) {
48866        composeCodeableConcept("routeofAdministration", element.getRouteofAdministration());
48867      }
48868      if (element.hasAdministration()) {
48869        openArray("administration");
48870        for (NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent e : element.getAdministration()) 
48871          composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(null, e);
48872        closeArray();
48873      };
48874      if (element.hasMaxVolumeToDeliver()) {
48875        composeQuantity("maxVolumeToDeliver", element.getMaxVolumeToDeliver());
48876      }
48877      if (element.hasAdministrationInstructionElement()) {
48878        composeStringCore("administrationInstruction", element.getAdministrationInstructionElement(), false);
48879        composeStringExtras("administrationInstruction", element.getAdministrationInstructionElement(), false);
48880      }
48881  }
48882
48883  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
48884    if (element != null) {
48885      open(name);
48886      composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(element);
48887      close();
48888    }
48889  }
48890
48891  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
48892      composeBackbone(element);
48893      if (element.hasSchedule()) {
48894        composeTiming("schedule", element.getSchedule());
48895      }
48896      if (element.hasQuantity()) {
48897        composeQuantity("quantity", element.getQuantity());
48898      }
48899      if (element.hasRate()) {
48900        composeType("rate", element.getRate());
48901      }
48902  }
48903
48904  protected void composeObservation(String name, Observation element) throws IOException {
48905    if (element != null) {
48906      prop("resourceType", name);
48907      composeObservationInner(element);
48908    }
48909  }
48910
48911  protected void composeObservationInner(Observation element) throws IOException {
48912      composeDomainResourceElements(element);
48913      if (element.hasIdentifier()) {
48914        openArray("identifier");
48915        for (Identifier e : element.getIdentifier()) 
48916          composeIdentifier(null, e);
48917        closeArray();
48918      };
48919      if (element.hasBasedOn()) {
48920        openArray("basedOn");
48921        for (Reference e : element.getBasedOn()) 
48922          composeReference(null, e);
48923        closeArray();
48924      };
48925      if (element.hasPartOf()) {
48926        openArray("partOf");
48927        for (Reference e : element.getPartOf()) 
48928          composeReference(null, e);
48929        closeArray();
48930      };
48931      if (element.hasStatusElement()) {
48932        composeEnumerationCore("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
48933        composeEnumerationExtras("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
48934      }
48935      if (element.hasCategory()) {
48936        openArray("category");
48937        for (CodeableConcept e : element.getCategory()) 
48938          composeCodeableConcept(null, e);
48939        closeArray();
48940      };
48941      if (element.hasCode()) {
48942        composeCodeableConcept("code", element.getCode());
48943      }
48944      if (element.hasSubject()) {
48945        composeReference("subject", element.getSubject());
48946      }
48947      if (element.hasFocus()) {
48948        openArray("focus");
48949        for (Reference e : element.getFocus()) 
48950          composeReference(null, e);
48951        closeArray();
48952      };
48953      if (element.hasEncounter()) {
48954        composeReference("encounter", element.getEncounter());
48955      }
48956      if (element.hasEffective()) {
48957        composeType("effective", element.getEffective());
48958      }
48959      if (element.hasIssuedElement()) {
48960        composeInstantCore("issued", element.getIssuedElement(), false);
48961        composeInstantExtras("issued", element.getIssuedElement(), false);
48962      }
48963      if (element.hasPerformer()) {
48964        openArray("performer");
48965        for (Reference e : element.getPerformer()) 
48966          composeReference(null, e);
48967        closeArray();
48968      };
48969      if (element.hasValue()) {
48970        composeType("value", element.getValue());
48971      }
48972      if (element.hasDataAbsentReason()) {
48973        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
48974      }
48975      if (element.hasInterpretation()) {
48976        openArray("interpretation");
48977        for (CodeableConcept e : element.getInterpretation()) 
48978          composeCodeableConcept(null, e);
48979        closeArray();
48980      };
48981      if (element.hasNote()) {
48982        openArray("note");
48983        for (Annotation e : element.getNote()) 
48984          composeAnnotation(null, e);
48985        closeArray();
48986      };
48987      if (element.hasBodySite()) {
48988        composeCodeableConcept("bodySite", element.getBodySite());
48989      }
48990      if (element.hasMethod()) {
48991        composeCodeableConcept("method", element.getMethod());
48992      }
48993      if (element.hasSpecimen()) {
48994        composeReference("specimen", element.getSpecimen());
48995      }
48996      if (element.hasDevice()) {
48997        composeReference("device", element.getDevice());
48998      }
48999      if (element.hasReferenceRange()) {
49000        openArray("referenceRange");
49001        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
49002          composeObservationObservationReferenceRangeComponent(null, e);
49003        closeArray();
49004      };
49005      if (element.hasHasMember()) {
49006        openArray("hasMember");
49007        for (Reference e : element.getHasMember()) 
49008          composeReference(null, e);
49009        closeArray();
49010      };
49011      if (element.hasDerivedFrom()) {
49012        openArray("derivedFrom");
49013        for (Reference e : element.getDerivedFrom()) 
49014          composeReference(null, e);
49015        closeArray();
49016      };
49017      if (element.hasComponent()) {
49018        openArray("component");
49019        for (Observation.ObservationComponentComponent e : element.getComponent()) 
49020          composeObservationObservationComponentComponent(null, e);
49021        closeArray();
49022      };
49023  }
49024
49025  protected void composeObservationObservationReferenceRangeComponent(String name, Observation.ObservationReferenceRangeComponent element) throws IOException {
49026    if (element != null) {
49027      open(name);
49028      composeObservationObservationReferenceRangeComponentInner(element);
49029      close();
49030    }
49031  }
49032
49033  protected void composeObservationObservationReferenceRangeComponentInner(Observation.ObservationReferenceRangeComponent element) throws IOException {
49034      composeBackbone(element);
49035      if (element.hasLow()) {
49036        composeQuantity("low", element.getLow());
49037      }
49038      if (element.hasHigh()) {
49039        composeQuantity("high", element.getHigh());
49040      }
49041      if (element.hasType()) {
49042        composeCodeableConcept("type", element.getType());
49043      }
49044      if (element.hasAppliesTo()) {
49045        openArray("appliesTo");
49046        for (CodeableConcept e : element.getAppliesTo()) 
49047          composeCodeableConcept(null, e);
49048        closeArray();
49049      };
49050      if (element.hasAge()) {
49051        composeRange("age", element.getAge());
49052      }
49053      if (element.hasTextElement()) {
49054        composeStringCore("text", element.getTextElement(), false);
49055        composeStringExtras("text", element.getTextElement(), false);
49056      }
49057  }
49058
49059  protected void composeObservationObservationComponentComponent(String name, Observation.ObservationComponentComponent element) throws IOException {
49060    if (element != null) {
49061      open(name);
49062      composeObservationObservationComponentComponentInner(element);
49063      close();
49064    }
49065  }
49066
49067  protected void composeObservationObservationComponentComponentInner(Observation.ObservationComponentComponent element) throws IOException {
49068      composeBackbone(element);
49069      if (element.hasCode()) {
49070        composeCodeableConcept("code", element.getCode());
49071      }
49072      if (element.hasValue()) {
49073        composeType("value", element.getValue());
49074      }
49075      if (element.hasDataAbsentReason()) {
49076        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
49077      }
49078      if (element.hasInterpretation()) {
49079        openArray("interpretation");
49080        for (CodeableConcept e : element.getInterpretation()) 
49081          composeCodeableConcept(null, e);
49082        closeArray();
49083      };
49084      if (element.hasReferenceRange()) {
49085        openArray("referenceRange");
49086        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
49087          composeObservationObservationReferenceRangeComponent(null, e);
49088        closeArray();
49089      };
49090  }
49091
49092  protected void composeObservationDefinition(String name, ObservationDefinition element) throws IOException {
49093    if (element != null) {
49094      prop("resourceType", name);
49095      composeObservationDefinitionInner(element);
49096    }
49097  }
49098
49099  protected void composeObservationDefinitionInner(ObservationDefinition element) throws IOException {
49100      composeDomainResourceElements(element);
49101      if (element.hasCategory()) {
49102        openArray("category");
49103        for (CodeableConcept e : element.getCategory()) 
49104          composeCodeableConcept(null, e);
49105        closeArray();
49106      };
49107      if (element.hasCode()) {
49108        composeCodeableConcept("code", element.getCode());
49109      }
49110      if (element.hasIdentifier()) {
49111        openArray("identifier");
49112        for (Identifier e : element.getIdentifier()) 
49113          composeIdentifier(null, e);
49114        closeArray();
49115      };
49116      if (element.hasPermittedDataType()) {
49117        openArray("permittedDataType");
49118        for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
49119          composeEnumerationCore(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
49120        closeArray();
49121        if (anyHasExtras(element.getPermittedDataType())) {
49122          openArray("_permittedDataType");
49123          for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
49124            composeEnumerationExtras(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
49125          closeArray();
49126        }
49127      };
49128      if (element.hasMultipleResultsAllowedElement()) {
49129        composeBooleanCore("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
49130        composeBooleanExtras("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
49131      }
49132      if (element.hasMethod()) {
49133        composeCodeableConcept("method", element.getMethod());
49134      }
49135      if (element.hasPreferredReportNameElement()) {
49136        composeStringCore("preferredReportName", element.getPreferredReportNameElement(), false);
49137        composeStringExtras("preferredReportName", element.getPreferredReportNameElement(), false);
49138      }
49139      if (element.hasQuantitativeDetails()) {
49140        composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponent("quantitativeDetails", element.getQuantitativeDetails());
49141      }
49142      if (element.hasQualifiedInterval()) {
49143        openArray("qualifiedInterval");
49144        for (ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent e : element.getQualifiedInterval()) 
49145          composeObservationDefinitionObservationDefinitionQualifiedIntervalComponent(null, e);
49146        closeArray();
49147      };
49148      if (element.hasValidCodedValueSet()) {
49149        composeReference("validCodedValueSet", element.getValidCodedValueSet());
49150      }
49151      if (element.hasNormalCodedValueSet()) {
49152        composeReference("normalCodedValueSet", element.getNormalCodedValueSet());
49153      }
49154      if (element.hasAbnormalCodedValueSet()) {
49155        composeReference("abnormalCodedValueSet", element.getAbnormalCodedValueSet());
49156      }
49157      if (element.hasCriticalCodedValueSet()) {
49158        composeReference("criticalCodedValueSet", element.getCriticalCodedValueSet());
49159      }
49160  }
49161
49162  protected void composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(String name, ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
49163    if (element != null) {
49164      open(name);
49165      composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponentInner(element);
49166      close();
49167    }
49168  }
49169
49170  protected void composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponentInner(ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
49171      composeBackbone(element);
49172      if (element.hasCustomaryUnit()) {
49173        composeCodeableConcept("customaryUnit", element.getCustomaryUnit());
49174      }
49175      if (element.hasUnit()) {
49176        composeCodeableConcept("unit", element.getUnit());
49177      }
49178      if (element.hasConversionFactorElement()) {
49179        composeDecimalCore("conversionFactor", element.getConversionFactorElement(), false);
49180        composeDecimalExtras("conversionFactor", element.getConversionFactorElement(), false);
49181      }
49182      if (element.hasDecimalPrecisionElement()) {
49183        composeIntegerCore("decimalPrecision", element.getDecimalPrecisionElement(), false);
49184        composeIntegerExtras("decimalPrecision", element.getDecimalPrecisionElement(), false);
49185      }
49186  }
49187
49188  protected void composeObservationDefinitionObservationDefinitionQualifiedIntervalComponent(String name, ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
49189    if (element != null) {
49190      open(name);
49191      composeObservationDefinitionObservationDefinitionQualifiedIntervalComponentInner(element);
49192      close();
49193    }
49194  }
49195
49196  protected void composeObservationDefinitionObservationDefinitionQualifiedIntervalComponentInner(ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
49197      composeBackbone(element);
49198      if (element.hasCategoryElement()) {
49199        composeEnumerationCore("category", element.getCategoryElement(), new ObservationDefinition.ObservationRangeCategoryEnumFactory(), false);
49200        composeEnumerationExtras("category", element.getCategoryElement(), new ObservationDefinition.ObservationRangeCategoryEnumFactory(), false);
49201      }
49202      if (element.hasRange()) {
49203        composeRange("range", element.getRange());
49204      }
49205      if (element.hasContext()) {
49206        composeCodeableConcept("context", element.getContext());
49207      }
49208      if (element.hasAppliesTo()) {
49209        openArray("appliesTo");
49210        for (CodeableConcept e : element.getAppliesTo()) 
49211          composeCodeableConcept(null, e);
49212        closeArray();
49213      };
49214      if (element.hasGenderElement()) {
49215        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49216        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49217      }
49218      if (element.hasAge()) {
49219        composeRange("age", element.getAge());
49220      }
49221      if (element.hasGestationalAge()) {
49222        composeRange("gestationalAge", element.getGestationalAge());
49223      }
49224      if (element.hasConditionElement()) {
49225        composeStringCore("condition", element.getConditionElement(), false);
49226        composeStringExtras("condition", element.getConditionElement(), false);
49227      }
49228  }
49229
49230  protected void composeOperationDefinition(String name, OperationDefinition element) throws IOException {
49231    if (element != null) {
49232      prop("resourceType", name);
49233      composeOperationDefinitionInner(element);
49234    }
49235  }
49236
49237  protected void composeOperationDefinitionInner(OperationDefinition element) throws IOException {
49238      composeDomainResourceElements(element);
49239      if (element.hasUrlElement()) {
49240        composeUriCore("url", element.getUrlElement(), false);
49241        composeUriExtras("url", element.getUrlElement(), false);
49242      }
49243      if (element.hasVersionElement()) {
49244        composeStringCore("version", element.getVersionElement(), false);
49245        composeStringExtras("version", element.getVersionElement(), false);
49246      }
49247      if (element.hasNameElement()) {
49248        composeStringCore("name", element.getNameElement(), false);
49249        composeStringExtras("name", element.getNameElement(), false);
49250      }
49251      if (element.hasTitleElement()) {
49252        composeStringCore("title", element.getTitleElement(), false);
49253        composeStringExtras("title", element.getTitleElement(), false);
49254      }
49255      if (element.hasStatusElement()) {
49256        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
49257        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
49258      }
49259      if (element.hasKindElement()) {
49260        composeEnumerationCore("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
49261        composeEnumerationExtras("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
49262      }
49263      if (element.hasExperimentalElement()) {
49264        composeBooleanCore("experimental", element.getExperimentalElement(), false);
49265        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
49266      }
49267      if (element.hasDateElement()) {
49268        composeDateTimeCore("date", element.getDateElement(), false);
49269        composeDateTimeExtras("date", element.getDateElement(), false);
49270      }
49271      if (element.hasPublisherElement()) {
49272        composeStringCore("publisher", element.getPublisherElement(), false);
49273        composeStringExtras("publisher", element.getPublisherElement(), false);
49274      }
49275      if (element.hasContact()) {
49276        openArray("contact");
49277        for (ContactDetail e : element.getContact()) 
49278          composeContactDetail(null, e);
49279        closeArray();
49280      };
49281      if (element.hasDescriptionElement()) {
49282        composeMarkdownCore("description", element.getDescriptionElement(), false);
49283        composeMarkdownExtras("description", element.getDescriptionElement(), false);
49284      }
49285      if (element.hasUseContext()) {
49286        openArray("useContext");
49287        for (UsageContext e : element.getUseContext()) 
49288          composeUsageContext(null, e);
49289        closeArray();
49290      };
49291      if (element.hasJurisdiction()) {
49292        openArray("jurisdiction");
49293        for (CodeableConcept e : element.getJurisdiction()) 
49294          composeCodeableConcept(null, e);
49295        closeArray();
49296      };
49297      if (element.hasPurposeElement()) {
49298        composeMarkdownCore("purpose", element.getPurposeElement(), false);
49299        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
49300      }
49301      if (element.hasAffectsStateElement()) {
49302        composeBooleanCore("affectsState", element.getAffectsStateElement(), false);
49303        composeBooleanExtras("affectsState", element.getAffectsStateElement(), false);
49304      }
49305      if (element.hasCodeElement()) {
49306        composeCodeCore("code", element.getCodeElement(), false);
49307        composeCodeExtras("code", element.getCodeElement(), false);
49308      }
49309      if (element.hasCommentElement()) {
49310        composeMarkdownCore("comment", element.getCommentElement(), false);
49311        composeMarkdownExtras("comment", element.getCommentElement(), false);
49312      }
49313      if (element.hasBaseElement()) {
49314        composeCanonicalCore("base", element.getBaseElement(), false);
49315        composeCanonicalExtras("base", element.getBaseElement(), false);
49316      }
49317      if (element.hasResource()) {
49318        openArray("resource");
49319        for (CodeType e : element.getResource()) 
49320          composeCodeCore(null, e, true);
49321        closeArray();
49322        if (anyHasExtras(element.getResource())) {
49323          openArray("_resource");
49324          for (CodeType e : element.getResource()) 
49325            composeCodeExtras(null, e, true);
49326          closeArray();
49327        }
49328      };
49329      if (element.hasSystemElement()) {
49330        composeBooleanCore("system", element.getSystemElement(), false);
49331        composeBooleanExtras("system", element.getSystemElement(), false);
49332      }
49333      if (element.hasTypeElement()) {
49334        composeBooleanCore("type", element.getTypeElement(), false);
49335        composeBooleanExtras("type", element.getTypeElement(), false);
49336      }
49337      if (element.hasInstanceElement()) {
49338        composeBooleanCore("instance", element.getInstanceElement(), false);
49339        composeBooleanExtras("instance", element.getInstanceElement(), false);
49340      }
49341      if (element.hasInputProfileElement()) {
49342        composeCanonicalCore("inputProfile", element.getInputProfileElement(), false);
49343        composeCanonicalExtras("inputProfile", element.getInputProfileElement(), false);
49344      }
49345      if (element.hasOutputProfileElement()) {
49346        composeCanonicalCore("outputProfile", element.getOutputProfileElement(), false);
49347        composeCanonicalExtras("outputProfile", element.getOutputProfileElement(), false);
49348      }
49349      if (element.hasParameter()) {
49350        openArray("parameter");
49351        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getParameter()) 
49352          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
49353        closeArray();
49354      };
49355      if (element.hasOverload()) {
49356        openArray("overload");
49357        for (OperationDefinition.OperationDefinitionOverloadComponent e : element.getOverload()) 
49358          composeOperationDefinitionOperationDefinitionOverloadComponent(null, e);
49359        closeArray();
49360      };
49361  }
49362
49363  protected void composeOperationDefinitionOperationDefinitionParameterComponent(String name, OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
49364    if (element != null) {
49365      open(name);
49366      composeOperationDefinitionOperationDefinitionParameterComponentInner(element);
49367      close();
49368    }
49369  }
49370
49371  protected void composeOperationDefinitionOperationDefinitionParameterComponentInner(OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
49372      composeBackbone(element);
49373      if (element.hasNameElement()) {
49374        composeCodeCore("name", element.getNameElement(), false);
49375        composeCodeExtras("name", element.getNameElement(), false);
49376      }
49377      if (element.hasUseElement()) {
49378        composeEnumerationCore("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
49379        composeEnumerationExtras("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
49380      }
49381      if (element.hasMinElement()) {
49382        composeIntegerCore("min", element.getMinElement(), false);
49383        composeIntegerExtras("min", element.getMinElement(), false);
49384      }
49385      if (element.hasMaxElement()) {
49386        composeStringCore("max", element.getMaxElement(), false);
49387        composeStringExtras("max", element.getMaxElement(), false);
49388      }
49389      if (element.hasDocumentationElement()) {
49390        composeStringCore("documentation", element.getDocumentationElement(), false);
49391        composeStringExtras("documentation", element.getDocumentationElement(), false);
49392      }
49393      if (element.hasTypeElement()) {
49394        composeCodeCore("type", element.getTypeElement(), false);
49395        composeCodeExtras("type", element.getTypeElement(), false);
49396      }
49397      if (element.hasTargetProfile()) {
49398        openArray("targetProfile");
49399        for (CanonicalType e : element.getTargetProfile()) 
49400          composeCanonicalCore(null, e, true);
49401        closeArray();
49402        if (anyHasExtras(element.getTargetProfile())) {
49403          openArray("_targetProfile");
49404          for (CanonicalType e : element.getTargetProfile()) 
49405            composeCanonicalExtras(null, e, true);
49406          closeArray();
49407        }
49408      };
49409      if (element.hasSearchTypeElement()) {
49410        composeEnumerationCore("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
49411        composeEnumerationExtras("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
49412      }
49413      if (element.hasBinding()) {
49414        composeOperationDefinitionOperationDefinitionParameterBindingComponent("binding", element.getBinding());
49415      }
49416      if (element.hasReferencedFrom()) {
49417        openArray("referencedFrom");
49418        for (OperationDefinition.OperationDefinitionParameterReferencedFromComponent e : element.getReferencedFrom()) 
49419          composeOperationDefinitionOperationDefinitionParameterReferencedFromComponent(null, e);
49420        closeArray();
49421      };
49422      if (element.hasPart()) {
49423        openArray("part");
49424        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getPart()) 
49425          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
49426        closeArray();
49427      };
49428  }
49429
49430  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponent(String name, OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
49431    if (element != null) {
49432      open(name);
49433      composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(element);
49434      close();
49435    }
49436  }
49437
49438  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
49439      composeBackbone(element);
49440      if (element.hasStrengthElement()) {
49441        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
49442        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
49443      }
49444      if (element.hasValueSetElement()) {
49445        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
49446        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
49447      }
49448  }
49449
49450  protected void composeOperationDefinitionOperationDefinitionParameterReferencedFromComponent(String name, OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
49451    if (element != null) {
49452      open(name);
49453      composeOperationDefinitionOperationDefinitionParameterReferencedFromComponentInner(element);
49454      close();
49455    }
49456  }
49457
49458  protected void composeOperationDefinitionOperationDefinitionParameterReferencedFromComponentInner(OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
49459      composeBackbone(element);
49460      if (element.hasSourceElement()) {
49461        composeStringCore("source", element.getSourceElement(), false);
49462        composeStringExtras("source", element.getSourceElement(), false);
49463      }
49464      if (element.hasSourceIdElement()) {
49465        composeStringCore("sourceId", element.getSourceIdElement(), false);
49466        composeStringExtras("sourceId", element.getSourceIdElement(), false);
49467      }
49468  }
49469
49470  protected void composeOperationDefinitionOperationDefinitionOverloadComponent(String name, OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
49471    if (element != null) {
49472      open(name);
49473      composeOperationDefinitionOperationDefinitionOverloadComponentInner(element);
49474      close();
49475    }
49476  }
49477
49478  protected void composeOperationDefinitionOperationDefinitionOverloadComponentInner(OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
49479      composeBackbone(element);
49480      if (element.hasParameterName()) {
49481        openArray("parameterName");
49482        for (StringType e : element.getParameterName()) 
49483          composeStringCore(null, e, true);
49484        closeArray();
49485        if (anyHasExtras(element.getParameterName())) {
49486          openArray("_parameterName");
49487          for (StringType e : element.getParameterName()) 
49488            composeStringExtras(null, e, true);
49489          closeArray();
49490        }
49491      };
49492      if (element.hasCommentElement()) {
49493        composeStringCore("comment", element.getCommentElement(), false);
49494        composeStringExtras("comment", element.getCommentElement(), false);
49495      }
49496  }
49497
49498  protected void composeOperationOutcome(String name, OperationOutcome element) throws IOException {
49499    if (element != null) {
49500      prop("resourceType", name);
49501      composeOperationOutcomeInner(element);
49502    }
49503  }
49504
49505  protected void composeOperationOutcomeInner(OperationOutcome element) throws IOException {
49506      composeDomainResourceElements(element);
49507      if (element.hasIssue()) {
49508        openArray("issue");
49509        for (OperationOutcome.OperationOutcomeIssueComponent e : element.getIssue()) 
49510          composeOperationOutcomeOperationOutcomeIssueComponent(null, e);
49511        closeArray();
49512      };
49513  }
49514
49515  protected void composeOperationOutcomeOperationOutcomeIssueComponent(String name, OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
49516    if (element != null) {
49517      open(name);
49518      composeOperationOutcomeOperationOutcomeIssueComponentInner(element);
49519      close();
49520    }
49521  }
49522
49523  protected void composeOperationOutcomeOperationOutcomeIssueComponentInner(OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
49524      composeBackbone(element);
49525      if (element.hasSeverityElement()) {
49526        composeEnumerationCore("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
49527        composeEnumerationExtras("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
49528      }
49529      if (element.hasCodeElement()) {
49530        composeEnumerationCore("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
49531        composeEnumerationExtras("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
49532      }
49533      if (element.hasDetails()) {
49534        composeCodeableConcept("details", element.getDetails());
49535      }
49536      if (element.hasDiagnosticsElement()) {
49537        composeStringCore("diagnostics", element.getDiagnosticsElement(), false);
49538        composeStringExtras("diagnostics", element.getDiagnosticsElement(), false);
49539      }
49540      if (element.hasLocation()) {
49541        openArray("location");
49542        for (StringType e : element.getLocation()) 
49543          composeStringCore(null, e, true);
49544        closeArray();
49545        if (anyHasExtras(element.getLocation())) {
49546          openArray("_location");
49547          for (StringType e : element.getLocation()) 
49548            composeStringExtras(null, e, true);
49549          closeArray();
49550        }
49551      };
49552      if (element.hasExpression()) {
49553        openArray("expression");
49554        for (StringType e : element.getExpression()) 
49555          composeStringCore(null, e, true);
49556        closeArray();
49557        if (anyHasExtras(element.getExpression())) {
49558          openArray("_expression");
49559          for (StringType e : element.getExpression()) 
49560            composeStringExtras(null, e, true);
49561          closeArray();
49562        }
49563      };
49564  }
49565
49566  protected void composeOrganization(String name, Organization element) throws IOException {
49567    if (element != null) {
49568      prop("resourceType", name);
49569      composeOrganizationInner(element);
49570    }
49571  }
49572
49573  protected void composeOrganizationInner(Organization element) throws IOException {
49574      composeDomainResourceElements(element);
49575      if (element.hasIdentifier()) {
49576        openArray("identifier");
49577        for (Identifier e : element.getIdentifier()) 
49578          composeIdentifier(null, e);
49579        closeArray();
49580      };
49581      if (element.hasActiveElement()) {
49582        composeBooleanCore("active", element.getActiveElement(), false);
49583        composeBooleanExtras("active", element.getActiveElement(), false);
49584      }
49585      if (element.hasType()) {
49586        openArray("type");
49587        for (CodeableConcept e : element.getType()) 
49588          composeCodeableConcept(null, e);
49589        closeArray();
49590      };
49591      if (element.hasNameElement()) {
49592        composeStringCore("name", element.getNameElement(), false);
49593        composeStringExtras("name", element.getNameElement(), false);
49594      }
49595      if (element.hasAlias()) {
49596        openArray("alias");
49597        for (StringType e : element.getAlias()) 
49598          composeStringCore(null, e, true);
49599        closeArray();
49600        if (anyHasExtras(element.getAlias())) {
49601          openArray("_alias");
49602          for (StringType e : element.getAlias()) 
49603            composeStringExtras(null, e, true);
49604          closeArray();
49605        }
49606      };
49607      if (element.hasTelecom()) {
49608        openArray("telecom");
49609        for (ContactPoint e : element.getTelecom()) 
49610          composeContactPoint(null, e);
49611        closeArray();
49612      };
49613      if (element.hasAddress()) {
49614        openArray("address");
49615        for (Address e : element.getAddress()) 
49616          composeAddress(null, e);
49617        closeArray();
49618      };
49619      if (element.hasPartOf()) {
49620        composeReference("partOf", element.getPartOf());
49621      }
49622      if (element.hasContact()) {
49623        openArray("contact");
49624        for (Organization.OrganizationContactComponent e : element.getContact()) 
49625          composeOrganizationOrganizationContactComponent(null, e);
49626        closeArray();
49627      };
49628      if (element.hasEndpoint()) {
49629        openArray("endpoint");
49630        for (Reference e : element.getEndpoint()) 
49631          composeReference(null, e);
49632        closeArray();
49633      };
49634  }
49635
49636  protected void composeOrganizationOrganizationContactComponent(String name, Organization.OrganizationContactComponent element) throws IOException {
49637    if (element != null) {
49638      open(name);
49639      composeOrganizationOrganizationContactComponentInner(element);
49640      close();
49641    }
49642  }
49643
49644  protected void composeOrganizationOrganizationContactComponentInner(Organization.OrganizationContactComponent element) throws IOException {
49645      composeBackbone(element);
49646      if (element.hasPurpose()) {
49647        composeCodeableConcept("purpose", element.getPurpose());
49648      }
49649      if (element.hasName()) {
49650        composeHumanName("name", element.getName());
49651      }
49652      if (element.hasTelecom()) {
49653        openArray("telecom");
49654        for (ContactPoint e : element.getTelecom()) 
49655          composeContactPoint(null, e);
49656        closeArray();
49657      };
49658      if (element.hasAddress()) {
49659        composeAddress("address", element.getAddress());
49660      }
49661  }
49662
49663  protected void composeOrganizationAffiliation(String name, OrganizationAffiliation element) throws IOException {
49664    if (element != null) {
49665      prop("resourceType", name);
49666      composeOrganizationAffiliationInner(element);
49667    }
49668  }
49669
49670  protected void composeOrganizationAffiliationInner(OrganizationAffiliation element) throws IOException {
49671      composeDomainResourceElements(element);
49672      if (element.hasIdentifier()) {
49673        openArray("identifier");
49674        for (Identifier e : element.getIdentifier()) 
49675          composeIdentifier(null, e);
49676        closeArray();
49677      };
49678      if (element.hasActiveElement()) {
49679        composeBooleanCore("active", element.getActiveElement(), false);
49680        composeBooleanExtras("active", element.getActiveElement(), false);
49681      }
49682      if (element.hasPeriod()) {
49683        composePeriod("period", element.getPeriod());
49684      }
49685      if (element.hasOrganization()) {
49686        composeReference("organization", element.getOrganization());
49687      }
49688      if (element.hasParticipatingOrganization()) {
49689        composeReference("participatingOrganization", element.getParticipatingOrganization());
49690      }
49691      if (element.hasNetwork()) {
49692        openArray("network");
49693        for (Reference e : element.getNetwork()) 
49694          composeReference(null, e);
49695        closeArray();
49696      };
49697      if (element.hasCode()) {
49698        openArray("code");
49699        for (CodeableConcept e : element.getCode()) 
49700          composeCodeableConcept(null, e);
49701        closeArray();
49702      };
49703      if (element.hasSpecialty()) {
49704        openArray("specialty");
49705        for (CodeableConcept e : element.getSpecialty()) 
49706          composeCodeableConcept(null, e);
49707        closeArray();
49708      };
49709      if (element.hasLocation()) {
49710        openArray("location");
49711        for (Reference e : element.getLocation()) 
49712          composeReference(null, e);
49713        closeArray();
49714      };
49715      if (element.hasHealthcareService()) {
49716        openArray("healthcareService");
49717        for (Reference e : element.getHealthcareService()) 
49718          composeReference(null, e);
49719        closeArray();
49720      };
49721      if (element.hasTelecom()) {
49722        openArray("telecom");
49723        for (ContactPoint e : element.getTelecom()) 
49724          composeContactPoint(null, e);
49725        closeArray();
49726      };
49727      if (element.hasEndpoint()) {
49728        openArray("endpoint");
49729        for (Reference e : element.getEndpoint()) 
49730          composeReference(null, e);
49731        closeArray();
49732      };
49733  }
49734
49735  protected void composePatient(String name, Patient element) throws IOException {
49736    if (element != null) {
49737      prop("resourceType", name);
49738      composePatientInner(element);
49739    }
49740  }
49741
49742  protected void composePatientInner(Patient element) throws IOException {
49743      composeDomainResourceElements(element);
49744      if (element.hasIdentifier()) {
49745        openArray("identifier");
49746        for (Identifier e : element.getIdentifier()) 
49747          composeIdentifier(null, e);
49748        closeArray();
49749      };
49750      if (element.hasActiveElement()) {
49751        composeBooleanCore("active", element.getActiveElement(), false);
49752        composeBooleanExtras("active", element.getActiveElement(), false);
49753      }
49754      if (element.hasName()) {
49755        openArray("name");
49756        for (HumanName e : element.getName()) 
49757          composeHumanName(null, e);
49758        closeArray();
49759      };
49760      if (element.hasTelecom()) {
49761        openArray("telecom");
49762        for (ContactPoint e : element.getTelecom()) 
49763          composeContactPoint(null, e);
49764        closeArray();
49765      };
49766      if (element.hasGenderElement()) {
49767        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49768        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49769      }
49770      if (element.hasBirthDateElement()) {
49771        composeDateCore("birthDate", element.getBirthDateElement(), false);
49772        composeDateExtras("birthDate", element.getBirthDateElement(), false);
49773      }
49774      if (element.hasDeceased()) {
49775        composeType("deceased", element.getDeceased());
49776      }
49777      if (element.hasAddress()) {
49778        openArray("address");
49779        for (Address e : element.getAddress()) 
49780          composeAddress(null, e);
49781        closeArray();
49782      };
49783      if (element.hasMaritalStatus()) {
49784        composeCodeableConcept("maritalStatus", element.getMaritalStatus());
49785      }
49786      if (element.hasMultipleBirth()) {
49787        composeType("multipleBirth", element.getMultipleBirth());
49788      }
49789      if (element.hasPhoto()) {
49790        openArray("photo");
49791        for (Attachment e : element.getPhoto()) 
49792          composeAttachment(null, e);
49793        closeArray();
49794      };
49795      if (element.hasContact()) {
49796        openArray("contact");
49797        for (Patient.ContactComponent e : element.getContact()) 
49798          composePatientContactComponent(null, e);
49799        closeArray();
49800      };
49801      if (element.hasCommunication()) {
49802        openArray("communication");
49803        for (Patient.PatientCommunicationComponent e : element.getCommunication()) 
49804          composePatientPatientCommunicationComponent(null, e);
49805        closeArray();
49806      };
49807      if (element.hasGeneralPractitioner()) {
49808        openArray("generalPractitioner");
49809        for (Reference e : element.getGeneralPractitioner()) 
49810          composeReference(null, e);
49811        closeArray();
49812      };
49813      if (element.hasManagingOrganization()) {
49814        composeReference("managingOrganization", element.getManagingOrganization());
49815      }
49816      if (element.hasLink()) {
49817        openArray("link");
49818        for (Patient.PatientLinkComponent e : element.getLink()) 
49819          composePatientPatientLinkComponent(null, e);
49820        closeArray();
49821      };
49822  }
49823
49824  protected void composePatientContactComponent(String name, Patient.ContactComponent element) throws IOException {
49825    if (element != null) {
49826      open(name);
49827      composePatientContactComponentInner(element);
49828      close();
49829    }
49830  }
49831
49832  protected void composePatientContactComponentInner(Patient.ContactComponent element) throws IOException {
49833      composeBackbone(element);
49834      if (element.hasRelationship()) {
49835        openArray("relationship");
49836        for (CodeableConcept e : element.getRelationship()) 
49837          composeCodeableConcept(null, e);
49838        closeArray();
49839      };
49840      if (element.hasName()) {
49841        composeHumanName("name", element.getName());
49842      }
49843      if (element.hasTelecom()) {
49844        openArray("telecom");
49845        for (ContactPoint e : element.getTelecom()) 
49846          composeContactPoint(null, e);
49847        closeArray();
49848      };
49849      if (element.hasAddress()) {
49850        composeAddress("address", element.getAddress());
49851      }
49852      if (element.hasGenderElement()) {
49853        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49854        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49855      }
49856      if (element.hasOrganization()) {
49857        composeReference("organization", element.getOrganization());
49858      }
49859      if (element.hasPeriod()) {
49860        composePeriod("period", element.getPeriod());
49861      }
49862  }
49863
49864  protected void composePatientPatientCommunicationComponent(String name, Patient.PatientCommunicationComponent element) throws IOException {
49865    if (element != null) {
49866      open(name);
49867      composePatientPatientCommunicationComponentInner(element);
49868      close();
49869    }
49870  }
49871
49872  protected void composePatientPatientCommunicationComponentInner(Patient.PatientCommunicationComponent element) throws IOException {
49873      composeBackbone(element);
49874      if (element.hasLanguage()) {
49875        composeCodeableConcept("language", element.getLanguage());
49876      }
49877      if (element.hasPreferredElement()) {
49878        composeBooleanCore("preferred", element.getPreferredElement(), false);
49879        composeBooleanExtras("preferred", element.getPreferredElement(), false);
49880      }
49881  }
49882
49883  protected void composePatientPatientLinkComponent(String name, Patient.PatientLinkComponent element) throws IOException {
49884    if (element != null) {
49885      open(name);
49886      composePatientPatientLinkComponentInner(element);
49887      close();
49888    }
49889  }
49890
49891  protected void composePatientPatientLinkComponentInner(Patient.PatientLinkComponent element) throws IOException {
49892      composeBackbone(element);
49893      if (element.hasOther()) {
49894        composeReference("other", element.getOther());
49895      }
49896      if (element.hasTypeElement()) {
49897        composeEnumerationCore("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
49898        composeEnumerationExtras("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
49899      }
49900  }
49901
49902  protected void composePaymentNotice(String name, PaymentNotice element) throws IOException {
49903    if (element != null) {
49904      prop("resourceType", name);
49905      composePaymentNoticeInner(element);
49906    }
49907  }
49908
49909  protected void composePaymentNoticeInner(PaymentNotice element) throws IOException {
49910      composeDomainResourceElements(element);
49911      if (element.hasIdentifier()) {
49912        openArray("identifier");
49913        for (Identifier e : element.getIdentifier()) 
49914          composeIdentifier(null, e);
49915        closeArray();
49916      };
49917      if (element.hasStatusElement()) {
49918        composeEnumerationCore("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(), false);
49919        composeEnumerationExtras("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(), false);
49920      }
49921      if (element.hasRequest()) {
49922        composeReference("request", element.getRequest());
49923      }
49924      if (element.hasResponse()) {
49925        composeReference("response", element.getResponse());
49926      }
49927      if (element.hasCreatedElement()) {
49928        composeDateTimeCore("created", element.getCreatedElement(), false);
49929        composeDateTimeExtras("created", element.getCreatedElement(), false);
49930      }
49931      if (element.hasProvider()) {
49932        composeReference("provider", element.getProvider());
49933      }
49934      if (element.hasPayment()) {
49935        composeReference("payment", element.getPayment());
49936      }
49937      if (element.hasPaymentDateElement()) {
49938        composeDateCore("paymentDate", element.getPaymentDateElement(), false);
49939        composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
49940      }
49941      if (element.hasPayee()) {
49942        composeReference("payee", element.getPayee());
49943      }
49944      if (element.hasRecipient()) {
49945        composeReference("recipient", element.getRecipient());
49946      }
49947      if (element.hasAmount()) {
49948        composeMoney("amount", element.getAmount());
49949      }
49950      if (element.hasPaymentStatus()) {
49951        composeCodeableConcept("paymentStatus", element.getPaymentStatus());
49952      }
49953  }
49954
49955  protected void composePaymentReconciliation(String name, PaymentReconciliation element) throws IOException {
49956    if (element != null) {
49957      prop("resourceType", name);
49958      composePaymentReconciliationInner(element);
49959    }
49960  }
49961
49962  protected void composePaymentReconciliationInner(PaymentReconciliation element) throws IOException {
49963      composeDomainResourceElements(element);
49964      if (element.hasIdentifier()) {
49965        openArray("identifier");
49966        for (Identifier e : element.getIdentifier()) 
49967          composeIdentifier(null, e);
49968        closeArray();
49969      };
49970      if (element.hasStatusElement()) {
49971        composeEnumerationCore("status", element.getStatusElement(), new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
49972        composeEnumerationExtras("status", element.getStatusElement(), new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
49973      }
49974      if (element.hasPeriod()) {
49975        composePeriod("period", element.getPeriod());
49976      }
49977      if (element.hasCreatedElement()) {
49978        composeDateTimeCore("created", element.getCreatedElement(), false);
49979        composeDateTimeExtras("created", element.getCreatedElement(), false);
49980      }
49981      if (element.hasPaymentIssuer()) {
49982        composeReference("paymentIssuer", element.getPaymentIssuer());
49983      }
49984      if (element.hasRequest()) {
49985        composeReference("request", element.getRequest());
49986      }
49987      if (element.hasRequestor()) {
49988        composeReference("requestor", element.getRequestor());
49989      }
49990      if (element.hasOutcomeElement()) {
49991        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
49992        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
49993      }
49994      if (element.hasDispositionElement()) {
49995        composeStringCore("disposition", element.getDispositionElement(), false);
49996        composeStringExtras("disposition", element.getDispositionElement(), false);
49997      }
49998      if (element.hasPaymentDateElement()) {
49999        composeDateCore("paymentDate", element.getPaymentDateElement(), false);
50000        composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
50001      }
50002      if (element.hasPaymentAmount()) {
50003        composeMoney("paymentAmount", element.getPaymentAmount());
50004      }
50005      if (element.hasPaymentIdentifier()) {
50006        composeIdentifier("paymentIdentifier", element.getPaymentIdentifier());
50007      }
50008      if (element.hasDetail()) {
50009        openArray("detail");
50010        for (PaymentReconciliation.DetailsComponent e : element.getDetail()) 
50011          composePaymentReconciliationDetailsComponent(null, e);
50012        closeArray();
50013      };
50014      if (element.hasFormCode()) {
50015        composeCodeableConcept("formCode", element.getFormCode());
50016      }
50017      if (element.hasProcessNote()) {
50018        openArray("processNote");
50019        for (PaymentReconciliation.NotesComponent e : element.getProcessNote()) 
50020          composePaymentReconciliationNotesComponent(null, e);
50021        closeArray();
50022      };
50023  }
50024
50025  protected void composePaymentReconciliationDetailsComponent(String name, PaymentReconciliation.DetailsComponent element) throws IOException {
50026    if (element != null) {
50027      open(name);
50028      composePaymentReconciliationDetailsComponentInner(element);
50029      close();
50030    }
50031  }
50032
50033  protected void composePaymentReconciliationDetailsComponentInner(PaymentReconciliation.DetailsComponent element) throws IOException {
50034      composeBackbone(element);
50035      if (element.hasIdentifier()) {
50036        composeIdentifier("identifier", element.getIdentifier());
50037      }
50038      if (element.hasPredecessor()) {
50039        composeIdentifier("predecessor", element.getPredecessor());
50040      }
50041      if (element.hasType()) {
50042        composeCodeableConcept("type", element.getType());
50043      }
50044      if (element.hasRequest()) {
50045        composeReference("request", element.getRequest());
50046      }
50047      if (element.hasSubmitter()) {
50048        composeReference("submitter", element.getSubmitter());
50049      }
50050      if (element.hasResponse()) {
50051        composeReference("response", element.getResponse());
50052      }
50053      if (element.hasDateElement()) {
50054        composeDateCore("date", element.getDateElement(), false);
50055        composeDateExtras("date", element.getDateElement(), false);
50056      }
50057      if (element.hasResponsible()) {
50058        composeReference("responsible", element.getResponsible());
50059      }
50060      if (element.hasPayee()) {
50061        composeReference("payee", element.getPayee());
50062      }
50063      if (element.hasAmount()) {
50064        composeMoney("amount", element.getAmount());
50065      }
50066  }
50067
50068  protected void composePaymentReconciliationNotesComponent(String name, PaymentReconciliation.NotesComponent element) throws IOException {
50069    if (element != null) {
50070      open(name);
50071      composePaymentReconciliationNotesComponentInner(element);
50072      close();
50073    }
50074  }
50075
50076  protected void composePaymentReconciliationNotesComponentInner(PaymentReconciliation.NotesComponent element) throws IOException {
50077      composeBackbone(element);
50078      if (element.hasTypeElement()) {
50079        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
50080        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
50081      }
50082      if (element.hasTextElement()) {
50083        composeStringCore("text", element.getTextElement(), false);
50084        composeStringExtras("text", element.getTextElement(), false);
50085      }
50086  }
50087
50088  protected void composePerson(String name, Person element) throws IOException {
50089    if (element != null) {
50090      prop("resourceType", name);
50091      composePersonInner(element);
50092    }
50093  }
50094
50095  protected void composePersonInner(Person element) throws IOException {
50096      composeDomainResourceElements(element);
50097      if (element.hasIdentifier()) {
50098        openArray("identifier");
50099        for (Identifier e : element.getIdentifier()) 
50100          composeIdentifier(null, e);
50101        closeArray();
50102      };
50103      if (element.hasName()) {
50104        openArray("name");
50105        for (HumanName e : element.getName()) 
50106          composeHumanName(null, e);
50107        closeArray();
50108      };
50109      if (element.hasTelecom()) {
50110        openArray("telecom");
50111        for (ContactPoint e : element.getTelecom()) 
50112          composeContactPoint(null, e);
50113        closeArray();
50114      };
50115      if (element.hasGenderElement()) {
50116        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
50117        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
50118      }
50119      if (element.hasBirthDateElement()) {
50120        composeDateCore("birthDate", element.getBirthDateElement(), false);
50121        composeDateExtras("birthDate", element.getBirthDateElement(), false);
50122      }
50123      if (element.hasAddress()) {
50124        openArray("address");
50125        for (Address e : element.getAddress()) 
50126          composeAddress(null, e);
50127        closeArray();
50128      };
50129      if (element.hasPhoto()) {
50130        composeAttachment("photo", element.getPhoto());
50131      }
50132      if (element.hasManagingOrganization()) {
50133        composeReference("managingOrganization", element.getManagingOrganization());
50134      }
50135      if (element.hasActiveElement()) {
50136        composeBooleanCore("active", element.getActiveElement(), false);
50137        composeBooleanExtras("active", element.getActiveElement(), false);
50138      }
50139      if (element.hasLink()) {
50140        openArray("link");
50141        for (Person.PersonLinkComponent e : element.getLink()) 
50142          composePersonPersonLinkComponent(null, e);
50143        closeArray();
50144      };
50145  }
50146
50147  protected void composePersonPersonLinkComponent(String name, Person.PersonLinkComponent element) throws IOException {
50148    if (element != null) {
50149      open(name);
50150      composePersonPersonLinkComponentInner(element);
50151      close();
50152    }
50153  }
50154
50155  protected void composePersonPersonLinkComponentInner(Person.PersonLinkComponent element) throws IOException {
50156      composeBackbone(element);
50157      if (element.hasTarget()) {
50158        composeReference("target", element.getTarget());
50159      }
50160      if (element.hasAssuranceElement()) {
50161        composeEnumerationCore("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
50162        composeEnumerationExtras("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
50163      }
50164  }
50165
50166  protected void composePlanDefinition(String name, PlanDefinition element) throws IOException {
50167    if (element != null) {
50168      prop("resourceType", name);
50169      composePlanDefinitionInner(element);
50170    }
50171  }
50172
50173  protected void composePlanDefinitionInner(PlanDefinition element) throws IOException {
50174      composeDomainResourceElements(element);
50175      if (element.hasUrlElement()) {
50176        composeUriCore("url", element.getUrlElement(), false);
50177        composeUriExtras("url", element.getUrlElement(), false);
50178      }
50179      if (element.hasIdentifier()) {
50180        openArray("identifier");
50181        for (Identifier e : element.getIdentifier()) 
50182          composeIdentifier(null, e);
50183        closeArray();
50184      };
50185      if (element.hasVersionElement()) {
50186        composeStringCore("version", element.getVersionElement(), false);
50187        composeStringExtras("version", element.getVersionElement(), false);
50188      }
50189      if (element.hasNameElement()) {
50190        composeStringCore("name", element.getNameElement(), false);
50191        composeStringExtras("name", element.getNameElement(), false);
50192      }
50193      if (element.hasTitleElement()) {
50194        composeStringCore("title", element.getTitleElement(), false);
50195        composeStringExtras("title", element.getTitleElement(), false);
50196      }
50197      if (element.hasSubtitleElement()) {
50198        composeStringCore("subtitle", element.getSubtitleElement(), false);
50199        composeStringExtras("subtitle", element.getSubtitleElement(), false);
50200      }
50201      if (element.hasType()) {
50202        composeCodeableConcept("type", element.getType());
50203      }
50204      if (element.hasStatusElement()) {
50205        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
50206        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
50207      }
50208      if (element.hasExperimentalElement()) {
50209        composeBooleanCore("experimental", element.getExperimentalElement(), false);
50210        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
50211      }
50212      if (element.hasSubject()) {
50213        composeType("subject", element.getSubject());
50214      }
50215      if (element.hasDateElement()) {
50216        composeDateTimeCore("date", element.getDateElement(), false);
50217        composeDateTimeExtras("date", element.getDateElement(), false);
50218      }
50219      if (element.hasPublisherElement()) {
50220        composeStringCore("publisher", element.getPublisherElement(), false);
50221        composeStringExtras("publisher", element.getPublisherElement(), false);
50222      }
50223      if (element.hasContact()) {
50224        openArray("contact");
50225        for (ContactDetail e : element.getContact()) 
50226          composeContactDetail(null, e);
50227        closeArray();
50228      };
50229      if (element.hasDescriptionElement()) {
50230        composeMarkdownCore("description", element.getDescriptionElement(), false);
50231        composeMarkdownExtras("description", element.getDescriptionElement(), false);
50232      }
50233      if (element.hasUseContext()) {
50234        openArray("useContext");
50235        for (UsageContext e : element.getUseContext()) 
50236          composeUsageContext(null, e);
50237        closeArray();
50238      };
50239      if (element.hasJurisdiction()) {
50240        openArray("jurisdiction");
50241        for (CodeableConcept e : element.getJurisdiction()) 
50242          composeCodeableConcept(null, e);
50243        closeArray();
50244      };
50245      if (element.hasPurposeElement()) {
50246        composeMarkdownCore("purpose", element.getPurposeElement(), false);
50247        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
50248      }
50249      if (element.hasUsageElement()) {
50250        composeStringCore("usage", element.getUsageElement(), false);
50251        composeStringExtras("usage", element.getUsageElement(), false);
50252      }
50253      if (element.hasCopyrightElement()) {
50254        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
50255        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
50256      }
50257      if (element.hasApprovalDateElement()) {
50258        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
50259        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
50260      }
50261      if (element.hasLastReviewDateElement()) {
50262        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
50263        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
50264      }
50265      if (element.hasEffectivePeriod()) {
50266        composePeriod("effectivePeriod", element.getEffectivePeriod());
50267      }
50268      if (element.hasTopic()) {
50269        openArray("topic");
50270        for (CodeableConcept e : element.getTopic()) 
50271          composeCodeableConcept(null, e);
50272        closeArray();
50273      };
50274      if (element.hasAuthor()) {
50275        openArray("author");
50276        for (ContactDetail e : element.getAuthor()) 
50277          composeContactDetail(null, e);
50278        closeArray();
50279      };
50280      if (element.hasEditor()) {
50281        openArray("editor");
50282        for (ContactDetail e : element.getEditor()) 
50283          composeContactDetail(null, e);
50284        closeArray();
50285      };
50286      if (element.hasReviewer()) {
50287        openArray("reviewer");
50288        for (ContactDetail e : element.getReviewer()) 
50289          composeContactDetail(null, e);
50290        closeArray();
50291      };
50292      if (element.hasEndorser()) {
50293        openArray("endorser");
50294        for (ContactDetail e : element.getEndorser()) 
50295          composeContactDetail(null, e);
50296        closeArray();
50297      };
50298      if (element.hasRelatedArtifact()) {
50299        openArray("relatedArtifact");
50300        for (RelatedArtifact e : element.getRelatedArtifact()) 
50301          composeRelatedArtifact(null, e);
50302        closeArray();
50303      };
50304      if (element.hasLibrary()) {
50305        openArray("library");
50306        for (CanonicalType e : element.getLibrary()) 
50307          composeCanonicalCore(null, e, true);
50308        closeArray();
50309        if (anyHasExtras(element.getLibrary())) {
50310          openArray("_library");
50311          for (CanonicalType e : element.getLibrary()) 
50312            composeCanonicalExtras(null, e, true);
50313          closeArray();
50314        }
50315      };
50316      if (element.hasGoal()) {
50317        openArray("goal");
50318        for (PlanDefinition.PlanDefinitionGoalComponent e : element.getGoal()) 
50319          composePlanDefinitionPlanDefinitionGoalComponent(null, e);
50320        closeArray();
50321      };
50322      if (element.hasAction()) {
50323        openArray("action");
50324        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
50325          composePlanDefinitionPlanDefinitionActionComponent(null, e);
50326        closeArray();
50327      };
50328  }
50329
50330  protected void composePlanDefinitionPlanDefinitionGoalComponent(String name, PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
50331    if (element != null) {
50332      open(name);
50333      composePlanDefinitionPlanDefinitionGoalComponentInner(element);
50334      close();
50335    }
50336  }
50337
50338  protected void composePlanDefinitionPlanDefinitionGoalComponentInner(PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
50339      composeBackbone(element);
50340      if (element.hasCategory()) {
50341        composeCodeableConcept("category", element.getCategory());
50342      }
50343      if (element.hasDescription()) {
50344        composeCodeableConcept("description", element.getDescription());
50345      }
50346      if (element.hasPriority()) {
50347        composeCodeableConcept("priority", element.getPriority());
50348      }
50349      if (element.hasStart()) {
50350        composeCodeableConcept("start", element.getStart());
50351      }
50352      if (element.hasAddresses()) {
50353        openArray("addresses");
50354        for (CodeableConcept e : element.getAddresses()) 
50355          composeCodeableConcept(null, e);
50356        closeArray();
50357      };
50358      if (element.hasDocumentation()) {
50359        openArray("documentation");
50360        for (RelatedArtifact e : element.getDocumentation()) 
50361          composeRelatedArtifact(null, e);
50362        closeArray();
50363      };
50364      if (element.hasTarget()) {
50365        openArray("target");
50366        for (PlanDefinition.PlanDefinitionGoalTargetComponent e : element.getTarget()) 
50367          composePlanDefinitionPlanDefinitionGoalTargetComponent(null, e);
50368        closeArray();
50369      };
50370  }
50371
50372  protected void composePlanDefinitionPlanDefinitionGoalTargetComponent(String name, PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
50373    if (element != null) {
50374      open(name);
50375      composePlanDefinitionPlanDefinitionGoalTargetComponentInner(element);
50376      close();
50377    }
50378  }
50379
50380  protected void composePlanDefinitionPlanDefinitionGoalTargetComponentInner(PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
50381      composeBackbone(element);
50382      if (element.hasMeasure()) {
50383        composeCodeableConcept("measure", element.getMeasure());
50384      }
50385      if (element.hasDetail()) {
50386        composeType("detail", element.getDetail());
50387      }
50388      if (element.hasDue()) {
50389        composeDuration("due", element.getDue());
50390      }
50391  }
50392
50393  protected void composePlanDefinitionPlanDefinitionActionComponent(String name, PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
50394    if (element != null) {
50395      open(name);
50396      composePlanDefinitionPlanDefinitionActionComponentInner(element);
50397      close();
50398    }
50399  }
50400
50401  protected void composePlanDefinitionPlanDefinitionActionComponentInner(PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
50402      composeBackbone(element);
50403      if (element.hasPrefixElement()) {
50404        composeStringCore("prefix", element.getPrefixElement(), false);
50405        composeStringExtras("prefix", element.getPrefixElement(), false);
50406      }
50407      if (element.hasTitleElement()) {
50408        composeStringCore("title", element.getTitleElement(), false);
50409        composeStringExtras("title", element.getTitleElement(), false);
50410      }
50411      if (element.hasDescriptionElement()) {
50412        composeStringCore("description", element.getDescriptionElement(), false);
50413        composeStringExtras("description", element.getDescriptionElement(), false);
50414      }
50415      if (element.hasTextEquivalentElement()) {
50416        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
50417        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
50418      }
50419      if (element.hasPriorityElement()) {
50420        composeEnumerationCore("priority", element.getPriorityElement(), new PlanDefinition.RequestPriorityEnumFactory(), false);
50421        composeEnumerationExtras("priority", element.getPriorityElement(), new PlanDefinition.RequestPriorityEnumFactory(), false);
50422      }
50423      if (element.hasCode()) {
50424        openArray("code");
50425        for (CodeableConcept e : element.getCode()) 
50426          composeCodeableConcept(null, e);
50427        closeArray();
50428      };
50429      if (element.hasReason()) {
50430        openArray("reason");
50431        for (CodeableConcept e : element.getReason()) 
50432          composeCodeableConcept(null, e);
50433        closeArray();
50434      };
50435      if (element.hasDocumentation()) {
50436        openArray("documentation");
50437        for (RelatedArtifact e : element.getDocumentation()) 
50438          composeRelatedArtifact(null, e);
50439        closeArray();
50440      };
50441      if (element.hasGoalId()) {
50442        openArray("goalId");
50443        for (IdType e : element.getGoalId()) 
50444          composeIdCore(null, e, true);
50445        closeArray();
50446        if (anyHasExtras(element.getGoalId())) {
50447          openArray("_goalId");
50448          for (IdType e : element.getGoalId()) 
50449            composeIdExtras(null, e, true);
50450          closeArray();
50451        }
50452      };
50453      if (element.hasSubject()) {
50454        composeType("subject", element.getSubject());
50455      }
50456      if (element.hasTrigger()) {
50457        openArray("trigger");
50458        for (TriggerDefinition e : element.getTrigger()) 
50459          composeTriggerDefinition(null, e);
50460        closeArray();
50461      };
50462      if (element.hasCondition()) {
50463        openArray("condition");
50464        for (PlanDefinition.PlanDefinitionActionConditionComponent e : element.getCondition()) 
50465          composePlanDefinitionPlanDefinitionActionConditionComponent(null, e);
50466        closeArray();
50467      };
50468      if (element.hasInput()) {
50469        openArray("input");
50470        for (DataRequirement e : element.getInput()) 
50471          composeDataRequirement(null, e);
50472        closeArray();
50473      };
50474      if (element.hasOutput()) {
50475        openArray("output");
50476        for (DataRequirement e : element.getOutput()) 
50477          composeDataRequirement(null, e);
50478        closeArray();
50479      };
50480      if (element.hasRelatedAction()) {
50481        openArray("relatedAction");
50482        for (PlanDefinition.PlanDefinitionActionRelatedActionComponent e : element.getRelatedAction()) 
50483          composePlanDefinitionPlanDefinitionActionRelatedActionComponent(null, e);
50484        closeArray();
50485      };
50486      if (element.hasTiming()) {
50487        composeType("timing", element.getTiming());
50488      }
50489      if (element.hasParticipant()) {
50490        openArray("participant");
50491        for (PlanDefinition.PlanDefinitionActionParticipantComponent e : element.getParticipant()) 
50492          composePlanDefinitionPlanDefinitionActionParticipantComponent(null, e);
50493        closeArray();
50494      };
50495      if (element.hasType()) {
50496        composeCodeableConcept("type", element.getType());
50497      }
50498      if (element.hasGroupingBehaviorElement()) {
50499        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
50500        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
50501      }
50502      if (element.hasSelectionBehaviorElement()) {
50503        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
50504        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
50505      }
50506      if (element.hasRequiredBehaviorElement()) {
50507        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
50508        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
50509      }
50510      if (element.hasPrecheckBehaviorElement()) {
50511        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
50512        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
50513      }
50514      if (element.hasCardinalityBehaviorElement()) {
50515        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
50516        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
50517      }
50518      if (element.hasDefinition()) {
50519        composeType("definition", element.getDefinition());
50520      }
50521      if (element.hasTransformElement()) {
50522        composeCanonicalCore("transform", element.getTransformElement(), false);
50523        composeCanonicalExtras("transform", element.getTransformElement(), false);
50524      }
50525      if (element.hasDynamicValue()) {
50526        openArray("dynamicValue");
50527        for (PlanDefinition.PlanDefinitionActionDynamicValueComponent e : element.getDynamicValue()) 
50528          composePlanDefinitionPlanDefinitionActionDynamicValueComponent(null, e);
50529        closeArray();
50530      };
50531      if (element.hasAction()) {
50532        openArray("action");
50533        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
50534          composePlanDefinitionPlanDefinitionActionComponent(null, e);
50535        closeArray();
50536      };
50537  }
50538
50539  protected void composePlanDefinitionPlanDefinitionActionConditionComponent(String name, PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
50540    if (element != null) {
50541      open(name);
50542      composePlanDefinitionPlanDefinitionActionConditionComponentInner(element);
50543      close();
50544    }
50545  }
50546
50547  protected void composePlanDefinitionPlanDefinitionActionConditionComponentInner(PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
50548      composeBackbone(element);
50549      if (element.hasKindElement()) {
50550        composeEnumerationCore("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(), false);
50551        composeEnumerationExtras("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(), false);
50552      }
50553      if (element.hasExpression()) {
50554        composeExpression("expression", element.getExpression());
50555      }
50556  }
50557
50558  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponent(String name, PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
50559    if (element != null) {
50560      open(name);
50561      composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(element);
50562      close();
50563    }
50564  }
50565
50566  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
50567      composeBackbone(element);
50568      if (element.hasActionIdElement()) {
50569        composeIdCore("actionId", element.getActionIdElement(), false);
50570        composeIdExtras("actionId", element.getActionIdElement(), false);
50571      }
50572      if (element.hasRelationshipElement()) {
50573        composeEnumerationCore("relationship", element.getRelationshipElement(), new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
50574        composeEnumerationExtras("relationship", element.getRelationshipElement(), new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
50575      }
50576      if (element.hasOffset()) {
50577        composeType("offset", element.getOffset());
50578      }
50579  }
50580
50581  protected void composePlanDefinitionPlanDefinitionActionParticipantComponent(String name, PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
50582    if (element != null) {
50583      open(name);
50584      composePlanDefinitionPlanDefinitionActionParticipantComponentInner(element);
50585      close();
50586    }
50587  }
50588
50589  protected void composePlanDefinitionPlanDefinitionActionParticipantComponentInner(PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
50590      composeBackbone(element);
50591      if (element.hasTypeElement()) {
50592        composeEnumerationCore("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(), false);
50593        composeEnumerationExtras("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(), false);
50594      }
50595      if (element.hasRole()) {
50596        composeCodeableConcept("role", element.getRole());
50597      }
50598  }
50599
50600  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponent(String name, PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
50601    if (element != null) {
50602      open(name);
50603      composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(element);
50604      close();
50605    }
50606  }
50607
50608  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
50609      composeBackbone(element);
50610      if (element.hasPathElement()) {
50611        composeStringCore("path", element.getPathElement(), false);
50612        composeStringExtras("path", element.getPathElement(), false);
50613      }
50614      if (element.hasExpression()) {
50615        composeExpression("expression", element.getExpression());
50616      }
50617  }
50618
50619  protected void composePractitioner(String name, Practitioner element) throws IOException {
50620    if (element != null) {
50621      prop("resourceType", name);
50622      composePractitionerInner(element);
50623    }
50624  }
50625
50626  protected void composePractitionerInner(Practitioner element) throws IOException {
50627      composeDomainResourceElements(element);
50628      if (element.hasIdentifier()) {
50629        openArray("identifier");
50630        for (Identifier e : element.getIdentifier()) 
50631          composeIdentifier(null, e);
50632        closeArray();
50633      };
50634      if (element.hasActiveElement()) {
50635        composeBooleanCore("active", element.getActiveElement(), false);
50636        composeBooleanExtras("active", element.getActiveElement(), false);
50637      }
50638      if (element.hasName()) {
50639        openArray("name");
50640        for (HumanName e : element.getName()) 
50641          composeHumanName(null, e);
50642        closeArray();
50643      };
50644      if (element.hasTelecom()) {
50645        openArray("telecom");
50646        for (ContactPoint e : element.getTelecom()) 
50647          composeContactPoint(null, e);
50648        closeArray();
50649      };
50650      if (element.hasAddress()) {
50651        openArray("address");
50652        for (Address e : element.getAddress()) 
50653          composeAddress(null, e);
50654        closeArray();
50655      };
50656      if (element.hasGenderElement()) {
50657        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
50658        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
50659      }
50660      if (element.hasBirthDateElement()) {
50661        composeDateCore("birthDate", element.getBirthDateElement(), false);
50662        composeDateExtras("birthDate", element.getBirthDateElement(), false);
50663      }
50664      if (element.hasPhoto()) {
50665        openArray("photo");
50666        for (Attachment e : element.getPhoto()) 
50667          composeAttachment(null, e);
50668        closeArray();
50669      };
50670      if (element.hasQualification()) {
50671        openArray("qualification");
50672        for (Practitioner.PractitionerQualificationComponent e : element.getQualification()) 
50673          composePractitionerPractitionerQualificationComponent(null, e);
50674        closeArray();
50675      };
50676      if (element.hasCommunication()) {
50677        openArray("communication");
50678        for (CodeableConcept e : element.getCommunication()) 
50679          composeCodeableConcept(null, e);
50680        closeArray();
50681      };
50682  }
50683
50684  protected void composePractitionerPractitionerQualificationComponent(String name, Practitioner.PractitionerQualificationComponent element) throws IOException {
50685    if (element != null) {
50686      open(name);
50687      composePractitionerPractitionerQualificationComponentInner(element);
50688      close();
50689    }
50690  }
50691
50692  protected void composePractitionerPractitionerQualificationComponentInner(Practitioner.PractitionerQualificationComponent element) throws IOException {
50693      composeBackbone(element);
50694      if (element.hasIdentifier()) {
50695        openArray("identifier");
50696        for (Identifier e : element.getIdentifier()) 
50697          composeIdentifier(null, e);
50698        closeArray();
50699      };
50700      if (element.hasCode()) {
50701        composeCodeableConcept("code", element.getCode());
50702      }
50703      if (element.hasPeriod()) {
50704        composePeriod("period", element.getPeriod());
50705      }
50706      if (element.hasIssuer()) {
50707        composeReference("issuer", element.getIssuer());
50708      }
50709  }
50710
50711  protected void composePractitionerRole(String name, PractitionerRole element) throws IOException {
50712    if (element != null) {
50713      prop("resourceType", name);
50714      composePractitionerRoleInner(element);
50715    }
50716  }
50717
50718  protected void composePractitionerRoleInner(PractitionerRole element) throws IOException {
50719      composeDomainResourceElements(element);
50720      if (element.hasIdentifier()) {
50721        openArray("identifier");
50722        for (Identifier e : element.getIdentifier()) 
50723          composeIdentifier(null, e);
50724        closeArray();
50725      };
50726      if (element.hasActiveElement()) {
50727        composeBooleanCore("active", element.getActiveElement(), false);
50728        composeBooleanExtras("active", element.getActiveElement(), false);
50729      }
50730      if (element.hasPeriod()) {
50731        composePeriod("period", element.getPeriod());
50732      }
50733      if (element.hasPractitioner()) {
50734        composeReference("practitioner", element.getPractitioner());
50735      }
50736      if (element.hasOrganization()) {
50737        composeReference("organization", element.getOrganization());
50738      }
50739      if (element.hasCode()) {
50740        openArray("code");
50741        for (CodeableConcept e : element.getCode()) 
50742          composeCodeableConcept(null, e);
50743        closeArray();
50744      };
50745      if (element.hasSpecialty()) {
50746        openArray("specialty");
50747        for (CodeableConcept e : element.getSpecialty()) 
50748          composeCodeableConcept(null, e);
50749        closeArray();
50750      };
50751      if (element.hasLocation()) {
50752        openArray("location");
50753        for (Reference e : element.getLocation()) 
50754          composeReference(null, e);
50755        closeArray();
50756      };
50757      if (element.hasHealthcareService()) {
50758        openArray("healthcareService");
50759        for (Reference e : element.getHealthcareService()) 
50760          composeReference(null, e);
50761        closeArray();
50762      };
50763      if (element.hasTelecom()) {
50764        openArray("telecom");
50765        for (ContactPoint e : element.getTelecom()) 
50766          composeContactPoint(null, e);
50767        closeArray();
50768      };
50769      if (element.hasAvailableTime()) {
50770        openArray("availableTime");
50771        for (PractitionerRole.PractitionerRoleAvailableTimeComponent e : element.getAvailableTime()) 
50772          composePractitionerRolePractitionerRoleAvailableTimeComponent(null, e);
50773        closeArray();
50774      };
50775      if (element.hasNotAvailable()) {
50776        openArray("notAvailable");
50777        for (PractitionerRole.PractitionerRoleNotAvailableComponent e : element.getNotAvailable()) 
50778          composePractitionerRolePractitionerRoleNotAvailableComponent(null, e);
50779        closeArray();
50780      };
50781      if (element.hasAvailabilityExceptionsElement()) {
50782        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
50783        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
50784      }
50785      if (element.hasEndpoint()) {
50786        openArray("endpoint");
50787        for (Reference e : element.getEndpoint()) 
50788          composeReference(null, e);
50789        closeArray();
50790      };
50791  }
50792
50793  protected void composePractitionerRolePractitionerRoleAvailableTimeComponent(String name, PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
50794    if (element != null) {
50795      open(name);
50796      composePractitionerRolePractitionerRoleAvailableTimeComponentInner(element);
50797      close();
50798    }
50799  }
50800
50801  protected void composePractitionerRolePractitionerRoleAvailableTimeComponentInner(PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
50802      composeBackbone(element);
50803      if (element.hasDaysOfWeek()) {
50804        openArray("daysOfWeek");
50805        for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek()) 
50806          composeEnumerationCore(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
50807        closeArray();
50808        if (anyHasExtras(element.getDaysOfWeek())) {
50809          openArray("_daysOfWeek");
50810          for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek()) 
50811            composeEnumerationExtras(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
50812          closeArray();
50813        }
50814      };
50815      if (element.hasAllDayElement()) {
50816        composeBooleanCore("allDay", element.getAllDayElement(), false);
50817        composeBooleanExtras("allDay", element.getAllDayElement(), false);
50818      }
50819      if (element.hasAvailableStartTimeElement()) {
50820        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
50821        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
50822      }
50823      if (element.hasAvailableEndTimeElement()) {
50824        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
50825        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
50826      }
50827  }
50828
50829  protected void composePractitionerRolePractitionerRoleNotAvailableComponent(String name, PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
50830    if (element != null) {
50831      open(name);
50832      composePractitionerRolePractitionerRoleNotAvailableComponentInner(element);
50833      close();
50834    }
50835  }
50836
50837  protected void composePractitionerRolePractitionerRoleNotAvailableComponentInner(PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
50838      composeBackbone(element);
50839      if (element.hasDescriptionElement()) {
50840        composeStringCore("description", element.getDescriptionElement(), false);
50841        composeStringExtras("description", element.getDescriptionElement(), false);
50842      }
50843      if (element.hasDuring()) {
50844        composePeriod("during", element.getDuring());
50845      }
50846  }
50847
50848  protected void composeProcedure(String name, Procedure element) throws IOException {
50849    if (element != null) {
50850      prop("resourceType", name);
50851      composeProcedureInner(element);
50852    }
50853  }
50854
50855  protected void composeProcedureInner(Procedure element) throws IOException {
50856      composeDomainResourceElements(element);
50857      if (element.hasIdentifier()) {
50858        openArray("identifier");
50859        for (Identifier e : element.getIdentifier()) 
50860          composeIdentifier(null, e);
50861        closeArray();
50862      };
50863      if (element.hasInstantiatesCanonical()) {
50864        openArray("instantiatesCanonical");
50865        for (CanonicalType e : element.getInstantiatesCanonical()) 
50866          composeCanonicalCore(null, e, true);
50867        closeArray();
50868        if (anyHasExtras(element.getInstantiatesCanonical())) {
50869          openArray("_instantiatesCanonical");
50870          for (CanonicalType e : element.getInstantiatesCanonical()) 
50871            composeCanonicalExtras(null, e, true);
50872          closeArray();
50873        }
50874      };
50875      if (element.hasInstantiatesUri()) {
50876        openArray("instantiatesUri");
50877        for (UriType e : element.getInstantiatesUri()) 
50878          composeUriCore(null, e, true);
50879        closeArray();
50880        if (anyHasExtras(element.getInstantiatesUri())) {
50881          openArray("_instantiatesUri");
50882          for (UriType e : element.getInstantiatesUri()) 
50883            composeUriExtras(null, e, true);
50884          closeArray();
50885        }
50886      };
50887      if (element.hasBasedOn()) {
50888        openArray("basedOn");
50889        for (Reference e : element.getBasedOn()) 
50890          composeReference(null, e);
50891        closeArray();
50892      };
50893      if (element.hasPartOf()) {
50894        openArray("partOf");
50895        for (Reference e : element.getPartOf()) 
50896          composeReference(null, e);
50897        closeArray();
50898      };
50899      if (element.hasStatusElement()) {
50900        composeEnumerationCore("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
50901        composeEnumerationExtras("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
50902      }
50903      if (element.hasStatusReason()) {
50904        composeCodeableConcept("statusReason", element.getStatusReason());
50905      }
50906      if (element.hasCategory()) {
50907        composeCodeableConcept("category", element.getCategory());
50908      }
50909      if (element.hasCode()) {
50910        composeCodeableConcept("code", element.getCode());
50911      }
50912      if (element.hasSubject()) {
50913        composeReference("subject", element.getSubject());
50914      }
50915      if (element.hasEncounter()) {
50916        composeReference("encounter", element.getEncounter());
50917      }
50918      if (element.hasPerformed()) {
50919        composeType("performed", element.getPerformed());
50920      }
50921      if (element.hasRecorder()) {
50922        composeReference("recorder", element.getRecorder());
50923      }
50924      if (element.hasAsserter()) {
50925        composeReference("asserter", element.getAsserter());
50926      }
50927      if (element.hasPerformer()) {
50928        openArray("performer");
50929        for (Procedure.ProcedurePerformerComponent e : element.getPerformer()) 
50930          composeProcedureProcedurePerformerComponent(null, e);
50931        closeArray();
50932      };
50933      if (element.hasLocation()) {
50934        composeReference("location", element.getLocation());
50935      }
50936      if (element.hasReasonCode()) {
50937        openArray("reasonCode");
50938        for (CodeableConcept e : element.getReasonCode()) 
50939          composeCodeableConcept(null, e);
50940        closeArray();
50941      };
50942      if (element.hasReasonReference()) {
50943        openArray("reasonReference");
50944        for (Reference e : element.getReasonReference()) 
50945          composeReference(null, e);
50946        closeArray();
50947      };
50948      if (element.hasBodySite()) {
50949        openArray("bodySite");
50950        for (CodeableConcept e : element.getBodySite()) 
50951          composeCodeableConcept(null, e);
50952        closeArray();
50953      };
50954      if (element.hasOutcome()) {
50955        composeCodeableConcept("outcome", element.getOutcome());
50956      }
50957      if (element.hasReport()) {
50958        openArray("report");
50959        for (Reference e : element.getReport()) 
50960          composeReference(null, e);
50961        closeArray();
50962      };
50963      if (element.hasComplication()) {
50964        openArray("complication");
50965        for (CodeableConcept e : element.getComplication()) 
50966          composeCodeableConcept(null, e);
50967        closeArray();
50968      };
50969      if (element.hasComplicationDetail()) {
50970        openArray("complicationDetail");
50971        for (Reference e : element.getComplicationDetail()) 
50972          composeReference(null, e);
50973        closeArray();
50974      };
50975      if (element.hasFollowUp()) {
50976        openArray("followUp");
50977        for (CodeableConcept e : element.getFollowUp()) 
50978          composeCodeableConcept(null, e);
50979        closeArray();
50980      };
50981      if (element.hasNote()) {
50982        openArray("note");
50983        for (Annotation e : element.getNote()) 
50984          composeAnnotation(null, e);
50985        closeArray();
50986      };
50987      if (element.hasFocalDevice()) {
50988        openArray("focalDevice");
50989        for (Procedure.ProcedureFocalDeviceComponent e : element.getFocalDevice()) 
50990          composeProcedureProcedureFocalDeviceComponent(null, e);
50991        closeArray();
50992      };
50993      if (element.hasUsedReference()) {
50994        openArray("usedReference");
50995        for (Reference e : element.getUsedReference()) 
50996          composeReference(null, e);
50997        closeArray();
50998      };
50999      if (element.hasUsedCode()) {
51000        openArray("usedCode");
51001        for (CodeableConcept e : element.getUsedCode()) 
51002          composeCodeableConcept(null, e);
51003        closeArray();
51004      };
51005  }
51006
51007  protected void composeProcedureProcedurePerformerComponent(String name, Procedure.ProcedurePerformerComponent element) throws IOException {
51008    if (element != null) {
51009      open(name);
51010      composeProcedureProcedurePerformerComponentInner(element);
51011      close();
51012    }
51013  }
51014
51015  protected void composeProcedureProcedurePerformerComponentInner(Procedure.ProcedurePerformerComponent element) throws IOException {
51016      composeBackbone(element);
51017      if (element.hasFunction()) {
51018        composeCodeableConcept("function", element.getFunction());
51019      }
51020      if (element.hasActor()) {
51021        composeReference("actor", element.getActor());
51022      }
51023      if (element.hasOnBehalfOf()) {
51024        composeReference("onBehalfOf", element.getOnBehalfOf());
51025      }
51026  }
51027
51028  protected void composeProcedureProcedureFocalDeviceComponent(String name, Procedure.ProcedureFocalDeviceComponent element) throws IOException {
51029    if (element != null) {
51030      open(name);
51031      composeProcedureProcedureFocalDeviceComponentInner(element);
51032      close();
51033    }
51034  }
51035
51036  protected void composeProcedureProcedureFocalDeviceComponentInner(Procedure.ProcedureFocalDeviceComponent element) throws IOException {
51037      composeBackbone(element);
51038      if (element.hasAction()) {
51039        composeCodeableConcept("action", element.getAction());
51040      }
51041      if (element.hasManipulated()) {
51042        composeReference("manipulated", element.getManipulated());
51043      }
51044  }
51045
51046  protected void composeProvenance(String name, Provenance element) throws IOException {
51047    if (element != null) {
51048      prop("resourceType", name);
51049      composeProvenanceInner(element);
51050    }
51051  }
51052
51053  protected void composeProvenanceInner(Provenance element) throws IOException {
51054      composeDomainResourceElements(element);
51055      if (element.hasTarget()) {
51056        openArray("target");
51057        for (Reference e : element.getTarget()) 
51058          composeReference(null, e);
51059        closeArray();
51060      };
51061      if (element.hasOccurred()) {
51062        composeType("occurred", element.getOccurred());
51063      }
51064      if (element.hasRecordedElement()) {
51065        composeInstantCore("recorded", element.getRecordedElement(), false);
51066        composeInstantExtras("recorded", element.getRecordedElement(), false);
51067      }
51068      if (element.hasPolicy()) {
51069        openArray("policy");
51070        for (UriType e : element.getPolicy()) 
51071          composeUriCore(null, e, true);
51072        closeArray();
51073        if (anyHasExtras(element.getPolicy())) {
51074          openArray("_policy");
51075          for (UriType e : element.getPolicy()) 
51076            composeUriExtras(null, e, true);
51077          closeArray();
51078        }
51079      };
51080      if (element.hasLocation()) {
51081        composeReference("location", element.getLocation());
51082      }
51083      if (element.hasReason()) {
51084        openArray("reason");
51085        for (CodeableConcept e : element.getReason()) 
51086          composeCodeableConcept(null, e);
51087        closeArray();
51088      };
51089      if (element.hasActivity()) {
51090        composeCodeableConcept("activity", element.getActivity());
51091      }
51092      if (element.hasAgent()) {
51093        openArray("agent");
51094        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
51095          composeProvenanceProvenanceAgentComponent(null, e);
51096        closeArray();
51097      };
51098      if (element.hasEntity()) {
51099        openArray("entity");
51100        for (Provenance.ProvenanceEntityComponent e : element.getEntity()) 
51101          composeProvenanceProvenanceEntityComponent(null, e);
51102        closeArray();
51103      };
51104      if (element.hasSignature()) {
51105        openArray("signature");
51106        for (Signature e : element.getSignature()) 
51107          composeSignature(null, e);
51108        closeArray();
51109      };
51110  }
51111
51112  protected void composeProvenanceProvenanceAgentComponent(String name, Provenance.ProvenanceAgentComponent element) throws IOException {
51113    if (element != null) {
51114      open(name);
51115      composeProvenanceProvenanceAgentComponentInner(element);
51116      close();
51117    }
51118  }
51119
51120  protected void composeProvenanceProvenanceAgentComponentInner(Provenance.ProvenanceAgentComponent element) throws IOException {
51121      composeBackbone(element);
51122      if (element.hasType()) {
51123        composeCodeableConcept("type", element.getType());
51124      }
51125      if (element.hasRole()) {
51126        openArray("role");
51127        for (CodeableConcept e : element.getRole()) 
51128          composeCodeableConcept(null, e);
51129        closeArray();
51130      };
51131      if (element.hasWho()) {
51132        composeReference("who", element.getWho());
51133      }
51134      if (element.hasOnBehalfOf()) {
51135        composeReference("onBehalfOf", element.getOnBehalfOf());
51136      }
51137  }
51138
51139  protected void composeProvenanceProvenanceEntityComponent(String name, Provenance.ProvenanceEntityComponent element) throws IOException {
51140    if (element != null) {
51141      open(name);
51142      composeProvenanceProvenanceEntityComponentInner(element);
51143      close();
51144    }
51145  }
51146
51147  protected void composeProvenanceProvenanceEntityComponentInner(Provenance.ProvenanceEntityComponent element) throws IOException {
51148      composeBackbone(element);
51149      if (element.hasRoleElement()) {
51150        composeEnumerationCore("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
51151        composeEnumerationExtras("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
51152      }
51153      if (element.hasWhat()) {
51154        composeReference("what", element.getWhat());
51155      }
51156      if (element.hasAgent()) {
51157        openArray("agent");
51158        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
51159          composeProvenanceProvenanceAgentComponent(null, e);
51160        closeArray();
51161      };
51162  }
51163
51164  protected void composeQuestionnaire(String name, Questionnaire element) throws IOException {
51165    if (element != null) {
51166      prop("resourceType", name);
51167      composeQuestionnaireInner(element);
51168    }
51169  }
51170
51171  protected void composeQuestionnaireInner(Questionnaire element) throws IOException {
51172      composeDomainResourceElements(element);
51173      if (element.hasUrlElement()) {
51174        composeUriCore("url", element.getUrlElement(), false);
51175        composeUriExtras("url", element.getUrlElement(), false);
51176      }
51177      if (element.hasIdentifier()) {
51178        openArray("identifier");
51179        for (Identifier e : element.getIdentifier()) 
51180          composeIdentifier(null, e);
51181        closeArray();
51182      };
51183      if (element.hasVersionElement()) {
51184        composeStringCore("version", element.getVersionElement(), false);
51185        composeStringExtras("version", element.getVersionElement(), false);
51186      }
51187      if (element.hasNameElement()) {
51188        composeStringCore("name", element.getNameElement(), false);
51189        composeStringExtras("name", element.getNameElement(), false);
51190      }
51191      if (element.hasTitleElement()) {
51192        composeStringCore("title", element.getTitleElement(), false);
51193        composeStringExtras("title", element.getTitleElement(), false);
51194      }
51195      if (element.hasDerivedFrom()) {
51196        openArray("derivedFrom");
51197        for (CanonicalType e : element.getDerivedFrom()) 
51198          composeCanonicalCore(null, e, true);
51199        closeArray();
51200        if (anyHasExtras(element.getDerivedFrom())) {
51201          openArray("_derivedFrom");
51202          for (CanonicalType e : element.getDerivedFrom()) 
51203            composeCanonicalExtras(null, e, true);
51204          closeArray();
51205        }
51206      };
51207      if (element.hasStatusElement()) {
51208        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51209        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51210      }
51211      if (element.hasExperimentalElement()) {
51212        composeBooleanCore("experimental", element.getExperimentalElement(), false);
51213        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
51214      }
51215      if (element.hasSubjectType()) {
51216        openArray("subjectType");
51217        for (CodeType e : element.getSubjectType()) 
51218          composeCodeCore(null, e, true);
51219        closeArray();
51220        if (anyHasExtras(element.getSubjectType())) {
51221          openArray("_subjectType");
51222          for (CodeType e : element.getSubjectType()) 
51223            composeCodeExtras(null, e, true);
51224          closeArray();
51225        }
51226      };
51227      if (element.hasDateElement()) {
51228        composeDateTimeCore("date", element.getDateElement(), false);
51229        composeDateTimeExtras("date", element.getDateElement(), false);
51230      }
51231      if (element.hasPublisherElement()) {
51232        composeStringCore("publisher", element.getPublisherElement(), false);
51233        composeStringExtras("publisher", element.getPublisherElement(), false);
51234      }
51235      if (element.hasContact()) {
51236        openArray("contact");
51237        for (ContactDetail e : element.getContact()) 
51238          composeContactDetail(null, e);
51239        closeArray();
51240      };
51241      if (element.hasDescriptionElement()) {
51242        composeMarkdownCore("description", element.getDescriptionElement(), false);
51243        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51244      }
51245      if (element.hasUseContext()) {
51246        openArray("useContext");
51247        for (UsageContext e : element.getUseContext()) 
51248          composeUsageContext(null, e);
51249        closeArray();
51250      };
51251      if (element.hasJurisdiction()) {
51252        openArray("jurisdiction");
51253        for (CodeableConcept e : element.getJurisdiction()) 
51254          composeCodeableConcept(null, e);
51255        closeArray();
51256      };
51257      if (element.hasPurposeElement()) {
51258        composeMarkdownCore("purpose", element.getPurposeElement(), false);
51259        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
51260      }
51261      if (element.hasCopyrightElement()) {
51262        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
51263        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
51264      }
51265      if (element.hasApprovalDateElement()) {
51266        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
51267        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
51268      }
51269      if (element.hasLastReviewDateElement()) {
51270        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
51271        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
51272      }
51273      if (element.hasEffectivePeriod()) {
51274        composePeriod("effectivePeriod", element.getEffectivePeriod());
51275      }
51276      if (element.hasCode()) {
51277        openArray("code");
51278        for (Coding e : element.getCode()) 
51279          composeCoding(null, e);
51280        closeArray();
51281      };
51282      if (element.hasItem()) {
51283        openArray("item");
51284        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
51285          composeQuestionnaireQuestionnaireItemComponent(null, e);
51286        closeArray();
51287      };
51288  }
51289
51290  protected void composeQuestionnaireQuestionnaireItemComponent(String name, Questionnaire.QuestionnaireItemComponent element) throws IOException {
51291    if (element != null) {
51292      open(name);
51293      composeQuestionnaireQuestionnaireItemComponentInner(element);
51294      close();
51295    }
51296  }
51297
51298  protected void composeQuestionnaireQuestionnaireItemComponentInner(Questionnaire.QuestionnaireItemComponent element) throws IOException {
51299      composeBackbone(element);
51300      if (element.hasLinkIdElement()) {
51301        composeStringCore("linkId", element.getLinkIdElement(), false);
51302        composeStringExtras("linkId", element.getLinkIdElement(), false);
51303      }
51304      if (element.hasDefinitionElement()) {
51305        composeUriCore("definition", element.getDefinitionElement(), false);
51306        composeUriExtras("definition", element.getDefinitionElement(), false);
51307      }
51308      if (element.hasCode()) {
51309        openArray("code");
51310        for (Coding e : element.getCode()) 
51311          composeCoding(null, e);
51312        closeArray();
51313      };
51314      if (element.hasPrefixElement()) {
51315        composeStringCore("prefix", element.getPrefixElement(), false);
51316        composeStringExtras("prefix", element.getPrefixElement(), false);
51317      }
51318      if (element.hasTextElement()) {
51319        composeStringCore("text", element.getTextElement(), false);
51320        composeStringExtras("text", element.getTextElement(), false);
51321      }
51322      if (element.hasTypeElement()) {
51323        composeEnumerationCore("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
51324        composeEnumerationExtras("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
51325      }
51326      if (element.hasEnableWhen()) {
51327        openArray("enableWhen");
51328        for (Questionnaire.QuestionnaireItemEnableWhenComponent e : element.getEnableWhen()) 
51329          composeQuestionnaireQuestionnaireItemEnableWhenComponent(null, e);
51330        closeArray();
51331      };
51332      if (element.hasEnableBehaviorElement()) {
51333        composeEnumerationCore("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
51334        composeEnumerationExtras("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
51335      }
51336      if (element.hasRequiredElement()) {
51337        composeBooleanCore("required", element.getRequiredElement(), false);
51338        composeBooleanExtras("required", element.getRequiredElement(), false);
51339      }
51340      if (element.hasRepeatsElement()) {
51341        composeBooleanCore("repeats", element.getRepeatsElement(), false);
51342        composeBooleanExtras("repeats", element.getRepeatsElement(), false);
51343      }
51344      if (element.hasReadOnlyElement()) {
51345        composeBooleanCore("readOnly", element.getReadOnlyElement(), false);
51346        composeBooleanExtras("readOnly", element.getReadOnlyElement(), false);
51347      }
51348      if (element.hasMaxLengthElement()) {
51349        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
51350        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
51351      }
51352      if (element.hasAnswerValueSetElement()) {
51353        composeCanonicalCore("answerValueSet", element.getAnswerValueSetElement(), false);
51354        composeCanonicalExtras("answerValueSet", element.getAnswerValueSetElement(), false);
51355      }
51356      if (element.hasAnswerOption()) {
51357        openArray("answerOption");
51358        for (Questionnaire.QuestionnaireItemAnswerOptionComponent e : element.getAnswerOption()) 
51359          composeQuestionnaireQuestionnaireItemAnswerOptionComponent(null, e);
51360        closeArray();
51361      };
51362      if (element.hasInitial()) {
51363        openArray("initial");
51364        for (Questionnaire.QuestionnaireItemInitialComponent e : element.getInitial()) 
51365          composeQuestionnaireQuestionnaireItemInitialComponent(null, e);
51366        closeArray();
51367      };
51368      if (element.hasItem()) {
51369        openArray("item");
51370        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
51371          composeQuestionnaireQuestionnaireItemComponent(null, e);
51372        closeArray();
51373      };
51374  }
51375
51376  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponent(String name, Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
51377    if (element != null) {
51378      open(name);
51379      composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(element);
51380      close();
51381    }
51382  }
51383
51384  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
51385      composeBackbone(element);
51386      if (element.hasQuestionElement()) {
51387        composeStringCore("question", element.getQuestionElement(), false);
51388        composeStringExtras("question", element.getQuestionElement(), false);
51389      }
51390      if (element.hasOperatorElement()) {
51391        composeEnumerationCore("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
51392        composeEnumerationExtras("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
51393      }
51394      if (element.hasAnswer()) {
51395        composeType("answer", element.getAnswer());
51396      }
51397  }
51398
51399  protected void composeQuestionnaireQuestionnaireItemAnswerOptionComponent(String name, Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
51400    if (element != null) {
51401      open(name);
51402      composeQuestionnaireQuestionnaireItemAnswerOptionComponentInner(element);
51403      close();
51404    }
51405  }
51406
51407  protected void composeQuestionnaireQuestionnaireItemAnswerOptionComponentInner(Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
51408      composeBackbone(element);
51409      if (element.hasValue()) {
51410        composeType("value", element.getValue());
51411      }
51412      if (element.hasInitialSelectedElement()) {
51413        composeBooleanCore("initialSelected", element.getInitialSelectedElement(), false);
51414        composeBooleanExtras("initialSelected", element.getInitialSelectedElement(), false);
51415      }
51416  }
51417
51418  protected void composeQuestionnaireQuestionnaireItemInitialComponent(String name, Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
51419    if (element != null) {
51420      open(name);
51421      composeQuestionnaireQuestionnaireItemInitialComponentInner(element);
51422      close();
51423    }
51424  }
51425
51426  protected void composeQuestionnaireQuestionnaireItemInitialComponentInner(Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
51427      composeBackbone(element);
51428      if (element.hasValue()) {
51429        composeType("value", element.getValue());
51430      }
51431  }
51432
51433  protected void composeQuestionnaireResponse(String name, QuestionnaireResponse element) throws IOException {
51434    if (element != null) {
51435      prop("resourceType", name);
51436      composeQuestionnaireResponseInner(element);
51437    }
51438  }
51439
51440  protected void composeQuestionnaireResponseInner(QuestionnaireResponse element) throws IOException {
51441      composeDomainResourceElements(element);
51442      if (element.hasIdentifier()) {
51443        composeIdentifier("identifier", element.getIdentifier());
51444      }
51445      if (element.hasBasedOn()) {
51446        openArray("basedOn");
51447        for (Reference e : element.getBasedOn()) 
51448          composeReference(null, e);
51449        closeArray();
51450      };
51451      if (element.hasPartOf()) {
51452        openArray("partOf");
51453        for (Reference e : element.getPartOf()) 
51454          composeReference(null, e);
51455        closeArray();
51456      };
51457      if (element.hasQuestionnaireElement()) {
51458        composeCanonicalCore("questionnaire", element.getQuestionnaireElement(), false);
51459        composeCanonicalExtras("questionnaire", element.getQuestionnaireElement(), false);
51460      }
51461      if (element.hasStatusElement()) {
51462        composeEnumerationCore("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
51463        composeEnumerationExtras("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
51464      }
51465      if (element.hasSubject()) {
51466        composeReference("subject", element.getSubject());
51467      }
51468      if (element.hasEncounter()) {
51469        composeReference("encounter", element.getEncounter());
51470      }
51471      if (element.hasAuthoredElement()) {
51472        composeDateTimeCore("authored", element.getAuthoredElement(), false);
51473        composeDateTimeExtras("authored", element.getAuthoredElement(), false);
51474      }
51475      if (element.hasAuthor()) {
51476        composeReference("author", element.getAuthor());
51477      }
51478      if (element.hasSource()) {
51479        composeReference("source", element.getSource());
51480      }
51481      if (element.hasItem()) {
51482        openArray("item");
51483        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
51484          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
51485        closeArray();
51486      };
51487  }
51488
51489  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
51490    if (element != null) {
51491      open(name);
51492      composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(element);
51493      close();
51494    }
51495  }
51496
51497  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
51498      composeBackbone(element);
51499      if (element.hasLinkIdElement()) {
51500        composeStringCore("linkId", element.getLinkIdElement(), false);
51501        composeStringExtras("linkId", element.getLinkIdElement(), false);
51502      }
51503      if (element.hasDefinitionElement()) {
51504        composeUriCore("definition", element.getDefinitionElement(), false);
51505        composeUriExtras("definition", element.getDefinitionElement(), false);
51506      }
51507      if (element.hasTextElement()) {
51508        composeStringCore("text", element.getTextElement(), false);
51509        composeStringExtras("text", element.getTextElement(), false);
51510      }
51511      if (element.hasAnswer()) {
51512        openArray("answer");
51513        for (QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent e : element.getAnswer()) 
51514          composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(null, e);
51515        closeArray();
51516      };
51517      if (element.hasItem()) {
51518        openArray("item");
51519        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
51520          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
51521        closeArray();
51522      };
51523  }
51524
51525  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
51526    if (element != null) {
51527      open(name);
51528      composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(element);
51529      close();
51530    }
51531  }
51532
51533  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
51534      composeBackbone(element);
51535      if (element.hasValue()) {
51536        composeType("value", element.getValue());
51537      }
51538      if (element.hasItem()) {
51539        openArray("item");
51540        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
51541          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
51542        closeArray();
51543      };
51544  }
51545
51546  protected void composeRelatedPerson(String name, RelatedPerson element) throws IOException {
51547    if (element != null) {
51548      prop("resourceType", name);
51549      composeRelatedPersonInner(element);
51550    }
51551  }
51552
51553  protected void composeRelatedPersonInner(RelatedPerson element) throws IOException {
51554      composeDomainResourceElements(element);
51555      if (element.hasIdentifier()) {
51556        openArray("identifier");
51557        for (Identifier e : element.getIdentifier()) 
51558          composeIdentifier(null, e);
51559        closeArray();
51560      };
51561      if (element.hasActiveElement()) {
51562        composeBooleanCore("active", element.getActiveElement(), false);
51563        composeBooleanExtras("active", element.getActiveElement(), false);
51564      }
51565      if (element.hasPatient()) {
51566        composeReference("patient", element.getPatient());
51567      }
51568      if (element.hasRelationship()) {
51569        openArray("relationship");
51570        for (CodeableConcept e : element.getRelationship()) 
51571          composeCodeableConcept(null, e);
51572        closeArray();
51573      };
51574      if (element.hasName()) {
51575        openArray("name");
51576        for (HumanName e : element.getName()) 
51577          composeHumanName(null, e);
51578        closeArray();
51579      };
51580      if (element.hasTelecom()) {
51581        openArray("telecom");
51582        for (ContactPoint e : element.getTelecom()) 
51583          composeContactPoint(null, e);
51584        closeArray();
51585      };
51586      if (element.hasGenderElement()) {
51587        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
51588        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
51589      }
51590      if (element.hasBirthDateElement()) {
51591        composeDateCore("birthDate", element.getBirthDateElement(), false);
51592        composeDateExtras("birthDate", element.getBirthDateElement(), false);
51593      }
51594      if (element.hasAddress()) {
51595        openArray("address");
51596        for (Address e : element.getAddress()) 
51597          composeAddress(null, e);
51598        closeArray();
51599      };
51600      if (element.hasPhoto()) {
51601        openArray("photo");
51602        for (Attachment e : element.getPhoto()) 
51603          composeAttachment(null, e);
51604        closeArray();
51605      };
51606      if (element.hasPeriod()) {
51607        composePeriod("period", element.getPeriod());
51608      }
51609      if (element.hasCommunication()) {
51610        openArray("communication");
51611        for (RelatedPerson.RelatedPersonCommunicationComponent e : element.getCommunication()) 
51612          composeRelatedPersonRelatedPersonCommunicationComponent(null, e);
51613        closeArray();
51614      };
51615  }
51616
51617  protected void composeRelatedPersonRelatedPersonCommunicationComponent(String name, RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
51618    if (element != null) {
51619      open(name);
51620      composeRelatedPersonRelatedPersonCommunicationComponentInner(element);
51621      close();
51622    }
51623  }
51624
51625  protected void composeRelatedPersonRelatedPersonCommunicationComponentInner(RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
51626      composeBackbone(element);
51627      if (element.hasLanguage()) {
51628        composeCodeableConcept("language", element.getLanguage());
51629      }
51630      if (element.hasPreferredElement()) {
51631        composeBooleanCore("preferred", element.getPreferredElement(), false);
51632        composeBooleanExtras("preferred", element.getPreferredElement(), false);
51633      }
51634  }
51635
51636  protected void composeRequestGroup(String name, RequestGroup element) throws IOException {
51637    if (element != null) {
51638      prop("resourceType", name);
51639      composeRequestGroupInner(element);
51640    }
51641  }
51642
51643  protected void composeRequestGroupInner(RequestGroup element) throws IOException {
51644      composeDomainResourceElements(element);
51645      if (element.hasIdentifier()) {
51646        openArray("identifier");
51647        for (Identifier e : element.getIdentifier()) 
51648          composeIdentifier(null, e);
51649        closeArray();
51650      };
51651      if (element.hasInstantiatesCanonical()) {
51652        openArray("instantiatesCanonical");
51653        for (CanonicalType e : element.getInstantiatesCanonical()) 
51654          composeCanonicalCore(null, e, true);
51655        closeArray();
51656        if (anyHasExtras(element.getInstantiatesCanonical())) {
51657          openArray("_instantiatesCanonical");
51658          for (CanonicalType e : element.getInstantiatesCanonical()) 
51659            composeCanonicalExtras(null, e, true);
51660          closeArray();
51661        }
51662      };
51663      if (element.hasInstantiatesUri()) {
51664        openArray("instantiatesUri");
51665        for (UriType e : element.getInstantiatesUri()) 
51666          composeUriCore(null, e, true);
51667        closeArray();
51668        if (anyHasExtras(element.getInstantiatesUri())) {
51669          openArray("_instantiatesUri");
51670          for (UriType e : element.getInstantiatesUri()) 
51671            composeUriExtras(null, e, true);
51672          closeArray();
51673        }
51674      };
51675      if (element.hasBasedOn()) {
51676        openArray("basedOn");
51677        for (Reference e : element.getBasedOn()) 
51678          composeReference(null, e);
51679        closeArray();
51680      };
51681      if (element.hasReplaces()) {
51682        openArray("replaces");
51683        for (Reference e : element.getReplaces()) 
51684          composeReference(null, e);
51685        closeArray();
51686      };
51687      if (element.hasGroupIdentifier()) {
51688        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
51689      }
51690      if (element.hasStatusElement()) {
51691        composeEnumerationCore("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(), false);
51692        composeEnumerationExtras("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(), false);
51693      }
51694      if (element.hasIntentElement()) {
51695        composeEnumerationCore("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(), false);
51696        composeEnumerationExtras("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(), false);
51697      }
51698      if (element.hasPriorityElement()) {
51699        composeEnumerationCore("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
51700        composeEnumerationExtras("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
51701      }
51702      if (element.hasCode()) {
51703        composeCodeableConcept("code", element.getCode());
51704      }
51705      if (element.hasSubject()) {
51706        composeReference("subject", element.getSubject());
51707      }
51708      if (element.hasEncounter()) {
51709        composeReference("encounter", element.getEncounter());
51710      }
51711      if (element.hasAuthoredOnElement()) {
51712        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
51713        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
51714      }
51715      if (element.hasAuthor()) {
51716        composeReference("author", element.getAuthor());
51717      }
51718      if (element.hasReasonCode()) {
51719        openArray("reasonCode");
51720        for (CodeableConcept e : element.getReasonCode()) 
51721          composeCodeableConcept(null, e);
51722        closeArray();
51723      };
51724      if (element.hasReasonReference()) {
51725        openArray("reasonReference");
51726        for (Reference e : element.getReasonReference()) 
51727          composeReference(null, e);
51728        closeArray();
51729      };
51730      if (element.hasNote()) {
51731        openArray("note");
51732        for (Annotation e : element.getNote()) 
51733          composeAnnotation(null, e);
51734        closeArray();
51735      };
51736      if (element.hasAction()) {
51737        openArray("action");
51738        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
51739          composeRequestGroupRequestGroupActionComponent(null, e);
51740        closeArray();
51741      };
51742  }
51743
51744  protected void composeRequestGroupRequestGroupActionComponent(String name, RequestGroup.RequestGroupActionComponent element) throws IOException {
51745    if (element != null) {
51746      open(name);
51747      composeRequestGroupRequestGroupActionComponentInner(element);
51748      close();
51749    }
51750  }
51751
51752  protected void composeRequestGroupRequestGroupActionComponentInner(RequestGroup.RequestGroupActionComponent element) throws IOException {
51753      composeBackbone(element);
51754      if (element.hasPrefixElement()) {
51755        composeStringCore("prefix", element.getPrefixElement(), false);
51756        composeStringExtras("prefix", element.getPrefixElement(), false);
51757      }
51758      if (element.hasTitleElement()) {
51759        composeStringCore("title", element.getTitleElement(), false);
51760        composeStringExtras("title", element.getTitleElement(), false);
51761      }
51762      if (element.hasDescriptionElement()) {
51763        composeStringCore("description", element.getDescriptionElement(), false);
51764        composeStringExtras("description", element.getDescriptionElement(), false);
51765      }
51766      if (element.hasTextEquivalentElement()) {
51767        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
51768        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
51769      }
51770      if (element.hasPriorityElement()) {
51771        composeEnumerationCore("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
51772        composeEnumerationExtras("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
51773      }
51774      if (element.hasCode()) {
51775        openArray("code");
51776        for (CodeableConcept e : element.getCode()) 
51777          composeCodeableConcept(null, e);
51778        closeArray();
51779      };
51780      if (element.hasDocumentation()) {
51781        openArray("documentation");
51782        for (RelatedArtifact e : element.getDocumentation()) 
51783          composeRelatedArtifact(null, e);
51784        closeArray();
51785      };
51786      if (element.hasCondition()) {
51787        openArray("condition");
51788        for (RequestGroup.RequestGroupActionConditionComponent e : element.getCondition()) 
51789          composeRequestGroupRequestGroupActionConditionComponent(null, e);
51790        closeArray();
51791      };
51792      if (element.hasRelatedAction()) {
51793        openArray("relatedAction");
51794        for (RequestGroup.RequestGroupActionRelatedActionComponent e : element.getRelatedAction()) 
51795          composeRequestGroupRequestGroupActionRelatedActionComponent(null, e);
51796        closeArray();
51797      };
51798      if (element.hasTiming()) {
51799        composeType("timing", element.getTiming());
51800      }
51801      if (element.hasParticipant()) {
51802        openArray("participant");
51803        for (Reference e : element.getParticipant()) 
51804          composeReference(null, e);
51805        closeArray();
51806      };
51807      if (element.hasType()) {
51808        composeCodeableConcept("type", element.getType());
51809      }
51810      if (element.hasGroupingBehaviorElement()) {
51811        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
51812        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
51813      }
51814      if (element.hasSelectionBehaviorElement()) {
51815        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
51816        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
51817      }
51818      if (element.hasRequiredBehaviorElement()) {
51819        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
51820        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
51821      }
51822      if (element.hasPrecheckBehaviorElement()) {
51823        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
51824        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
51825      }
51826      if (element.hasCardinalityBehaviorElement()) {
51827        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
51828        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
51829      }
51830      if (element.hasResource()) {
51831        composeReference("resource", element.getResource());
51832      }
51833      if (element.hasAction()) {
51834        openArray("action");
51835        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
51836          composeRequestGroupRequestGroupActionComponent(null, e);
51837        closeArray();
51838      };
51839  }
51840
51841  protected void composeRequestGroupRequestGroupActionConditionComponent(String name, RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
51842    if (element != null) {
51843      open(name);
51844      composeRequestGroupRequestGroupActionConditionComponentInner(element);
51845      close();
51846    }
51847  }
51848
51849  protected void composeRequestGroupRequestGroupActionConditionComponentInner(RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
51850      composeBackbone(element);
51851      if (element.hasKindElement()) {
51852        composeEnumerationCore("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(), false);
51853        composeEnumerationExtras("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(), false);
51854      }
51855      if (element.hasExpression()) {
51856        composeExpression("expression", element.getExpression());
51857      }
51858  }
51859
51860  protected void composeRequestGroupRequestGroupActionRelatedActionComponent(String name, RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
51861    if (element != null) {
51862      open(name);
51863      composeRequestGroupRequestGroupActionRelatedActionComponentInner(element);
51864      close();
51865    }
51866  }
51867
51868  protected void composeRequestGroupRequestGroupActionRelatedActionComponentInner(RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
51869      composeBackbone(element);
51870      if (element.hasActionIdElement()) {
51871        composeIdCore("actionId", element.getActionIdElement(), false);
51872        composeIdExtras("actionId", element.getActionIdElement(), false);
51873      }
51874      if (element.hasRelationshipElement()) {
51875        composeEnumerationCore("relationship", element.getRelationshipElement(), new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
51876        composeEnumerationExtras("relationship", element.getRelationshipElement(), new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
51877      }
51878      if (element.hasOffset()) {
51879        composeType("offset", element.getOffset());
51880      }
51881  }
51882
51883  protected void composeResearchDefinition(String name, ResearchDefinition element) throws IOException {
51884    if (element != null) {
51885      prop("resourceType", name);
51886      composeResearchDefinitionInner(element);
51887    }
51888  }
51889
51890  protected void composeResearchDefinitionInner(ResearchDefinition element) throws IOException {
51891      composeDomainResourceElements(element);
51892      if (element.hasUrlElement()) {
51893        composeUriCore("url", element.getUrlElement(), false);
51894        composeUriExtras("url", element.getUrlElement(), false);
51895      }
51896      if (element.hasIdentifier()) {
51897        openArray("identifier");
51898        for (Identifier e : element.getIdentifier()) 
51899          composeIdentifier(null, e);
51900        closeArray();
51901      };
51902      if (element.hasVersionElement()) {
51903        composeStringCore("version", element.getVersionElement(), false);
51904        composeStringExtras("version", element.getVersionElement(), false);
51905      }
51906      if (element.hasNameElement()) {
51907        composeStringCore("name", element.getNameElement(), false);
51908        composeStringExtras("name", element.getNameElement(), false);
51909      }
51910      if (element.hasTitleElement()) {
51911        composeStringCore("title", element.getTitleElement(), false);
51912        composeStringExtras("title", element.getTitleElement(), false);
51913      }
51914      if (element.hasShortTitleElement()) {
51915        composeStringCore("shortTitle", element.getShortTitleElement(), false);
51916        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
51917      }
51918      if (element.hasSubtitleElement()) {
51919        composeStringCore("subtitle", element.getSubtitleElement(), false);
51920        composeStringExtras("subtitle", element.getSubtitleElement(), false);
51921      }
51922      if (element.hasStatusElement()) {
51923        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51924        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51925      }
51926      if (element.hasExperimentalElement()) {
51927        composeBooleanCore("experimental", element.getExperimentalElement(), false);
51928        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
51929      }
51930      if (element.hasSubject()) {
51931        composeType("subject", element.getSubject());
51932      }
51933      if (element.hasDateElement()) {
51934        composeDateTimeCore("date", element.getDateElement(), false);
51935        composeDateTimeExtras("date", element.getDateElement(), false);
51936      }
51937      if (element.hasPublisherElement()) {
51938        composeStringCore("publisher", element.getPublisherElement(), false);
51939        composeStringExtras("publisher", element.getPublisherElement(), false);
51940      }
51941      if (element.hasContact()) {
51942        openArray("contact");
51943        for (ContactDetail e : element.getContact()) 
51944          composeContactDetail(null, e);
51945        closeArray();
51946      };
51947      if (element.hasDescriptionElement()) {
51948        composeMarkdownCore("description", element.getDescriptionElement(), false);
51949        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51950      }
51951      if (element.hasComment()) {
51952        openArray("comment");
51953        for (StringType e : element.getComment()) 
51954          composeStringCore(null, e, true);
51955        closeArray();
51956        if (anyHasExtras(element.getComment())) {
51957          openArray("_comment");
51958          for (StringType e : element.getComment()) 
51959            composeStringExtras(null, e, true);
51960          closeArray();
51961        }
51962      };
51963      if (element.hasUseContext()) {
51964        openArray("useContext");
51965        for (UsageContext e : element.getUseContext()) 
51966          composeUsageContext(null, e);
51967        closeArray();
51968      };
51969      if (element.hasJurisdiction()) {
51970        openArray("jurisdiction");
51971        for (CodeableConcept e : element.getJurisdiction()) 
51972          composeCodeableConcept(null, e);
51973        closeArray();
51974      };
51975      if (element.hasPurposeElement()) {
51976        composeMarkdownCore("purpose", element.getPurposeElement(), false);
51977        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
51978      }
51979      if (element.hasUsageElement()) {
51980        composeStringCore("usage", element.getUsageElement(), false);
51981        composeStringExtras("usage", element.getUsageElement(), false);
51982      }
51983      if (element.hasCopyrightElement()) {
51984        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
51985        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
51986      }
51987      if (element.hasApprovalDateElement()) {
51988        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
51989        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
51990      }
51991      if (element.hasLastReviewDateElement()) {
51992        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
51993        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
51994      }
51995      if (element.hasEffectivePeriod()) {
51996        composePeriod("effectivePeriod", element.getEffectivePeriod());
51997      }
51998      if (element.hasTopic()) {
51999        openArray("topic");
52000        for (CodeableConcept e : element.getTopic()) 
52001          composeCodeableConcept(null, e);
52002        closeArray();
52003      };
52004      if (element.hasAuthor()) {
52005        openArray("author");
52006        for (ContactDetail e : element.getAuthor()) 
52007          composeContactDetail(null, e);
52008        closeArray();
52009      };
52010      if (element.hasEditor()) {
52011        openArray("editor");
52012        for (ContactDetail e : element.getEditor()) 
52013          composeContactDetail(null, e);
52014        closeArray();
52015      };
52016      if (element.hasReviewer()) {
52017        openArray("reviewer");
52018        for (ContactDetail e : element.getReviewer()) 
52019          composeContactDetail(null, e);
52020        closeArray();
52021      };
52022      if (element.hasEndorser()) {
52023        openArray("endorser");
52024        for (ContactDetail e : element.getEndorser()) 
52025          composeContactDetail(null, e);
52026        closeArray();
52027      };
52028      if (element.hasRelatedArtifact()) {
52029        openArray("relatedArtifact");
52030        for (RelatedArtifact e : element.getRelatedArtifact()) 
52031          composeRelatedArtifact(null, e);
52032        closeArray();
52033      };
52034      if (element.hasLibrary()) {
52035        openArray("library");
52036        for (CanonicalType e : element.getLibrary()) 
52037          composeCanonicalCore(null, e, true);
52038        closeArray();
52039        if (anyHasExtras(element.getLibrary())) {
52040          openArray("_library");
52041          for (CanonicalType e : element.getLibrary()) 
52042            composeCanonicalExtras(null, e, true);
52043          closeArray();
52044        }
52045      };
52046      if (element.hasPopulation()) {
52047        composeReference("population", element.getPopulation());
52048      }
52049      if (element.hasExposure()) {
52050        composeReference("exposure", element.getExposure());
52051      }
52052      if (element.hasExposureAlternative()) {
52053        composeReference("exposureAlternative", element.getExposureAlternative());
52054      }
52055      if (element.hasOutcome()) {
52056        composeReference("outcome", element.getOutcome());
52057      }
52058  }
52059
52060  protected void composeResearchElementDefinition(String name, ResearchElementDefinition element) throws IOException {
52061    if (element != null) {
52062      prop("resourceType", name);
52063      composeResearchElementDefinitionInner(element);
52064    }
52065  }
52066
52067  protected void composeResearchElementDefinitionInner(ResearchElementDefinition element) throws IOException {
52068      composeDomainResourceElements(element);
52069      if (element.hasUrlElement()) {
52070        composeUriCore("url", element.getUrlElement(), false);
52071        composeUriExtras("url", element.getUrlElement(), false);
52072      }
52073      if (element.hasIdentifier()) {
52074        openArray("identifier");
52075        for (Identifier e : element.getIdentifier()) 
52076          composeIdentifier(null, e);
52077        closeArray();
52078      };
52079      if (element.hasVersionElement()) {
52080        composeStringCore("version", element.getVersionElement(), false);
52081        composeStringExtras("version", element.getVersionElement(), false);
52082      }
52083      if (element.hasNameElement()) {
52084        composeStringCore("name", element.getNameElement(), false);
52085        composeStringExtras("name", element.getNameElement(), false);
52086      }
52087      if (element.hasTitleElement()) {
52088        composeStringCore("title", element.getTitleElement(), false);
52089        composeStringExtras("title", element.getTitleElement(), false);
52090      }
52091      if (element.hasShortTitleElement()) {
52092        composeStringCore("shortTitle", element.getShortTitleElement(), false);
52093        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
52094      }
52095      if (element.hasSubtitleElement()) {
52096        composeStringCore("subtitle", element.getSubtitleElement(), false);
52097        composeStringExtras("subtitle", element.getSubtitleElement(), false);
52098      }
52099      if (element.hasStatusElement()) {
52100        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52101        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52102      }
52103      if (element.hasExperimentalElement()) {
52104        composeBooleanCore("experimental", element.getExperimentalElement(), false);
52105        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
52106      }
52107      if (element.hasSubject()) {
52108        composeType("subject", element.getSubject());
52109      }
52110      if (element.hasDateElement()) {
52111        composeDateTimeCore("date", element.getDateElement(), false);
52112        composeDateTimeExtras("date", element.getDateElement(), false);
52113      }
52114      if (element.hasPublisherElement()) {
52115        composeStringCore("publisher", element.getPublisherElement(), false);
52116        composeStringExtras("publisher", element.getPublisherElement(), false);
52117      }
52118      if (element.hasContact()) {
52119        openArray("contact");
52120        for (ContactDetail e : element.getContact()) 
52121          composeContactDetail(null, e);
52122        closeArray();
52123      };
52124      if (element.hasDescriptionElement()) {
52125        composeMarkdownCore("description", element.getDescriptionElement(), false);
52126        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52127      }
52128      if (element.hasComment()) {
52129        openArray("comment");
52130        for (StringType e : element.getComment()) 
52131          composeStringCore(null, e, true);
52132        closeArray();
52133        if (anyHasExtras(element.getComment())) {
52134          openArray("_comment");
52135          for (StringType e : element.getComment()) 
52136            composeStringExtras(null, e, true);
52137          closeArray();
52138        }
52139      };
52140      if (element.hasUseContext()) {
52141        openArray("useContext");
52142        for (UsageContext e : element.getUseContext()) 
52143          composeUsageContext(null, e);
52144        closeArray();
52145      };
52146      if (element.hasJurisdiction()) {
52147        openArray("jurisdiction");
52148        for (CodeableConcept e : element.getJurisdiction()) 
52149          composeCodeableConcept(null, e);
52150        closeArray();
52151      };
52152      if (element.hasPurposeElement()) {
52153        composeMarkdownCore("purpose", element.getPurposeElement(), false);
52154        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
52155      }
52156      if (element.hasUsageElement()) {
52157        composeStringCore("usage", element.getUsageElement(), false);
52158        composeStringExtras("usage", element.getUsageElement(), false);
52159      }
52160      if (element.hasCopyrightElement()) {
52161        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
52162        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
52163      }
52164      if (element.hasApprovalDateElement()) {
52165        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
52166        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
52167      }
52168      if (element.hasLastReviewDateElement()) {
52169        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
52170        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
52171      }
52172      if (element.hasEffectivePeriod()) {
52173        composePeriod("effectivePeriod", element.getEffectivePeriod());
52174      }
52175      if (element.hasTopic()) {
52176        openArray("topic");
52177        for (CodeableConcept e : element.getTopic()) 
52178          composeCodeableConcept(null, e);
52179        closeArray();
52180      };
52181      if (element.hasAuthor()) {
52182        openArray("author");
52183        for (ContactDetail e : element.getAuthor()) 
52184          composeContactDetail(null, e);
52185        closeArray();
52186      };
52187      if (element.hasEditor()) {
52188        openArray("editor");
52189        for (ContactDetail e : element.getEditor()) 
52190          composeContactDetail(null, e);
52191        closeArray();
52192      };
52193      if (element.hasReviewer()) {
52194        openArray("reviewer");
52195        for (ContactDetail e : element.getReviewer()) 
52196          composeContactDetail(null, e);
52197        closeArray();
52198      };
52199      if (element.hasEndorser()) {
52200        openArray("endorser");
52201        for (ContactDetail e : element.getEndorser()) 
52202          composeContactDetail(null, e);
52203        closeArray();
52204      };
52205      if (element.hasRelatedArtifact()) {
52206        openArray("relatedArtifact");
52207        for (RelatedArtifact e : element.getRelatedArtifact()) 
52208          composeRelatedArtifact(null, e);
52209        closeArray();
52210      };
52211      if (element.hasLibrary()) {
52212        openArray("library");
52213        for (CanonicalType e : element.getLibrary()) 
52214          composeCanonicalCore(null, e, true);
52215        closeArray();
52216        if (anyHasExtras(element.getLibrary())) {
52217          openArray("_library");
52218          for (CanonicalType e : element.getLibrary()) 
52219            composeCanonicalExtras(null, e, true);
52220          closeArray();
52221        }
52222      };
52223      if (element.hasTypeElement()) {
52224        composeEnumerationCore("type", element.getTypeElement(), new ResearchElementDefinition.ResearchElementTypeEnumFactory(), false);
52225        composeEnumerationExtras("type", element.getTypeElement(), new ResearchElementDefinition.ResearchElementTypeEnumFactory(), false);
52226      }
52227      if (element.hasVariableTypeElement()) {
52228        composeEnumerationCore("variableType", element.getVariableTypeElement(), new ResearchElementDefinition.VariableTypeEnumFactory(), false);
52229        composeEnumerationExtras("variableType", element.getVariableTypeElement(), new ResearchElementDefinition.VariableTypeEnumFactory(), false);
52230      }
52231      if (element.hasCharacteristic()) {
52232        openArray("characteristic");
52233        for (ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent e : element.getCharacteristic()) 
52234          composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(null, e);
52235        closeArray();
52236      };
52237  }
52238
52239  protected void composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(String name, ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent element) throws IOException {
52240    if (element != null) {
52241      open(name);
52242      composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponentInner(element);
52243      close();
52244    }
52245  }
52246
52247  protected void composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponentInner(ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent element) throws IOException {
52248      composeBackbone(element);
52249      if (element.hasDefinition()) {
52250        composeType("definition", element.getDefinition());
52251      }
52252      if (element.hasUsageContext()) {
52253        openArray("usageContext");
52254        for (UsageContext e : element.getUsageContext()) 
52255          composeUsageContext(null, e);
52256        closeArray();
52257      };
52258      if (element.hasExcludeElement()) {
52259        composeBooleanCore("exclude", element.getExcludeElement(), false);
52260        composeBooleanExtras("exclude", element.getExcludeElement(), false);
52261      }
52262      if (element.hasUnitOfMeasure()) {
52263        composeCodeableConcept("unitOfMeasure", element.getUnitOfMeasure());
52264      }
52265      if (element.hasStudyEffectiveDescriptionElement()) {
52266        composeStringCore("studyEffectiveDescription", element.getStudyEffectiveDescriptionElement(), false);
52267        composeStringExtras("studyEffectiveDescription", element.getStudyEffectiveDescriptionElement(), false);
52268      }
52269      if (element.hasStudyEffective()) {
52270        composeType("studyEffective", element.getStudyEffective());
52271      }
52272      if (element.hasStudyEffectiveTimeFromStart()) {
52273        composeDuration("studyEffectiveTimeFromStart", element.getStudyEffectiveTimeFromStart());
52274      }
52275      if (element.hasStudyEffectiveGroupMeasureElement()) {
52276        composeEnumerationCore("studyEffectiveGroupMeasure", element.getStudyEffectiveGroupMeasureElement(), new ResearchElementDefinition.GroupMeasureEnumFactory(), false);
52277        composeEnumerationExtras("studyEffectiveGroupMeasure", element.getStudyEffectiveGroupMeasureElement(), new ResearchElementDefinition.GroupMeasureEnumFactory(), false);
52278      }
52279      if (element.hasParticipantEffectiveDescriptionElement()) {
52280        composeStringCore("participantEffectiveDescription", element.getParticipantEffectiveDescriptionElement(), false);
52281        composeStringExtras("participantEffectiveDescription", element.getParticipantEffectiveDescriptionElement(), false);
52282      }
52283      if (element.hasParticipantEffective()) {
52284        composeType("participantEffective", element.getParticipantEffective());
52285      }
52286      if (element.hasParticipantEffectiveTimeFromStart()) {
52287        composeDuration("participantEffectiveTimeFromStart", element.getParticipantEffectiveTimeFromStart());
52288      }
52289      if (element.hasParticipantEffectiveGroupMeasureElement()) {
52290        composeEnumerationCore("participantEffectiveGroupMeasure", element.getParticipantEffectiveGroupMeasureElement(), new ResearchElementDefinition.GroupMeasureEnumFactory(), false);
52291        composeEnumerationExtras("participantEffectiveGroupMeasure", element.getParticipantEffectiveGroupMeasureElement(), new ResearchElementDefinition.GroupMeasureEnumFactory(), false);
52292      }
52293  }
52294
52295  protected void composeResearchStudy(String name, ResearchStudy element) throws IOException {
52296    if (element != null) {
52297      prop("resourceType", name);
52298      composeResearchStudyInner(element);
52299    }
52300  }
52301
52302  protected void composeResearchStudyInner(ResearchStudy element) throws IOException {
52303      composeDomainResourceElements(element);
52304      if (element.hasIdentifier()) {
52305        openArray("identifier");
52306        for (Identifier e : element.getIdentifier()) 
52307          composeIdentifier(null, e);
52308        closeArray();
52309      };
52310      if (element.hasTitleElement()) {
52311        composeStringCore("title", element.getTitleElement(), false);
52312        composeStringExtras("title", element.getTitleElement(), false);
52313      }
52314      if (element.hasProtocol()) {
52315        openArray("protocol");
52316        for (Reference e : element.getProtocol()) 
52317          composeReference(null, e);
52318        closeArray();
52319      };
52320      if (element.hasPartOf()) {
52321        openArray("partOf");
52322        for (Reference e : element.getPartOf()) 
52323          composeReference(null, e);
52324        closeArray();
52325      };
52326      if (element.hasStatusElement()) {
52327        composeEnumerationCore("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
52328        composeEnumerationExtras("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
52329      }
52330      if (element.hasPrimaryPurposeType()) {
52331        composeCodeableConcept("primaryPurposeType", element.getPrimaryPurposeType());
52332      }
52333      if (element.hasPhase()) {
52334        composeCodeableConcept("phase", element.getPhase());
52335      }
52336      if (element.hasCategory()) {
52337        openArray("category");
52338        for (CodeableConcept e : element.getCategory()) 
52339          composeCodeableConcept(null, e);
52340        closeArray();
52341      };
52342      if (element.hasFocus()) {
52343        openArray("focus");
52344        for (CodeableConcept e : element.getFocus()) 
52345          composeCodeableConcept(null, e);
52346        closeArray();
52347      };
52348      if (element.hasCondition()) {
52349        openArray("condition");
52350        for (CodeableConcept e : element.getCondition()) 
52351          composeCodeableConcept(null, e);
52352        closeArray();
52353      };
52354      if (element.hasContact()) {
52355        openArray("contact");
52356        for (ContactDetail e : element.getContact()) 
52357          composeContactDetail(null, e);
52358        closeArray();
52359      };
52360      if (element.hasRelatedArtifact()) {
52361        openArray("relatedArtifact");
52362        for (RelatedArtifact e : element.getRelatedArtifact()) 
52363          composeRelatedArtifact(null, e);
52364        closeArray();
52365      };
52366      if (element.hasKeyword()) {
52367        openArray("keyword");
52368        for (CodeableConcept e : element.getKeyword()) 
52369          composeCodeableConcept(null, e);
52370        closeArray();
52371      };
52372      if (element.hasLocation()) {
52373        openArray("location");
52374        for (CodeableConcept e : element.getLocation()) 
52375          composeCodeableConcept(null, e);
52376        closeArray();
52377      };
52378      if (element.hasDescriptionElement()) {
52379        composeMarkdownCore("description", element.getDescriptionElement(), false);
52380        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52381      }
52382      if (element.hasEnrollment()) {
52383        openArray("enrollment");
52384        for (Reference e : element.getEnrollment()) 
52385          composeReference(null, e);
52386        closeArray();
52387      };
52388      if (element.hasPeriod()) {
52389        composePeriod("period", element.getPeriod());
52390      }
52391      if (element.hasSponsor()) {
52392        composeReference("sponsor", element.getSponsor());
52393      }
52394      if (element.hasPrincipalInvestigator()) {
52395        composeReference("principalInvestigator", element.getPrincipalInvestigator());
52396      }
52397      if (element.hasSite()) {
52398        openArray("site");
52399        for (Reference e : element.getSite()) 
52400          composeReference(null, e);
52401        closeArray();
52402      };
52403      if (element.hasReasonStopped()) {
52404        composeCodeableConcept("reasonStopped", element.getReasonStopped());
52405      }
52406      if (element.hasNote()) {
52407        openArray("note");
52408        for (Annotation e : element.getNote()) 
52409          composeAnnotation(null, e);
52410        closeArray();
52411      };
52412      if (element.hasArm()) {
52413        openArray("arm");
52414        for (ResearchStudy.ResearchStudyArmComponent e : element.getArm()) 
52415          composeResearchStudyResearchStudyArmComponent(null, e);
52416        closeArray();
52417      };
52418      if (element.hasObjective()) {
52419        openArray("objective");
52420        for (ResearchStudy.ResearchStudyObjectiveComponent e : element.getObjective()) 
52421          composeResearchStudyResearchStudyObjectiveComponent(null, e);
52422        closeArray();
52423      };
52424  }
52425
52426  protected void composeResearchStudyResearchStudyArmComponent(String name, ResearchStudy.ResearchStudyArmComponent element) throws IOException {
52427    if (element != null) {
52428      open(name);
52429      composeResearchStudyResearchStudyArmComponentInner(element);
52430      close();
52431    }
52432  }
52433
52434  protected void composeResearchStudyResearchStudyArmComponentInner(ResearchStudy.ResearchStudyArmComponent element) throws IOException {
52435      composeBackbone(element);
52436      if (element.hasNameElement()) {
52437        composeStringCore("name", element.getNameElement(), false);
52438        composeStringExtras("name", element.getNameElement(), false);
52439      }
52440      if (element.hasType()) {
52441        composeCodeableConcept("type", element.getType());
52442      }
52443      if (element.hasDescriptionElement()) {
52444        composeStringCore("description", element.getDescriptionElement(), false);
52445        composeStringExtras("description", element.getDescriptionElement(), false);
52446      }
52447  }
52448
52449  protected void composeResearchStudyResearchStudyObjectiveComponent(String name, ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
52450    if (element != null) {
52451      open(name);
52452      composeResearchStudyResearchStudyObjectiveComponentInner(element);
52453      close();
52454    }
52455  }
52456
52457  protected void composeResearchStudyResearchStudyObjectiveComponentInner(ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
52458      composeBackbone(element);
52459      if (element.hasNameElement()) {
52460        composeStringCore("name", element.getNameElement(), false);
52461        composeStringExtras("name", element.getNameElement(), false);
52462      }
52463      if (element.hasType()) {
52464        composeCodeableConcept("type", element.getType());
52465      }
52466  }
52467
52468  protected void composeResearchSubject(String name, ResearchSubject element) throws IOException {
52469    if (element != null) {
52470      prop("resourceType", name);
52471      composeResearchSubjectInner(element);
52472    }
52473  }
52474
52475  protected void composeResearchSubjectInner(ResearchSubject element) throws IOException {
52476      composeDomainResourceElements(element);
52477      if (element.hasIdentifier()) {
52478        openArray("identifier");
52479        for (Identifier e : element.getIdentifier()) 
52480          composeIdentifier(null, e);
52481        closeArray();
52482      };
52483      if (element.hasStatusElement()) {
52484        composeEnumerationCore("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
52485        composeEnumerationExtras("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
52486      }
52487      if (element.hasPeriod()) {
52488        composePeriod("period", element.getPeriod());
52489      }
52490      if (element.hasStudy()) {
52491        composeReference("study", element.getStudy());
52492      }
52493      if (element.hasIndividual()) {
52494        composeReference("individual", element.getIndividual());
52495      }
52496      if (element.hasAssignedArmElement()) {
52497        composeStringCore("assignedArm", element.getAssignedArmElement(), false);
52498        composeStringExtras("assignedArm", element.getAssignedArmElement(), false);
52499      }
52500      if (element.hasActualArmElement()) {
52501        composeStringCore("actualArm", element.getActualArmElement(), false);
52502        composeStringExtras("actualArm", element.getActualArmElement(), false);
52503      }
52504      if (element.hasConsent()) {
52505        composeReference("consent", element.getConsent());
52506      }
52507  }
52508
52509  protected void composeRiskAssessment(String name, RiskAssessment element) throws IOException {
52510    if (element != null) {
52511      prop("resourceType", name);
52512      composeRiskAssessmentInner(element);
52513    }
52514  }
52515
52516  protected void composeRiskAssessmentInner(RiskAssessment element) throws IOException {
52517      composeDomainResourceElements(element);
52518      if (element.hasIdentifier()) {
52519        openArray("identifier");
52520        for (Identifier e : element.getIdentifier()) 
52521          composeIdentifier(null, e);
52522        closeArray();
52523      };
52524      if (element.hasBasedOn()) {
52525        composeReference("basedOn", element.getBasedOn());
52526      }
52527      if (element.hasParent()) {
52528        composeReference("parent", element.getParent());
52529      }
52530      if (element.hasStatusElement()) {
52531        composeEnumerationCore("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory(), false);
52532        composeEnumerationExtras("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory(), false);
52533      }
52534      if (element.hasMethod()) {
52535        composeCodeableConcept("method", element.getMethod());
52536      }
52537      if (element.hasCode()) {
52538        composeCodeableConcept("code", element.getCode());
52539      }
52540      if (element.hasSubject()) {
52541        composeReference("subject", element.getSubject());
52542      }
52543      if (element.hasEncounter()) {
52544        composeReference("encounter", element.getEncounter());
52545      }
52546      if (element.hasOccurrence()) {
52547        composeType("occurrence", element.getOccurrence());
52548      }
52549      if (element.hasCondition()) {
52550        composeReference("condition", element.getCondition());
52551      }
52552      if (element.hasPerformer()) {
52553        composeReference("performer", element.getPerformer());
52554      }
52555      if (element.hasReasonCode()) {
52556        openArray("reasonCode");
52557        for (CodeableConcept e : element.getReasonCode()) 
52558          composeCodeableConcept(null, e);
52559        closeArray();
52560      };
52561      if (element.hasReasonReference()) {
52562        openArray("reasonReference");
52563        for (Reference e : element.getReasonReference()) 
52564          composeReference(null, e);
52565        closeArray();
52566      };
52567      if (element.hasBasis()) {
52568        openArray("basis");
52569        for (Reference e : element.getBasis()) 
52570          composeReference(null, e);
52571        closeArray();
52572      };
52573      if (element.hasPrediction()) {
52574        openArray("prediction");
52575        for (RiskAssessment.RiskAssessmentPredictionComponent e : element.getPrediction()) 
52576          composeRiskAssessmentRiskAssessmentPredictionComponent(null, e);
52577        closeArray();
52578      };
52579      if (element.hasMitigationElement()) {
52580        composeStringCore("mitigation", element.getMitigationElement(), false);
52581        composeStringExtras("mitigation", element.getMitigationElement(), false);
52582      }
52583      if (element.hasNote()) {
52584        openArray("note");
52585        for (Annotation e : element.getNote()) 
52586          composeAnnotation(null, e);
52587        closeArray();
52588      };
52589  }
52590
52591  protected void composeRiskAssessmentRiskAssessmentPredictionComponent(String name, RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
52592    if (element != null) {
52593      open(name);
52594      composeRiskAssessmentRiskAssessmentPredictionComponentInner(element);
52595      close();
52596    }
52597  }
52598
52599  protected void composeRiskAssessmentRiskAssessmentPredictionComponentInner(RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
52600      composeBackbone(element);
52601      if (element.hasOutcome()) {
52602        composeCodeableConcept("outcome", element.getOutcome());
52603      }
52604      if (element.hasProbability()) {
52605        composeType("probability", element.getProbability());
52606      }
52607      if (element.hasQualitativeRisk()) {
52608        composeCodeableConcept("qualitativeRisk", element.getQualitativeRisk());
52609      }
52610      if (element.hasRelativeRiskElement()) {
52611        composeDecimalCore("relativeRisk", element.getRelativeRiskElement(), false);
52612        composeDecimalExtras("relativeRisk", element.getRelativeRiskElement(), false);
52613      }
52614      if (element.hasWhen()) {
52615        composeType("when", element.getWhen());
52616      }
52617      if (element.hasRationaleElement()) {
52618        composeStringCore("rationale", element.getRationaleElement(), false);
52619        composeStringExtras("rationale", element.getRationaleElement(), false);
52620      }
52621  }
52622
52623  protected void composeRiskEvidenceSynthesis(String name, RiskEvidenceSynthesis element) throws IOException {
52624    if (element != null) {
52625      prop("resourceType", name);
52626      composeRiskEvidenceSynthesisInner(element);
52627    }
52628  }
52629
52630  protected void composeRiskEvidenceSynthesisInner(RiskEvidenceSynthesis element) throws IOException {
52631      composeDomainResourceElements(element);
52632      if (element.hasUrlElement()) {
52633        composeUriCore("url", element.getUrlElement(), false);
52634        composeUriExtras("url", element.getUrlElement(), false);
52635      }
52636      if (element.hasIdentifier()) {
52637        openArray("identifier");
52638        for (Identifier e : element.getIdentifier()) 
52639          composeIdentifier(null, e);
52640        closeArray();
52641      };
52642      if (element.hasVersionElement()) {
52643        composeStringCore("version", element.getVersionElement(), false);
52644        composeStringExtras("version", element.getVersionElement(), false);
52645      }
52646      if (element.hasNameElement()) {
52647        composeStringCore("name", element.getNameElement(), false);
52648        composeStringExtras("name", element.getNameElement(), false);
52649      }
52650      if (element.hasTitleElement()) {
52651        composeStringCore("title", element.getTitleElement(), false);
52652        composeStringExtras("title", element.getTitleElement(), false);
52653      }
52654      if (element.hasStatusElement()) {
52655        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52656        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52657      }
52658      if (element.hasDateElement()) {
52659        composeDateTimeCore("date", element.getDateElement(), false);
52660        composeDateTimeExtras("date", element.getDateElement(), false);
52661      }
52662      if (element.hasPublisherElement()) {
52663        composeStringCore("publisher", element.getPublisherElement(), false);
52664        composeStringExtras("publisher", element.getPublisherElement(), false);
52665      }
52666      if (element.hasContact()) {
52667        openArray("contact");
52668        for (ContactDetail e : element.getContact()) 
52669          composeContactDetail(null, e);
52670        closeArray();
52671      };
52672      if (element.hasDescriptionElement()) {
52673        composeMarkdownCore("description", element.getDescriptionElement(), false);
52674        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52675      }
52676      if (element.hasNote()) {
52677        openArray("note");
52678        for (Annotation e : element.getNote()) 
52679          composeAnnotation(null, e);
52680        closeArray();
52681      };
52682      if (element.hasUseContext()) {
52683        openArray("useContext");
52684        for (UsageContext e : element.getUseContext()) 
52685          composeUsageContext(null, e);
52686        closeArray();
52687      };
52688      if (element.hasJurisdiction()) {
52689        openArray("jurisdiction");
52690        for (CodeableConcept e : element.getJurisdiction()) 
52691          composeCodeableConcept(null, e);
52692        closeArray();
52693      };
52694      if (element.hasCopyrightElement()) {
52695        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
52696        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
52697      }
52698      if (element.hasApprovalDateElement()) {
52699        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
52700        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
52701      }
52702      if (element.hasLastReviewDateElement()) {
52703        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
52704        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
52705      }
52706      if (element.hasEffectivePeriod()) {
52707        composePeriod("effectivePeriod", element.getEffectivePeriod());
52708      }
52709      if (element.hasTopic()) {
52710        openArray("topic");
52711        for (CodeableConcept e : element.getTopic()) 
52712          composeCodeableConcept(null, e);
52713        closeArray();
52714      };
52715      if (element.hasAuthor()) {
52716        openArray("author");
52717        for (ContactDetail e : element.getAuthor()) 
52718          composeContactDetail(null, e);
52719        closeArray();
52720      };
52721      if (element.hasEditor()) {
52722        openArray("editor");
52723        for (ContactDetail e : element.getEditor()) 
52724          composeContactDetail(null, e);
52725        closeArray();
52726      };
52727      if (element.hasReviewer()) {
52728        openArray("reviewer");
52729        for (ContactDetail e : element.getReviewer()) 
52730          composeContactDetail(null, e);
52731        closeArray();
52732      };
52733      if (element.hasEndorser()) {
52734        openArray("endorser");
52735        for (ContactDetail e : element.getEndorser()) 
52736          composeContactDetail(null, e);
52737        closeArray();
52738      };
52739      if (element.hasRelatedArtifact()) {
52740        openArray("relatedArtifact");
52741        for (RelatedArtifact e : element.getRelatedArtifact()) 
52742          composeRelatedArtifact(null, e);
52743        closeArray();
52744      };
52745      if (element.hasSynthesisType()) {
52746        composeCodeableConcept("synthesisType", element.getSynthesisType());
52747      }
52748      if (element.hasStudyType()) {
52749        composeCodeableConcept("studyType", element.getStudyType());
52750      }
52751      if (element.hasPopulation()) {
52752        composeReference("population", element.getPopulation());
52753      }
52754      if (element.hasExposure()) {
52755        composeReference("exposure", element.getExposure());
52756      }
52757      if (element.hasOutcome()) {
52758        composeReference("outcome", element.getOutcome());
52759      }
52760      if (element.hasSampleSize()) {
52761        composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent("sampleSize", element.getSampleSize());
52762      }
52763      if (element.hasRiskEstimate()) {
52764        composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent("riskEstimate", element.getRiskEstimate());
52765      }
52766      if (element.hasCertainty()) {
52767        openArray("certainty");
52768        for (RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent e : element.getCertainty()) 
52769          composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(null, e);
52770        closeArray();
52771      };
52772  }
52773
52774  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent(String name, RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent element) throws IOException {
52775    if (element != null) {
52776      open(name);
52777      composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentInner(element);
52778      close();
52779    }
52780  }
52781
52782  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentInner(RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent element) throws IOException {
52783      composeBackbone(element);
52784      if (element.hasDescriptionElement()) {
52785        composeStringCore("description", element.getDescriptionElement(), false);
52786        composeStringExtras("description", element.getDescriptionElement(), false);
52787      }
52788      if (element.hasNumberOfStudiesElement()) {
52789        composeIntegerCore("numberOfStudies", element.getNumberOfStudiesElement(), false);
52790        composeIntegerExtras("numberOfStudies", element.getNumberOfStudiesElement(), false);
52791      }
52792      if (element.hasNumberOfParticipantsElement()) {
52793        composeIntegerCore("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
52794        composeIntegerExtras("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
52795      }
52796  }
52797
52798  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent(String name, RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent element) throws IOException {
52799    if (element != null) {
52800      open(name);
52801      composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentInner(element);
52802      close();
52803    }
52804  }
52805
52806  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentInner(RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent element) throws IOException {
52807      composeBackbone(element);
52808      if (element.hasDescriptionElement()) {
52809        composeStringCore("description", element.getDescriptionElement(), false);
52810        composeStringExtras("description", element.getDescriptionElement(), false);
52811      }
52812      if (element.hasType()) {
52813        composeCodeableConcept("type", element.getType());
52814      }
52815      if (element.hasValueElement()) {
52816        composeDecimalCore("value", element.getValueElement(), false);
52817        composeDecimalExtras("value", element.getValueElement(), false);
52818      }
52819      if (element.hasUnitOfMeasure()) {
52820        composeCodeableConcept("unitOfMeasure", element.getUnitOfMeasure());
52821      }
52822      if (element.hasDenominatorCountElement()) {
52823        composeIntegerCore("denominatorCount", element.getDenominatorCountElement(), false);
52824        composeIntegerExtras("denominatorCount", element.getDenominatorCountElement(), false);
52825      }
52826      if (element.hasNumeratorCountElement()) {
52827        composeIntegerCore("numeratorCount", element.getNumeratorCountElement(), false);
52828        composeIntegerExtras("numeratorCount", element.getNumeratorCountElement(), false);
52829      }
52830      if (element.hasPrecisionEstimate()) {
52831        openArray("precisionEstimate");
52832        for (RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent e : element.getPrecisionEstimate()) 
52833          composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(null, e);
52834        closeArray();
52835      };
52836  }
52837
52838  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(String name, RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent element) throws IOException {
52839    if (element != null) {
52840      open(name);
52841      composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentInner(element);
52842      close();
52843    }
52844  }
52845
52846  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentInner(RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent element) throws IOException {
52847      composeBackbone(element);
52848      if (element.hasType()) {
52849        composeCodeableConcept("type", element.getType());
52850      }
52851      if (element.hasLevelElement()) {
52852        composeDecimalCore("level", element.getLevelElement(), false);
52853        composeDecimalExtras("level", element.getLevelElement(), false);
52854      }
52855      if (element.hasFromElement()) {
52856        composeDecimalCore("from", element.getFromElement(), false);
52857        composeDecimalExtras("from", element.getFromElement(), false);
52858      }
52859      if (element.hasToElement()) {
52860        composeDecimalCore("to", element.getToElement(), false);
52861        composeDecimalExtras("to", element.getToElement(), false);
52862      }
52863  }
52864
52865  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(String name, RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent element) throws IOException {
52866    if (element != null) {
52867      open(name);
52868      composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentInner(element);
52869      close();
52870    }
52871  }
52872
52873  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentInner(RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent element) throws IOException {
52874      composeBackbone(element);
52875      if (element.hasRating()) {
52876        openArray("rating");
52877        for (CodeableConcept e : element.getRating()) 
52878          composeCodeableConcept(null, e);
52879        closeArray();
52880      };
52881      if (element.hasNote()) {
52882        openArray("note");
52883        for (Annotation e : element.getNote()) 
52884          composeAnnotation(null, e);
52885        closeArray();
52886      };
52887      if (element.hasCertaintySubcomponent()) {
52888        openArray("certaintySubcomponent");
52889        for (RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent e : element.getCertaintySubcomponent()) 
52890          composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(null, e);
52891        closeArray();
52892      };
52893  }
52894
52895  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(String name, RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent element) throws IOException {
52896    if (element != null) {
52897      open(name);
52898      composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentInner(element);
52899      close();
52900    }
52901  }
52902
52903  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentInner(RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent element) throws IOException {
52904      composeBackbone(element);
52905      if (element.hasType()) {
52906        composeCodeableConcept("type", element.getType());
52907      }
52908      if (element.hasRating()) {
52909        openArray("rating");
52910        for (CodeableConcept e : element.getRating()) 
52911          composeCodeableConcept(null, e);
52912        closeArray();
52913      };
52914      if (element.hasNote()) {
52915        openArray("note");
52916        for (Annotation e : element.getNote()) 
52917          composeAnnotation(null, e);
52918        closeArray();
52919      };
52920  }
52921
52922  protected void composeSchedule(String name, Schedule element) throws IOException {
52923    if (element != null) {
52924      prop("resourceType", name);
52925      composeScheduleInner(element);
52926    }
52927  }
52928
52929  protected void composeScheduleInner(Schedule element) throws IOException {
52930      composeDomainResourceElements(element);
52931      if (element.hasIdentifier()) {
52932        openArray("identifier");
52933        for (Identifier e : element.getIdentifier()) 
52934          composeIdentifier(null, e);
52935        closeArray();
52936      };
52937      if (element.hasActiveElement()) {
52938        composeBooleanCore("active", element.getActiveElement(), false);
52939        composeBooleanExtras("active", element.getActiveElement(), false);
52940      }
52941      if (element.hasServiceCategory()) {
52942        openArray("serviceCategory");
52943        for (CodeableConcept e : element.getServiceCategory()) 
52944          composeCodeableConcept(null, e);
52945        closeArray();
52946      };
52947      if (element.hasServiceType()) {
52948        openArray("serviceType");
52949        for (CodeableConcept e : element.getServiceType()) 
52950          composeCodeableConcept(null, e);
52951        closeArray();
52952      };
52953      if (element.hasSpecialty()) {
52954        openArray("specialty");
52955        for (CodeableConcept e : element.getSpecialty()) 
52956          composeCodeableConcept(null, e);
52957        closeArray();
52958      };
52959      if (element.hasActor()) {
52960        openArray("actor");
52961        for (Reference e : element.getActor()) 
52962          composeReference(null, e);
52963        closeArray();
52964      };
52965      if (element.hasPlanningHorizon()) {
52966        composePeriod("planningHorizon", element.getPlanningHorizon());
52967      }
52968      if (element.hasCommentElement()) {
52969        composeStringCore("comment", element.getCommentElement(), false);
52970        composeStringExtras("comment", element.getCommentElement(), false);
52971      }
52972  }
52973
52974  protected void composeSearchParameter(String name, SearchParameter element) throws IOException {
52975    if (element != null) {
52976      prop("resourceType", name);
52977      composeSearchParameterInner(element);
52978    }
52979  }
52980
52981  protected void composeSearchParameterInner(SearchParameter element) throws IOException {
52982      composeDomainResourceElements(element);
52983      if (element.hasUrlElement()) {
52984        composeUriCore("url", element.getUrlElement(), false);
52985        composeUriExtras("url", element.getUrlElement(), false);
52986      }
52987      if (element.hasVersionElement()) {
52988        composeStringCore("version", element.getVersionElement(), false);
52989        composeStringExtras("version", element.getVersionElement(), false);
52990      }
52991      if (element.hasNameElement()) {
52992        composeStringCore("name", element.getNameElement(), false);
52993        composeStringExtras("name", element.getNameElement(), false);
52994      }
52995      if (element.hasDerivedFromElement()) {
52996        composeCanonicalCore("derivedFrom", element.getDerivedFromElement(), false);
52997        composeCanonicalExtras("derivedFrom", element.getDerivedFromElement(), false);
52998      }
52999      if (element.hasStatusElement()) {
53000        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53001        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53002      }
53003      if (element.hasExperimentalElement()) {
53004        composeBooleanCore("experimental", element.getExperimentalElement(), false);
53005        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
53006      }
53007      if (element.hasDateElement()) {
53008        composeDateTimeCore("date", element.getDateElement(), false);
53009        composeDateTimeExtras("date", element.getDateElement(), false);
53010      }
53011      if (element.hasPublisherElement()) {
53012        composeStringCore("publisher", element.getPublisherElement(), false);
53013        composeStringExtras("publisher", element.getPublisherElement(), false);
53014      }
53015      if (element.hasContact()) {
53016        openArray("contact");
53017        for (ContactDetail e : element.getContact()) 
53018          composeContactDetail(null, e);
53019        closeArray();
53020      };
53021      if (element.hasDescriptionElement()) {
53022        composeMarkdownCore("description", element.getDescriptionElement(), false);
53023        composeMarkdownExtras("description", element.getDescriptionElement(), false);
53024      }
53025      if (element.hasUseContext()) {
53026        openArray("useContext");
53027        for (UsageContext e : element.getUseContext()) 
53028          composeUsageContext(null, e);
53029        closeArray();
53030      };
53031      if (element.hasJurisdiction()) {
53032        openArray("jurisdiction");
53033        for (CodeableConcept e : element.getJurisdiction()) 
53034          composeCodeableConcept(null, e);
53035        closeArray();
53036      };
53037      if (element.hasPurposeElement()) {
53038        composeMarkdownCore("purpose", element.getPurposeElement(), false);
53039        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
53040      }
53041      if (element.hasCodeElement()) {
53042        composeCodeCore("code", element.getCodeElement(), false);
53043        composeCodeExtras("code", element.getCodeElement(), false);
53044      }
53045      if (element.hasBase()) {
53046        openArray("base");
53047        for (CodeType e : element.getBase()) 
53048          composeCodeCore(null, e, true);
53049        closeArray();
53050        if (anyHasExtras(element.getBase())) {
53051          openArray("_base");
53052          for (CodeType e : element.getBase()) 
53053            composeCodeExtras(null, e, true);
53054          closeArray();
53055        }
53056      };
53057      if (element.hasTypeElement()) {
53058        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
53059        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
53060      }
53061      if (element.hasExpressionElement()) {
53062        composeStringCore("expression", element.getExpressionElement(), false);
53063        composeStringExtras("expression", element.getExpressionElement(), false);
53064      }
53065      if (element.hasXpathElement()) {
53066        composeStringCore("xpath", element.getXpathElement(), false);
53067        composeStringExtras("xpath", element.getXpathElement(), false);
53068      }
53069      if (element.hasXpathUsageElement()) {
53070        composeEnumerationCore("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
53071        composeEnumerationExtras("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
53072      }
53073      if (element.hasTarget()) {
53074        openArray("target");
53075        for (CodeType e : element.getTarget()) 
53076          composeCodeCore(null, e, true);
53077        closeArray();
53078        if (anyHasExtras(element.getTarget())) {
53079          openArray("_target");
53080          for (CodeType e : element.getTarget()) 
53081            composeCodeExtras(null, e, true);
53082          closeArray();
53083        }
53084      };
53085      if (element.hasMultipleOrElement()) {
53086        composeBooleanCore("multipleOr", element.getMultipleOrElement(), false);
53087        composeBooleanExtras("multipleOr", element.getMultipleOrElement(), false);
53088      }
53089      if (element.hasMultipleAndElement()) {
53090        composeBooleanCore("multipleAnd", element.getMultipleAndElement(), false);
53091        composeBooleanExtras("multipleAnd", element.getMultipleAndElement(), false);
53092      }
53093      if (element.hasComparator()) {
53094        openArray("comparator");
53095        for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
53096          composeEnumerationCore(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
53097        closeArray();
53098        if (anyHasExtras(element.getComparator())) {
53099          openArray("_comparator");
53100          for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
53101            composeEnumerationExtras(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
53102          closeArray();
53103        }
53104      };
53105      if (element.hasModifier()) {
53106        openArray("modifier");
53107        for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
53108          composeEnumerationCore(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
53109        closeArray();
53110        if (anyHasExtras(element.getModifier())) {
53111          openArray("_modifier");
53112          for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
53113            composeEnumerationExtras(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
53114          closeArray();
53115        }
53116      };
53117      if (element.hasChain()) {
53118        openArray("chain");
53119        for (StringType e : element.getChain()) 
53120          composeStringCore(null, e, true);
53121        closeArray();
53122        if (anyHasExtras(element.getChain())) {
53123          openArray("_chain");
53124          for (StringType e : element.getChain()) 
53125            composeStringExtras(null, e, true);
53126          closeArray();
53127        }
53128      };
53129      if (element.hasComponent()) {
53130        openArray("component");
53131        for (SearchParameter.SearchParameterComponentComponent e : element.getComponent()) 
53132          composeSearchParameterSearchParameterComponentComponent(null, e);
53133        closeArray();
53134      };
53135  }
53136
53137  protected void composeSearchParameterSearchParameterComponentComponent(String name, SearchParameter.SearchParameterComponentComponent element) throws IOException {
53138    if (element != null) {
53139      open(name);
53140      composeSearchParameterSearchParameterComponentComponentInner(element);
53141      close();
53142    }
53143  }
53144
53145  protected void composeSearchParameterSearchParameterComponentComponentInner(SearchParameter.SearchParameterComponentComponent element) throws IOException {
53146      composeBackbone(element);
53147      if (element.hasDefinitionElement()) {
53148        composeCanonicalCore("definition", element.getDefinitionElement(), false);
53149        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
53150      }
53151      if (element.hasExpressionElement()) {
53152        composeStringCore("expression", element.getExpressionElement(), false);
53153        composeStringExtras("expression", element.getExpressionElement(), false);
53154      }
53155  }
53156
53157  protected void composeServiceRequest(String name, ServiceRequest element) throws IOException {
53158    if (element != null) {
53159      prop("resourceType", name);
53160      composeServiceRequestInner(element);
53161    }
53162  }
53163
53164  protected void composeServiceRequestInner(ServiceRequest element) throws IOException {
53165      composeDomainResourceElements(element);
53166      if (element.hasIdentifier()) {
53167        openArray("identifier");
53168        for (Identifier e : element.getIdentifier()) 
53169          composeIdentifier(null, e);
53170        closeArray();
53171      };
53172      if (element.hasInstantiatesCanonical()) {
53173        openArray("instantiatesCanonical");
53174        for (CanonicalType e : element.getInstantiatesCanonical()) 
53175          composeCanonicalCore(null, e, true);
53176        closeArray();
53177        if (anyHasExtras(element.getInstantiatesCanonical())) {
53178          openArray("_instantiatesCanonical");
53179          for (CanonicalType e : element.getInstantiatesCanonical()) 
53180            composeCanonicalExtras(null, e, true);
53181          closeArray();
53182        }
53183      };
53184      if (element.hasInstantiatesUri()) {
53185        openArray("instantiatesUri");
53186        for (UriType e : element.getInstantiatesUri()) 
53187          composeUriCore(null, e, true);
53188        closeArray();
53189        if (anyHasExtras(element.getInstantiatesUri())) {
53190          openArray("_instantiatesUri");
53191          for (UriType e : element.getInstantiatesUri()) 
53192            composeUriExtras(null, e, true);
53193          closeArray();
53194        }
53195      };
53196      if (element.hasBasedOn()) {
53197        openArray("basedOn");
53198        for (Reference e : element.getBasedOn()) 
53199          composeReference(null, e);
53200        closeArray();
53201      };
53202      if (element.hasReplaces()) {
53203        openArray("replaces");
53204        for (Reference e : element.getReplaces()) 
53205          composeReference(null, e);
53206        closeArray();
53207      };
53208      if (element.hasRequisition()) {
53209        composeIdentifier("requisition", element.getRequisition());
53210      }
53211      if (element.hasStatusElement()) {
53212        composeEnumerationCore("status", element.getStatusElement(), new ServiceRequest.ServiceRequestStatusEnumFactory(), false);
53213        composeEnumerationExtras("status", element.getStatusElement(), new ServiceRequest.ServiceRequestStatusEnumFactory(), false);
53214      }
53215      if (element.hasIntentElement()) {
53216        composeEnumerationCore("intent", element.getIntentElement(), new ServiceRequest.ServiceRequestIntentEnumFactory(), false);
53217        composeEnumerationExtras("intent", element.getIntentElement(), new ServiceRequest.ServiceRequestIntentEnumFactory(), false);
53218      }
53219      if (element.hasCategory()) {
53220        openArray("category");
53221        for (CodeableConcept e : element.getCategory()) 
53222          composeCodeableConcept(null, e);
53223        closeArray();
53224      };
53225      if (element.hasPriorityElement()) {
53226        composeEnumerationCore("priority", element.getPriorityElement(), new ServiceRequest.ServiceRequestPriorityEnumFactory(), false);
53227        composeEnumerationExtras("priority", element.getPriorityElement(), new ServiceRequest.ServiceRequestPriorityEnumFactory(), false);
53228      }
53229      if (element.hasDoNotPerformElement()) {
53230        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
53231        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
53232      }
53233      if (element.hasCode()) {
53234        composeCodeableConcept("code", element.getCode());
53235      }
53236      if (element.hasOrderDetail()) {
53237        openArray("orderDetail");
53238        for (CodeableConcept e : element.getOrderDetail()) 
53239          composeCodeableConcept(null, e);
53240        closeArray();
53241      };
53242      if (element.hasQuantity()) {
53243        composeType("quantity", element.getQuantity());
53244      }
53245      if (element.hasSubject()) {
53246        composeReference("subject", element.getSubject());
53247      }
53248      if (element.hasEncounter()) {
53249        composeReference("encounter", element.getEncounter());
53250      }
53251      if (element.hasOccurrence()) {
53252        composeType("occurrence", element.getOccurrence());
53253      }
53254      if (element.hasAsNeeded()) {
53255        composeType("asNeeded", element.getAsNeeded());
53256      }
53257      if (element.hasAuthoredOnElement()) {
53258        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
53259        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
53260      }
53261      if (element.hasRequester()) {
53262        composeReference("requester", element.getRequester());
53263      }
53264      if (element.hasPerformerType()) {
53265        composeCodeableConcept("performerType", element.getPerformerType());
53266      }
53267      if (element.hasPerformer()) {
53268        openArray("performer");
53269        for (Reference e : element.getPerformer()) 
53270          composeReference(null, e);
53271        closeArray();
53272      };
53273      if (element.hasLocationCode()) {
53274        openArray("locationCode");
53275        for (CodeableConcept e : element.getLocationCode()) 
53276          composeCodeableConcept(null, e);
53277        closeArray();
53278      };
53279      if (element.hasLocationReference()) {
53280        openArray("locationReference");
53281        for (Reference e : element.getLocationReference()) 
53282          composeReference(null, e);
53283        closeArray();
53284      };
53285      if (element.hasReasonCode()) {
53286        openArray("reasonCode");
53287        for (CodeableConcept e : element.getReasonCode()) 
53288          composeCodeableConcept(null, e);
53289        closeArray();
53290      };
53291      if (element.hasReasonReference()) {
53292        openArray("reasonReference");
53293        for (Reference e : element.getReasonReference()) 
53294          composeReference(null, e);
53295        closeArray();
53296      };
53297      if (element.hasInsurance()) {
53298        openArray("insurance");
53299        for (Reference e : element.getInsurance()) 
53300          composeReference(null, e);
53301        closeArray();
53302      };
53303      if (element.hasSupportingInfo()) {
53304        openArray("supportingInfo");
53305        for (Reference e : element.getSupportingInfo()) 
53306          composeReference(null, e);
53307        closeArray();
53308      };
53309      if (element.hasSpecimen()) {
53310        openArray("specimen");
53311        for (Reference e : element.getSpecimen()) 
53312          composeReference(null, e);
53313        closeArray();
53314      };
53315      if (element.hasBodySite()) {
53316        openArray("bodySite");
53317        for (CodeableConcept e : element.getBodySite()) 
53318          composeCodeableConcept(null, e);
53319        closeArray();
53320      };
53321      if (element.hasNote()) {
53322        openArray("note");
53323        for (Annotation e : element.getNote()) 
53324          composeAnnotation(null, e);
53325        closeArray();
53326      };
53327      if (element.hasPatientInstructionElement()) {
53328        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
53329        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
53330      }
53331      if (element.hasRelevantHistory()) {
53332        openArray("relevantHistory");
53333        for (Reference e : element.getRelevantHistory()) 
53334          composeReference(null, e);
53335        closeArray();
53336      };
53337  }
53338
53339  protected void composeSlot(String name, Slot element) throws IOException {
53340    if (element != null) {
53341      prop("resourceType", name);
53342      composeSlotInner(element);
53343    }
53344  }
53345
53346  protected void composeSlotInner(Slot element) throws IOException {
53347      composeDomainResourceElements(element);
53348      if (element.hasIdentifier()) {
53349        openArray("identifier");
53350        for (Identifier e : element.getIdentifier()) 
53351          composeIdentifier(null, e);
53352        closeArray();
53353      };
53354      if (element.hasServiceCategory()) {
53355        openArray("serviceCategory");
53356        for (CodeableConcept e : element.getServiceCategory()) 
53357          composeCodeableConcept(null, e);
53358        closeArray();
53359      };
53360      if (element.hasServiceType()) {
53361        openArray("serviceType");
53362        for (CodeableConcept e : element.getServiceType()) 
53363          composeCodeableConcept(null, e);
53364        closeArray();
53365      };
53366      if (element.hasSpecialty()) {
53367        openArray("specialty");
53368        for (CodeableConcept e : element.getSpecialty()) 
53369          composeCodeableConcept(null, e);
53370        closeArray();
53371      };
53372      if (element.hasAppointmentType()) {
53373        composeCodeableConcept("appointmentType", element.getAppointmentType());
53374      }
53375      if (element.hasSchedule()) {
53376        composeReference("schedule", element.getSchedule());
53377      }
53378      if (element.hasStatusElement()) {
53379        composeEnumerationCore("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
53380        composeEnumerationExtras("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
53381      }
53382      if (element.hasStartElement()) {
53383        composeInstantCore("start", element.getStartElement(), false);
53384        composeInstantExtras("start", element.getStartElement(), false);
53385      }
53386      if (element.hasEndElement()) {
53387        composeInstantCore("end", element.getEndElement(), false);
53388        composeInstantExtras("end", element.getEndElement(), false);
53389      }
53390      if (element.hasOverbookedElement()) {
53391        composeBooleanCore("overbooked", element.getOverbookedElement(), false);
53392        composeBooleanExtras("overbooked", element.getOverbookedElement(), false);
53393      }
53394      if (element.hasCommentElement()) {
53395        composeStringCore("comment", element.getCommentElement(), false);
53396        composeStringExtras("comment", element.getCommentElement(), false);
53397      }
53398  }
53399
53400  protected void composeSpecimen(String name, Specimen element) throws IOException {
53401    if (element != null) {
53402      prop("resourceType", name);
53403      composeSpecimenInner(element);
53404    }
53405  }
53406
53407  protected void composeSpecimenInner(Specimen element) throws IOException {
53408      composeDomainResourceElements(element);
53409      if (element.hasIdentifier()) {
53410        openArray("identifier");
53411        for (Identifier e : element.getIdentifier()) 
53412          composeIdentifier(null, e);
53413        closeArray();
53414      };
53415      if (element.hasAccessionIdentifier()) {
53416        composeIdentifier("accessionIdentifier", element.getAccessionIdentifier());
53417      }
53418      if (element.hasStatusElement()) {
53419        composeEnumerationCore("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
53420        composeEnumerationExtras("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
53421      }
53422      if (element.hasType()) {
53423        composeCodeableConcept("type", element.getType());
53424      }
53425      if (element.hasSubject()) {
53426        composeReference("subject", element.getSubject());
53427      }
53428      if (element.hasReceivedTimeElement()) {
53429        composeDateTimeCore("receivedTime", element.getReceivedTimeElement(), false);
53430        composeDateTimeExtras("receivedTime", element.getReceivedTimeElement(), false);
53431      }
53432      if (element.hasParent()) {
53433        openArray("parent");
53434        for (Reference e : element.getParent()) 
53435          composeReference(null, e);
53436        closeArray();
53437      };
53438      if (element.hasRequest()) {
53439        openArray("request");
53440        for (Reference e : element.getRequest()) 
53441          composeReference(null, e);
53442        closeArray();
53443      };
53444      if (element.hasCollection()) {
53445        composeSpecimenSpecimenCollectionComponent("collection", element.getCollection());
53446      }
53447      if (element.hasProcessing()) {
53448        openArray("processing");
53449        for (Specimen.SpecimenProcessingComponent e : element.getProcessing()) 
53450          composeSpecimenSpecimenProcessingComponent(null, e);
53451        closeArray();
53452      };
53453      if (element.hasContainer()) {
53454        openArray("container");
53455        for (Specimen.SpecimenContainerComponent e : element.getContainer()) 
53456          composeSpecimenSpecimenContainerComponent(null, e);
53457        closeArray();
53458      };
53459      if (element.hasCondition()) {
53460        openArray("condition");
53461        for (CodeableConcept e : element.getCondition()) 
53462          composeCodeableConcept(null, e);
53463        closeArray();
53464      };
53465      if (element.hasNote()) {
53466        openArray("note");
53467        for (Annotation e : element.getNote()) 
53468          composeAnnotation(null, e);
53469        closeArray();
53470      };
53471  }
53472
53473  protected void composeSpecimenSpecimenCollectionComponent(String name, Specimen.SpecimenCollectionComponent element) throws IOException {
53474    if (element != null) {
53475      open(name);
53476      composeSpecimenSpecimenCollectionComponentInner(element);
53477      close();
53478    }
53479  }
53480
53481  protected void composeSpecimenSpecimenCollectionComponentInner(Specimen.SpecimenCollectionComponent element) throws IOException {
53482      composeBackbone(element);
53483      if (element.hasCollector()) {
53484        composeReference("collector", element.getCollector());
53485      }
53486      if (element.hasCollected()) {
53487        composeType("collected", element.getCollected());
53488      }
53489      if (element.hasDuration()) {
53490        composeDuration("duration", element.getDuration());
53491      }
53492      if (element.hasQuantity()) {
53493        composeQuantity("quantity", element.getQuantity());
53494      }
53495      if (element.hasMethod()) {
53496        composeCodeableConcept("method", element.getMethod());
53497      }
53498      if (element.hasBodySite()) {
53499        composeCodeableConcept("bodySite", element.getBodySite());
53500      }
53501      if (element.hasFastingStatus()) {
53502        composeType("fastingStatus", element.getFastingStatus());
53503      }
53504  }
53505
53506  protected void composeSpecimenSpecimenProcessingComponent(String name, Specimen.SpecimenProcessingComponent element) throws IOException {
53507    if (element != null) {
53508      open(name);
53509      composeSpecimenSpecimenProcessingComponentInner(element);
53510      close();
53511    }
53512  }
53513
53514  protected void composeSpecimenSpecimenProcessingComponentInner(Specimen.SpecimenProcessingComponent element) throws IOException {
53515      composeBackbone(element);
53516      if (element.hasDescriptionElement()) {
53517        composeStringCore("description", element.getDescriptionElement(), false);
53518        composeStringExtras("description", element.getDescriptionElement(), false);
53519      }
53520      if (element.hasProcedure()) {
53521        composeCodeableConcept("procedure", element.getProcedure());
53522      }
53523      if (element.hasAdditive()) {
53524        openArray("additive");
53525        for (Reference e : element.getAdditive()) 
53526          composeReference(null, e);
53527        closeArray();
53528      };
53529      if (element.hasTime()) {
53530        composeType("time", element.getTime());
53531      }
53532  }
53533
53534  protected void composeSpecimenSpecimenContainerComponent(String name, Specimen.SpecimenContainerComponent element) throws IOException {
53535    if (element != null) {
53536      open(name);
53537      composeSpecimenSpecimenContainerComponentInner(element);
53538      close();
53539    }
53540  }
53541
53542  protected void composeSpecimenSpecimenContainerComponentInner(Specimen.SpecimenContainerComponent element) throws IOException {
53543      composeBackbone(element);
53544      if (element.hasIdentifier()) {
53545        openArray("identifier");
53546        for (Identifier e : element.getIdentifier()) 
53547          composeIdentifier(null, e);
53548        closeArray();
53549      };
53550      if (element.hasDescriptionElement()) {
53551        composeStringCore("description", element.getDescriptionElement(), false);
53552        composeStringExtras("description", element.getDescriptionElement(), false);
53553      }
53554      if (element.hasType()) {
53555        composeCodeableConcept("type", element.getType());
53556      }
53557      if (element.hasCapacity()) {
53558        composeQuantity("capacity", element.getCapacity());
53559      }
53560      if (element.hasSpecimenQuantity()) {
53561        composeQuantity("specimenQuantity", element.getSpecimenQuantity());
53562      }
53563      if (element.hasAdditive()) {
53564        composeType("additive", element.getAdditive());
53565      }
53566  }
53567
53568  protected void composeSpecimenDefinition(String name, SpecimenDefinition element) throws IOException {
53569    if (element != null) {
53570      prop("resourceType", name);
53571      composeSpecimenDefinitionInner(element);
53572    }
53573  }
53574
53575  protected void composeSpecimenDefinitionInner(SpecimenDefinition element) throws IOException {
53576      composeDomainResourceElements(element);
53577      if (element.hasIdentifier()) {
53578        composeIdentifier("identifier", element.getIdentifier());
53579      }
53580      if (element.hasTypeCollected()) {
53581        composeCodeableConcept("typeCollected", element.getTypeCollected());
53582      }
53583      if (element.hasPatientPreparation()) {
53584        openArray("patientPreparation");
53585        for (CodeableConcept e : element.getPatientPreparation()) 
53586          composeCodeableConcept(null, e);
53587        closeArray();
53588      };
53589      if (element.hasTimeAspectElement()) {
53590        composeStringCore("timeAspect", element.getTimeAspectElement(), false);
53591        composeStringExtras("timeAspect", element.getTimeAspectElement(), false);
53592      }
53593      if (element.hasCollection()) {
53594        openArray("collection");
53595        for (CodeableConcept e : element.getCollection()) 
53596          composeCodeableConcept(null, e);
53597        closeArray();
53598      };
53599      if (element.hasTypeTested()) {
53600        openArray("typeTested");
53601        for (SpecimenDefinition.SpecimenDefinitionTypeTestedComponent e : element.getTypeTested()) 
53602          composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(null, e);
53603        closeArray();
53604      };
53605  }
53606
53607  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
53608    if (element != null) {
53609      open(name);
53610      composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponentInner(element);
53611      close();
53612    }
53613  }
53614
53615  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
53616      composeBackbone(element);
53617      if (element.hasIsDerivedElement()) {
53618        composeBooleanCore("isDerived", element.getIsDerivedElement(), false);
53619        composeBooleanExtras("isDerived", element.getIsDerivedElement(), false);
53620      }
53621      if (element.hasType()) {
53622        composeCodeableConcept("type", element.getType());
53623      }
53624      if (element.hasPreferenceElement()) {
53625        composeEnumerationCore("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
53626        composeEnumerationExtras("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
53627      }
53628      if (element.hasContainer()) {
53629        composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent("container", element.getContainer());
53630      }
53631      if (element.hasRequirementElement()) {
53632        composeStringCore("requirement", element.getRequirementElement(), false);
53633        composeStringExtras("requirement", element.getRequirementElement(), false);
53634      }
53635      if (element.hasRetentionTime()) {
53636        composeDuration("retentionTime", element.getRetentionTime());
53637      }
53638      if (element.hasRejectionCriterion()) {
53639        openArray("rejectionCriterion");
53640        for (CodeableConcept e : element.getRejectionCriterion()) 
53641          composeCodeableConcept(null, e);
53642        closeArray();
53643      };
53644      if (element.hasHandling()) {
53645        openArray("handling");
53646        for (SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent e : element.getHandling()) 
53647          composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(null, e);
53648        closeArray();
53649      };
53650  }
53651
53652  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
53653    if (element != null) {
53654      open(name);
53655      composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentInner(element);
53656      close();
53657    }
53658  }
53659
53660  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
53661      composeBackbone(element);
53662      if (element.hasMaterial()) {
53663        composeCodeableConcept("material", element.getMaterial());
53664      }
53665      if (element.hasType()) {
53666        composeCodeableConcept("type", element.getType());
53667      }
53668      if (element.hasCap()) {
53669        composeCodeableConcept("cap", element.getCap());
53670      }
53671      if (element.hasDescriptionElement()) {
53672        composeStringCore("description", element.getDescriptionElement(), false);
53673        composeStringExtras("description", element.getDescriptionElement(), false);
53674      }
53675      if (element.hasCapacity()) {
53676        composeQuantity("capacity", element.getCapacity());
53677      }
53678      if (element.hasMinimumVolume()) {
53679        composeType("minimumVolume", element.getMinimumVolume());
53680      }
53681      if (element.hasAdditive()) {
53682        openArray("additive");
53683        for (SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent e : element.getAdditive()) 
53684          composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(null, e);
53685        closeArray();
53686      };
53687      if (element.hasPreparationElement()) {
53688        composeStringCore("preparation", element.getPreparationElement(), false);
53689        composeStringExtras("preparation", element.getPreparationElement(), false);
53690      }
53691  }
53692
53693  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
53694    if (element != null) {
53695      open(name);
53696      composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentInner(element);
53697      close();
53698    }
53699  }
53700
53701  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
53702      composeBackbone(element);
53703      if (element.hasAdditive()) {
53704        composeType("additive", element.getAdditive());
53705      }
53706  }
53707
53708  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
53709    if (element != null) {
53710      open(name);
53711      composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentInner(element);
53712      close();
53713    }
53714  }
53715
53716  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
53717      composeBackbone(element);
53718      if (element.hasTemperatureQualifier()) {
53719        composeCodeableConcept("temperatureQualifier", element.getTemperatureQualifier());
53720      }
53721      if (element.hasTemperatureRange()) {
53722        composeRange("temperatureRange", element.getTemperatureRange());
53723      }
53724      if (element.hasMaxDuration()) {
53725        composeDuration("maxDuration", element.getMaxDuration());
53726      }
53727      if (element.hasInstructionElement()) {
53728        composeStringCore("instruction", element.getInstructionElement(), false);
53729        composeStringExtras("instruction", element.getInstructionElement(), false);
53730      }
53731  }
53732
53733  protected void composeStructureDefinition(String name, StructureDefinition element) throws IOException {
53734    if (element != null) {
53735      prop("resourceType", name);
53736      composeStructureDefinitionInner(element);
53737    }
53738  }
53739
53740  protected void composeStructureDefinitionInner(StructureDefinition element) throws IOException {
53741      composeDomainResourceElements(element);
53742      if (element.hasUrlElement()) {
53743        composeUriCore("url", element.getUrlElement(), false);
53744        composeUriExtras("url", element.getUrlElement(), false);
53745      }
53746      if (element.hasIdentifier()) {
53747        openArray("identifier");
53748        for (Identifier e : element.getIdentifier()) 
53749          composeIdentifier(null, e);
53750        closeArray();
53751      };
53752      if (element.hasVersionElement()) {
53753        composeStringCore("version", element.getVersionElement(), false);
53754        composeStringExtras("version", element.getVersionElement(), false);
53755      }
53756      if (element.hasNameElement()) {
53757        composeStringCore("name", element.getNameElement(), false);
53758        composeStringExtras("name", element.getNameElement(), false);
53759      }
53760      if (element.hasTitleElement()) {
53761        composeStringCore("title", element.getTitleElement(), false);
53762        composeStringExtras("title", element.getTitleElement(), false);
53763      }
53764      if (element.hasStatusElement()) {
53765        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53766        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53767      }
53768      if (element.hasExperimentalElement()) {
53769        composeBooleanCore("experimental", element.getExperimentalElement(), false);
53770        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
53771      }
53772      if (element.hasDateElement()) {
53773        composeDateTimeCore("date", element.getDateElement(), false);
53774        composeDateTimeExtras("date", element.getDateElement(), false);
53775      }
53776      if (element.hasPublisherElement()) {
53777        composeStringCore("publisher", element.getPublisherElement(), false);
53778        composeStringExtras("publisher", element.getPublisherElement(), false);
53779      }
53780      if (element.hasContact()) {
53781        openArray("contact");
53782        for (ContactDetail e : element.getContact()) 
53783          composeContactDetail(null, e);
53784        closeArray();
53785      };
53786      if (element.hasDescriptionElement()) {
53787        composeMarkdownCore("description", element.getDescriptionElement(), false);
53788        composeMarkdownExtras("description", element.getDescriptionElement(), false);
53789      }
53790      if (element.hasUseContext()) {
53791        openArray("useContext");
53792        for (UsageContext e : element.getUseContext()) 
53793          composeUsageContext(null, e);
53794        closeArray();
53795      };
53796      if (element.hasJurisdiction()) {
53797        openArray("jurisdiction");
53798        for (CodeableConcept e : element.getJurisdiction()) 
53799          composeCodeableConcept(null, e);
53800        closeArray();
53801      };
53802      if (element.hasPurposeElement()) {
53803        composeMarkdownCore("purpose", element.getPurposeElement(), false);
53804        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
53805      }
53806      if (element.hasCopyrightElement()) {
53807        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
53808        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
53809      }
53810      if (element.hasKeyword()) {
53811        openArray("keyword");
53812        for (Coding e : element.getKeyword()) 
53813          composeCoding(null, e);
53814        closeArray();
53815      };
53816      if (element.hasFhirVersionElement()) {
53817        composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
53818        composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
53819      }
53820      if (element.hasMapping()) {
53821        openArray("mapping");
53822        for (StructureDefinition.StructureDefinitionMappingComponent e : element.getMapping()) 
53823          composeStructureDefinitionStructureDefinitionMappingComponent(null, e);
53824        closeArray();
53825      };
53826      if (element.hasKindElement()) {
53827        composeEnumerationCore("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
53828        composeEnumerationExtras("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
53829      }
53830      if (element.hasAbstractElement()) {
53831        composeBooleanCore("abstract", element.getAbstractElement(), false);
53832        composeBooleanExtras("abstract", element.getAbstractElement(), false);
53833      }
53834      if (element.hasContext()) {
53835        openArray("context");
53836        for (StructureDefinition.StructureDefinitionContextComponent e : element.getContext()) 
53837          composeStructureDefinitionStructureDefinitionContextComponent(null, e);
53838        closeArray();
53839      };
53840      if (element.hasContextInvariant()) {
53841        openArray("contextInvariant");
53842        for (StringType e : element.getContextInvariant()) 
53843          composeStringCore(null, e, true);
53844        closeArray();
53845        if (anyHasExtras(element.getContextInvariant())) {
53846          openArray("_contextInvariant");
53847          for (StringType e : element.getContextInvariant()) 
53848            composeStringExtras(null, e, true);
53849          closeArray();
53850        }
53851      };
53852      if (element.hasTypeElement()) {
53853        composeUriCore("type", element.getTypeElement(), false);
53854        composeUriExtras("type", element.getTypeElement(), false);
53855      }
53856      if (element.hasBaseDefinitionElement()) {
53857        composeCanonicalCore("baseDefinition", element.getBaseDefinitionElement(), false);
53858        composeCanonicalExtras("baseDefinition", element.getBaseDefinitionElement(), false);
53859      }
53860      if (element.hasDerivationElement()) {
53861        composeEnumerationCore("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
53862        composeEnumerationExtras("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
53863      }
53864      if (element.hasSnapshot()) {
53865        composeStructureDefinitionStructureDefinitionSnapshotComponent("snapshot", element.getSnapshot());
53866      }
53867      if (element.hasDifferential()) {
53868        composeStructureDefinitionStructureDefinitionDifferentialComponent("differential", element.getDifferential());
53869      }
53870  }
53871
53872  protected void composeStructureDefinitionStructureDefinitionMappingComponent(String name, StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
53873    if (element != null) {
53874      open(name);
53875      composeStructureDefinitionStructureDefinitionMappingComponentInner(element);
53876      close();
53877    }
53878  }
53879
53880  protected void composeStructureDefinitionStructureDefinitionMappingComponentInner(StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
53881      composeBackbone(element);
53882      if (element.hasIdentityElement()) {
53883        composeIdCore("identity", element.getIdentityElement(), false);
53884        composeIdExtras("identity", element.getIdentityElement(), false);
53885      }
53886      if (element.hasUriElement()) {
53887        composeUriCore("uri", element.getUriElement(), false);
53888        composeUriExtras("uri", element.getUriElement(), false);
53889      }
53890      if (element.hasNameElement()) {
53891        composeStringCore("name", element.getNameElement(), false);
53892        composeStringExtras("name", element.getNameElement(), false);
53893      }
53894      if (element.hasCommentElement()) {
53895        composeStringCore("comment", element.getCommentElement(), false);
53896        composeStringExtras("comment", element.getCommentElement(), false);
53897      }
53898  }
53899
53900  protected void composeStructureDefinitionStructureDefinitionContextComponent(String name, StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
53901    if (element != null) {
53902      open(name);
53903      composeStructureDefinitionStructureDefinitionContextComponentInner(element);
53904      close();
53905    }
53906  }
53907
53908  protected void composeStructureDefinitionStructureDefinitionContextComponentInner(StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
53909      composeBackbone(element);
53910      if (element.hasTypeElement()) {
53911        composeEnumerationCore("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
53912        composeEnumerationExtras("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
53913      }
53914      if (element.hasExpressionElement()) {
53915        composeStringCore("expression", element.getExpressionElement(), false);
53916        composeStringExtras("expression", element.getExpressionElement(), false);
53917      }
53918  }
53919
53920  protected void composeStructureDefinitionStructureDefinitionSnapshotComponent(String name, StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
53921    if (element != null) {
53922      open(name);
53923      composeStructureDefinitionStructureDefinitionSnapshotComponentInner(element);
53924      close();
53925    }
53926  }
53927
53928  protected void composeStructureDefinitionStructureDefinitionSnapshotComponentInner(StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
53929      composeBackbone(element);
53930      if (element.hasElement()) {
53931        openArray("element");
53932        for (ElementDefinition e : element.getElement()) 
53933          composeElementDefinition(null, e);
53934        closeArray();
53935      };
53936  }
53937
53938  protected void composeStructureDefinitionStructureDefinitionDifferentialComponent(String name, StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
53939    if (element != null) {
53940      open(name);
53941      composeStructureDefinitionStructureDefinitionDifferentialComponentInner(element);
53942      close();
53943    }
53944  }
53945
53946  protected void composeStructureDefinitionStructureDefinitionDifferentialComponentInner(StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
53947      composeBackbone(element);
53948      if (element.hasElement()) {
53949        openArray("element");
53950        for (ElementDefinition e : element.getElement()) 
53951          composeElementDefinition(null, e);
53952        closeArray();
53953      };
53954  }
53955
53956  protected void composeStructureMap(String name, StructureMap element) throws IOException {
53957    if (element != null) {
53958      prop("resourceType", name);
53959      composeStructureMapInner(element);
53960    }
53961  }
53962
53963  protected void composeStructureMapInner(StructureMap element) throws IOException {
53964      composeDomainResourceElements(element);
53965      if (element.hasUrlElement()) {
53966        composeUriCore("url", element.getUrlElement(), false);
53967        composeUriExtras("url", element.getUrlElement(), false);
53968      }
53969      if (element.hasIdentifier()) {
53970        openArray("identifier");
53971        for (Identifier e : element.getIdentifier()) 
53972          composeIdentifier(null, e);
53973        closeArray();
53974      };
53975      if (element.hasVersionElement()) {
53976        composeStringCore("version", element.getVersionElement(), false);
53977        composeStringExtras("version", element.getVersionElement(), false);
53978      }
53979      if (element.hasNameElement()) {
53980        composeStringCore("name", element.getNameElement(), false);
53981        composeStringExtras("name", element.getNameElement(), false);
53982      }
53983      if (element.hasTitleElement()) {
53984        composeStringCore("title", element.getTitleElement(), false);
53985        composeStringExtras("title", element.getTitleElement(), false);
53986      }
53987      if (element.hasStatusElement()) {
53988        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53989        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53990      }
53991      if (element.hasExperimentalElement()) {
53992        composeBooleanCore("experimental", element.getExperimentalElement(), false);
53993        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
53994      }
53995      if (element.hasDateElement()) {
53996        composeDateTimeCore("date", element.getDateElement(), false);
53997        composeDateTimeExtras("date", element.getDateElement(), false);
53998      }
53999      if (element.hasPublisherElement()) {
54000        composeStringCore("publisher", element.getPublisherElement(), false);
54001        composeStringExtras("publisher", element.getPublisherElement(), false);
54002      }
54003      if (element.hasContact()) {
54004        openArray("contact");
54005        for (ContactDetail e : element.getContact()) 
54006          composeContactDetail(null, e);
54007        closeArray();
54008      };
54009      if (element.hasDescriptionElement()) {
54010        composeMarkdownCore("description", element.getDescriptionElement(), false);
54011        composeMarkdownExtras("description", element.getDescriptionElement(), false);
54012      }
54013      if (element.hasUseContext()) {
54014        openArray("useContext");
54015        for (UsageContext e : element.getUseContext()) 
54016          composeUsageContext(null, e);
54017        closeArray();
54018      };
54019      if (element.hasJurisdiction()) {
54020        openArray("jurisdiction");
54021        for (CodeableConcept e : element.getJurisdiction()) 
54022          composeCodeableConcept(null, e);
54023        closeArray();
54024      };
54025      if (element.hasPurposeElement()) {
54026        composeMarkdownCore("purpose", element.getPurposeElement(), false);
54027        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
54028      }
54029      if (element.hasCopyrightElement()) {
54030        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
54031        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
54032      }
54033      if (element.hasStructure()) {
54034        openArray("structure");
54035        for (StructureMap.StructureMapStructureComponent e : element.getStructure()) 
54036          composeStructureMapStructureMapStructureComponent(null, e);
54037        closeArray();
54038      };
54039      if (element.hasImport()) {
54040        openArray("import");
54041        for (CanonicalType e : element.getImport()) 
54042          composeCanonicalCore(null, e, true);
54043        closeArray();
54044        if (anyHasExtras(element.getImport())) {
54045          openArray("_import");
54046          for (CanonicalType e : element.getImport()) 
54047            composeCanonicalExtras(null, e, true);
54048          closeArray();
54049        }
54050      };
54051      if (element.hasGroup()) {
54052        openArray("group");
54053        for (StructureMap.StructureMapGroupComponent e : element.getGroup()) 
54054          composeStructureMapStructureMapGroupComponent(null, e);
54055        closeArray();
54056      };
54057  }
54058
54059  protected void composeStructureMapStructureMapStructureComponent(String name, StructureMap.StructureMapStructureComponent element) throws IOException {
54060    if (element != null) {
54061      open(name);
54062      composeStructureMapStructureMapStructureComponentInner(element);
54063      close();
54064    }
54065  }
54066
54067  protected void composeStructureMapStructureMapStructureComponentInner(StructureMap.StructureMapStructureComponent element) throws IOException {
54068      composeBackbone(element);
54069      if (element.hasUrlElement()) {
54070        composeCanonicalCore("url", element.getUrlElement(), false);
54071        composeCanonicalExtras("url", element.getUrlElement(), false);
54072      }
54073      if (element.hasModeElement()) {
54074        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
54075        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
54076      }
54077      if (element.hasAliasElement()) {
54078        composeStringCore("alias", element.getAliasElement(), false);
54079        composeStringExtras("alias", element.getAliasElement(), false);
54080      }
54081      if (element.hasDocumentationElement()) {
54082        composeStringCore("documentation", element.getDocumentationElement(), false);
54083        composeStringExtras("documentation", element.getDocumentationElement(), false);
54084      }
54085  }
54086
54087  protected void composeStructureMapStructureMapGroupComponent(String name, StructureMap.StructureMapGroupComponent element) throws IOException {
54088    if (element != null) {
54089      open(name);
54090      composeStructureMapStructureMapGroupComponentInner(element);
54091      close();
54092    }
54093  }
54094
54095  protected void composeStructureMapStructureMapGroupComponentInner(StructureMap.StructureMapGroupComponent element) throws IOException {
54096      composeBackbone(element);
54097      if (element.hasNameElement()) {
54098        composeIdCore("name", element.getNameElement(), false);
54099        composeIdExtras("name", element.getNameElement(), false);
54100      }
54101      if (element.hasExtendsElement()) {
54102        composeIdCore("extends", element.getExtendsElement(), false);
54103        composeIdExtras("extends", element.getExtendsElement(), false);
54104      }
54105      if (element.hasTypeModeElement()) {
54106        composeEnumerationCore("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
54107        composeEnumerationExtras("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
54108      }
54109      if (element.hasDocumentationElement()) {
54110        composeStringCore("documentation", element.getDocumentationElement(), false);
54111        composeStringExtras("documentation", element.getDocumentationElement(), false);
54112      }
54113      if (element.hasInput()) {
54114        openArray("input");
54115        for (StructureMap.StructureMapGroupInputComponent e : element.getInput()) 
54116          composeStructureMapStructureMapGroupInputComponent(null, e);
54117        closeArray();
54118      };
54119      if (element.hasRule()) {
54120        openArray("rule");
54121        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
54122          composeStructureMapStructureMapGroupRuleComponent(null, e);
54123        closeArray();
54124      };
54125  }
54126
54127  protected void composeStructureMapStructureMapGroupInputComponent(String name, StructureMap.StructureMapGroupInputComponent element) throws IOException {
54128    if (element != null) {
54129      open(name);
54130      composeStructureMapStructureMapGroupInputComponentInner(element);
54131      close();
54132    }
54133  }
54134
54135  protected void composeStructureMapStructureMapGroupInputComponentInner(StructureMap.StructureMapGroupInputComponent element) throws IOException {
54136      composeBackbone(element);
54137      if (element.hasNameElement()) {
54138        composeIdCore("name", element.getNameElement(), false);
54139        composeIdExtras("name", element.getNameElement(), false);
54140      }
54141      if (element.hasTypeElement()) {
54142        composeStringCore("type", element.getTypeElement(), false);
54143        composeStringExtras("type", element.getTypeElement(), false);
54144      }
54145      if (element.hasModeElement()) {
54146        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
54147        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
54148      }
54149      if (element.hasDocumentationElement()) {
54150        composeStringCore("documentation", element.getDocumentationElement(), false);
54151        composeStringExtras("documentation", element.getDocumentationElement(), false);
54152      }
54153  }
54154
54155  protected void composeStructureMapStructureMapGroupRuleComponent(String name, StructureMap.StructureMapGroupRuleComponent element) throws IOException {
54156    if (element != null) {
54157      open(name);
54158      composeStructureMapStructureMapGroupRuleComponentInner(element);
54159      close();
54160    }
54161  }
54162
54163  protected void composeStructureMapStructureMapGroupRuleComponentInner(StructureMap.StructureMapGroupRuleComponent element) throws IOException {
54164      composeBackbone(element);
54165      if (element.hasNameElement()) {
54166        composeIdCore("name", element.getNameElement(), false);
54167        composeIdExtras("name", element.getNameElement(), false);
54168      }
54169      if (element.hasSource()) {
54170        openArray("source");
54171        for (StructureMap.StructureMapGroupRuleSourceComponent e : element.getSource()) 
54172          composeStructureMapStructureMapGroupRuleSourceComponent(null, e);
54173        closeArray();
54174      };
54175      if (element.hasTarget()) {
54176        openArray("target");
54177        for (StructureMap.StructureMapGroupRuleTargetComponent e : element.getTarget()) 
54178          composeStructureMapStructureMapGroupRuleTargetComponent(null, e);
54179        closeArray();
54180      };
54181      if (element.hasRule()) {
54182        openArray("rule");
54183        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
54184          composeStructureMapStructureMapGroupRuleComponent(null, e);
54185        closeArray();
54186      };
54187      if (element.hasDependent()) {
54188        openArray("dependent");
54189        for (StructureMap.StructureMapGroupRuleDependentComponent e : element.getDependent()) 
54190          composeStructureMapStructureMapGroupRuleDependentComponent(null, e);
54191        closeArray();
54192      };
54193      if (element.hasDocumentationElement()) {
54194        composeStringCore("documentation", element.getDocumentationElement(), false);
54195        composeStringExtras("documentation", element.getDocumentationElement(), false);
54196      }
54197  }
54198
54199  protected void composeStructureMapStructureMapGroupRuleSourceComponent(String name, StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
54200    if (element != null) {
54201      open(name);
54202      composeStructureMapStructureMapGroupRuleSourceComponentInner(element);
54203      close();
54204    }
54205  }
54206
54207  protected void composeStructureMapStructureMapGroupRuleSourceComponentInner(StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
54208      composeBackbone(element);
54209      if (element.hasContextElement()) {
54210        composeIdCore("context", element.getContextElement(), false);
54211        composeIdExtras("context", element.getContextElement(), false);
54212      }
54213      if (element.hasMinElement()) {
54214        composeIntegerCore("min", element.getMinElement(), false);
54215        composeIntegerExtras("min", element.getMinElement(), false);
54216      }
54217      if (element.hasMaxElement()) {
54218        composeStringCore("max", element.getMaxElement(), false);
54219        composeStringExtras("max", element.getMaxElement(), false);
54220      }
54221      if (element.hasTypeElement()) {
54222        composeStringCore("type", element.getTypeElement(), false);
54223        composeStringExtras("type", element.getTypeElement(), false);
54224      }
54225      if (element.hasDefaultValue()) {
54226        composeType("defaultValue", element.getDefaultValue());
54227      }
54228      if (element.hasElementElement()) {
54229        composeStringCore("element", element.getElementElement(), false);
54230        composeStringExtras("element", element.getElementElement(), false);
54231      }
54232      if (element.hasListModeElement()) {
54233        composeEnumerationCore("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
54234        composeEnumerationExtras("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
54235      }
54236      if (element.hasVariableElement()) {
54237        composeIdCore("variable", element.getVariableElement(), false);
54238        composeIdExtras("variable", element.getVariableElement(), false);
54239      }
54240      if (element.hasConditionElement()) {
54241        composeStringCore("condition", element.getConditionElement(), false);
54242        composeStringExtras("condition", element.getConditionElement(), false);
54243      }
54244      if (element.hasCheckElement()) {
54245        composeStringCore("check", element.getCheckElement(), false);
54246        composeStringExtras("check", element.getCheckElement(), false);
54247      }
54248      if (element.hasLogMessageElement()) {
54249        composeStringCore("logMessage", element.getLogMessageElement(), false);
54250        composeStringExtras("logMessage", element.getLogMessageElement(), false);
54251      }
54252  }
54253
54254  protected void composeStructureMapStructureMapGroupRuleTargetComponent(String name, StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
54255    if (element != null) {
54256      open(name);
54257      composeStructureMapStructureMapGroupRuleTargetComponentInner(element);
54258      close();
54259    }
54260  }
54261
54262  protected void composeStructureMapStructureMapGroupRuleTargetComponentInner(StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
54263      composeBackbone(element);
54264      if (element.hasContextElement()) {
54265        composeIdCore("context", element.getContextElement(), false);
54266        composeIdExtras("context", element.getContextElement(), false);
54267      }
54268      if (element.hasContextTypeElement()) {
54269        composeEnumerationCore("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
54270        composeEnumerationExtras("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
54271      }
54272      if (element.hasElementElement()) {
54273        composeStringCore("element", element.getElementElement(), false);
54274        composeStringExtras("element", element.getElementElement(), false);
54275      }
54276      if (element.hasVariableElement()) {
54277        composeIdCore("variable", element.getVariableElement(), false);
54278        composeIdExtras("variable", element.getVariableElement(), false);
54279      }
54280      if (element.hasListMode()) {
54281        openArray("listMode");
54282        for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
54283          composeEnumerationCore(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
54284        closeArray();
54285        if (anyHasExtras(element.getListMode())) {
54286          openArray("_listMode");
54287          for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
54288            composeEnumerationExtras(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
54289          closeArray();
54290        }
54291      };
54292      if (element.hasListRuleIdElement()) {
54293        composeIdCore("listRuleId", element.getListRuleIdElement(), false);
54294        composeIdExtras("listRuleId", element.getListRuleIdElement(), false);
54295      }
54296      if (element.hasTransformElement()) {
54297        composeEnumerationCore("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
54298        composeEnumerationExtras("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
54299      }
54300      if (element.hasParameter()) {
54301        openArray("parameter");
54302        for (StructureMap.StructureMapGroupRuleTargetParameterComponent e : element.getParameter()) 
54303          composeStructureMapStructureMapGroupRuleTargetParameterComponent(null, e);
54304        closeArray();
54305      };
54306  }
54307
54308  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponent(String name, StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
54309    if (element != null) {
54310      open(name);
54311      composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(element);
54312      close();
54313    }
54314  }
54315
54316  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
54317      composeBackbone(element);
54318      if (element.hasValue()) {
54319        composeType("value", element.getValue());
54320      }
54321  }
54322
54323  protected void composeStructureMapStructureMapGroupRuleDependentComponent(String name, StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
54324    if (element != null) {
54325      open(name);
54326      composeStructureMapStructureMapGroupRuleDependentComponentInner(element);
54327      close();
54328    }
54329  }
54330
54331  protected void composeStructureMapStructureMapGroupRuleDependentComponentInner(StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
54332      composeBackbone(element);
54333      if (element.hasNameElement()) {
54334        composeIdCore("name", element.getNameElement(), false);
54335        composeIdExtras("name", element.getNameElement(), false);
54336      }
54337      if (element.hasVariable()) {
54338        openArray("variable");
54339        for (StringType e : element.getVariable()) 
54340          composeStringCore(null, e, true);
54341        closeArray();
54342        if (anyHasExtras(element.getVariable())) {
54343          openArray("_variable");
54344          for (StringType e : element.getVariable()) 
54345            composeStringExtras(null, e, true);
54346          closeArray();
54347        }
54348      };
54349  }
54350
54351  protected void composeSubscription(String name, Subscription element) throws IOException {
54352    if (element != null) {
54353      prop("resourceType", name);
54354      composeSubscriptionInner(element);
54355    }
54356  }
54357
54358  protected void composeSubscriptionInner(Subscription element) throws IOException {
54359      composeDomainResourceElements(element);
54360      if (element.hasStatusElement()) {
54361        composeEnumerationCore("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
54362        composeEnumerationExtras("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
54363      }
54364      if (element.hasContact()) {
54365        openArray("contact");
54366        for (ContactPoint e : element.getContact()) 
54367          composeContactPoint(null, e);
54368        closeArray();
54369      };
54370      if (element.hasEndElement()) {
54371        composeInstantCore("end", element.getEndElement(), false);
54372        composeInstantExtras("end", element.getEndElement(), false);
54373      }
54374      if (element.hasReasonElement()) {
54375        composeStringCore("reason", element.getReasonElement(), false);
54376        composeStringExtras("reason", element.getReasonElement(), false);
54377      }
54378      if (element.hasCriteriaElement()) {
54379        composeStringCore("criteria", element.getCriteriaElement(), false);
54380        composeStringExtras("criteria", element.getCriteriaElement(), false);
54381      }
54382      if (element.hasErrorElement()) {
54383        composeStringCore("error", element.getErrorElement(), false);
54384        composeStringExtras("error", element.getErrorElement(), false);
54385      }
54386      if (element.hasChannel()) {
54387        composeSubscriptionSubscriptionChannelComponent("channel", element.getChannel());
54388      }
54389  }
54390
54391  protected void composeSubscriptionSubscriptionChannelComponent(String name, Subscription.SubscriptionChannelComponent element) throws IOException {
54392    if (element != null) {
54393      open(name);
54394      composeSubscriptionSubscriptionChannelComponentInner(element);
54395      close();
54396    }
54397  }
54398
54399  protected void composeSubscriptionSubscriptionChannelComponentInner(Subscription.SubscriptionChannelComponent element) throws IOException {
54400      composeBackbone(element);
54401      if (element.hasTypeElement()) {
54402        composeEnumerationCore("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
54403        composeEnumerationExtras("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
54404      }
54405      if (element.hasEndpointElement()) {
54406        composeUrlCore("endpoint", element.getEndpointElement(), false);
54407        composeUrlExtras("endpoint", element.getEndpointElement(), false);
54408      }
54409      if (element.hasPayloadElement()) {
54410        composeCodeCore("payload", element.getPayloadElement(), false);
54411        composeCodeExtras("payload", element.getPayloadElement(), false);
54412      }
54413      if (element.hasHeader()) {
54414        openArray("header");
54415        for (StringType e : element.getHeader()) 
54416          composeStringCore(null, e, true);
54417        closeArray();
54418        if (anyHasExtras(element.getHeader())) {
54419          openArray("_header");
54420          for (StringType e : element.getHeader()) 
54421            composeStringExtras(null, e, true);
54422          closeArray();
54423        }
54424      };
54425  }
54426
54427  protected void composeSubstance(String name, Substance element) throws IOException {
54428    if (element != null) {
54429      prop("resourceType", name);
54430      composeSubstanceInner(element);
54431    }
54432  }
54433
54434  protected void composeSubstanceInner(Substance element) throws IOException {
54435      composeDomainResourceElements(element);
54436      if (element.hasIdentifier()) {
54437        openArray("identifier");
54438        for (Identifier e : element.getIdentifier()) 
54439          composeIdentifier(null, e);
54440        closeArray();
54441      };
54442      if (element.hasStatusElement()) {
54443        composeEnumerationCore("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
54444        composeEnumerationExtras("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
54445      }
54446      if (element.hasCategory()) {
54447        openArray("category");
54448        for (CodeableConcept e : element.getCategory()) 
54449          composeCodeableConcept(null, e);
54450        closeArray();
54451      };
54452      if (element.hasCode()) {
54453        composeCodeableConcept("code", element.getCode());
54454      }
54455      if (element.hasDescriptionElement()) {
54456        composeStringCore("description", element.getDescriptionElement(), false);
54457        composeStringExtras("description", element.getDescriptionElement(), false);
54458      }
54459      if (element.hasInstance()) {
54460        openArray("instance");
54461        for (Substance.SubstanceInstanceComponent e : element.getInstance()) 
54462          composeSubstanceSubstanceInstanceComponent(null, e);
54463        closeArray();
54464      };
54465      if (element.hasIngredient()) {
54466        openArray("ingredient");
54467        for (Substance.SubstanceIngredientComponent e : element.getIngredient()) 
54468          composeSubstanceSubstanceIngredientComponent(null, e);
54469        closeArray();
54470      };
54471  }
54472
54473  protected void composeSubstanceSubstanceInstanceComponent(String name, Substance.SubstanceInstanceComponent element) throws IOException {
54474    if (element != null) {
54475      open(name);
54476      composeSubstanceSubstanceInstanceComponentInner(element);
54477      close();
54478    }
54479  }
54480
54481  protected void composeSubstanceSubstanceInstanceComponentInner(Substance.SubstanceInstanceComponent element) throws IOException {
54482      composeBackbone(element);
54483      if (element.hasIdentifier()) {
54484        composeIdentifier("identifier", element.getIdentifier());
54485      }
54486      if (element.hasExpiryElement()) {
54487        composeDateTimeCore("expiry", element.getExpiryElement(), false);
54488        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
54489      }
54490      if (element.hasQuantity()) {
54491        composeQuantity("quantity", element.getQuantity());
54492      }
54493  }
54494
54495  protected void composeSubstanceSubstanceIngredientComponent(String name, Substance.SubstanceIngredientComponent element) throws IOException {
54496    if (element != null) {
54497      open(name);
54498      composeSubstanceSubstanceIngredientComponentInner(element);
54499      close();
54500    }
54501  }
54502
54503  protected void composeSubstanceSubstanceIngredientComponentInner(Substance.SubstanceIngredientComponent element) throws IOException {
54504      composeBackbone(element);
54505      if (element.hasQuantity()) {
54506        composeRatio("quantity", element.getQuantity());
54507      }
54508      if (element.hasSubstance()) {
54509        composeType("substance", element.getSubstance());
54510      }
54511  }
54512
54513  protected void composeSubstanceNucleicAcid(String name, SubstanceNucleicAcid element) throws IOException {
54514    if (element != null) {
54515      prop("resourceType", name);
54516      composeSubstanceNucleicAcidInner(element);
54517    }
54518  }
54519
54520  protected void composeSubstanceNucleicAcidInner(SubstanceNucleicAcid element) throws IOException {
54521      composeDomainResourceElements(element);
54522      if (element.hasSequenceType()) {
54523        composeCodeableConcept("sequenceType", element.getSequenceType());
54524      }
54525      if (element.hasNumberOfSubunitsElement()) {
54526        composeIntegerCore("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
54527        composeIntegerExtras("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
54528      }
54529      if (element.hasAreaOfHybridisationElement()) {
54530        composeStringCore("areaOfHybridisation", element.getAreaOfHybridisationElement(), false);
54531        composeStringExtras("areaOfHybridisation", element.getAreaOfHybridisationElement(), false);
54532      }
54533      if (element.hasOligoNucleotideType()) {
54534        composeCodeableConcept("oligoNucleotideType", element.getOligoNucleotideType());
54535      }
54536      if (element.hasSubunit()) {
54537        openArray("subunit");
54538        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent e : element.getSubunit()) 
54539          composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(null, e);
54540        closeArray();
54541      };
54542  }
54543
54544  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent element) throws IOException {
54545    if (element != null) {
54546      open(name);
54547      composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentInner(element);
54548      close();
54549    }
54550  }
54551
54552  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentInner(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent element) throws IOException {
54553      composeBackbone(element);
54554      if (element.hasSubunitElement()) {
54555        composeIntegerCore("subunit", element.getSubunitElement(), false);
54556        composeIntegerExtras("subunit", element.getSubunitElement(), false);
54557      }
54558      if (element.hasSequenceElement()) {
54559        composeStringCore("sequence", element.getSequenceElement(), false);
54560        composeStringExtras("sequence", element.getSequenceElement(), false);
54561      }
54562      if (element.hasLengthElement()) {
54563        composeIntegerCore("length", element.getLengthElement(), false);
54564        composeIntegerExtras("length", element.getLengthElement(), false);
54565      }
54566      if (element.hasSequenceAttachment()) {
54567        composeAttachment("sequenceAttachment", element.getSequenceAttachment());
54568      }
54569      if (element.hasFivePrime()) {
54570        composeCodeableConcept("fivePrime", element.getFivePrime());
54571      }
54572      if (element.hasThreePrime()) {
54573        composeCodeableConcept("threePrime", element.getThreePrime());
54574      }
54575      if (element.hasLinkage()) {
54576        openArray("linkage");
54577        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent e : element.getLinkage()) 
54578          composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(null, e);
54579        closeArray();
54580      };
54581      if (element.hasSugar()) {
54582        openArray("sugar");
54583        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent e : element.getSugar()) 
54584          composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(null, e);
54585        closeArray();
54586      };
54587  }
54588
54589  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent element) throws IOException {
54590    if (element != null) {
54591      open(name);
54592      composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentInner(element);
54593      close();
54594    }
54595  }
54596
54597  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentInner(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent element) throws IOException {
54598      composeBackbone(element);
54599      if (element.hasConnectivityElement()) {
54600        composeStringCore("connectivity", element.getConnectivityElement(), false);
54601        composeStringExtras("connectivity", element.getConnectivityElement(), false);
54602      }
54603      if (element.hasIdentifier()) {
54604        composeIdentifier("identifier", element.getIdentifier());
54605      }
54606      if (element.hasNameElement()) {
54607        composeStringCore("name", element.getNameElement(), false);
54608        composeStringExtras("name", element.getNameElement(), false);
54609      }
54610      if (element.hasResidueSiteElement()) {
54611        composeStringCore("residueSite", element.getResidueSiteElement(), false);
54612        composeStringExtras("residueSite", element.getResidueSiteElement(), false);
54613      }
54614  }
54615
54616  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent element) throws IOException {
54617    if (element != null) {
54618      open(name);
54619      composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentInner(element);
54620      close();
54621    }
54622  }
54623
54624  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentInner(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent element) throws IOException {
54625      composeBackbone(element);
54626      if (element.hasIdentifier()) {
54627        composeIdentifier("identifier", element.getIdentifier());
54628      }
54629      if (element.hasNameElement()) {
54630        composeStringCore("name", element.getNameElement(), false);
54631        composeStringExtras("name", element.getNameElement(), false);
54632      }
54633      if (element.hasResidueSiteElement()) {
54634        composeStringCore("residueSite", element.getResidueSiteElement(), false);
54635        composeStringExtras("residueSite", element.getResidueSiteElement(), false);
54636      }
54637  }
54638
54639  protected void composeSubstancePolymer(String name, SubstancePolymer element) throws IOException {
54640    if (element != null) {
54641      prop("resourceType", name);
54642      composeSubstancePolymerInner(element);
54643    }
54644  }
54645
54646  protected void composeSubstancePolymerInner(SubstancePolymer element) throws IOException {
54647      composeDomainResourceElements(element);
54648      if (element.hasClass_()) {
54649        composeCodeableConcept("class", element.getClass_());
54650      }
54651      if (element.hasGeometry()) {
54652        composeCodeableConcept("geometry", element.getGeometry());
54653      }
54654      if (element.hasCopolymerConnectivity()) {
54655        openArray("copolymerConnectivity");
54656        for (CodeableConcept e : element.getCopolymerConnectivity()) 
54657          composeCodeableConcept(null, e);
54658        closeArray();
54659      };
54660      if (element.hasModification()) {
54661        openArray("modification");
54662        for (StringType e : element.getModification()) 
54663          composeStringCore(null, e, true);
54664        closeArray();
54665        if (anyHasExtras(element.getModification())) {
54666          openArray("_modification");
54667          for (StringType e : element.getModification()) 
54668            composeStringExtras(null, e, true);
54669          closeArray();
54670        }
54671      };
54672      if (element.hasMonomerSet()) {
54673        openArray("monomerSet");
54674        for (SubstancePolymer.SubstancePolymerMonomerSetComponent e : element.getMonomerSet()) 
54675          composeSubstancePolymerSubstancePolymerMonomerSetComponent(null, e);
54676        closeArray();
54677      };
54678      if (element.hasRepeat()) {
54679        openArray("repeat");
54680        for (SubstancePolymer.SubstancePolymerRepeatComponent e : element.getRepeat()) 
54681          composeSubstancePolymerSubstancePolymerRepeatComponent(null, e);
54682        closeArray();
54683      };
54684  }
54685
54686  protected void composeSubstancePolymerSubstancePolymerMonomerSetComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
54687    if (element != null) {
54688      open(name);
54689      composeSubstancePolymerSubstancePolymerMonomerSetComponentInner(element);
54690      close();
54691    }
54692  }
54693
54694  protected void composeSubstancePolymerSubstancePolymerMonomerSetComponentInner(SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
54695      composeBackbone(element);
54696      if (element.hasRatioType()) {
54697        composeCodeableConcept("ratioType", element.getRatioType());
54698      }
54699      if (element.hasStartingMaterial()) {
54700        openArray("startingMaterial");
54701        for (SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent e : element.getStartingMaterial()) 
54702          composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(null, e);
54703        closeArray();
54704      };
54705  }
54706
54707  protected void composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
54708    if (element != null) {
54709      open(name);
54710      composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentInner(element);
54711      close();
54712    }
54713  }
54714
54715  protected void composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentInner(SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
54716      composeBackbone(element);
54717      if (element.hasMaterial()) {
54718        composeCodeableConcept("material", element.getMaterial());
54719      }
54720      if (element.hasType()) {
54721        composeCodeableConcept("type", element.getType());
54722      }
54723      if (element.hasIsDefiningElement()) {
54724        composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
54725        composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
54726      }
54727      if (element.hasAmount()) {
54728        composeSubstanceAmount("amount", element.getAmount());
54729      }
54730  }
54731
54732  protected void composeSubstancePolymerSubstancePolymerRepeatComponent(String name, SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
54733    if (element != null) {
54734      open(name);
54735      composeSubstancePolymerSubstancePolymerRepeatComponentInner(element);
54736      close();
54737    }
54738  }
54739
54740  protected void composeSubstancePolymerSubstancePolymerRepeatComponentInner(SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
54741      composeBackbone(element);
54742      if (element.hasNumberOfUnitsElement()) {
54743        composeIntegerCore("numberOfUnits", element.getNumberOfUnitsElement(), false);
54744        composeIntegerExtras("numberOfUnits", element.getNumberOfUnitsElement(), false);
54745      }
54746      if (element.hasAverageMolecularFormulaElement()) {
54747        composeStringCore("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
54748        composeStringExtras("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
54749      }
54750      if (element.hasRepeatUnitAmountType()) {
54751        composeCodeableConcept("repeatUnitAmountType", element.getRepeatUnitAmountType());
54752      }
54753      if (element.hasRepeatUnit()) {
54754        openArray("repeatUnit");
54755        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent e : element.getRepeatUnit()) 
54756          composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(null, e);
54757        closeArray();
54758      };
54759  }
54760
54761  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
54762    if (element != null) {
54763      open(name);
54764      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentInner(element);
54765      close();
54766    }
54767  }
54768
54769  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentInner(SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
54770      composeBackbone(element);
54771      if (element.hasOrientationOfPolymerisation()) {
54772        composeCodeableConcept("orientationOfPolymerisation", element.getOrientationOfPolymerisation());
54773      }
54774      if (element.hasRepeatUnitElement()) {
54775        composeStringCore("repeatUnit", element.getRepeatUnitElement(), false);
54776        composeStringExtras("repeatUnit", element.getRepeatUnitElement(), false);
54777      }
54778      if (element.hasAmount()) {
54779        composeSubstanceAmount("amount", element.getAmount());
54780      }
54781      if (element.hasDegreeOfPolymerisation()) {
54782        openArray("degreeOfPolymerisation");
54783        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent e : element.getDegreeOfPolymerisation()) 
54784          composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(null, e);
54785        closeArray();
54786      };
54787      if (element.hasStructuralRepresentation()) {
54788        openArray("structuralRepresentation");
54789        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent e : element.getStructuralRepresentation()) 
54790          composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(null, e);
54791        closeArray();
54792      };
54793  }
54794
54795  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
54796    if (element != null) {
54797      open(name);
54798      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentInner(element);
54799      close();
54800    }
54801  }
54802
54803  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentInner(SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
54804      composeBackbone(element);
54805      if (element.hasDegree()) {
54806        composeCodeableConcept("degree", element.getDegree());
54807      }
54808      if (element.hasAmount()) {
54809        composeSubstanceAmount("amount", element.getAmount());
54810      }
54811  }
54812
54813  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
54814    if (element != null) {
54815      open(name);
54816      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentInner(element);
54817      close();
54818    }
54819  }
54820
54821  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentInner(SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
54822      composeBackbone(element);
54823      if (element.hasType()) {
54824        composeCodeableConcept("type", element.getType());
54825      }
54826      if (element.hasRepresentationElement()) {
54827        composeStringCore("representation", element.getRepresentationElement(), false);
54828        composeStringExtras("representation", element.getRepresentationElement(), false);
54829      }
54830      if (element.hasAttachment()) {
54831        composeAttachment("attachment", element.getAttachment());
54832      }
54833  }
54834
54835  protected void composeSubstanceProtein(String name, SubstanceProtein element) throws IOException {
54836    if (element != null) {
54837      prop("resourceType", name);
54838      composeSubstanceProteinInner(element);
54839    }
54840  }
54841
54842  protected void composeSubstanceProteinInner(SubstanceProtein element) throws IOException {
54843      composeDomainResourceElements(element);
54844      if (element.hasSequenceType()) {
54845        composeCodeableConcept("sequenceType", element.getSequenceType());
54846      }
54847      if (element.hasNumberOfSubunitsElement()) {
54848        composeIntegerCore("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
54849        composeIntegerExtras("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
54850      }
54851      if (element.hasDisulfideLinkage()) {
54852        openArray("disulfideLinkage");
54853        for (StringType e : element.getDisulfideLinkage()) 
54854          composeStringCore(null, e, true);
54855        closeArray();
54856        if (anyHasExtras(element.getDisulfideLinkage())) {
54857          openArray("_disulfideLinkage");
54858          for (StringType e : element.getDisulfideLinkage()) 
54859            composeStringExtras(null, e, true);
54860          closeArray();
54861        }
54862      };
54863      if (element.hasSubunit()) {
54864        openArray("subunit");
54865        for (SubstanceProtein.SubstanceProteinSubunitComponent e : element.getSubunit()) 
54866          composeSubstanceProteinSubstanceProteinSubunitComponent(null, e);
54867        closeArray();
54868      };
54869  }
54870
54871  protected void composeSubstanceProteinSubstanceProteinSubunitComponent(String name, SubstanceProtein.SubstanceProteinSubunitComponent element) throws IOException {
54872    if (element != null) {
54873      open(name);
54874      composeSubstanceProteinSubstanceProteinSubunitComponentInner(element);
54875      close();
54876    }
54877  }
54878
54879  protected void composeSubstanceProteinSubstanceProteinSubunitComponentInner(SubstanceProtein.SubstanceProteinSubunitComponent element) throws IOException {
54880      composeBackbone(element);
54881      if (element.hasSubunitElement()) {
54882        composeIntegerCore("subunit", element.getSubunitElement(), false);
54883        composeIntegerExtras("subunit", element.getSubunitElement(), false);
54884      }
54885      if (element.hasSequenceElement()) {
54886        composeStringCore("sequence", element.getSequenceElement(), false);
54887        composeStringExtras("sequence", element.getSequenceElement(), false);
54888      }
54889      if (element.hasLengthElement()) {
54890        composeIntegerCore("length", element.getLengthElement(), false);
54891        composeIntegerExtras("length", element.getLengthElement(), false);
54892      }
54893      if (element.hasSequenceAttachment()) {
54894        composeAttachment("sequenceAttachment", element.getSequenceAttachment());
54895      }
54896      if (element.hasNTerminalModificationId()) {
54897        composeIdentifier("nTerminalModificationId", element.getNTerminalModificationId());
54898      }
54899      if (element.hasNTerminalModificationElement()) {
54900        composeStringCore("nTerminalModification", element.getNTerminalModificationElement(), false);
54901        composeStringExtras("nTerminalModification", element.getNTerminalModificationElement(), false);
54902      }
54903      if (element.hasCTerminalModificationId()) {
54904        composeIdentifier("cTerminalModificationId", element.getCTerminalModificationId());
54905      }
54906      if (element.hasCTerminalModificationElement()) {
54907        composeStringCore("cTerminalModification", element.getCTerminalModificationElement(), false);
54908        composeStringExtras("cTerminalModification", element.getCTerminalModificationElement(), false);
54909      }
54910  }
54911
54912  protected void composeSubstanceReferenceInformation(String name, SubstanceReferenceInformation element) throws IOException {
54913    if (element != null) {
54914      prop("resourceType", name);
54915      composeSubstanceReferenceInformationInner(element);
54916    }
54917  }
54918
54919  protected void composeSubstanceReferenceInformationInner(SubstanceReferenceInformation element) throws IOException {
54920      composeDomainResourceElements(element);
54921      if (element.hasCommentElement()) {
54922        composeStringCore("comment", element.getCommentElement(), false);
54923        composeStringExtras("comment", element.getCommentElement(), false);
54924      }
54925      if (element.hasGene()) {
54926        openArray("gene");
54927        for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent e : element.getGene()) 
54928          composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(null, e);
54929        closeArray();
54930      };
54931      if (element.hasGeneElement()) {
54932        openArray("geneElement");
54933        for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent e : element.getGeneElement()) 
54934          composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(null, e);
54935        closeArray();
54936      };
54937      if (element.hasClassification()) {
54938        openArray("classification");
54939        for (SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent e : element.getClassification()) 
54940          composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(null, e);
54941        closeArray();
54942      };
54943      if (element.hasTarget()) {
54944        openArray("target");
54945        for (SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent e : element.getTarget()) 
54946          composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(null, e);
54947        closeArray();
54948      };
54949  }
54950
54951  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
54952    if (element != null) {
54953      open(name);
54954      composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentInner(element);
54955      close();
54956    }
54957  }
54958
54959  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
54960      composeBackbone(element);
54961      if (element.hasGeneSequenceOrigin()) {
54962        composeCodeableConcept("geneSequenceOrigin", element.getGeneSequenceOrigin());
54963      }
54964      if (element.hasGene()) {
54965        composeCodeableConcept("gene", element.getGene());
54966      }
54967      if (element.hasSource()) {
54968        openArray("source");
54969        for (Reference e : element.getSource()) 
54970          composeReference(null, e);
54971        closeArray();
54972      };
54973  }
54974
54975  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
54976    if (element != null) {
54977      open(name);
54978      composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentInner(element);
54979      close();
54980    }
54981  }
54982
54983  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
54984      composeBackbone(element);
54985      if (element.hasType()) {
54986        composeCodeableConcept("type", element.getType());
54987      }
54988      if (element.hasElement()) {
54989        composeIdentifier("element", element.getElement());
54990      }
54991      if (element.hasSource()) {
54992        openArray("source");
54993        for (Reference e : element.getSource()) 
54994          composeReference(null, e);
54995        closeArray();
54996      };
54997  }
54998
54999  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent element) throws IOException {
55000    if (element != null) {
55001      open(name);
55002      composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentInner(element);
55003      close();
55004    }
55005  }
55006
55007  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent element) throws IOException {
55008      composeBackbone(element);
55009      if (element.hasDomain()) {
55010        composeCodeableConcept("domain", element.getDomain());
55011      }
55012      if (element.hasClassification()) {
55013        composeCodeableConcept("classification", element.getClassification());
55014      }
55015      if (element.hasSubtype()) {
55016        openArray("subtype");
55017        for (CodeableConcept e : element.getSubtype()) 
55018          composeCodeableConcept(null, e);
55019        closeArray();
55020      };
55021      if (element.hasSource()) {
55022        openArray("source");
55023        for (Reference e : element.getSource()) 
55024          composeReference(null, e);
55025        closeArray();
55026      };
55027  }
55028
55029  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
55030    if (element != null) {
55031      open(name);
55032      composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentInner(element);
55033      close();
55034    }
55035  }
55036
55037  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
55038      composeBackbone(element);
55039      if (element.hasTarget()) {
55040        composeIdentifier("target", element.getTarget());
55041      }
55042      if (element.hasType()) {
55043        composeCodeableConcept("type", element.getType());
55044      }
55045      if (element.hasInteraction()) {
55046        composeCodeableConcept("interaction", element.getInteraction());
55047      }
55048      if (element.hasOrganism()) {
55049        composeCodeableConcept("organism", element.getOrganism());
55050      }
55051      if (element.hasOrganismType()) {
55052        composeCodeableConcept("organismType", element.getOrganismType());
55053      }
55054      if (element.hasAmount()) {
55055        composeType("amount", element.getAmount());
55056      }
55057      if (element.hasAmountType()) {
55058        composeCodeableConcept("amountType", element.getAmountType());
55059      }
55060      if (element.hasSource()) {
55061        openArray("source");
55062        for (Reference e : element.getSource()) 
55063          composeReference(null, e);
55064        closeArray();
55065      };
55066  }
55067
55068  protected void composeSubstanceSourceMaterial(String name, SubstanceSourceMaterial element) throws IOException {
55069    if (element != null) {
55070      prop("resourceType", name);
55071      composeSubstanceSourceMaterialInner(element);
55072    }
55073  }
55074
55075  protected void composeSubstanceSourceMaterialInner(SubstanceSourceMaterial element) throws IOException {
55076      composeDomainResourceElements(element);
55077      if (element.hasSourceMaterialClass()) {
55078        composeCodeableConcept("sourceMaterialClass", element.getSourceMaterialClass());
55079      }
55080      if (element.hasSourceMaterialType()) {
55081        composeCodeableConcept("sourceMaterialType", element.getSourceMaterialType());
55082      }
55083      if (element.hasSourceMaterialState()) {
55084        composeCodeableConcept("sourceMaterialState", element.getSourceMaterialState());
55085      }
55086      if (element.hasOrganismId()) {
55087        composeIdentifier("organismId", element.getOrganismId());
55088      }
55089      if (element.hasOrganismNameElement()) {
55090        composeStringCore("organismName", element.getOrganismNameElement(), false);
55091        composeStringExtras("organismName", element.getOrganismNameElement(), false);
55092      }
55093      if (element.hasParentSubstanceId()) {
55094        openArray("parentSubstanceId");
55095        for (Identifier e : element.getParentSubstanceId()) 
55096          composeIdentifier(null, e);
55097        closeArray();
55098      };
55099      if (element.hasParentSubstanceName()) {
55100        openArray("parentSubstanceName");
55101        for (StringType e : element.getParentSubstanceName()) 
55102          composeStringCore(null, e, true);
55103        closeArray();
55104        if (anyHasExtras(element.getParentSubstanceName())) {
55105          openArray("_parentSubstanceName");
55106          for (StringType e : element.getParentSubstanceName()) 
55107            composeStringExtras(null, e, true);
55108          closeArray();
55109        }
55110      };
55111      if (element.hasCountryOfOrigin()) {
55112        openArray("countryOfOrigin");
55113        for (CodeableConcept e : element.getCountryOfOrigin()) 
55114          composeCodeableConcept(null, e);
55115        closeArray();
55116      };
55117      if (element.hasGeographicalLocation()) {
55118        openArray("geographicalLocation");
55119        for (StringType e : element.getGeographicalLocation()) 
55120          composeStringCore(null, e, true);
55121        closeArray();
55122        if (anyHasExtras(element.getGeographicalLocation())) {
55123          openArray("_geographicalLocation");
55124          for (StringType e : element.getGeographicalLocation()) 
55125            composeStringExtras(null, e, true);
55126          closeArray();
55127        }
55128      };
55129      if (element.hasDevelopmentStage()) {
55130        composeCodeableConcept("developmentStage", element.getDevelopmentStage());
55131      }
55132      if (element.hasFractionDescription()) {
55133        openArray("fractionDescription");
55134        for (SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent e : element.getFractionDescription()) 
55135          composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(null, e);
55136        closeArray();
55137      };
55138      if (element.hasOrganism()) {
55139        composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent("organism", element.getOrganism());
55140      }
55141      if (element.hasPartDescription()) {
55142        openArray("partDescription");
55143        for (SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent e : element.getPartDescription()) 
55144          composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(null, e);
55145        closeArray();
55146      };
55147  }
55148
55149  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
55150    if (element != null) {
55151      open(name);
55152      composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentInner(element);
55153      close();
55154    }
55155  }
55156
55157  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
55158      composeBackbone(element);
55159      if (element.hasFractionElement()) {
55160        composeStringCore("fraction", element.getFractionElement(), false);
55161        composeStringExtras("fraction", element.getFractionElement(), false);
55162      }
55163      if (element.hasMaterialType()) {
55164        composeCodeableConcept("materialType", element.getMaterialType());
55165      }
55166  }
55167
55168  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent element) throws IOException {
55169    if (element != null) {
55170      open(name);
55171      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentInner(element);
55172      close();
55173    }
55174  }
55175
55176  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent element) throws IOException {
55177      composeBackbone(element);
55178      if (element.hasFamily()) {
55179        composeCodeableConcept("family", element.getFamily());
55180      }
55181      if (element.hasGenus()) {
55182        composeCodeableConcept("genus", element.getGenus());
55183      }
55184      if (element.hasSpecies()) {
55185        composeCodeableConcept("species", element.getSpecies());
55186      }
55187      if (element.hasIntraspecificType()) {
55188        composeCodeableConcept("intraspecificType", element.getIntraspecificType());
55189      }
55190      if (element.hasIntraspecificDescriptionElement()) {
55191        composeStringCore("intraspecificDescription", element.getIntraspecificDescriptionElement(), false);
55192        composeStringExtras("intraspecificDescription", element.getIntraspecificDescriptionElement(), false);
55193      }
55194      if (element.hasAuthor()) {
55195        openArray("author");
55196        for (SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent e : element.getAuthor()) 
55197          composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(null, e);
55198        closeArray();
55199      };
55200      if (element.hasHybrid()) {
55201        composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent("hybrid", element.getHybrid());
55202      }
55203      if (element.hasOrganismGeneral()) {
55204        composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent("organismGeneral", element.getOrganismGeneral());
55205      }
55206  }
55207
55208  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
55209    if (element != null) {
55210      open(name);
55211      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentInner(element);
55212      close();
55213    }
55214  }
55215
55216  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
55217      composeBackbone(element);
55218      if (element.hasAuthorType()) {
55219        composeCodeableConcept("authorType", element.getAuthorType());
55220      }
55221      if (element.hasAuthorDescriptionElement()) {
55222        composeStringCore("authorDescription", element.getAuthorDescriptionElement(), false);
55223        composeStringExtras("authorDescription", element.getAuthorDescriptionElement(), false);
55224      }
55225  }
55226
55227  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent element) throws IOException {
55228    if (element != null) {
55229      open(name);
55230      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentInner(element);
55231      close();
55232    }
55233  }
55234
55235  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent element) throws IOException {
55236      composeBackbone(element);
55237      if (element.hasMaternalOrganismIdElement()) {
55238        composeStringCore("maternalOrganismId", element.getMaternalOrganismIdElement(), false);
55239        composeStringExtras("maternalOrganismId", element.getMaternalOrganismIdElement(), false);
55240      }
55241      if (element.hasMaternalOrganismNameElement()) {
55242        composeStringCore("maternalOrganismName", element.getMaternalOrganismNameElement(), false);
55243        composeStringExtras("maternalOrganismName", element.getMaternalOrganismNameElement(), false);
55244      }
55245      if (element.hasPaternalOrganismIdElement()) {
55246        composeStringCore("paternalOrganismId", element.getPaternalOrganismIdElement(), false);
55247        composeStringExtras("paternalOrganismId", element.getPaternalOrganismIdElement(), false);
55248      }
55249      if (element.hasPaternalOrganismNameElement()) {
55250        composeStringCore("paternalOrganismName", element.getPaternalOrganismNameElement(), false);
55251        composeStringExtras("paternalOrganismName", element.getPaternalOrganismNameElement(), false);
55252      }
55253      if (element.hasHybridType()) {
55254        composeCodeableConcept("hybridType", element.getHybridType());
55255      }
55256  }
55257
55258  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent element) throws IOException {
55259    if (element != null) {
55260      open(name);
55261      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentInner(element);
55262      close();
55263    }
55264  }
55265
55266  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent element) throws IOException {
55267      composeBackbone(element);
55268      if (element.hasKingdom()) {
55269        composeCodeableConcept("kingdom", element.getKingdom());
55270      }
55271      if (element.hasPhylum()) {
55272        composeCodeableConcept("phylum", element.getPhylum());
55273      }
55274      if (element.hasClass_()) {
55275        composeCodeableConcept("class", element.getClass_());
55276      }
55277      if (element.hasOrder()) {
55278        composeCodeableConcept("order", element.getOrder());
55279      }
55280  }
55281
55282  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
55283    if (element != null) {
55284      open(name);
55285      composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentInner(element);
55286      close();
55287    }
55288  }
55289
55290  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
55291      composeBackbone(element);
55292      if (element.hasPart()) {
55293        composeCodeableConcept("part", element.getPart());
55294      }
55295      if (element.hasPartLocation()) {
55296        composeCodeableConcept("partLocation", element.getPartLocation());
55297      }
55298  }
55299
55300  protected void composeSubstanceSpecification(String name, SubstanceSpecification element) throws IOException {
55301    if (element != null) {
55302      prop("resourceType", name);
55303      composeSubstanceSpecificationInner(element);
55304    }
55305  }
55306
55307  protected void composeSubstanceSpecificationInner(SubstanceSpecification element) throws IOException {
55308      composeDomainResourceElements(element);
55309      if (element.hasIdentifier()) {
55310        composeIdentifier("identifier", element.getIdentifier());
55311      }
55312      if (element.hasType()) {
55313        composeCodeableConcept("type", element.getType());
55314      }
55315      if (element.hasStatus()) {
55316        composeCodeableConcept("status", element.getStatus());
55317      }
55318      if (element.hasDomain()) {
55319        composeCodeableConcept("domain", element.getDomain());
55320      }
55321      if (element.hasDescriptionElement()) {
55322        composeStringCore("description", element.getDescriptionElement(), false);
55323        composeStringExtras("description", element.getDescriptionElement(), false);
55324      }
55325      if (element.hasSource()) {
55326        openArray("source");
55327        for (Reference e : element.getSource()) 
55328          composeReference(null, e);
55329        closeArray();
55330      };
55331      if (element.hasCommentElement()) {
55332        composeStringCore("comment", element.getCommentElement(), false);
55333        composeStringExtras("comment", element.getCommentElement(), false);
55334      }
55335      if (element.hasMoiety()) {
55336        openArray("moiety");
55337        for (SubstanceSpecification.SubstanceSpecificationMoietyComponent e : element.getMoiety()) 
55338          composeSubstanceSpecificationSubstanceSpecificationMoietyComponent(null, e);
55339        closeArray();
55340      };
55341      if (element.hasProperty()) {
55342        openArray("property");
55343        for (SubstanceSpecification.SubstanceSpecificationPropertyComponent e : element.getProperty()) 
55344          composeSubstanceSpecificationSubstanceSpecificationPropertyComponent(null, e);
55345        closeArray();
55346      };
55347      if (element.hasReferenceInformation()) {
55348        composeReference("referenceInformation", element.getReferenceInformation());
55349      }
55350      if (element.hasStructure()) {
55351        composeSubstanceSpecificationSubstanceSpecificationStructureComponent("structure", element.getStructure());
55352      }
55353      if (element.hasCode()) {
55354        openArray("code");
55355        for (SubstanceSpecification.SubstanceSpecificationCodeComponent e : element.getCode()) 
55356          composeSubstanceSpecificationSubstanceSpecificationCodeComponent(null, e);
55357        closeArray();
55358      };
55359      if (element.hasName()) {
55360        openArray("name");
55361        for (SubstanceSpecification.SubstanceSpecificationNameComponent e : element.getName()) 
55362          composeSubstanceSpecificationSubstanceSpecificationNameComponent(null, e);
55363        closeArray();
55364      };
55365      if (element.hasMolecularWeight()) {
55366        openArray("molecularWeight");
55367        for (SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent e : element.getMolecularWeight()) 
55368          composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(null, e);
55369        closeArray();
55370      };
55371      if (element.hasRelationship()) {
55372        openArray("relationship");
55373        for (SubstanceSpecification.SubstanceSpecificationRelationshipComponent e : element.getRelationship()) 
55374          composeSubstanceSpecificationSubstanceSpecificationRelationshipComponent(null, e);
55375        closeArray();
55376      };
55377      if (element.hasNucleicAcid()) {
55378        composeReference("nucleicAcid", element.getNucleicAcid());
55379      }
55380      if (element.hasPolymer()) {
55381        composeReference("polymer", element.getPolymer());
55382      }
55383      if (element.hasProtein()) {
55384        composeReference("protein", element.getProtein());
55385      }
55386      if (element.hasSourceMaterial()) {
55387        composeReference("sourceMaterial", element.getSourceMaterial());
55388      }
55389  }
55390
55391  protected void composeSubstanceSpecificationSubstanceSpecificationMoietyComponent(String name, SubstanceSpecification.SubstanceSpecificationMoietyComponent element) throws IOException {
55392    if (element != null) {
55393      open(name);
55394      composeSubstanceSpecificationSubstanceSpecificationMoietyComponentInner(element);
55395      close();
55396    }
55397  }
55398
55399  protected void composeSubstanceSpecificationSubstanceSpecificationMoietyComponentInner(SubstanceSpecification.SubstanceSpecificationMoietyComponent element) throws IOException {
55400      composeBackbone(element);
55401      if (element.hasRole()) {
55402        composeCodeableConcept("role", element.getRole());
55403      }
55404      if (element.hasIdentifier()) {
55405        composeIdentifier("identifier", element.getIdentifier());
55406      }
55407      if (element.hasNameElement()) {
55408        composeStringCore("name", element.getNameElement(), false);
55409        composeStringExtras("name", element.getNameElement(), false);
55410      }
55411      if (element.hasStereochemistry()) {
55412        composeCodeableConcept("stereochemistry", element.getStereochemistry());
55413      }
55414      if (element.hasOpticalActivity()) {
55415        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
55416      }
55417      if (element.hasMolecularFormulaElement()) {
55418        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
55419        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
55420      }
55421      if (element.hasAmount()) {
55422        composeType("amount", element.getAmount());
55423      }
55424  }
55425
55426  protected void composeSubstanceSpecificationSubstanceSpecificationPropertyComponent(String name, SubstanceSpecification.SubstanceSpecificationPropertyComponent element) throws IOException {
55427    if (element != null) {
55428      open(name);
55429      composeSubstanceSpecificationSubstanceSpecificationPropertyComponentInner(element);
55430      close();
55431    }
55432  }
55433
55434  protected void composeSubstanceSpecificationSubstanceSpecificationPropertyComponentInner(SubstanceSpecification.SubstanceSpecificationPropertyComponent element) throws IOException {
55435      composeBackbone(element);
55436      if (element.hasCategory()) {
55437        composeCodeableConcept("category", element.getCategory());
55438      }
55439      if (element.hasCode()) {
55440        composeCodeableConcept("code", element.getCode());
55441      }
55442      if (element.hasParametersElement()) {
55443        composeStringCore("parameters", element.getParametersElement(), false);
55444        composeStringExtras("parameters", element.getParametersElement(), false);
55445      }
55446      if (element.hasDefiningSubstance()) {
55447        composeType("definingSubstance", element.getDefiningSubstance());
55448      }
55449      if (element.hasAmount()) {
55450        composeType("amount", element.getAmount());
55451      }
55452  }
55453
55454  protected void composeSubstanceSpecificationSubstanceSpecificationStructureComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureComponent element) throws IOException {
55455    if (element != null) {
55456      open(name);
55457      composeSubstanceSpecificationSubstanceSpecificationStructureComponentInner(element);
55458      close();
55459    }
55460  }
55461
55462  protected void composeSubstanceSpecificationSubstanceSpecificationStructureComponentInner(SubstanceSpecification.SubstanceSpecificationStructureComponent element) throws IOException {
55463      composeBackbone(element);
55464      if (element.hasStereochemistry()) {
55465        composeCodeableConcept("stereochemistry", element.getStereochemistry());
55466      }
55467      if (element.hasOpticalActivity()) {
55468        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
55469      }
55470      if (element.hasMolecularFormulaElement()) {
55471        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
55472        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
55473      }
55474      if (element.hasMolecularFormulaByMoietyElement()) {
55475        composeStringCore("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
55476        composeStringExtras("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
55477      }
55478      if (element.hasIsotope()) {
55479        openArray("isotope");
55480        for (SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent e : element.getIsotope()) 
55481          composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(null, e);
55482        closeArray();
55483      };
55484      if (element.hasMolecularWeight()) {
55485        composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent("molecularWeight", element.getMolecularWeight());
55486      }
55487      if (element.hasSource()) {
55488        openArray("source");
55489        for (Reference e : element.getSource()) 
55490          composeReference(null, e);
55491        closeArray();
55492      };
55493      if (element.hasRepresentation()) {
55494        openArray("representation");
55495        for (SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent e : element.getRepresentation()) 
55496          composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(null, e);
55497        closeArray();
55498      };
55499  }
55500
55501  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent element) throws IOException {
55502    if (element != null) {
55503      open(name);
55504      composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentInner(element);
55505      close();
55506    }
55507  }
55508
55509  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentInner(SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent element) throws IOException {
55510      composeBackbone(element);
55511      if (element.hasIdentifier()) {
55512        composeIdentifier("identifier", element.getIdentifier());
55513      }
55514      if (element.hasName()) {
55515        composeCodeableConcept("name", element.getName());
55516      }
55517      if (element.hasSubstitution()) {
55518        composeCodeableConcept("substitution", element.getSubstitution());
55519      }
55520      if (element.hasHalfLife()) {
55521        composeQuantity("halfLife", element.getHalfLife());
55522      }
55523      if (element.hasMolecularWeight()) {
55524        composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent("molecularWeight", element.getMolecularWeight());
55525      }
55526  }
55527
55528  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent element) throws IOException {
55529    if (element != null) {
55530      open(name);
55531      composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentInner(element);
55532      close();
55533    }
55534  }
55535
55536  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentInner(SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent element) throws IOException {
55537      composeBackbone(element);
55538      if (element.hasMethod()) {
55539        composeCodeableConcept("method", element.getMethod());
55540      }
55541      if (element.hasType()) {
55542        composeCodeableConcept("type", element.getType());
55543      }
55544      if (element.hasAmount()) {
55545        composeQuantity("amount", element.getAmount());
55546      }
55547  }
55548
55549  protected void composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent element) throws IOException {
55550    if (element != null) {
55551      open(name);
55552      composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentInner(element);
55553      close();
55554    }
55555  }
55556
55557  protected void composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentInner(SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent element) throws IOException {
55558      composeBackbone(element);
55559      if (element.hasType()) {
55560        composeCodeableConcept("type", element.getType());
55561      }
55562      if (element.hasRepresentationElement()) {
55563        composeStringCore("representation", element.getRepresentationElement(), false);
55564        composeStringExtras("representation", element.getRepresentationElement(), false);
55565      }
55566      if (element.hasAttachment()) {
55567        composeAttachment("attachment", element.getAttachment());
55568      }
55569  }
55570
55571  protected void composeSubstanceSpecificationSubstanceSpecificationCodeComponent(String name, SubstanceSpecification.SubstanceSpecificationCodeComponent element) throws IOException {
55572    if (element != null) {
55573      open(name);
55574      composeSubstanceSpecificationSubstanceSpecificationCodeComponentInner(element);
55575      close();
55576    }
55577  }
55578
55579  protected void composeSubstanceSpecificationSubstanceSpecificationCodeComponentInner(SubstanceSpecification.SubstanceSpecificationCodeComponent element) throws IOException {
55580      composeBackbone(element);
55581      if (element.hasCode()) {
55582        composeCodeableConcept("code", element.getCode());
55583      }
55584      if (element.hasStatus()) {
55585        composeCodeableConcept("status", element.getStatus());
55586      }
55587      if (element.hasStatusDateElement()) {
55588        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
55589        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
55590      }
55591      if (element.hasCommentElement()) {
55592        composeStringCore("comment", element.getCommentElement(), false);
55593        composeStringExtras("comment", element.getCommentElement(), false);
55594      }
55595      if (element.hasSource()) {
55596        openArray("source");
55597        for (Reference e : element.getSource()) 
55598          composeReference(null, e);
55599        closeArray();
55600      };
55601  }
55602
55603  protected void composeSubstanceSpecificationSubstanceSpecificationNameComponent(String name, SubstanceSpecification.SubstanceSpecificationNameComponent element) throws IOException {
55604    if (element != null) {
55605      open(name);
55606      composeSubstanceSpecificationSubstanceSpecificationNameComponentInner(element);
55607      close();
55608    }
55609  }
55610
55611  protected void composeSubstanceSpecificationSubstanceSpecificationNameComponentInner(SubstanceSpecification.SubstanceSpecificationNameComponent element) throws IOException {
55612      composeBackbone(element);
55613      if (element.hasNameElement()) {
55614        composeStringCore("name", element.getNameElement(), false);
55615        composeStringExtras("name", element.getNameElement(), false);
55616      }
55617      if (element.hasType()) {
55618        composeCodeableConcept("type", element.getType());
55619      }
55620      if (element.hasStatus()) {
55621        composeCodeableConcept("status", element.getStatus());
55622      }
55623      if (element.hasPreferredElement()) {
55624        composeBooleanCore("preferred", element.getPreferredElement(), false);
55625        composeBooleanExtras("preferred", element.getPreferredElement(), false);
55626      }
55627      if (element.hasLanguage()) {
55628        openArray("language");
55629        for (CodeableConcept e : element.getLanguage()) 
55630          composeCodeableConcept(null, e);
55631        closeArray();
55632      };
55633      if (element.hasDomain()) {
55634        openArray("domain");
55635        for (CodeableConcept e : element.getDomain()) 
55636          composeCodeableConcept(null, e);
55637        closeArray();
55638      };
55639      if (element.hasJurisdiction()) {
55640        openArray("jurisdiction");
55641        for (CodeableConcept e : element.getJurisdiction()) 
55642          composeCodeableConcept(null, e);
55643        closeArray();
55644      };
55645      if (element.hasSynonym()) {
55646        openArray("synonym");
55647        for (SubstanceSpecification.SubstanceSpecificationNameComponent e : element.getSynonym()) 
55648          composeSubstanceSpecificationSubstanceSpecificationNameComponent(null, e);
55649        closeArray();
55650      };
55651      if (element.hasTranslation()) {
55652        openArray("translation");
55653        for (SubstanceSpecification.SubstanceSpecificationNameComponent e : element.getTranslation()) 
55654          composeSubstanceSpecificationSubstanceSpecificationNameComponent(null, e);
55655        closeArray();
55656      };
55657      if (element.hasOfficial()) {
55658        openArray("official");
55659        for (SubstanceSpecification.SubstanceSpecificationNameOfficialComponent e : element.getOfficial()) 
55660          composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(null, e);
55661        closeArray();
55662      };
55663      if (element.hasSource()) {
55664        openArray("source");
55665        for (Reference e : element.getSource()) 
55666          composeReference(null, e);
55667        closeArray();
55668      };
55669  }
55670
55671  protected void composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(String name, SubstanceSpecification.SubstanceSpecificationNameOfficialComponent element) throws IOException {
55672    if (element != null) {
55673      open(name);
55674      composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponentInner(element);
55675      close();
55676    }
55677  }
55678
55679  protected void composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponentInner(SubstanceSpecification.SubstanceSpecificationNameOfficialComponent element) throws IOException {
55680      composeBackbone(element);
55681      if (element.hasAuthority()) {
55682        composeCodeableConcept("authority", element.getAuthority());
55683      }
55684      if (element.hasStatus()) {
55685        composeCodeableConcept("status", element.getStatus());
55686      }
55687      if (element.hasDateElement()) {
55688        composeDateTimeCore("date", element.getDateElement(), false);
55689        composeDateTimeExtras("date", element.getDateElement(), false);
55690      }
55691  }
55692
55693  protected void composeSubstanceSpecificationSubstanceSpecificationRelationshipComponent(String name, SubstanceSpecification.SubstanceSpecificationRelationshipComponent element) throws IOException {
55694    if (element != null) {
55695      open(name);
55696      composeSubstanceSpecificationSubstanceSpecificationRelationshipComponentInner(element);
55697      close();
55698    }
55699  }
55700
55701  protected void composeSubstanceSpecificationSubstanceSpecificationRelationshipComponentInner(SubstanceSpecification.SubstanceSpecificationRelationshipComponent element) throws IOException {
55702      composeBackbone(element);
55703      if (element.hasSubstance()) {
55704        composeType("substance", element.getSubstance());
55705      }
55706      if (element.hasRelationship()) {
55707        composeCodeableConcept("relationship", element.getRelationship());
55708      }
55709      if (element.hasIsDefiningElement()) {
55710        composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
55711        composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
55712      }
55713      if (element.hasAmount()) {
55714        composeType("amount", element.getAmount());
55715      }
55716      if (element.hasAmountRatioLowLimit()) {
55717        composeRatio("amountRatioLowLimit", element.getAmountRatioLowLimit());
55718      }
55719      if (element.hasAmountType()) {
55720        composeCodeableConcept("amountType", element.getAmountType());
55721      }
55722      if (element.hasSource()) {
55723        openArray("source");
55724        for (Reference e : element.getSource()) 
55725          composeReference(null, e);
55726        closeArray();
55727      };
55728  }
55729
55730  protected void composeSupplyDelivery(String name, SupplyDelivery element) throws IOException {
55731    if (element != null) {
55732      prop("resourceType", name);
55733      composeSupplyDeliveryInner(element);
55734    }
55735  }
55736
55737  protected void composeSupplyDeliveryInner(SupplyDelivery element) throws IOException {
55738      composeDomainResourceElements(element);
55739      if (element.hasIdentifier()) {
55740        openArray("identifier");
55741        for (Identifier e : element.getIdentifier()) 
55742          composeIdentifier(null, e);
55743        closeArray();
55744      };
55745      if (element.hasBasedOn()) {
55746        openArray("basedOn");
55747        for (Reference e : element.getBasedOn()) 
55748          composeReference(null, e);
55749        closeArray();
55750      };
55751      if (element.hasPartOf()) {
55752        openArray("partOf");
55753        for (Reference e : element.getPartOf()) 
55754          composeReference(null, e);
55755        closeArray();
55756      };
55757      if (element.hasStatusElement()) {
55758        composeEnumerationCore("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
55759        composeEnumerationExtras("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
55760      }
55761      if (element.hasPatient()) {
55762        composeReference("patient", element.getPatient());
55763      }
55764      if (element.hasType()) {
55765        composeCodeableConcept("type", element.getType());
55766      }
55767      if (element.hasSuppliedItem()) {
55768        composeSupplyDeliverySupplyDeliverySuppliedItemComponent("suppliedItem", element.getSuppliedItem());
55769      }
55770      if (element.hasOccurrence()) {
55771        composeType("occurrence", element.getOccurrence());
55772      }
55773      if (element.hasSupplier()) {
55774        composeReference("supplier", element.getSupplier());
55775      }
55776      if (element.hasDestination()) {
55777        composeReference("destination", element.getDestination());
55778      }
55779      if (element.hasReceiver()) {
55780        openArray("receiver");
55781        for (Reference e : element.getReceiver()) 
55782          composeReference(null, e);
55783        closeArray();
55784      };
55785  }
55786
55787  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponent(String name, SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
55788    if (element != null) {
55789      open(name);
55790      composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(element);
55791      close();
55792    }
55793  }
55794
55795  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
55796      composeBackbone(element);
55797      if (element.hasQuantity()) {
55798        composeQuantity("quantity", element.getQuantity());
55799      }
55800      if (element.hasItem()) {
55801        composeType("item", element.getItem());
55802      }
55803  }
55804
55805  protected void composeSupplyRequest(String name, SupplyRequest element) throws IOException {
55806    if (element != null) {
55807      prop("resourceType", name);
55808      composeSupplyRequestInner(element);
55809    }
55810  }
55811
55812  protected void composeSupplyRequestInner(SupplyRequest element) throws IOException {
55813      composeDomainResourceElements(element);
55814      if (element.hasIdentifier()) {
55815        openArray("identifier");
55816        for (Identifier e : element.getIdentifier()) 
55817          composeIdentifier(null, e);
55818        closeArray();
55819      };
55820      if (element.hasStatusElement()) {
55821        composeEnumerationCore("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
55822        composeEnumerationExtras("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
55823      }
55824      if (element.hasCategory()) {
55825        composeCodeableConcept("category", element.getCategory());
55826      }
55827      if (element.hasPriorityElement()) {
55828        composeEnumerationCore("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(), false);
55829        composeEnumerationExtras("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(), false);
55830      }
55831      if (element.hasItem()) {
55832        composeType("item", element.getItem());
55833      }
55834      if (element.hasQuantity()) {
55835        composeQuantity("quantity", element.getQuantity());
55836      }
55837      if (element.hasParameter()) {
55838        openArray("parameter");
55839        for (SupplyRequest.SupplyRequestParameterComponent e : element.getParameter()) 
55840          composeSupplyRequestSupplyRequestParameterComponent(null, e);
55841        closeArray();
55842      };
55843      if (element.hasOccurrence()) {
55844        composeType("occurrence", element.getOccurrence());
55845      }
55846      if (element.hasAuthoredOnElement()) {
55847        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
55848        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
55849      }
55850      if (element.hasRequester()) {
55851        composeReference("requester", element.getRequester());
55852      }
55853      if (element.hasSupplier()) {
55854        openArray("supplier");
55855        for (Reference e : element.getSupplier()) 
55856          composeReference(null, e);
55857        closeArray();
55858      };
55859      if (element.hasReasonCode()) {
55860        openArray("reasonCode");
55861        for (CodeableConcept e : element.getReasonCode()) 
55862          composeCodeableConcept(null, e);
55863        closeArray();
55864      };
55865      if (element.hasReasonReference()) {
55866        openArray("reasonReference");
55867        for (Reference e : element.getReasonReference()) 
55868          composeReference(null, e);
55869        closeArray();
55870      };
55871      if (element.hasDeliverFrom()) {
55872        composeReference("deliverFrom", element.getDeliverFrom());
55873      }
55874      if (element.hasDeliverTo()) {
55875        composeReference("deliverTo", element.getDeliverTo());
55876      }
55877  }
55878
55879  protected void composeSupplyRequestSupplyRequestParameterComponent(String name, SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
55880    if (element != null) {
55881      open(name);
55882      composeSupplyRequestSupplyRequestParameterComponentInner(element);
55883      close();
55884    }
55885  }
55886
55887  protected void composeSupplyRequestSupplyRequestParameterComponentInner(SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
55888      composeBackbone(element);
55889      if (element.hasCode()) {
55890        composeCodeableConcept("code", element.getCode());
55891      }
55892      if (element.hasValue()) {
55893        composeType("value", element.getValue());
55894      }
55895  }
55896
55897  protected void composeTask(String name, Task element) throws IOException {
55898    if (element != null) {
55899      prop("resourceType", name);
55900      composeTaskInner(element);
55901    }
55902  }
55903
55904  protected void composeTaskInner(Task element) throws IOException {
55905      composeDomainResourceElements(element);
55906      if (element.hasIdentifier()) {
55907        openArray("identifier");
55908        for (Identifier e : element.getIdentifier()) 
55909          composeIdentifier(null, e);
55910        closeArray();
55911      };
55912      if (element.hasInstantiatesCanonicalElement()) {
55913        composeCanonicalCore("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
55914        composeCanonicalExtras("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
55915      }
55916      if (element.hasInstantiatesUriElement()) {
55917        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
55918        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
55919      }
55920      if (element.hasBasedOn()) {
55921        openArray("basedOn");
55922        for (Reference e : element.getBasedOn()) 
55923          composeReference(null, e);
55924        closeArray();
55925      };
55926      if (element.hasGroupIdentifier()) {
55927        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
55928      }
55929      if (element.hasPartOf()) {
55930        openArray("partOf");
55931        for (Reference e : element.getPartOf()) 
55932          composeReference(null, e);
55933        closeArray();
55934      };
55935      if (element.hasStatusElement()) {
55936        composeEnumerationCore("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
55937        composeEnumerationExtras("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
55938      }
55939      if (element.hasStatusReason()) {
55940        composeCodeableConcept("statusReason", element.getStatusReason());
55941      }
55942      if (element.hasBusinessStatus()) {
55943        composeCodeableConcept("businessStatus", element.getBusinessStatus());
55944      }
55945      if (element.hasIntentElement()) {
55946        composeEnumerationCore("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
55947        composeEnumerationExtras("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
55948      }
55949      if (element.hasPriorityElement()) {
55950        composeEnumerationCore("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
55951        composeEnumerationExtras("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
55952      }
55953      if (element.hasCode()) {
55954        composeCodeableConcept("code", element.getCode());
55955      }
55956      if (element.hasDescriptionElement()) {
55957        composeStringCore("description", element.getDescriptionElement(), false);
55958        composeStringExtras("description", element.getDescriptionElement(), false);
55959      }
55960      if (element.hasFocus()) {
55961        composeReference("focus", element.getFocus());
55962      }
55963      if (element.hasFor()) {
55964        composeReference("for", element.getFor());
55965      }
55966      if (element.hasEncounter()) {
55967        composeReference("encounter", element.getEncounter());
55968      }
55969      if (element.hasExecutionPeriod()) {
55970        composePeriod("executionPeriod", element.getExecutionPeriod());
55971      }
55972      if (element.hasAuthoredOnElement()) {
55973        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
55974        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
55975      }
55976      if (element.hasLastModifiedElement()) {
55977        composeDateTimeCore("lastModified", element.getLastModifiedElement(), false);
55978        composeDateTimeExtras("lastModified", element.getLastModifiedElement(), false);
55979      }
55980      if (element.hasRequester()) {
55981        composeReference("requester", element.getRequester());
55982      }
55983      if (element.hasPerformerType()) {
55984        openArray("performerType");
55985        for (CodeableConcept e : element.getPerformerType()) 
55986          composeCodeableConcept(null, e);
55987        closeArray();
55988      };
55989      if (element.hasOwner()) {
55990        composeReference("owner", element.getOwner());
55991      }
55992      if (element.hasLocation()) {
55993        composeReference("location", element.getLocation());
55994      }
55995      if (element.hasReasonCode()) {
55996        composeCodeableConcept("reasonCode", element.getReasonCode());
55997      }
55998      if (element.hasReasonReference()) {
55999        composeReference("reasonReference", element.getReasonReference());
56000      }
56001      if (element.hasInsurance()) {
56002        openArray("insurance");
56003        for (Reference e : element.getInsurance()) 
56004          composeReference(null, e);
56005        closeArray();
56006      };
56007      if (element.hasNote()) {
56008        openArray("note");
56009        for (Annotation e : element.getNote()) 
56010          composeAnnotation(null, e);
56011        closeArray();
56012      };
56013      if (element.hasRelevantHistory()) {
56014        openArray("relevantHistory");
56015        for (Reference e : element.getRelevantHistory()) 
56016          composeReference(null, e);
56017        closeArray();
56018      };
56019      if (element.hasRestriction()) {
56020        composeTaskTaskRestrictionComponent("restriction", element.getRestriction());
56021      }
56022      if (element.hasInput()) {
56023        openArray("input");
56024        for (Task.ParameterComponent e : element.getInput()) 
56025          composeTaskParameterComponent(null, e);
56026        closeArray();
56027      };
56028      if (element.hasOutput()) {
56029        openArray("output");
56030        for (Task.TaskOutputComponent e : element.getOutput()) 
56031          composeTaskTaskOutputComponent(null, e);
56032        closeArray();
56033      };
56034  }
56035
56036  protected void composeTaskTaskRestrictionComponent(String name, Task.TaskRestrictionComponent element) throws IOException {
56037    if (element != null) {
56038      open(name);
56039      composeTaskTaskRestrictionComponentInner(element);
56040      close();
56041    }
56042  }
56043
56044  protected void composeTaskTaskRestrictionComponentInner(Task.TaskRestrictionComponent element) throws IOException {
56045      composeBackbone(element);
56046      if (element.hasRepetitionsElement()) {
56047        composePositiveIntCore("repetitions", element.getRepetitionsElement(), false);
56048        composePositiveIntExtras("repetitions", element.getRepetitionsElement(), false);
56049      }
56050      if (element.hasPeriod()) {
56051        composePeriod("period", element.getPeriod());
56052      }
56053      if (element.hasRecipient()) {
56054        openArray("recipient");
56055        for (Reference e : element.getRecipient()) 
56056          composeReference(null, e);
56057        closeArray();
56058      };
56059  }
56060
56061  protected void composeTaskParameterComponent(String name, Task.ParameterComponent element) throws IOException {
56062    if (element != null) {
56063      open(name);
56064      composeTaskParameterComponentInner(element);
56065      close();
56066    }
56067  }
56068
56069  protected void composeTaskParameterComponentInner(Task.ParameterComponent element) throws IOException {
56070      composeBackbone(element);
56071      if (element.hasType()) {
56072        composeCodeableConcept("type", element.getType());
56073      }
56074      if (element.hasValue()) {
56075        composeType("value", element.getValue());
56076      }
56077  }
56078
56079  protected void composeTaskTaskOutputComponent(String name, Task.TaskOutputComponent element) throws IOException {
56080    if (element != null) {
56081      open(name);
56082      composeTaskTaskOutputComponentInner(element);
56083      close();
56084    }
56085  }
56086
56087  protected void composeTaskTaskOutputComponentInner(Task.TaskOutputComponent element) throws IOException {
56088      composeBackbone(element);
56089      if (element.hasType()) {
56090        composeCodeableConcept("type", element.getType());
56091      }
56092      if (element.hasValue()) {
56093        composeType("value", element.getValue());
56094      }
56095  }
56096
56097  protected void composeTerminologyCapabilities(String name, TerminologyCapabilities element) throws IOException {
56098    if (element != null) {
56099      prop("resourceType", name);
56100      composeTerminologyCapabilitiesInner(element);
56101    }
56102  }
56103
56104  protected void composeTerminologyCapabilitiesInner(TerminologyCapabilities element) throws IOException {
56105      composeDomainResourceElements(element);
56106      if (element.hasUrlElement()) {
56107        composeUriCore("url", element.getUrlElement(), false);
56108        composeUriExtras("url", element.getUrlElement(), false);
56109      }
56110      if (element.hasVersionElement()) {
56111        composeStringCore("version", element.getVersionElement(), false);
56112        composeStringExtras("version", element.getVersionElement(), false);
56113      }
56114      if (element.hasNameElement()) {
56115        composeStringCore("name", element.getNameElement(), false);
56116        composeStringExtras("name", element.getNameElement(), false);
56117      }
56118      if (element.hasTitleElement()) {
56119        composeStringCore("title", element.getTitleElement(), false);
56120        composeStringExtras("title", element.getTitleElement(), false);
56121      }
56122      if (element.hasStatusElement()) {
56123        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56124        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56125      }
56126      if (element.hasExperimentalElement()) {
56127        composeBooleanCore("experimental", element.getExperimentalElement(), false);
56128        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
56129      }
56130      if (element.hasDateElement()) {
56131        composeDateTimeCore("date", element.getDateElement(), false);
56132        composeDateTimeExtras("date", element.getDateElement(), false);
56133      }
56134      if (element.hasPublisherElement()) {
56135        composeStringCore("publisher", element.getPublisherElement(), false);
56136        composeStringExtras("publisher", element.getPublisherElement(), false);
56137      }
56138      if (element.hasContact()) {
56139        openArray("contact");
56140        for (ContactDetail e : element.getContact()) 
56141          composeContactDetail(null, e);
56142        closeArray();
56143      };
56144      if (element.hasDescriptionElement()) {
56145        composeMarkdownCore("description", element.getDescriptionElement(), false);
56146        composeMarkdownExtras("description", element.getDescriptionElement(), false);
56147      }
56148      if (element.hasUseContext()) {
56149        openArray("useContext");
56150        for (UsageContext e : element.getUseContext()) 
56151          composeUsageContext(null, e);
56152        closeArray();
56153      };
56154      if (element.hasJurisdiction()) {
56155        openArray("jurisdiction");
56156        for (CodeableConcept e : element.getJurisdiction()) 
56157          composeCodeableConcept(null, e);
56158        closeArray();
56159      };
56160      if (element.hasPurposeElement()) {
56161        composeMarkdownCore("purpose", element.getPurposeElement(), false);
56162        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
56163      }
56164      if (element.hasCopyrightElement()) {
56165        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
56166        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
56167      }
56168      if (element.hasKindElement()) {
56169        composeEnumerationCore("kind", element.getKindElement(), new TerminologyCapabilities.CapabilityStatementKindEnumFactory(), false);
56170        composeEnumerationExtras("kind", element.getKindElement(), new TerminologyCapabilities.CapabilityStatementKindEnumFactory(), false);
56171      }
56172      if (element.hasSoftware()) {
56173        composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent("software", element.getSoftware());
56174      }
56175      if (element.hasImplementation()) {
56176        composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent("implementation", element.getImplementation());
56177      }
56178      if (element.hasLockedDateElement()) {
56179        composeBooleanCore("lockedDate", element.getLockedDateElement(), false);
56180        composeBooleanExtras("lockedDate", element.getLockedDateElement(), false);
56181      }
56182      if (element.hasCodeSystem()) {
56183        openArray("codeSystem");
56184        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent e : element.getCodeSystem()) 
56185          composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(null, e);
56186        closeArray();
56187      };
56188      if (element.hasExpansion()) {
56189        composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent("expansion", element.getExpansion());
56190      }
56191      if (element.hasCodeSearchElement()) {
56192        composeEnumerationCore("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
56193        composeEnumerationExtras("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
56194      }
56195      if (element.hasValidateCode()) {
56196        composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent("validateCode", element.getValidateCode());
56197      }
56198      if (element.hasTranslation()) {
56199        composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent("translation", element.getTranslation());
56200      }
56201      if (element.hasClosure()) {
56202        composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent("closure", element.getClosure());
56203      }
56204  }
56205
56206  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
56207    if (element != null) {
56208      open(name);
56209      composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentInner(element);
56210      close();
56211    }
56212  }
56213
56214  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentInner(TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
56215      composeBackbone(element);
56216      if (element.hasNameElement()) {
56217        composeStringCore("name", element.getNameElement(), false);
56218        composeStringExtras("name", element.getNameElement(), false);
56219      }
56220      if (element.hasVersionElement()) {
56221        composeStringCore("version", element.getVersionElement(), false);
56222        composeStringExtras("version", element.getVersionElement(), false);
56223      }
56224  }
56225
56226  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
56227    if (element != null) {
56228      open(name);
56229      composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentInner(element);
56230      close();
56231    }
56232  }
56233
56234  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentInner(TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
56235      composeBackbone(element);
56236      if (element.hasDescriptionElement()) {
56237        composeStringCore("description", element.getDescriptionElement(), false);
56238        composeStringExtras("description", element.getDescriptionElement(), false);
56239      }
56240      if (element.hasUrlElement()) {
56241        composeUrlCore("url", element.getUrlElement(), false);
56242        composeUrlExtras("url", element.getUrlElement(), false);
56243      }
56244  }
56245
56246  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
56247    if (element != null) {
56248      open(name);
56249      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentInner(element);
56250      close();
56251    }
56252  }
56253
56254  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentInner(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
56255      composeBackbone(element);
56256      if (element.hasUriElement()) {
56257        composeCanonicalCore("uri", element.getUriElement(), false);
56258        composeCanonicalExtras("uri", element.getUriElement(), false);
56259      }
56260      if (element.hasVersion()) {
56261        openArray("version");
56262        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent e : element.getVersion()) 
56263          composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(null, e);
56264        closeArray();
56265      };
56266      if (element.hasSubsumptionElement()) {
56267        composeBooleanCore("subsumption", element.getSubsumptionElement(), false);
56268        composeBooleanExtras("subsumption", element.getSubsumptionElement(), false);
56269      }
56270  }
56271
56272  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
56273    if (element != null) {
56274      open(name);
56275      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentInner(element);
56276      close();
56277    }
56278  }
56279
56280  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentInner(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
56281      composeBackbone(element);
56282      if (element.hasCodeElement()) {
56283        composeStringCore("code", element.getCodeElement(), false);
56284        composeStringExtras("code", element.getCodeElement(), false);
56285      }
56286      if (element.hasIsDefaultElement()) {
56287        composeBooleanCore("isDefault", element.getIsDefaultElement(), false);
56288        composeBooleanExtras("isDefault", element.getIsDefaultElement(), false);
56289      }
56290      if (element.hasCompositionalElement()) {
56291        composeBooleanCore("compositional", element.getCompositionalElement(), false);
56292        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
56293      }
56294      if (element.hasLanguage()) {
56295        openArray("language");
56296        for (CodeType e : element.getLanguage()) 
56297          composeCodeCore(null, e, true);
56298        closeArray();
56299        if (anyHasExtras(element.getLanguage())) {
56300          openArray("_language");
56301          for (CodeType e : element.getLanguage()) 
56302            composeCodeExtras(null, e, true);
56303          closeArray();
56304        }
56305      };
56306      if (element.hasFilter()) {
56307        openArray("filter");
56308        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent e : element.getFilter()) 
56309          composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(null, e);
56310        closeArray();
56311      };
56312      if (element.hasProperty()) {
56313        openArray("property");
56314        for (CodeType e : element.getProperty()) 
56315          composeCodeCore(null, e, true);
56316        closeArray();
56317        if (anyHasExtras(element.getProperty())) {
56318          openArray("_property");
56319          for (CodeType e : element.getProperty()) 
56320            composeCodeExtras(null, e, true);
56321          closeArray();
56322        }
56323      };
56324  }
56325
56326  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
56327    if (element != null) {
56328      open(name);
56329      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentInner(element);
56330      close();
56331    }
56332  }
56333
56334  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentInner(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
56335      composeBackbone(element);
56336      if (element.hasCodeElement()) {
56337        composeCodeCore("code", element.getCodeElement(), false);
56338        composeCodeExtras("code", element.getCodeElement(), false);
56339      }
56340      if (element.hasOp()) {
56341        openArray("op");
56342        for (CodeType e : element.getOp()) 
56343          composeCodeCore(null, e, true);
56344        closeArray();
56345        if (anyHasExtras(element.getOp())) {
56346          openArray("_op");
56347          for (CodeType e : element.getOp()) 
56348            composeCodeExtras(null, e, true);
56349          closeArray();
56350        }
56351      };
56352  }
56353
56354  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
56355    if (element != null) {
56356      open(name);
56357      composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentInner(element);
56358      close();
56359    }
56360  }
56361
56362  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentInner(TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
56363      composeBackbone(element);
56364      if (element.hasHierarchicalElement()) {
56365        composeBooleanCore("hierarchical", element.getHierarchicalElement(), false);
56366        composeBooleanExtras("hierarchical", element.getHierarchicalElement(), false);
56367      }
56368      if (element.hasPagingElement()) {
56369        composeBooleanCore("paging", element.getPagingElement(), false);
56370        composeBooleanExtras("paging", element.getPagingElement(), false);
56371      }
56372      if (element.hasIncompleteElement()) {
56373        composeBooleanCore("incomplete", element.getIncompleteElement(), false);
56374        composeBooleanExtras("incomplete", element.getIncompleteElement(), false);
56375      }
56376      if (element.hasParameter()) {
56377        openArray("parameter");
56378        for (TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent e : element.getParameter()) 
56379          composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(null, e);
56380        closeArray();
56381      };
56382      if (element.hasTextFilterElement()) {
56383        composeMarkdownCore("textFilter", element.getTextFilterElement(), false);
56384        composeMarkdownExtras("textFilter", element.getTextFilterElement(), false);
56385      }
56386  }
56387
56388  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
56389    if (element != null) {
56390      open(name);
56391      composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentInner(element);
56392      close();
56393    }
56394  }
56395
56396  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentInner(TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
56397      composeBackbone(element);
56398      if (element.hasNameElement()) {
56399        composeCodeCore("name", element.getNameElement(), false);
56400        composeCodeExtras("name", element.getNameElement(), false);
56401      }
56402      if (element.hasDocumentationElement()) {
56403        composeStringCore("documentation", element.getDocumentationElement(), false);
56404        composeStringExtras("documentation", element.getDocumentationElement(), false);
56405      }
56406  }
56407
56408  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
56409    if (element != null) {
56410      open(name);
56411      composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentInner(element);
56412      close();
56413    }
56414  }
56415
56416  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentInner(TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
56417      composeBackbone(element);
56418      if (element.hasTranslationsElement()) {
56419        composeBooleanCore("translations", element.getTranslationsElement(), false);
56420        composeBooleanExtras("translations", element.getTranslationsElement(), false);
56421      }
56422  }
56423
56424  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
56425    if (element != null) {
56426      open(name);
56427      composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentInner(element);
56428      close();
56429    }
56430  }
56431
56432  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentInner(TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
56433      composeBackbone(element);
56434      if (element.hasNeedsMapElement()) {
56435        composeBooleanCore("needsMap", element.getNeedsMapElement(), false);
56436        composeBooleanExtras("needsMap", element.getNeedsMapElement(), false);
56437      }
56438  }
56439
56440  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
56441    if (element != null) {
56442      open(name);
56443      composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentInner(element);
56444      close();
56445    }
56446  }
56447
56448  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentInner(TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
56449      composeBackbone(element);
56450      if (element.hasTranslationElement()) {
56451        composeBooleanCore("translation", element.getTranslationElement(), false);
56452        composeBooleanExtras("translation", element.getTranslationElement(), false);
56453      }
56454  }
56455
56456  protected void composeTestReport(String name, TestReport element) throws IOException {
56457    if (element != null) {
56458      prop("resourceType", name);
56459      composeTestReportInner(element);
56460    }
56461  }
56462
56463  protected void composeTestReportInner(TestReport element) throws IOException {
56464      composeDomainResourceElements(element);
56465      if (element.hasIdentifier()) {
56466        composeIdentifier("identifier", element.getIdentifier());
56467      }
56468      if (element.hasNameElement()) {
56469        composeStringCore("name", element.getNameElement(), false);
56470        composeStringExtras("name", element.getNameElement(), false);
56471      }
56472      if (element.hasStatusElement()) {
56473        composeEnumerationCore("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
56474        composeEnumerationExtras("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
56475      }
56476      if (element.hasTestScript()) {
56477        composeReference("testScript", element.getTestScript());
56478      }
56479      if (element.hasResultElement()) {
56480        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
56481        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
56482      }
56483      if (element.hasScoreElement()) {
56484        composeDecimalCore("score", element.getScoreElement(), false);
56485        composeDecimalExtras("score", element.getScoreElement(), false);
56486      }
56487      if (element.hasTesterElement()) {
56488        composeStringCore("tester", element.getTesterElement(), false);
56489        composeStringExtras("tester", element.getTesterElement(), false);
56490      }
56491      if (element.hasIssuedElement()) {
56492        composeDateTimeCore("issued", element.getIssuedElement(), false);
56493        composeDateTimeExtras("issued", element.getIssuedElement(), false);
56494      }
56495      if (element.hasParticipant()) {
56496        openArray("participant");
56497        for (TestReport.TestReportParticipantComponent e : element.getParticipant()) 
56498          composeTestReportTestReportParticipantComponent(null, e);
56499        closeArray();
56500      };
56501      if (element.hasSetup()) {
56502        composeTestReportTestReportSetupComponent("setup", element.getSetup());
56503      }
56504      if (element.hasTest()) {
56505        openArray("test");
56506        for (TestReport.TestReportTestComponent e : element.getTest()) 
56507          composeTestReportTestReportTestComponent(null, e);
56508        closeArray();
56509      };
56510      if (element.hasTeardown()) {
56511        composeTestReportTestReportTeardownComponent("teardown", element.getTeardown());
56512      }
56513  }
56514
56515  protected void composeTestReportTestReportParticipantComponent(String name, TestReport.TestReportParticipantComponent element) throws IOException {
56516    if (element != null) {
56517      open(name);
56518      composeTestReportTestReportParticipantComponentInner(element);
56519      close();
56520    }
56521  }
56522
56523  protected void composeTestReportTestReportParticipantComponentInner(TestReport.TestReportParticipantComponent element) throws IOException {
56524      composeBackbone(element);
56525      if (element.hasTypeElement()) {
56526        composeEnumerationCore("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
56527        composeEnumerationExtras("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
56528      }
56529      if (element.hasUriElement()) {
56530        composeUriCore("uri", element.getUriElement(), false);
56531        composeUriExtras("uri", element.getUriElement(), false);
56532      }
56533      if (element.hasDisplayElement()) {
56534        composeStringCore("display", element.getDisplayElement(), false);
56535        composeStringExtras("display", element.getDisplayElement(), false);
56536      }
56537  }
56538
56539  protected void composeTestReportTestReportSetupComponent(String name, TestReport.TestReportSetupComponent element) throws IOException {
56540    if (element != null) {
56541      open(name);
56542      composeTestReportTestReportSetupComponentInner(element);
56543      close();
56544    }
56545  }
56546
56547  protected void composeTestReportTestReportSetupComponentInner(TestReport.TestReportSetupComponent element) throws IOException {
56548      composeBackbone(element);
56549      if (element.hasAction()) {
56550        openArray("action");
56551        for (TestReport.SetupActionComponent e : element.getAction()) 
56552          composeTestReportSetupActionComponent(null, e);
56553        closeArray();
56554      };
56555  }
56556
56557  protected void composeTestReportSetupActionComponent(String name, TestReport.SetupActionComponent element) throws IOException {
56558    if (element != null) {
56559      open(name);
56560      composeTestReportSetupActionComponentInner(element);
56561      close();
56562    }
56563  }
56564
56565  protected void composeTestReportSetupActionComponentInner(TestReport.SetupActionComponent element) throws IOException {
56566      composeBackbone(element);
56567      if (element.hasOperation()) {
56568        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
56569      }
56570      if (element.hasAssert()) {
56571        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
56572      }
56573  }
56574
56575  protected void composeTestReportSetupActionOperationComponent(String name, TestReport.SetupActionOperationComponent element) throws IOException {
56576    if (element != null) {
56577      open(name);
56578      composeTestReportSetupActionOperationComponentInner(element);
56579      close();
56580    }
56581  }
56582
56583  protected void composeTestReportSetupActionOperationComponentInner(TestReport.SetupActionOperationComponent element) throws IOException {
56584      composeBackbone(element);
56585      if (element.hasResultElement()) {
56586        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
56587        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
56588      }
56589      if (element.hasMessageElement()) {
56590        composeMarkdownCore("message", element.getMessageElement(), false);
56591        composeMarkdownExtras("message", element.getMessageElement(), false);
56592      }
56593      if (element.hasDetailElement()) {
56594        composeUriCore("detail", element.getDetailElement(), false);
56595        composeUriExtras("detail", element.getDetailElement(), false);
56596      }
56597  }
56598
56599  protected void composeTestReportSetupActionAssertComponent(String name, TestReport.SetupActionAssertComponent element) throws IOException {
56600    if (element != null) {
56601      open(name);
56602      composeTestReportSetupActionAssertComponentInner(element);
56603      close();
56604    }
56605  }
56606
56607  protected void composeTestReportSetupActionAssertComponentInner(TestReport.SetupActionAssertComponent element) throws IOException {
56608      composeBackbone(element);
56609      if (element.hasResultElement()) {
56610        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
56611        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
56612      }
56613      if (element.hasMessageElement()) {
56614        composeMarkdownCore("message", element.getMessageElement(), false);
56615        composeMarkdownExtras("message", element.getMessageElement(), false);
56616      }
56617      if (element.hasDetailElement()) {
56618        composeStringCore("detail", element.getDetailElement(), false);
56619        composeStringExtras("detail", element.getDetailElement(), false);
56620      }
56621  }
56622
56623  protected void composeTestReportTestReportTestComponent(String name, TestReport.TestReportTestComponent element) throws IOException {
56624    if (element != null) {
56625      open(name);
56626      composeTestReportTestReportTestComponentInner(element);
56627      close();
56628    }
56629  }
56630
56631  protected void composeTestReportTestReportTestComponentInner(TestReport.TestReportTestComponent element) throws IOException {
56632      composeBackbone(element);
56633      if (element.hasNameElement()) {
56634        composeStringCore("name", element.getNameElement(), false);
56635        composeStringExtras("name", element.getNameElement(), false);
56636      }
56637      if (element.hasDescriptionElement()) {
56638        composeStringCore("description", element.getDescriptionElement(), false);
56639        composeStringExtras("description", element.getDescriptionElement(), false);
56640      }
56641      if (element.hasAction()) {
56642        openArray("action");
56643        for (TestReport.TestActionComponent e : element.getAction()) 
56644          composeTestReportTestActionComponent(null, e);
56645        closeArray();
56646      };
56647  }
56648
56649  protected void composeTestReportTestActionComponent(String name, TestReport.TestActionComponent element) throws IOException {
56650    if (element != null) {
56651      open(name);
56652      composeTestReportTestActionComponentInner(element);
56653      close();
56654    }
56655  }
56656
56657  protected void composeTestReportTestActionComponentInner(TestReport.TestActionComponent element) throws IOException {
56658      composeBackbone(element);
56659      if (element.hasOperation()) {
56660        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
56661      }
56662      if (element.hasAssert()) {
56663        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
56664      }
56665  }
56666
56667  protected void composeTestReportTestReportTeardownComponent(String name, TestReport.TestReportTeardownComponent element) throws IOException {
56668    if (element != null) {
56669      open(name);
56670      composeTestReportTestReportTeardownComponentInner(element);
56671      close();
56672    }
56673  }
56674
56675  protected void composeTestReportTestReportTeardownComponentInner(TestReport.TestReportTeardownComponent element) throws IOException {
56676      composeBackbone(element);
56677      if (element.hasAction()) {
56678        openArray("action");
56679        for (TestReport.TeardownActionComponent e : element.getAction()) 
56680          composeTestReportTeardownActionComponent(null, e);
56681        closeArray();
56682      };
56683  }
56684
56685  protected void composeTestReportTeardownActionComponent(String name, TestReport.TeardownActionComponent element) throws IOException {
56686    if (element != null) {
56687      open(name);
56688      composeTestReportTeardownActionComponentInner(element);
56689      close();
56690    }
56691  }
56692
56693  protected void composeTestReportTeardownActionComponentInner(TestReport.TeardownActionComponent element) throws IOException {
56694      composeBackbone(element);
56695      if (element.hasOperation()) {
56696        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
56697      }
56698  }
56699
56700  protected void composeTestScript(String name, TestScript element) throws IOException {
56701    if (element != null) {
56702      prop("resourceType", name);
56703      composeTestScriptInner(element);
56704    }
56705  }
56706
56707  protected void composeTestScriptInner(TestScript element) throws IOException {
56708      composeDomainResourceElements(element);
56709      if (element.hasUrlElement()) {
56710        composeUriCore("url", element.getUrlElement(), false);
56711        composeUriExtras("url", element.getUrlElement(), false);
56712      }
56713      if (element.hasIdentifier()) {
56714        composeIdentifier("identifier", element.getIdentifier());
56715      }
56716      if (element.hasVersionElement()) {
56717        composeStringCore("version", element.getVersionElement(), false);
56718        composeStringExtras("version", element.getVersionElement(), false);
56719      }
56720      if (element.hasNameElement()) {
56721        composeStringCore("name", element.getNameElement(), false);
56722        composeStringExtras("name", element.getNameElement(), false);
56723      }
56724      if (element.hasTitleElement()) {
56725        composeStringCore("title", element.getTitleElement(), false);
56726        composeStringExtras("title", element.getTitleElement(), false);
56727      }
56728      if (element.hasStatusElement()) {
56729        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56730        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56731      }
56732      if (element.hasExperimentalElement()) {
56733        composeBooleanCore("experimental", element.getExperimentalElement(), false);
56734        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
56735      }
56736      if (element.hasDateElement()) {
56737        composeDateTimeCore("date", element.getDateElement(), false);
56738        composeDateTimeExtras("date", element.getDateElement(), false);
56739      }
56740      if (element.hasPublisherElement()) {
56741        composeStringCore("publisher", element.getPublisherElement(), false);
56742        composeStringExtras("publisher", element.getPublisherElement(), false);
56743      }
56744      if (element.hasContact()) {
56745        openArray("contact");
56746        for (ContactDetail e : element.getContact()) 
56747          composeContactDetail(null, e);
56748        closeArray();
56749      };
56750      if (element.hasDescriptionElement()) {
56751        composeMarkdownCore("description", element.getDescriptionElement(), false);
56752        composeMarkdownExtras("description", element.getDescriptionElement(), false);
56753      }
56754      if (element.hasUseContext()) {
56755        openArray("useContext");
56756        for (UsageContext e : element.getUseContext()) 
56757          composeUsageContext(null, e);
56758        closeArray();
56759      };
56760      if (element.hasJurisdiction()) {
56761        openArray("jurisdiction");
56762        for (CodeableConcept e : element.getJurisdiction()) 
56763          composeCodeableConcept(null, e);
56764        closeArray();
56765      };
56766      if (element.hasPurposeElement()) {
56767        composeMarkdownCore("purpose", element.getPurposeElement(), false);
56768        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
56769      }
56770      if (element.hasCopyrightElement()) {
56771        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
56772        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
56773      }
56774      if (element.hasOrigin()) {
56775        openArray("origin");
56776        for (TestScript.TestScriptOriginComponent e : element.getOrigin()) 
56777          composeTestScriptTestScriptOriginComponent(null, e);
56778        closeArray();
56779      };
56780      if (element.hasDestination()) {
56781        openArray("destination");
56782        for (TestScript.TestScriptDestinationComponent e : element.getDestination()) 
56783          composeTestScriptTestScriptDestinationComponent(null, e);
56784        closeArray();
56785      };
56786      if (element.hasMetadata()) {
56787        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
56788      }
56789      if (element.hasFixture()) {
56790        openArray("fixture");
56791        for (TestScript.TestScriptFixtureComponent e : element.getFixture()) 
56792          composeTestScriptTestScriptFixtureComponent(null, e);
56793        closeArray();
56794      };
56795      if (element.hasProfile()) {
56796        openArray("profile");
56797        for (Reference e : element.getProfile()) 
56798          composeReference(null, e);
56799        closeArray();
56800      };
56801      if (element.hasVariable()) {
56802        openArray("variable");
56803        for (TestScript.TestScriptVariableComponent e : element.getVariable()) 
56804          composeTestScriptTestScriptVariableComponent(null, e);
56805        closeArray();
56806      };
56807      if (element.hasSetup()) {
56808        composeTestScriptTestScriptSetupComponent("setup", element.getSetup());
56809      }
56810      if (element.hasTest()) {
56811        openArray("test");
56812        for (TestScript.TestScriptTestComponent e : element.getTest()) 
56813          composeTestScriptTestScriptTestComponent(null, e);
56814        closeArray();
56815      };
56816      if (element.hasTeardown()) {
56817        composeTestScriptTestScriptTeardownComponent("teardown", element.getTeardown());
56818      }
56819  }
56820
56821  protected void composeTestScriptTestScriptOriginComponent(String name, TestScript.TestScriptOriginComponent element) throws IOException {
56822    if (element != null) {
56823      open(name);
56824      composeTestScriptTestScriptOriginComponentInner(element);
56825      close();
56826    }
56827  }
56828
56829  protected void composeTestScriptTestScriptOriginComponentInner(TestScript.TestScriptOriginComponent element) throws IOException {
56830      composeBackbone(element);
56831      if (element.hasIndexElement()) {
56832        composeIntegerCore("index", element.getIndexElement(), false);
56833        composeIntegerExtras("index", element.getIndexElement(), false);
56834      }
56835      if (element.hasProfile()) {
56836        composeCoding("profile", element.getProfile());
56837      }
56838  }
56839
56840  protected void composeTestScriptTestScriptDestinationComponent(String name, TestScript.TestScriptDestinationComponent element) throws IOException {
56841    if (element != null) {
56842      open(name);
56843      composeTestScriptTestScriptDestinationComponentInner(element);
56844      close();
56845    }
56846  }
56847
56848  protected void composeTestScriptTestScriptDestinationComponentInner(TestScript.TestScriptDestinationComponent element) throws IOException {
56849      composeBackbone(element);
56850      if (element.hasIndexElement()) {
56851        composeIntegerCore("index", element.getIndexElement(), false);
56852        composeIntegerExtras("index", element.getIndexElement(), false);
56853      }
56854      if (element.hasProfile()) {
56855        composeCoding("profile", element.getProfile());
56856      }
56857  }
56858
56859  protected void composeTestScriptTestScriptMetadataComponent(String name, TestScript.TestScriptMetadataComponent element) throws IOException {
56860    if (element != null) {
56861      open(name);
56862      composeTestScriptTestScriptMetadataComponentInner(element);
56863      close();
56864    }
56865  }
56866
56867  protected void composeTestScriptTestScriptMetadataComponentInner(TestScript.TestScriptMetadataComponent element) throws IOException {
56868      composeBackbone(element);
56869      if (element.hasLink()) {
56870        openArray("link");
56871        for (TestScript.TestScriptMetadataLinkComponent e : element.getLink()) 
56872          composeTestScriptTestScriptMetadataLinkComponent(null, e);
56873        closeArray();
56874      };
56875      if (element.hasCapability()) {
56876        openArray("capability");
56877        for (TestScript.TestScriptMetadataCapabilityComponent e : element.getCapability()) 
56878          composeTestScriptTestScriptMetadataCapabilityComponent(null, e);
56879        closeArray();
56880      };
56881  }
56882
56883  protected void composeTestScriptTestScriptMetadataLinkComponent(String name, TestScript.TestScriptMetadataLinkComponent element) throws IOException {
56884    if (element != null) {
56885      open(name);
56886      composeTestScriptTestScriptMetadataLinkComponentInner(element);
56887      close();
56888    }
56889  }
56890
56891  protected void composeTestScriptTestScriptMetadataLinkComponentInner(TestScript.TestScriptMetadataLinkComponent element) throws IOException {
56892      composeBackbone(element);
56893      if (element.hasUrlElement()) {
56894        composeUriCore("url", element.getUrlElement(), false);
56895        composeUriExtras("url", element.getUrlElement(), false);
56896      }
56897      if (element.hasDescriptionElement()) {
56898        composeStringCore("description", element.getDescriptionElement(), false);
56899        composeStringExtras("description", element.getDescriptionElement(), false);
56900      }
56901  }
56902
56903  protected void composeTestScriptTestScriptMetadataCapabilityComponent(String name, TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
56904    if (element != null) {
56905      open(name);
56906      composeTestScriptTestScriptMetadataCapabilityComponentInner(element);
56907      close();
56908    }
56909  }
56910
56911  protected void composeTestScriptTestScriptMetadataCapabilityComponentInner(TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
56912      composeBackbone(element);
56913      if (element.hasRequiredElement()) {
56914        composeBooleanCore("required", element.getRequiredElement(), false);
56915        composeBooleanExtras("required", element.getRequiredElement(), false);
56916      }
56917      if (element.hasValidatedElement()) {
56918        composeBooleanCore("validated", element.getValidatedElement(), false);
56919        composeBooleanExtras("validated", element.getValidatedElement(), false);
56920      }
56921      if (element.hasDescriptionElement()) {
56922        composeStringCore("description", element.getDescriptionElement(), false);
56923        composeStringExtras("description", element.getDescriptionElement(), false);
56924      }
56925      if (element.hasOrigin()) {
56926        openArray("origin");
56927        for (IntegerType e : element.getOrigin()) 
56928          composeIntegerCore(null, e, true);
56929        closeArray();
56930        if (anyHasExtras(element.getOrigin())) {
56931          openArray("_origin");
56932          for (IntegerType e : element.getOrigin()) 
56933            composeIntegerExtras(null, e, true);
56934          closeArray();
56935        }
56936      };
56937      if (element.hasDestinationElement()) {
56938        composeIntegerCore("destination", element.getDestinationElement(), false);
56939        composeIntegerExtras("destination", element.getDestinationElement(), false);
56940      }
56941      if (element.hasLink()) {
56942        openArray("link");
56943        for (UriType e : element.getLink()) 
56944          composeUriCore(null, e, true);
56945        closeArray();
56946        if (anyHasExtras(element.getLink())) {
56947          openArray("_link");
56948          for (UriType e : element.getLink()) 
56949            composeUriExtras(null, e, true);
56950          closeArray();
56951        }
56952      };
56953      if (element.hasCapabilitiesElement()) {
56954        composeCanonicalCore("capabilities", element.getCapabilitiesElement(), false);
56955        composeCanonicalExtras("capabilities", element.getCapabilitiesElement(), false);
56956      }
56957  }
56958
56959  protected void composeTestScriptTestScriptFixtureComponent(String name, TestScript.TestScriptFixtureComponent element) throws IOException {
56960    if (element != null) {
56961      open(name);
56962      composeTestScriptTestScriptFixtureComponentInner(element);
56963      close();
56964    }
56965  }
56966
56967  protected void composeTestScriptTestScriptFixtureComponentInner(TestScript.TestScriptFixtureComponent element) throws IOException {
56968      composeBackbone(element);
56969      if (element.hasAutocreateElement()) {
56970        composeBooleanCore("autocreate", element.getAutocreateElement(), false);
56971        composeBooleanExtras("autocreate", element.getAutocreateElement(), false);
56972      }
56973      if (element.hasAutodeleteElement()) {
56974        composeBooleanCore("autodelete", element.getAutodeleteElement(), false);
56975        composeBooleanExtras("autodelete", element.getAutodeleteElement(), false);
56976      }
56977      if (element.hasResource()) {
56978        composeReference("resource", element.getResource());
56979      }
56980  }
56981
56982  protected void composeTestScriptTestScriptVariableComponent(String name, TestScript.TestScriptVariableComponent element) throws IOException {
56983    if (element != null) {
56984      open(name);
56985      composeTestScriptTestScriptVariableComponentInner(element);
56986      close();
56987    }
56988  }
56989
56990  protected void composeTestScriptTestScriptVariableComponentInner(TestScript.TestScriptVariableComponent element) throws IOException {
56991      composeBackbone(element);
56992      if (element.hasNameElement()) {
56993        composeStringCore("name", element.getNameElement(), false);
56994        composeStringExtras("name", element.getNameElement(), false);
56995      }
56996      if (element.hasDefaultValueElement()) {
56997        composeStringCore("defaultValue", element.getDefaultValueElement(), false);
56998        composeStringExtras("defaultValue", element.getDefaultValueElement(), false);
56999      }
57000      if (element.hasDescriptionElement()) {
57001        composeStringCore("description", element.getDescriptionElement(), false);
57002        composeStringExtras("description", element.getDescriptionElement(), false);
57003      }
57004      if (element.hasExpressionElement()) {
57005        composeStringCore("expression", element.getExpressionElement(), false);
57006        composeStringExtras("expression", element.getExpressionElement(), false);
57007      }
57008      if (element.hasHeaderFieldElement()) {
57009        composeStringCore("headerField", element.getHeaderFieldElement(), false);
57010        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
57011      }
57012      if (element.hasHintElement()) {
57013        composeStringCore("hint", element.getHintElement(), false);
57014        composeStringExtras("hint", element.getHintElement(), false);
57015      }
57016      if (element.hasPathElement()) {
57017        composeStringCore("path", element.getPathElement(), false);
57018        composeStringExtras("path", element.getPathElement(), false);
57019      }
57020      if (element.hasSourceIdElement()) {
57021        composeIdCore("sourceId", element.getSourceIdElement(), false);
57022        composeIdExtras("sourceId", element.getSourceIdElement(), false);
57023      }
57024  }
57025
57026  protected void composeTestScriptTestScriptSetupComponent(String name, TestScript.TestScriptSetupComponent element) throws IOException {
57027    if (element != null) {
57028      open(name);
57029      composeTestScriptTestScriptSetupComponentInner(element);
57030      close();
57031    }
57032  }
57033
57034  protected void composeTestScriptTestScriptSetupComponentInner(TestScript.TestScriptSetupComponent element) throws IOException {
57035      composeBackbone(element);
57036      if (element.hasAction()) {
57037        openArray("action");
57038        for (TestScript.SetupActionComponent e : element.getAction()) 
57039          composeTestScriptSetupActionComponent(null, e);
57040        closeArray();
57041      };
57042  }
57043
57044  protected void composeTestScriptSetupActionComponent(String name, TestScript.SetupActionComponent element) throws IOException {
57045    if (element != null) {
57046      open(name);
57047      composeTestScriptSetupActionComponentInner(element);
57048      close();
57049    }
57050  }
57051
57052  protected void composeTestScriptSetupActionComponentInner(TestScript.SetupActionComponent element) throws IOException {
57053      composeBackbone(element);
57054      if (element.hasOperation()) {
57055        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
57056      }
57057      if (element.hasAssert()) {
57058        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
57059      }
57060  }
57061
57062  protected void composeTestScriptSetupActionOperationComponent(String name, TestScript.SetupActionOperationComponent element) throws IOException {
57063    if (element != null) {
57064      open(name);
57065      composeTestScriptSetupActionOperationComponentInner(element);
57066      close();
57067    }
57068  }
57069
57070  protected void composeTestScriptSetupActionOperationComponentInner(TestScript.SetupActionOperationComponent element) throws IOException {
57071      composeBackbone(element);
57072      if (element.hasType()) {
57073        composeCoding("type", element.getType());
57074      }
57075      if (element.hasResourceElement()) {
57076        composeCodeCore("resource", element.getResourceElement(), false);
57077        composeCodeExtras("resource", element.getResourceElement(), false);
57078      }
57079      if (element.hasLabelElement()) {
57080        composeStringCore("label", element.getLabelElement(), false);
57081        composeStringExtras("label", element.getLabelElement(), false);
57082      }
57083      if (element.hasDescriptionElement()) {
57084        composeStringCore("description", element.getDescriptionElement(), false);
57085        composeStringExtras("description", element.getDescriptionElement(), false);
57086      }
57087      if (element.hasAcceptElement()) {
57088        composeCodeCore("accept", element.getAcceptElement(), false);
57089        composeCodeExtras("accept", element.getAcceptElement(), false);
57090      }
57091      if (element.hasContentTypeElement()) {
57092        composeCodeCore("contentType", element.getContentTypeElement(), false);
57093        composeCodeExtras("contentType", element.getContentTypeElement(), false);
57094      }
57095      if (element.hasDestinationElement()) {
57096        composeIntegerCore("destination", element.getDestinationElement(), false);
57097        composeIntegerExtras("destination", element.getDestinationElement(), false);
57098      }
57099      if (element.hasEncodeRequestUrlElement()) {
57100        composeBooleanCore("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
57101        composeBooleanExtras("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
57102      }
57103      if (element.hasMethodElement()) {
57104        composeEnumerationCore("method", element.getMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
57105        composeEnumerationExtras("method", element.getMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
57106      }
57107      if (element.hasOriginElement()) {
57108        composeIntegerCore("origin", element.getOriginElement(), false);
57109        composeIntegerExtras("origin", element.getOriginElement(), false);
57110      }
57111      if (element.hasParamsElement()) {
57112        composeStringCore("params", element.getParamsElement(), false);
57113        composeStringExtras("params", element.getParamsElement(), false);
57114      }
57115      if (element.hasRequestHeader()) {
57116        openArray("requestHeader");
57117        for (TestScript.SetupActionOperationRequestHeaderComponent e : element.getRequestHeader()) 
57118          composeTestScriptSetupActionOperationRequestHeaderComponent(null, e);
57119        closeArray();
57120      };
57121      if (element.hasRequestIdElement()) {
57122        composeIdCore("requestId", element.getRequestIdElement(), false);
57123        composeIdExtras("requestId", element.getRequestIdElement(), false);
57124      }
57125      if (element.hasResponseIdElement()) {
57126        composeIdCore("responseId", element.getResponseIdElement(), false);
57127        composeIdExtras("responseId", element.getResponseIdElement(), false);
57128      }
57129      if (element.hasSourceIdElement()) {
57130        composeIdCore("sourceId", element.getSourceIdElement(), false);
57131        composeIdExtras("sourceId", element.getSourceIdElement(), false);
57132      }
57133      if (element.hasTargetIdElement()) {
57134        composeIdCore("targetId", element.getTargetIdElement(), false);
57135        composeIdExtras("targetId", element.getTargetIdElement(), false);
57136      }
57137      if (element.hasUrlElement()) {
57138        composeStringCore("url", element.getUrlElement(), false);
57139        composeStringExtras("url", element.getUrlElement(), false);
57140      }
57141  }
57142
57143  protected void composeTestScriptSetupActionOperationRequestHeaderComponent(String name, TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
57144    if (element != null) {
57145      open(name);
57146      composeTestScriptSetupActionOperationRequestHeaderComponentInner(element);
57147      close();
57148    }
57149  }
57150
57151  protected void composeTestScriptSetupActionOperationRequestHeaderComponentInner(TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
57152      composeBackbone(element);
57153      if (element.hasFieldElement()) {
57154        composeStringCore("field", element.getFieldElement(), false);
57155        composeStringExtras("field", element.getFieldElement(), false);
57156      }
57157      if (element.hasValueElement()) {
57158        composeStringCore("value", element.getValueElement(), false);
57159        composeStringExtras("value", element.getValueElement(), false);
57160      }
57161  }
57162
57163  protected void composeTestScriptSetupActionAssertComponent(String name, TestScript.SetupActionAssertComponent element) throws IOException {
57164    if (element != null) {
57165      open(name);
57166      composeTestScriptSetupActionAssertComponentInner(element);
57167      close();
57168    }
57169  }
57170
57171  protected void composeTestScriptSetupActionAssertComponentInner(TestScript.SetupActionAssertComponent element) throws IOException {
57172      composeBackbone(element);
57173      if (element.hasLabelElement()) {
57174        composeStringCore("label", element.getLabelElement(), false);
57175        composeStringExtras("label", element.getLabelElement(), false);
57176      }
57177      if (element.hasDescriptionElement()) {
57178        composeStringCore("description", element.getDescriptionElement(), false);
57179        composeStringExtras("description", element.getDescriptionElement(), false);
57180      }
57181      if (element.hasDirectionElement()) {
57182        composeEnumerationCore("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
57183        composeEnumerationExtras("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
57184      }
57185      if (element.hasCompareToSourceIdElement()) {
57186        composeStringCore("compareToSourceId", element.getCompareToSourceIdElement(), false);
57187        composeStringExtras("compareToSourceId", element.getCompareToSourceIdElement(), false);
57188      }
57189      if (element.hasCompareToSourceExpressionElement()) {
57190        composeStringCore("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
57191        composeStringExtras("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
57192      }
57193      if (element.hasCompareToSourcePathElement()) {
57194        composeStringCore("compareToSourcePath", element.getCompareToSourcePathElement(), false);
57195        composeStringExtras("compareToSourcePath", element.getCompareToSourcePathElement(), false);
57196      }
57197      if (element.hasContentTypeElement()) {
57198        composeCodeCore("contentType", element.getContentTypeElement(), false);
57199        composeCodeExtras("contentType", element.getContentTypeElement(), false);
57200      }
57201      if (element.hasExpressionElement()) {
57202        composeStringCore("expression", element.getExpressionElement(), false);
57203        composeStringExtras("expression", element.getExpressionElement(), false);
57204      }
57205      if (element.hasHeaderFieldElement()) {
57206        composeStringCore("headerField", element.getHeaderFieldElement(), false);
57207        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
57208      }
57209      if (element.hasMinimumIdElement()) {
57210        composeStringCore("minimumId", element.getMinimumIdElement(), false);
57211        composeStringExtras("minimumId", element.getMinimumIdElement(), false);
57212      }
57213      if (element.hasNavigationLinksElement()) {
57214        composeBooleanCore("navigationLinks", element.getNavigationLinksElement(), false);
57215        composeBooleanExtras("navigationLinks", element.getNavigationLinksElement(), false);
57216      }
57217      if (element.hasOperatorElement()) {
57218        composeEnumerationCore("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
57219        composeEnumerationExtras("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
57220      }
57221      if (element.hasPathElement()) {
57222        composeStringCore("path", element.getPathElement(), false);
57223        composeStringExtras("path", element.getPathElement(), false);
57224      }
57225      if (element.hasRequestMethodElement()) {
57226        composeEnumerationCore("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
57227        composeEnumerationExtras("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
57228      }
57229      if (element.hasRequestURLElement()) {
57230        composeStringCore("requestURL", element.getRequestURLElement(), false);
57231        composeStringExtras("requestURL", element.getRequestURLElement(), false);
57232      }
57233      if (element.hasResourceElement()) {
57234        composeCodeCore("resource", element.getResourceElement(), false);
57235        composeCodeExtras("resource", element.getResourceElement(), false);
57236      }
57237      if (element.hasResponseElement()) {
57238        composeEnumerationCore("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
57239        composeEnumerationExtras("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
57240      }
57241      if (element.hasResponseCodeElement()) {
57242        composeStringCore("responseCode", element.getResponseCodeElement(), false);
57243        composeStringExtras("responseCode", element.getResponseCodeElement(), false);
57244      }
57245      if (element.hasSourceIdElement()) {
57246        composeIdCore("sourceId", element.getSourceIdElement(), false);
57247        composeIdExtras("sourceId", element.getSourceIdElement(), false);
57248      }
57249      if (element.hasValidateProfileIdElement()) {
57250        composeIdCore("validateProfileId", element.getValidateProfileIdElement(), false);
57251        composeIdExtras("validateProfileId", element.getValidateProfileIdElement(), false);
57252      }
57253      if (element.hasValueElement()) {
57254        composeStringCore("value", element.getValueElement(), false);
57255        composeStringExtras("value", element.getValueElement(), false);
57256      }
57257      if (element.hasWarningOnlyElement()) {
57258        composeBooleanCore("warningOnly", element.getWarningOnlyElement(), false);
57259        composeBooleanExtras("warningOnly", element.getWarningOnlyElement(), false);
57260      }
57261  }
57262
57263  protected void composeTestScriptTestScriptTestComponent(String name, TestScript.TestScriptTestComponent element) throws IOException {
57264    if (element != null) {
57265      open(name);
57266      composeTestScriptTestScriptTestComponentInner(element);
57267      close();
57268    }
57269  }
57270
57271  protected void composeTestScriptTestScriptTestComponentInner(TestScript.TestScriptTestComponent element) throws IOException {
57272      composeBackbone(element);
57273      if (element.hasNameElement()) {
57274        composeStringCore("name", element.getNameElement(), false);
57275        composeStringExtras("name", element.getNameElement(), false);
57276      }
57277      if (element.hasDescriptionElement()) {
57278        composeStringCore("description", element.getDescriptionElement(), false);
57279        composeStringExtras("description", element.getDescriptionElement(), false);
57280      }
57281      if (element.hasAction()) {
57282        openArray("action");
57283        for (TestScript.TestActionComponent e : element.getAction()) 
57284          composeTestScriptTestActionComponent(null, e);
57285        closeArray();
57286      };
57287  }
57288
57289  protected void composeTestScriptTestActionComponent(String name, TestScript.TestActionComponent element) throws IOException {
57290    if (element != null) {
57291      open(name);
57292      composeTestScriptTestActionComponentInner(element);
57293      close();
57294    }
57295  }
57296
57297  protected void composeTestScriptTestActionComponentInner(TestScript.TestActionComponent element) throws IOException {
57298      composeBackbone(element);
57299      if (element.hasOperation()) {
57300        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
57301      }
57302      if (element.hasAssert()) {
57303        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
57304      }
57305  }
57306
57307  protected void composeTestScriptTestScriptTeardownComponent(String name, TestScript.TestScriptTeardownComponent element) throws IOException {
57308    if (element != null) {
57309      open(name);
57310      composeTestScriptTestScriptTeardownComponentInner(element);
57311      close();
57312    }
57313  }
57314
57315  protected void composeTestScriptTestScriptTeardownComponentInner(TestScript.TestScriptTeardownComponent element) throws IOException {
57316      composeBackbone(element);
57317      if (element.hasAction()) {
57318        openArray("action");
57319        for (TestScript.TeardownActionComponent e : element.getAction()) 
57320          composeTestScriptTeardownActionComponent(null, e);
57321        closeArray();
57322      };
57323  }
57324
57325  protected void composeTestScriptTeardownActionComponent(String name, TestScript.TeardownActionComponent element) throws IOException {
57326    if (element != null) {
57327      open(name);
57328      composeTestScriptTeardownActionComponentInner(element);
57329      close();
57330    }
57331  }
57332
57333  protected void composeTestScriptTeardownActionComponentInner(TestScript.TeardownActionComponent element) throws IOException {
57334      composeBackbone(element);
57335      if (element.hasOperation()) {
57336        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
57337      }
57338  }
57339
57340  protected void composeValueSet(String name, ValueSet element) throws IOException {
57341    if (element != null) {
57342      prop("resourceType", name);
57343      composeValueSetInner(element);
57344    }
57345  }
57346
57347  protected void composeValueSetInner(ValueSet element) throws IOException {
57348      composeDomainResourceElements(element);
57349      if (element.hasUrlElement()) {
57350        composeUriCore("url", element.getUrlElement(), false);
57351        composeUriExtras("url", element.getUrlElement(), false);
57352      }
57353      if (element.hasIdentifier()) {
57354        openArray("identifier");
57355        for (Identifier e : element.getIdentifier()) 
57356          composeIdentifier(null, e);
57357        closeArray();
57358      };
57359      if (element.hasVersionElement()) {
57360        composeStringCore("version", element.getVersionElement(), false);
57361        composeStringExtras("version", element.getVersionElement(), false);
57362      }
57363      if (element.hasNameElement()) {
57364        composeStringCore("name", element.getNameElement(), false);
57365        composeStringExtras("name", element.getNameElement(), false);
57366      }
57367      if (element.hasTitleElement()) {
57368        composeStringCore("title", element.getTitleElement(), false);
57369        composeStringExtras("title", element.getTitleElement(), false);
57370      }
57371      if (element.hasStatusElement()) {
57372        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
57373        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
57374      }
57375      if (element.hasExperimentalElement()) {
57376        composeBooleanCore("experimental", element.getExperimentalElement(), false);
57377        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
57378      }
57379      if (element.hasDateElement()) {
57380        composeDateTimeCore("date", element.getDateElement(), false);
57381        composeDateTimeExtras("date", element.getDateElement(), false);
57382      }
57383      if (element.hasPublisherElement()) {
57384        composeStringCore("publisher", element.getPublisherElement(), false);
57385        composeStringExtras("publisher", element.getPublisherElement(), false);
57386      }
57387      if (element.hasContact()) {
57388        openArray("contact");
57389        for (ContactDetail e : element.getContact()) 
57390          composeContactDetail(null, e);
57391        closeArray();
57392      };
57393      if (element.hasDescriptionElement()) {
57394        composeMarkdownCore("description", element.getDescriptionElement(), false);
57395        composeMarkdownExtras("description", element.getDescriptionElement(), false);
57396      }
57397      if (element.hasUseContext()) {
57398        openArray("useContext");
57399        for (UsageContext e : element.getUseContext()) 
57400          composeUsageContext(null, e);
57401        closeArray();
57402      };
57403      if (element.hasJurisdiction()) {
57404        openArray("jurisdiction");
57405        for (CodeableConcept e : element.getJurisdiction()) 
57406          composeCodeableConcept(null, e);
57407        closeArray();
57408      };
57409      if (element.hasImmutableElement()) {
57410        composeBooleanCore("immutable", element.getImmutableElement(), false);
57411        composeBooleanExtras("immutable", element.getImmutableElement(), false);
57412      }
57413      if (element.hasPurposeElement()) {
57414        composeMarkdownCore("purpose", element.getPurposeElement(), false);
57415        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
57416      }
57417      if (element.hasCopyrightElement()) {
57418        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
57419        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
57420      }
57421      if (element.hasCompose()) {
57422        composeValueSetValueSetComposeComponent("compose", element.getCompose());
57423      }
57424      if (element.hasExpansion()) {
57425        composeValueSetValueSetExpansionComponent("expansion", element.getExpansion());
57426      }
57427  }
57428
57429  protected void composeValueSetValueSetComposeComponent(String name, ValueSet.ValueSetComposeComponent element) throws IOException {
57430    if (element != null) {
57431      open(name);
57432      composeValueSetValueSetComposeComponentInner(element);
57433      close();
57434    }
57435  }
57436
57437  protected void composeValueSetValueSetComposeComponentInner(ValueSet.ValueSetComposeComponent element) throws IOException {
57438      composeBackbone(element);
57439      if (element.hasLockedDateElement()) {
57440        composeDateCore("lockedDate", element.getLockedDateElement(), false);
57441        composeDateExtras("lockedDate", element.getLockedDateElement(), false);
57442      }
57443      if (element.hasInactiveElement()) {
57444        composeBooleanCore("inactive", element.getInactiveElement(), false);
57445        composeBooleanExtras("inactive", element.getInactiveElement(), false);
57446      }
57447      if (element.hasInclude()) {
57448        openArray("include");
57449        for (ValueSet.ConceptSetComponent e : element.getInclude()) 
57450          composeValueSetConceptSetComponent(null, e);
57451        closeArray();
57452      };
57453      if (element.hasExclude()) {
57454        openArray("exclude");
57455        for (ValueSet.ConceptSetComponent e : element.getExclude()) 
57456          composeValueSetConceptSetComponent(null, e);
57457        closeArray();
57458      };
57459  }
57460
57461  protected void composeValueSetConceptSetComponent(String name, ValueSet.ConceptSetComponent element) throws IOException {
57462    if (element != null) {
57463      open(name);
57464      composeValueSetConceptSetComponentInner(element);
57465      close();
57466    }
57467  }
57468
57469  protected void composeValueSetConceptSetComponentInner(ValueSet.ConceptSetComponent element) throws IOException {
57470      composeBackbone(element);
57471      if (element.hasSystemElement()) {
57472        composeUriCore("system", element.getSystemElement(), false);
57473        composeUriExtras("system", element.getSystemElement(), false);
57474      }
57475      if (element.hasVersionElement()) {
57476        composeStringCore("version", element.getVersionElement(), false);
57477        composeStringExtras("version", element.getVersionElement(), false);
57478      }
57479      if (element.hasConcept()) {
57480        openArray("concept");
57481        for (ValueSet.ConceptReferenceComponent e : element.getConcept()) 
57482          composeValueSetConceptReferenceComponent(null, e);
57483        closeArray();
57484      };
57485      if (element.hasFilter()) {
57486        openArray("filter");
57487        for (ValueSet.ConceptSetFilterComponent e : element.getFilter()) 
57488          composeValueSetConceptSetFilterComponent(null, e);
57489        closeArray();
57490      };
57491      if (element.hasValueSet()) {
57492        openArray("valueSet");
57493        for (CanonicalType e : element.getValueSet()) 
57494          composeCanonicalCore(null, e, true);
57495        closeArray();
57496        if (anyHasExtras(element.getValueSet())) {
57497          openArray("_valueSet");
57498          for (CanonicalType e : element.getValueSet()) 
57499            composeCanonicalExtras(null, e, true);
57500          closeArray();
57501        }
57502      };
57503  }
57504
57505  protected void composeValueSetConceptReferenceComponent(String name, ValueSet.ConceptReferenceComponent element) throws IOException {
57506    if (element != null) {
57507      open(name);
57508      composeValueSetConceptReferenceComponentInner(element);
57509      close();
57510    }
57511  }
57512
57513  protected void composeValueSetConceptReferenceComponentInner(ValueSet.ConceptReferenceComponent element) throws IOException {
57514      composeBackbone(element);
57515      if (element.hasCodeElement()) {
57516        composeCodeCore("code", element.getCodeElement(), false);
57517        composeCodeExtras("code", element.getCodeElement(), false);
57518      }
57519      if (element.hasDisplayElement()) {
57520        composeStringCore("display", element.getDisplayElement(), false);
57521        composeStringExtras("display", element.getDisplayElement(), false);
57522      }
57523      if (element.hasDesignation()) {
57524        openArray("designation");
57525        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
57526          composeValueSetConceptReferenceDesignationComponent(null, e);
57527        closeArray();
57528      };
57529  }
57530
57531  protected void composeValueSetConceptReferenceDesignationComponent(String name, ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
57532    if (element != null) {
57533      open(name);
57534      composeValueSetConceptReferenceDesignationComponentInner(element);
57535      close();
57536    }
57537  }
57538
57539  protected void composeValueSetConceptReferenceDesignationComponentInner(ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
57540      composeBackbone(element);
57541      if (element.hasLanguageElement()) {
57542        composeCodeCore("language", element.getLanguageElement(), false);
57543        composeCodeExtras("language", element.getLanguageElement(), false);
57544      }
57545      if (element.hasUse()) {
57546        composeCoding("use", element.getUse());
57547      }
57548      if (element.hasValueElement()) {
57549        composeStringCore("value", element.getValueElement(), false);
57550        composeStringExtras("value", element.getValueElement(), false);
57551      }
57552  }
57553
57554  protected void composeValueSetConceptSetFilterComponent(String name, ValueSet.ConceptSetFilterComponent element) throws IOException {
57555    if (element != null) {
57556      open(name);
57557      composeValueSetConceptSetFilterComponentInner(element);
57558      close();
57559    }
57560  }
57561
57562  protected void composeValueSetConceptSetFilterComponentInner(ValueSet.ConceptSetFilterComponent element) throws IOException {
57563      composeBackbone(element);
57564      if (element.hasPropertyElement()) {
57565        composeCodeCore("property", element.getPropertyElement(), false);
57566        composeCodeExtras("property", element.getPropertyElement(), false);
57567      }
57568      if (element.hasOpElement()) {
57569        composeEnumerationCore("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
57570        composeEnumerationExtras("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
57571      }
57572      if (element.hasValueElement()) {
57573        composeStringCore("value", element.getValueElement(), false);
57574        composeStringExtras("value", element.getValueElement(), false);
57575      }
57576  }
57577
57578  protected void composeValueSetValueSetExpansionComponent(String name, ValueSet.ValueSetExpansionComponent element) throws IOException {
57579    if (element != null) {
57580      open(name);
57581      composeValueSetValueSetExpansionComponentInner(element);
57582      close();
57583    }
57584  }
57585
57586  protected void composeValueSetValueSetExpansionComponentInner(ValueSet.ValueSetExpansionComponent element) throws IOException {
57587      composeBackbone(element);
57588      if (element.hasIdentifierElement()) {
57589        composeUriCore("identifier", element.getIdentifierElement(), false);
57590        composeUriExtras("identifier", element.getIdentifierElement(), false);
57591      }
57592      if (element.hasTimestampElement()) {
57593        composeDateTimeCore("timestamp", element.getTimestampElement(), false);
57594        composeDateTimeExtras("timestamp", element.getTimestampElement(), false);
57595      }
57596      if (element.hasTotalElement()) {
57597        composeIntegerCore("total", element.getTotalElement(), false);
57598        composeIntegerExtras("total", element.getTotalElement(), false);
57599      }
57600      if (element.hasOffsetElement()) {
57601        composeIntegerCore("offset", element.getOffsetElement(), false);
57602        composeIntegerExtras("offset", element.getOffsetElement(), false);
57603      }
57604      if (element.hasParameter()) {
57605        openArray("parameter");
57606        for (ValueSet.ValueSetExpansionParameterComponent e : element.getParameter()) 
57607          composeValueSetValueSetExpansionParameterComponent(null, e);
57608        closeArray();
57609      };
57610      if (element.hasContains()) {
57611        openArray("contains");
57612        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
57613          composeValueSetValueSetExpansionContainsComponent(null, e);
57614        closeArray();
57615      };
57616  }
57617
57618  protected void composeValueSetValueSetExpansionParameterComponent(String name, ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
57619    if (element != null) {
57620      open(name);
57621      composeValueSetValueSetExpansionParameterComponentInner(element);
57622      close();
57623    }
57624  }
57625
57626  protected void composeValueSetValueSetExpansionParameterComponentInner(ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
57627      composeBackbone(element);
57628      if (element.hasNameElement()) {
57629        composeStringCore("name", element.getNameElement(), false);
57630        composeStringExtras("name", element.getNameElement(), false);
57631      }
57632      if (element.hasValue()) {
57633        composeType("value", element.getValue());
57634      }
57635  }
57636
57637  protected void composeValueSetValueSetExpansionContainsComponent(String name, ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
57638    if (element != null) {
57639      open(name);
57640      composeValueSetValueSetExpansionContainsComponentInner(element);
57641      close();
57642    }
57643  }
57644
57645  protected void composeValueSetValueSetExpansionContainsComponentInner(ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
57646      composeBackbone(element);
57647      if (element.hasSystemElement()) {
57648        composeUriCore("system", element.getSystemElement(), false);
57649        composeUriExtras("system", element.getSystemElement(), false);
57650      }
57651      if (element.hasAbstractElement()) {
57652        composeBooleanCore("abstract", element.getAbstractElement(), false);
57653        composeBooleanExtras("abstract", element.getAbstractElement(), false);
57654      }
57655      if (element.hasInactiveElement()) {
57656        composeBooleanCore("inactive", element.getInactiveElement(), false);
57657        composeBooleanExtras("inactive", element.getInactiveElement(), false);
57658      }
57659      if (element.hasVersionElement()) {
57660        composeStringCore("version", element.getVersionElement(), false);
57661        composeStringExtras("version", element.getVersionElement(), false);
57662      }
57663      if (element.hasCodeElement()) {
57664        composeCodeCore("code", element.getCodeElement(), false);
57665        composeCodeExtras("code", element.getCodeElement(), false);
57666      }
57667      if (element.hasDisplayElement()) {
57668        composeStringCore("display", element.getDisplayElement(), false);
57669        composeStringExtras("display", element.getDisplayElement(), false);
57670      }
57671      if (element.hasDesignation()) {
57672        openArray("designation");
57673        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
57674          composeValueSetConceptReferenceDesignationComponent(null, e);
57675        closeArray();
57676      };
57677      if (element.hasContains()) {
57678        openArray("contains");
57679        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
57680          composeValueSetValueSetExpansionContainsComponent(null, e);
57681        closeArray();
57682      };
57683  }
57684
57685  protected void composeVerificationResult(String name, VerificationResult element) throws IOException {
57686    if (element != null) {
57687      prop("resourceType", name);
57688      composeVerificationResultInner(element);
57689    }
57690  }
57691
57692  protected void composeVerificationResultInner(VerificationResult element) throws IOException {
57693      composeDomainResourceElements(element);
57694      if (element.hasTarget()) {
57695        openArray("target");
57696        for (Reference e : element.getTarget()) 
57697          composeReference(null, e);
57698        closeArray();
57699      };
57700      if (element.hasTargetLocation()) {
57701        openArray("targetLocation");
57702        for (StringType e : element.getTargetLocation()) 
57703          composeStringCore(null, e, true);
57704        closeArray();
57705        if (anyHasExtras(element.getTargetLocation())) {
57706          openArray("_targetLocation");
57707          for (StringType e : element.getTargetLocation()) 
57708            composeStringExtras(null, e, true);
57709          closeArray();
57710        }
57711      };
57712      if (element.hasNeed()) {
57713        composeCodeableConcept("need", element.getNeed());
57714      }
57715      if (element.hasStatusElement()) {
57716        composeEnumerationCore("status", element.getStatusElement(), new VerificationResult.StatusEnumFactory(), false);
57717        composeEnumerationExtras("status", element.getStatusElement(), new VerificationResult.StatusEnumFactory(), false);
57718      }
57719      if (element.hasStatusDateElement()) {
57720        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
57721        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
57722      }
57723      if (element.hasValidationType()) {
57724        composeCodeableConcept("validationType", element.getValidationType());
57725      }
57726      if (element.hasValidationProcess()) {
57727        openArray("validationProcess");
57728        for (CodeableConcept e : element.getValidationProcess()) 
57729          composeCodeableConcept(null, e);
57730        closeArray();
57731      };
57732      if (element.hasFrequency()) {
57733        composeTiming("frequency", element.getFrequency());
57734      }
57735      if (element.hasLastPerformedElement()) {
57736        composeDateTimeCore("lastPerformed", element.getLastPerformedElement(), false);
57737        composeDateTimeExtras("lastPerformed", element.getLastPerformedElement(), false);
57738      }
57739      if (element.hasNextScheduledElement()) {
57740        composeDateCore("nextScheduled", element.getNextScheduledElement(), false);
57741        composeDateExtras("nextScheduled", element.getNextScheduledElement(), false);
57742      }
57743      if (element.hasFailureAction()) {
57744        composeCodeableConcept("failureAction", element.getFailureAction());
57745      }
57746      if (element.hasPrimarySource()) {
57747        openArray("primarySource");
57748        for (VerificationResult.VerificationResultPrimarySourceComponent e : element.getPrimarySource()) 
57749          composeVerificationResultVerificationResultPrimarySourceComponent(null, e);
57750        closeArray();
57751      };
57752      if (element.hasAttestation()) {
57753        composeVerificationResultVerificationResultAttestationComponent("attestation", element.getAttestation());
57754      }
57755      if (element.hasValidator()) {
57756        openArray("validator");
57757        for (VerificationResult.VerificationResultValidatorComponent e : element.getValidator()) 
57758          composeVerificationResultVerificationResultValidatorComponent(null, e);
57759        closeArray();
57760      };
57761  }
57762
57763  protected void composeVerificationResultVerificationResultPrimarySourceComponent(String name, VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
57764    if (element != null) {
57765      open(name);
57766      composeVerificationResultVerificationResultPrimarySourceComponentInner(element);
57767      close();
57768    }
57769  }
57770
57771  protected void composeVerificationResultVerificationResultPrimarySourceComponentInner(VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
57772      composeBackbone(element);
57773      if (element.hasWho()) {
57774        composeReference("who", element.getWho());
57775      }
57776      if (element.hasType()) {
57777        openArray("type");
57778        for (CodeableConcept e : element.getType()) 
57779          composeCodeableConcept(null, e);
57780        closeArray();
57781      };
57782      if (element.hasCommunicationMethod()) {
57783        openArray("communicationMethod");
57784        for (CodeableConcept e : element.getCommunicationMethod()) 
57785          composeCodeableConcept(null, e);
57786        closeArray();
57787      };
57788      if (element.hasValidationStatus()) {
57789        composeCodeableConcept("validationStatus", element.getValidationStatus());
57790      }
57791      if (element.hasValidationDateElement()) {
57792        composeDateTimeCore("validationDate", element.getValidationDateElement(), false);
57793        composeDateTimeExtras("validationDate", element.getValidationDateElement(), false);
57794      }
57795      if (element.hasCanPushUpdates()) {
57796        composeCodeableConcept("canPushUpdates", element.getCanPushUpdates());
57797      }
57798      if (element.hasPushTypeAvailable()) {
57799        openArray("pushTypeAvailable");
57800        for (CodeableConcept e : element.getPushTypeAvailable()) 
57801          composeCodeableConcept(null, e);
57802        closeArray();
57803      };
57804  }
57805
57806  protected void composeVerificationResultVerificationResultAttestationComponent(String name, VerificationResult.VerificationResultAttestationComponent element) throws IOException {
57807    if (element != null) {
57808      open(name);
57809      composeVerificationResultVerificationResultAttestationComponentInner(element);
57810      close();
57811    }
57812  }
57813
57814  protected void composeVerificationResultVerificationResultAttestationComponentInner(VerificationResult.VerificationResultAttestationComponent element) throws IOException {
57815      composeBackbone(element);
57816      if (element.hasWho()) {
57817        composeReference("who", element.getWho());
57818      }
57819      if (element.hasOnBehalfOf()) {
57820        composeReference("onBehalfOf", element.getOnBehalfOf());
57821      }
57822      if (element.hasCommunicationMethod()) {
57823        composeCodeableConcept("communicationMethod", element.getCommunicationMethod());
57824      }
57825      if (element.hasDateElement()) {
57826        composeDateCore("date", element.getDateElement(), false);
57827        composeDateExtras("date", element.getDateElement(), false);
57828      }
57829      if (element.hasSourceIdentityCertificateElement()) {
57830        composeStringCore("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
57831        composeStringExtras("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
57832      }
57833      if (element.hasProxyIdentityCertificateElement()) {
57834        composeStringCore("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
57835        composeStringExtras("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
57836      }
57837      if (element.hasProxySignature()) {
57838        composeSignature("proxySignature", element.getProxySignature());
57839      }
57840      if (element.hasSourceSignature()) {
57841        composeSignature("sourceSignature", element.getSourceSignature());
57842      }
57843  }
57844
57845  protected void composeVerificationResultVerificationResultValidatorComponent(String name, VerificationResult.VerificationResultValidatorComponent element) throws IOException {
57846    if (element != null) {
57847      open(name);
57848      composeVerificationResultVerificationResultValidatorComponentInner(element);
57849      close();
57850    }
57851  }
57852
57853  protected void composeVerificationResultVerificationResultValidatorComponentInner(VerificationResult.VerificationResultValidatorComponent element) throws IOException {
57854      composeBackbone(element);
57855      if (element.hasOrganization()) {
57856        composeReference("organization", element.getOrganization());
57857      }
57858      if (element.hasIdentityCertificateElement()) {
57859        composeStringCore("identityCertificate", element.getIdentityCertificateElement(), false);
57860        composeStringExtras("identityCertificate", element.getIdentityCertificateElement(), false);
57861      }
57862      if (element.hasAttestationSignature()) {
57863        composeSignature("attestationSignature", element.getAttestationSignature());
57864      }
57865  }
57866
57867  protected void composeVisionPrescription(String name, VisionPrescription element) throws IOException {
57868    if (element != null) {
57869      prop("resourceType", name);
57870      composeVisionPrescriptionInner(element);
57871    }
57872  }
57873
57874  protected void composeVisionPrescriptionInner(VisionPrescription element) throws IOException {
57875      composeDomainResourceElements(element);
57876      if (element.hasIdentifier()) {
57877        openArray("identifier");
57878        for (Identifier e : element.getIdentifier()) 
57879          composeIdentifier(null, e);
57880        closeArray();
57881      };
57882      if (element.hasStatusElement()) {
57883        composeEnumerationCore("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(), false);
57884        composeEnumerationExtras("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(), false);
57885      }
57886      if (element.hasCreatedElement()) {
57887        composeDateTimeCore("created", element.getCreatedElement(), false);
57888        composeDateTimeExtras("created", element.getCreatedElement(), false);
57889      }
57890      if (element.hasPatient()) {
57891        composeReference("patient", element.getPatient());
57892      }
57893      if (element.hasEncounter()) {
57894        composeReference("encounter", element.getEncounter());
57895      }
57896      if (element.hasDateWrittenElement()) {
57897        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
57898        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
57899      }
57900      if (element.hasPrescriber()) {
57901        composeReference("prescriber", element.getPrescriber());
57902      }
57903      if (element.hasLensSpecification()) {
57904        openArray("lensSpecification");
57905        for (VisionPrescription.VisionPrescriptionLensSpecificationComponent e : element.getLensSpecification()) 
57906          composeVisionPrescriptionVisionPrescriptionLensSpecificationComponent(null, e);
57907        closeArray();
57908      };
57909  }
57910
57911  protected void composeVisionPrescriptionVisionPrescriptionLensSpecificationComponent(String name, VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
57912    if (element != null) {
57913      open(name);
57914      composeVisionPrescriptionVisionPrescriptionLensSpecificationComponentInner(element);
57915      close();
57916    }
57917  }
57918
57919  protected void composeVisionPrescriptionVisionPrescriptionLensSpecificationComponentInner(VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
57920      composeBackbone(element);
57921      if (element.hasProduct()) {
57922        composeCodeableConcept("product", element.getProduct());
57923      }
57924      if (element.hasEyeElement()) {
57925        composeEnumerationCore("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
57926        composeEnumerationExtras("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
57927      }
57928      if (element.hasSphereElement()) {
57929        composeDecimalCore("sphere", element.getSphereElement(), false);
57930        composeDecimalExtras("sphere", element.getSphereElement(), false);
57931      }
57932      if (element.hasCylinderElement()) {
57933        composeDecimalCore("cylinder", element.getCylinderElement(), false);
57934        composeDecimalExtras("cylinder", element.getCylinderElement(), false);
57935      }
57936      if (element.hasAxisElement()) {
57937        composeIntegerCore("axis", element.getAxisElement(), false);
57938        composeIntegerExtras("axis", element.getAxisElement(), false);
57939      }
57940      if (element.hasPrism()) {
57941        openArray("prism");
57942        for (VisionPrescription.PrismComponent e : element.getPrism()) 
57943          composeVisionPrescriptionPrismComponent(null, e);
57944        closeArray();
57945      };
57946      if (element.hasAddElement()) {
57947        composeDecimalCore("add", element.getAddElement(), false);
57948        composeDecimalExtras("add", element.getAddElement(), false);
57949      }
57950      if (element.hasPowerElement()) {
57951        composeDecimalCore("power", element.getPowerElement(), false);
57952        composeDecimalExtras("power", element.getPowerElement(), false);
57953      }
57954      if (element.hasBackCurveElement()) {
57955        composeDecimalCore("backCurve", element.getBackCurveElement(), false);
57956        composeDecimalExtras("backCurve", element.getBackCurveElement(), false);
57957      }
57958      if (element.hasDiameterElement()) {
57959        composeDecimalCore("diameter", element.getDiameterElement(), false);
57960        composeDecimalExtras("diameter", element.getDiameterElement(), false);
57961      }
57962      if (element.hasDuration()) {
57963        composeQuantity("duration", element.getDuration());
57964      }
57965      if (element.hasColorElement()) {
57966        composeStringCore("color", element.getColorElement(), false);
57967        composeStringExtras("color", element.getColorElement(), false);
57968      }
57969      if (element.hasBrandElement()) {
57970        composeStringCore("brand", element.getBrandElement(), false);
57971        composeStringExtras("brand", element.getBrandElement(), false);
57972      }
57973      if (element.hasNote()) {
57974        openArray("note");
57975        for (Annotation e : element.getNote()) 
57976          composeAnnotation(null, e);
57977        closeArray();
57978      };
57979  }
57980
57981  protected void composeVisionPrescriptionPrismComponent(String name, VisionPrescription.PrismComponent element) throws IOException {
57982    if (element != null) {
57983      open(name);
57984      composeVisionPrescriptionPrismComponentInner(element);
57985      close();
57986    }
57987  }
57988
57989  protected void composeVisionPrescriptionPrismComponentInner(VisionPrescription.PrismComponent element) throws IOException {
57990      composeBackbone(element);
57991      if (element.hasAmountElement()) {
57992        composeDecimalCore("amount", element.getAmountElement(), false);
57993        composeDecimalExtras("amount", element.getAmountElement(), false);
57994      }
57995      if (element.hasBaseElement()) {
57996        composeEnumerationCore("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
57997        composeEnumerationExtras("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
57998      }
57999  }
58000
58001  @Override
58002  protected void composeResource(Resource resource) throws IOException {
58003    if (resource instanceof Parameters)
58004      composeParameters("Parameters", (Parameters)resource);
58005    else if (resource instanceof Account)
58006      composeAccount("Account", (Account)resource);
58007    else if (resource instanceof ActivityDefinition)
58008      composeActivityDefinition("ActivityDefinition", (ActivityDefinition)resource);
58009    else if (resource instanceof AdverseEvent)
58010      composeAdverseEvent("AdverseEvent", (AdverseEvent)resource);
58011    else if (resource instanceof AllergyIntolerance)
58012      composeAllergyIntolerance("AllergyIntolerance", (AllergyIntolerance)resource);
58013    else if (resource instanceof Appointment)
58014      composeAppointment("Appointment", (Appointment)resource);
58015    else if (resource instanceof AppointmentResponse)
58016      composeAppointmentResponse("AppointmentResponse", (AppointmentResponse)resource);
58017    else if (resource instanceof AuditEvent)
58018      composeAuditEvent("AuditEvent", (AuditEvent)resource);
58019    else if (resource instanceof Basic)
58020      composeBasic("Basic", (Basic)resource);
58021    else if (resource instanceof Binary)
58022      composeBinary("Binary", (Binary)resource);
58023    else if (resource instanceof BiologicallyDerivedProduct)
58024      composeBiologicallyDerivedProduct("BiologicallyDerivedProduct", (BiologicallyDerivedProduct)resource);
58025    else if (resource instanceof BodyStructure)
58026      composeBodyStructure("BodyStructure", (BodyStructure)resource);
58027    else if (resource instanceof Bundle)
58028      composeBundle("Bundle", (Bundle)resource);
58029    else if (resource instanceof CapabilityStatement)
58030      composeCapabilityStatement("CapabilityStatement", (CapabilityStatement)resource);
58031    else if (resource instanceof CarePlan)
58032      composeCarePlan("CarePlan", (CarePlan)resource);
58033    else if (resource instanceof CareTeam)
58034      composeCareTeam("CareTeam", (CareTeam)resource);
58035    else if (resource instanceof CatalogEntry)
58036      composeCatalogEntry("CatalogEntry", (CatalogEntry)resource);
58037    else if (resource instanceof ChargeItem)
58038      composeChargeItem("ChargeItem", (ChargeItem)resource);
58039    else if (resource instanceof ChargeItemDefinition)
58040      composeChargeItemDefinition("ChargeItemDefinition", (ChargeItemDefinition)resource);
58041    else if (resource instanceof Claim)
58042      composeClaim("Claim", (Claim)resource);
58043    else if (resource instanceof ClaimResponse)
58044      composeClaimResponse("ClaimResponse", (ClaimResponse)resource);
58045    else if (resource instanceof ClinicalImpression)
58046      composeClinicalImpression("ClinicalImpression", (ClinicalImpression)resource);
58047    else if (resource instanceof CodeSystem)
58048      composeCodeSystem("CodeSystem", (CodeSystem)resource);
58049    else if (resource instanceof Communication)
58050      composeCommunication("Communication", (Communication)resource);
58051    else if (resource instanceof CommunicationRequest)
58052      composeCommunicationRequest("CommunicationRequest", (CommunicationRequest)resource);
58053    else if (resource instanceof CompartmentDefinition)
58054      composeCompartmentDefinition("CompartmentDefinition", (CompartmentDefinition)resource);
58055    else if (resource instanceof Composition)
58056      composeComposition("Composition", (Composition)resource);
58057    else if (resource instanceof ConceptMap)
58058      composeConceptMap("ConceptMap", (ConceptMap)resource);
58059    else if (resource instanceof Condition)
58060      composeCondition("Condition", (Condition)resource);
58061    else if (resource instanceof Consent)
58062      composeConsent("Consent", (Consent)resource);
58063    else if (resource instanceof Contract)
58064      composeContract("Contract", (Contract)resource);
58065    else if (resource instanceof Coverage)
58066      composeCoverage("Coverage", (Coverage)resource);
58067    else if (resource instanceof CoverageEligibilityRequest)
58068      composeCoverageEligibilityRequest("CoverageEligibilityRequest", (CoverageEligibilityRequest)resource);
58069    else if (resource instanceof CoverageEligibilityResponse)
58070      composeCoverageEligibilityResponse("CoverageEligibilityResponse", (CoverageEligibilityResponse)resource);
58071    else if (resource instanceof DetectedIssue)
58072      composeDetectedIssue("DetectedIssue", (DetectedIssue)resource);
58073    else if (resource instanceof Device)
58074      composeDevice("Device", (Device)resource);
58075    else if (resource instanceof DeviceDefinition)
58076      composeDeviceDefinition("DeviceDefinition", (DeviceDefinition)resource);
58077    else if (resource instanceof DeviceMetric)
58078      composeDeviceMetric("DeviceMetric", (DeviceMetric)resource);
58079    else if (resource instanceof DeviceRequest)
58080      composeDeviceRequest("DeviceRequest", (DeviceRequest)resource);
58081    else if (resource instanceof DeviceUseStatement)
58082      composeDeviceUseStatement("DeviceUseStatement", (DeviceUseStatement)resource);
58083    else if (resource instanceof DiagnosticReport)
58084      composeDiagnosticReport("DiagnosticReport", (DiagnosticReport)resource);
58085    else if (resource instanceof DocumentManifest)
58086      composeDocumentManifest("DocumentManifest", (DocumentManifest)resource);
58087    else if (resource instanceof DocumentReference)
58088      composeDocumentReference("DocumentReference", (DocumentReference)resource);
58089    else if (resource instanceof EffectEvidenceSynthesis)
58090      composeEffectEvidenceSynthesis("EffectEvidenceSynthesis", (EffectEvidenceSynthesis)resource);
58091    else if (resource instanceof Encounter)
58092      composeEncounter("Encounter", (Encounter)resource);
58093    else if (resource instanceof Endpoint)
58094      composeEndpoint("Endpoint", (Endpoint)resource);
58095    else if (resource instanceof EnrollmentRequest)
58096      composeEnrollmentRequest("EnrollmentRequest", (EnrollmentRequest)resource);
58097    else if (resource instanceof EnrollmentResponse)
58098      composeEnrollmentResponse("EnrollmentResponse", (EnrollmentResponse)resource);
58099    else if (resource instanceof EpisodeOfCare)
58100      composeEpisodeOfCare("EpisodeOfCare", (EpisodeOfCare)resource);
58101    else if (resource instanceof EventDefinition)
58102      composeEventDefinition("EventDefinition", (EventDefinition)resource);
58103    else if (resource instanceof Evidence)
58104      composeEvidence("Evidence", (Evidence)resource);
58105    else if (resource instanceof EvidenceVariable)
58106      composeEvidenceVariable("EvidenceVariable", (EvidenceVariable)resource);
58107    else if (resource instanceof ExampleScenario)
58108      composeExampleScenario("ExampleScenario", (ExampleScenario)resource);
58109    else if (resource instanceof ExplanationOfBenefit)
58110      composeExplanationOfBenefit("ExplanationOfBenefit", (ExplanationOfBenefit)resource);
58111    else if (resource instanceof FamilyMemberHistory)
58112      composeFamilyMemberHistory("FamilyMemberHistory", (FamilyMemberHistory)resource);
58113    else if (resource instanceof Flag)
58114      composeFlag("Flag", (Flag)resource);
58115    else if (resource instanceof Goal)
58116      composeGoal("Goal", (Goal)resource);
58117    else if (resource instanceof GraphDefinition)
58118      composeGraphDefinition("GraphDefinition", (GraphDefinition)resource);
58119    else if (resource instanceof Group)
58120      composeGroup("Group", (Group)resource);
58121    else if (resource instanceof GuidanceResponse)
58122      composeGuidanceResponse("GuidanceResponse", (GuidanceResponse)resource);
58123    else if (resource instanceof HealthcareService)
58124      composeHealthcareService("HealthcareService", (HealthcareService)resource);
58125    else if (resource instanceof ImagingStudy)
58126      composeImagingStudy("ImagingStudy", (ImagingStudy)resource);
58127    else if (resource instanceof Immunization)
58128      composeImmunization("Immunization", (Immunization)resource);
58129    else if (resource instanceof ImmunizationEvaluation)
58130      composeImmunizationEvaluation("ImmunizationEvaluation", (ImmunizationEvaluation)resource);
58131    else if (resource instanceof ImmunizationRecommendation)
58132      composeImmunizationRecommendation("ImmunizationRecommendation", (ImmunizationRecommendation)resource);
58133    else if (resource instanceof ImplementationGuide)
58134      composeImplementationGuide("ImplementationGuide", (ImplementationGuide)resource);
58135    else if (resource instanceof InsurancePlan)
58136      composeInsurancePlan("InsurancePlan", (InsurancePlan)resource);
58137    else if (resource instanceof Invoice)
58138      composeInvoice("Invoice", (Invoice)resource);
58139    else if (resource instanceof Library)
58140      composeLibrary("Library", (Library)resource);
58141    else if (resource instanceof Linkage)
58142      composeLinkage("Linkage", (Linkage)resource);
58143    else if (resource instanceof ListResource)
58144      composeListResource("List", (ListResource)resource);
58145    else if (resource instanceof Location)
58146      composeLocation("Location", (Location)resource);
58147    else if (resource instanceof Measure)
58148      composeMeasure("Measure", (Measure)resource);
58149    else if (resource instanceof MeasureReport)
58150      composeMeasureReport("MeasureReport", (MeasureReport)resource);
58151    else if (resource instanceof Media)
58152      composeMedia("Media", (Media)resource);
58153    else if (resource instanceof Medication)
58154      composeMedication("Medication", (Medication)resource);
58155    else if (resource instanceof MedicationAdministration)
58156      composeMedicationAdministration("MedicationAdministration", (MedicationAdministration)resource);
58157    else if (resource instanceof MedicationDispense)
58158      composeMedicationDispense("MedicationDispense", (MedicationDispense)resource);
58159    else if (resource instanceof MedicationKnowledge)
58160      composeMedicationKnowledge("MedicationKnowledge", (MedicationKnowledge)resource);
58161    else if (resource instanceof MedicationRequest)
58162      composeMedicationRequest("MedicationRequest", (MedicationRequest)resource);
58163    else if (resource instanceof MedicationStatement)
58164      composeMedicationStatement("MedicationStatement", (MedicationStatement)resource);
58165    else if (resource instanceof MedicinalProduct)
58166      composeMedicinalProduct("MedicinalProduct", (MedicinalProduct)resource);
58167    else if (resource instanceof MedicinalProductAuthorization)
58168      composeMedicinalProductAuthorization("MedicinalProductAuthorization", (MedicinalProductAuthorization)resource);
58169    else if (resource instanceof MedicinalProductContraindication)
58170      composeMedicinalProductContraindication("MedicinalProductContraindication", (MedicinalProductContraindication)resource);
58171    else if (resource instanceof MedicinalProductIndication)
58172      composeMedicinalProductIndication("MedicinalProductIndication", (MedicinalProductIndication)resource);
58173    else if (resource instanceof MedicinalProductIngredient)
58174      composeMedicinalProductIngredient("MedicinalProductIngredient", (MedicinalProductIngredient)resource);
58175    else if (resource instanceof MedicinalProductInteraction)
58176      composeMedicinalProductInteraction("MedicinalProductInteraction", (MedicinalProductInteraction)resource);
58177    else if (resource instanceof MedicinalProductManufactured)
58178      composeMedicinalProductManufactured("MedicinalProductManufactured", (MedicinalProductManufactured)resource);
58179    else if (resource instanceof MedicinalProductPackaged)
58180      composeMedicinalProductPackaged("MedicinalProductPackaged", (MedicinalProductPackaged)resource);
58181    else if (resource instanceof MedicinalProductPharmaceutical)
58182      composeMedicinalProductPharmaceutical("MedicinalProductPharmaceutical", (MedicinalProductPharmaceutical)resource);
58183    else if (resource instanceof MedicinalProductUndesirableEffect)
58184      composeMedicinalProductUndesirableEffect("MedicinalProductUndesirableEffect", (MedicinalProductUndesirableEffect)resource);
58185    else if (resource instanceof MessageDefinition)
58186      composeMessageDefinition("MessageDefinition", (MessageDefinition)resource);
58187    else if (resource instanceof MessageHeader)
58188      composeMessageHeader("MessageHeader", (MessageHeader)resource);
58189    else if (resource instanceof MolecularSequence)
58190      composeMolecularSequence("MolecularSequence", (MolecularSequence)resource);
58191    else if (resource instanceof NamingSystem)
58192      composeNamingSystem("NamingSystem", (NamingSystem)resource);
58193    else if (resource instanceof NutritionOrder)
58194      composeNutritionOrder("NutritionOrder", (NutritionOrder)resource);
58195    else if (resource instanceof Observation)
58196      composeObservation("Observation", (Observation)resource);
58197    else if (resource instanceof ObservationDefinition)
58198      composeObservationDefinition("ObservationDefinition", (ObservationDefinition)resource);
58199    else if (resource instanceof OperationDefinition)
58200      composeOperationDefinition("OperationDefinition", (OperationDefinition)resource);
58201    else if (resource instanceof OperationOutcome)
58202      composeOperationOutcome("OperationOutcome", (OperationOutcome)resource);
58203    else if (resource instanceof Organization)
58204      composeOrganization("Organization", (Organization)resource);
58205    else if (resource instanceof OrganizationAffiliation)
58206      composeOrganizationAffiliation("OrganizationAffiliation", (OrganizationAffiliation)resource);
58207    else if (resource instanceof Patient)
58208      composePatient("Patient", (Patient)resource);
58209    else if (resource instanceof PaymentNotice)
58210      composePaymentNotice("PaymentNotice", (PaymentNotice)resource);
58211    else if (resource instanceof PaymentReconciliation)
58212      composePaymentReconciliation("PaymentReconciliation", (PaymentReconciliation)resource);
58213    else if (resource instanceof Person)
58214      composePerson("Person", (Person)resource);
58215    else if (resource instanceof PlanDefinition)
58216      composePlanDefinition("PlanDefinition", (PlanDefinition)resource);
58217    else if (resource instanceof Practitioner)
58218      composePractitioner("Practitioner", (Practitioner)resource);
58219    else if (resource instanceof PractitionerRole)
58220      composePractitionerRole("PractitionerRole", (PractitionerRole)resource);
58221    else if (resource instanceof Procedure)
58222      composeProcedure("Procedure", (Procedure)resource);
58223    else if (resource instanceof Provenance)
58224      composeProvenance("Provenance", (Provenance)resource);
58225    else if (resource instanceof Questionnaire)
58226      composeQuestionnaire("Questionnaire", (Questionnaire)resource);
58227    else if (resource instanceof QuestionnaireResponse)
58228      composeQuestionnaireResponse("QuestionnaireResponse", (QuestionnaireResponse)resource);
58229    else if (resource instanceof RelatedPerson)
58230      composeRelatedPerson("RelatedPerson", (RelatedPerson)resource);
58231    else if (resource instanceof RequestGroup)
58232      composeRequestGroup("RequestGroup", (RequestGroup)resource);
58233    else if (resource instanceof ResearchDefinition)
58234      composeResearchDefinition("ResearchDefinition", (ResearchDefinition)resource);
58235    else if (resource instanceof ResearchElementDefinition)
58236      composeResearchElementDefinition("ResearchElementDefinition", (ResearchElementDefinition)resource);
58237    else if (resource instanceof ResearchStudy)
58238      composeResearchStudy("ResearchStudy", (ResearchStudy)resource);
58239    else if (resource instanceof ResearchSubject)
58240      composeResearchSubject("ResearchSubject", (ResearchSubject)resource);
58241    else if (resource instanceof RiskAssessment)
58242      composeRiskAssessment("RiskAssessment", (RiskAssessment)resource);
58243    else if (resource instanceof RiskEvidenceSynthesis)
58244      composeRiskEvidenceSynthesis("RiskEvidenceSynthesis", (RiskEvidenceSynthesis)resource);
58245    else if (resource instanceof Schedule)
58246      composeSchedule("Schedule", (Schedule)resource);
58247    else if (resource instanceof SearchParameter)
58248      composeSearchParameter("SearchParameter", (SearchParameter)resource);
58249    else if (resource instanceof ServiceRequest)
58250      composeServiceRequest("ServiceRequest", (ServiceRequest)resource);
58251    else if (resource instanceof Slot)
58252      composeSlot("Slot", (Slot)resource);
58253    else if (resource instanceof Specimen)
58254      composeSpecimen("Specimen", (Specimen)resource);
58255    else if (resource instanceof SpecimenDefinition)
58256      composeSpecimenDefinition("SpecimenDefinition", (SpecimenDefinition)resource);
58257    else if (resource instanceof StructureDefinition)
58258      composeStructureDefinition("StructureDefinition", (StructureDefinition)resource);
58259    else if (resource instanceof StructureMap)
58260      composeStructureMap("StructureMap", (StructureMap)resource);
58261    else if (resource instanceof Subscription)
58262      composeSubscription("Subscription", (Subscription)resource);
58263    else if (resource instanceof Substance)
58264      composeSubstance("Substance", (Substance)resource);
58265    else if (resource instanceof SubstanceNucleicAcid)
58266      composeSubstanceNucleicAcid("SubstanceNucleicAcid", (SubstanceNucleicAcid)resource);
58267    else if (resource instanceof SubstancePolymer)
58268      composeSubstancePolymer("SubstancePolymer", (SubstancePolymer)resource);
58269    else if (resource instanceof SubstanceProtein)
58270      composeSubstanceProtein("SubstanceProtein", (SubstanceProtein)resource);
58271    else if (resource instanceof SubstanceReferenceInformation)
58272      composeSubstanceReferenceInformation("SubstanceReferenceInformation", (SubstanceReferenceInformation)resource);
58273    else if (resource instanceof SubstanceSourceMaterial)
58274      composeSubstanceSourceMaterial("SubstanceSourceMaterial", (SubstanceSourceMaterial)resource);
58275    else if (resource instanceof SubstanceSpecification)
58276      composeSubstanceSpecification("SubstanceSpecification", (SubstanceSpecification)resource);
58277    else if (resource instanceof SupplyDelivery)
58278      composeSupplyDelivery("SupplyDelivery", (SupplyDelivery)resource);
58279    else if (resource instanceof SupplyRequest)
58280      composeSupplyRequest("SupplyRequest", (SupplyRequest)resource);
58281    else if (resource instanceof Task)
58282      composeTask("Task", (Task)resource);
58283    else if (resource instanceof TerminologyCapabilities)
58284      composeTerminologyCapabilities("TerminologyCapabilities", (TerminologyCapabilities)resource);
58285    else if (resource instanceof TestReport)
58286      composeTestReport("TestReport", (TestReport)resource);
58287    else if (resource instanceof TestScript)
58288      composeTestScript("TestScript", (TestScript)resource);
58289    else if (resource instanceof ValueSet)
58290      composeValueSet("ValueSet", (ValueSet)resource);
58291    else if (resource instanceof VerificationResult)
58292      composeVerificationResult("VerificationResult", (VerificationResult)resource);
58293    else if (resource instanceof VisionPrescription)
58294      composeVisionPrescription("VisionPrescription", (VisionPrescription)resource);
58295    else if (resource instanceof Binary)
58296      composeBinary("Binary", (Binary)resource);
58297    else
58298      throw new Error("Unhandled resource type "+resource.getClass().getName());
58299  }
58300
58301  protected void composeNamedReference(String name, Resource resource) throws IOException {
58302    if (resource instanceof Parameters)
58303      composeParameters(name, (Parameters)resource);
58304    else if (resource instanceof Account)
58305      composeAccount(name, (Account)resource);
58306    else if (resource instanceof ActivityDefinition)
58307      composeActivityDefinition(name, (ActivityDefinition)resource);
58308    else if (resource instanceof AdverseEvent)
58309      composeAdverseEvent(name, (AdverseEvent)resource);
58310    else if (resource instanceof AllergyIntolerance)
58311      composeAllergyIntolerance(name, (AllergyIntolerance)resource);
58312    else if (resource instanceof Appointment)
58313      composeAppointment(name, (Appointment)resource);
58314    else if (resource instanceof AppointmentResponse)
58315      composeAppointmentResponse(name, (AppointmentResponse)resource);
58316    else if (resource instanceof AuditEvent)
58317      composeAuditEvent(name, (AuditEvent)resource);
58318    else if (resource instanceof Basic)
58319      composeBasic(name, (Basic)resource);
58320    else if (resource instanceof Binary)
58321      composeBinary(name, (Binary)resource);
58322    else if (resource instanceof BiologicallyDerivedProduct)
58323      composeBiologicallyDerivedProduct(name, (BiologicallyDerivedProduct)resource);
58324    else if (resource instanceof BodyStructure)
58325      composeBodyStructure(name, (BodyStructure)resource);
58326    else if (resource instanceof Bundle)
58327      composeBundle(name, (Bundle)resource);
58328    else if (resource instanceof CapabilityStatement)
58329      composeCapabilityStatement(name, (CapabilityStatement)resource);
58330    else if (resource instanceof CarePlan)
58331      composeCarePlan(name, (CarePlan)resource);
58332    else if (resource instanceof CareTeam)
58333      composeCareTeam(name, (CareTeam)resource);
58334    else if (resource instanceof CatalogEntry)
58335      composeCatalogEntry(name, (CatalogEntry)resource);
58336    else if (resource instanceof ChargeItem)
58337      composeChargeItem(name, (ChargeItem)resource);
58338    else if (resource instanceof ChargeItemDefinition)
58339      composeChargeItemDefinition(name, (ChargeItemDefinition)resource);
58340    else if (resource instanceof Claim)
58341      composeClaim(name, (Claim)resource);
58342    else if (resource instanceof ClaimResponse)
58343      composeClaimResponse(name, (ClaimResponse)resource);
58344    else if (resource instanceof ClinicalImpression)
58345      composeClinicalImpression(name, (ClinicalImpression)resource);
58346    else if (resource instanceof CodeSystem)
58347      composeCodeSystem(name, (CodeSystem)resource);
58348    else if (resource instanceof Communication)
58349      composeCommunication(name, (Communication)resource);
58350    else if (resource instanceof CommunicationRequest)
58351      composeCommunicationRequest(name, (CommunicationRequest)resource);
58352    else if (resource instanceof CompartmentDefinition)
58353      composeCompartmentDefinition(name, (CompartmentDefinition)resource);
58354    else if (resource instanceof Composition)
58355      composeComposition(name, (Composition)resource);
58356    else if (resource instanceof ConceptMap)
58357      composeConceptMap(name, (ConceptMap)resource);
58358    else if (resource instanceof Condition)
58359      composeCondition(name, (Condition)resource);
58360    else if (resource instanceof Consent)
58361      composeConsent(name, (Consent)resource);
58362    else if (resource instanceof Contract)
58363      composeContract(name, (Contract)resource);
58364    else if (resource instanceof Coverage)
58365      composeCoverage(name, (Coverage)resource);
58366    else if (resource instanceof CoverageEligibilityRequest)
58367      composeCoverageEligibilityRequest(name, (CoverageEligibilityRequest)resource);
58368    else if (resource instanceof CoverageEligibilityResponse)
58369      composeCoverageEligibilityResponse(name, (CoverageEligibilityResponse)resource);
58370    else if (resource instanceof DetectedIssue)
58371      composeDetectedIssue(name, (DetectedIssue)resource);
58372    else if (resource instanceof Device)
58373      composeDevice(name, (Device)resource);
58374    else if (resource instanceof DeviceDefinition)
58375      composeDeviceDefinition(name, (DeviceDefinition)resource);
58376    else if (resource instanceof DeviceMetric)
58377      composeDeviceMetric(name, (DeviceMetric)resource);
58378    else if (resource instanceof DeviceRequest)
58379      composeDeviceRequest(name, (DeviceRequest)resource);
58380    else if (resource instanceof DeviceUseStatement)
58381      composeDeviceUseStatement(name, (DeviceUseStatement)resource);
58382    else if (resource instanceof DiagnosticReport)
58383      composeDiagnosticReport(name, (DiagnosticReport)resource);
58384    else if (resource instanceof DocumentManifest)
58385      composeDocumentManifest(name, (DocumentManifest)resource);
58386    else if (resource instanceof DocumentReference)
58387      composeDocumentReference(name, (DocumentReference)resource);
58388    else if (resource instanceof EffectEvidenceSynthesis)
58389      composeEffectEvidenceSynthesis(name, (EffectEvidenceSynthesis)resource);
58390    else if (resource instanceof Encounter)
58391      composeEncounter(name, (Encounter)resource);
58392    else if (resource instanceof Endpoint)
58393      composeEndpoint(name, (Endpoint)resource);
58394    else if (resource instanceof EnrollmentRequest)
58395      composeEnrollmentRequest(name, (EnrollmentRequest)resource);
58396    else if (resource instanceof EnrollmentResponse)
58397      composeEnrollmentResponse(name, (EnrollmentResponse)resource);
58398    else if (resource instanceof EpisodeOfCare)
58399      composeEpisodeOfCare(name, (EpisodeOfCare)resource);
58400    else if (resource instanceof EventDefinition)
58401      composeEventDefinition(name, (EventDefinition)resource);
58402    else if (resource instanceof Evidence)
58403      composeEvidence(name, (Evidence)resource);
58404    else if (resource instanceof EvidenceVariable)
58405      composeEvidenceVariable(name, (EvidenceVariable)resource);
58406    else if (resource instanceof ExampleScenario)
58407      composeExampleScenario(name, (ExampleScenario)resource);
58408    else if (resource instanceof ExplanationOfBenefit)
58409      composeExplanationOfBenefit(name, (ExplanationOfBenefit)resource);
58410    else if (resource instanceof FamilyMemberHistory)
58411      composeFamilyMemberHistory(name, (FamilyMemberHistory)resource);
58412    else if (resource instanceof Flag)
58413      composeFlag(name, (Flag)resource);
58414    else if (resource instanceof Goal)
58415      composeGoal(name, (Goal)resource);
58416    else if (resource instanceof GraphDefinition)
58417      composeGraphDefinition(name, (GraphDefinition)resource);
58418    else if (resource instanceof Group)
58419      composeGroup(name, (Group)resource);
58420    else if (resource instanceof GuidanceResponse)
58421      composeGuidanceResponse(name, (GuidanceResponse)resource);
58422    else if (resource instanceof HealthcareService)
58423      composeHealthcareService(name, (HealthcareService)resource);
58424    else if (resource instanceof ImagingStudy)
58425      composeImagingStudy(name, (ImagingStudy)resource);
58426    else if (resource instanceof Immunization)
58427      composeImmunization(name, (Immunization)resource);
58428    else if (resource instanceof ImmunizationEvaluation)
58429      composeImmunizationEvaluation(name, (ImmunizationEvaluation)resource);
58430    else if (resource instanceof ImmunizationRecommendation)
58431      composeImmunizationRecommendation(name, (ImmunizationRecommendation)resource);
58432    else if (resource instanceof ImplementationGuide)
58433      composeImplementationGuide(name, (ImplementationGuide)resource);
58434    else if (resource instanceof InsurancePlan)
58435      composeInsurancePlan(name, (InsurancePlan)resource);
58436    else if (resource instanceof Invoice)
58437      composeInvoice(name, (Invoice)resource);
58438    else if (resource instanceof Library)
58439      composeLibrary(name, (Library)resource);
58440    else if (resource instanceof Linkage)
58441      composeLinkage(name, (Linkage)resource);
58442    else if (resource instanceof ListResource)
58443      composeListResource(name, (ListResource)resource);
58444    else if (resource instanceof Location)
58445      composeLocation(name, (Location)resource);
58446    else if (resource instanceof Measure)
58447      composeMeasure(name, (Measure)resource);
58448    else if (resource instanceof MeasureReport)
58449      composeMeasureReport(name, (MeasureReport)resource);
58450    else if (resource instanceof Media)
58451      composeMedia(name, (Media)resource);
58452    else if (resource instanceof Medication)
58453      composeMedication(name, (Medication)resource);
58454    else if (resource instanceof MedicationAdministration)
58455      composeMedicationAdministration(name, (MedicationAdministration)resource);
58456    else if (resource instanceof MedicationDispense)
58457      composeMedicationDispense(name, (MedicationDispense)resource);
58458    else if (resource instanceof MedicationKnowledge)
58459      composeMedicationKnowledge(name, (MedicationKnowledge)resource);
58460    else if (resource instanceof MedicationRequest)
58461      composeMedicationRequest(name, (MedicationRequest)resource);
58462    else if (resource instanceof MedicationStatement)
58463      composeMedicationStatement(name, (MedicationStatement)resource);
58464    else if (resource instanceof MedicinalProduct)
58465      composeMedicinalProduct(name, (MedicinalProduct)resource);
58466    else if (resource instanceof MedicinalProductAuthorization)
58467      composeMedicinalProductAuthorization(name, (MedicinalProductAuthorization)resource);
58468    else if (resource instanceof MedicinalProductContraindication)
58469      composeMedicinalProductContraindication(name, (MedicinalProductContraindication)resource);
58470    else if (resource instanceof MedicinalProductIndication)
58471      composeMedicinalProductIndication(name, (MedicinalProductIndication)resource);
58472    else if (resource instanceof MedicinalProductIngredient)
58473      composeMedicinalProductIngredient(name, (MedicinalProductIngredient)resource);
58474    else if (resource instanceof MedicinalProductInteraction)
58475      composeMedicinalProductInteraction(name, (MedicinalProductInteraction)resource);
58476    else if (resource instanceof MedicinalProductManufactured)
58477      composeMedicinalProductManufactured(name, (MedicinalProductManufactured)resource);
58478    else if (resource instanceof MedicinalProductPackaged)
58479      composeMedicinalProductPackaged(name, (MedicinalProductPackaged)resource);
58480    else if (resource instanceof MedicinalProductPharmaceutical)
58481      composeMedicinalProductPharmaceutical(name, (MedicinalProductPharmaceutical)resource);
58482    else if (resource instanceof MedicinalProductUndesirableEffect)
58483      composeMedicinalProductUndesirableEffect(name, (MedicinalProductUndesirableEffect)resource);
58484    else if (resource instanceof MessageDefinition)
58485      composeMessageDefinition(name, (MessageDefinition)resource);
58486    else if (resource instanceof MessageHeader)
58487      composeMessageHeader(name, (MessageHeader)resource);
58488    else if (resource instanceof MolecularSequence)
58489      composeMolecularSequence(name, (MolecularSequence)resource);
58490    else if (resource instanceof NamingSystem)
58491      composeNamingSystem(name, (NamingSystem)resource);
58492    else if (resource instanceof NutritionOrder)
58493      composeNutritionOrder(name, (NutritionOrder)resource);
58494    else if (resource instanceof Observation)
58495      composeObservation(name, (Observation)resource);
58496    else if (resource instanceof ObservationDefinition)
58497      composeObservationDefinition(name, (ObservationDefinition)resource);
58498    else if (resource instanceof OperationDefinition)
58499      composeOperationDefinition(name, (OperationDefinition)resource);
58500    else if (resource instanceof OperationOutcome)
58501      composeOperationOutcome(name, (OperationOutcome)resource);
58502    else if (resource instanceof Organization)
58503      composeOrganization(name, (Organization)resource);
58504    else if (resource instanceof OrganizationAffiliation)
58505      composeOrganizationAffiliation(name, (OrganizationAffiliation)resource);
58506    else if (resource instanceof Patient)
58507      composePatient(name, (Patient)resource);
58508    else if (resource instanceof PaymentNotice)
58509      composePaymentNotice(name, (PaymentNotice)resource);
58510    else if (resource instanceof PaymentReconciliation)
58511      composePaymentReconciliation(name, (PaymentReconciliation)resource);
58512    else if (resource instanceof Person)
58513      composePerson(name, (Person)resource);
58514    else if (resource instanceof PlanDefinition)
58515      composePlanDefinition(name, (PlanDefinition)resource);
58516    else if (resource instanceof Practitioner)
58517      composePractitioner(name, (Practitioner)resource);
58518    else if (resource instanceof PractitionerRole)
58519      composePractitionerRole(name, (PractitionerRole)resource);
58520    else if (resource instanceof Procedure)
58521      composeProcedure(name, (Procedure)resource);
58522    else if (resource instanceof Provenance)
58523      composeProvenance(name, (Provenance)resource);
58524    else if (resource instanceof Questionnaire)
58525      composeQuestionnaire(name, (Questionnaire)resource);
58526    else if (resource instanceof QuestionnaireResponse)
58527      composeQuestionnaireResponse(name, (QuestionnaireResponse)resource);
58528    else if (resource instanceof RelatedPerson)
58529      composeRelatedPerson(name, (RelatedPerson)resource);
58530    else if (resource instanceof RequestGroup)
58531      composeRequestGroup(name, (RequestGroup)resource);
58532    else if (resource instanceof ResearchDefinition)
58533      composeResearchDefinition(name, (ResearchDefinition)resource);
58534    else if (resource instanceof ResearchElementDefinition)
58535      composeResearchElementDefinition(name, (ResearchElementDefinition)resource);
58536    else if (resource instanceof ResearchStudy)
58537      composeResearchStudy(name, (ResearchStudy)resource);
58538    else if (resource instanceof ResearchSubject)
58539      composeResearchSubject(name, (ResearchSubject)resource);
58540    else if (resource instanceof RiskAssessment)
58541      composeRiskAssessment(name, (RiskAssessment)resource);
58542    else if (resource instanceof RiskEvidenceSynthesis)
58543      composeRiskEvidenceSynthesis(name, (RiskEvidenceSynthesis)resource);
58544    else if (resource instanceof Schedule)
58545      composeSchedule(name, (Schedule)resource);
58546    else if (resource instanceof SearchParameter)
58547      composeSearchParameter(name, (SearchParameter)resource);
58548    else if (resource instanceof ServiceRequest)
58549      composeServiceRequest(name, (ServiceRequest)resource);
58550    else if (resource instanceof Slot)
58551      composeSlot(name, (Slot)resource);
58552    else if (resource instanceof Specimen)
58553      composeSpecimen(name, (Specimen)resource);
58554    else if (resource instanceof SpecimenDefinition)
58555      composeSpecimenDefinition(name, (SpecimenDefinition)resource);
58556    else if (resource instanceof StructureDefinition)
58557      composeStructureDefinition(name, (StructureDefinition)resource);
58558    else if (resource instanceof StructureMap)
58559      composeStructureMap(name, (StructureMap)resource);
58560    else if (resource instanceof Subscription)
58561      composeSubscription(name, (Subscription)resource);
58562    else if (resource instanceof Substance)
58563      composeSubstance(name, (Substance)resource);
58564    else if (resource instanceof SubstanceNucleicAcid)
58565      composeSubstanceNucleicAcid(name, (SubstanceNucleicAcid)resource);
58566    else if (resource instanceof SubstancePolymer)
58567      composeSubstancePolymer(name, (SubstancePolymer)resource);
58568    else if (resource instanceof SubstanceProtein)
58569      composeSubstanceProtein(name, (SubstanceProtein)resource);
58570    else if (resource instanceof SubstanceReferenceInformation)
58571      composeSubstanceReferenceInformation(name, (SubstanceReferenceInformation)resource);
58572    else if (resource instanceof SubstanceSourceMaterial)
58573      composeSubstanceSourceMaterial(name, (SubstanceSourceMaterial)resource);
58574    else if (resource instanceof SubstanceSpecification)
58575      composeSubstanceSpecification(name, (SubstanceSpecification)resource);
58576    else if (resource instanceof SupplyDelivery)
58577      composeSupplyDelivery(name, (SupplyDelivery)resource);
58578    else if (resource instanceof SupplyRequest)
58579      composeSupplyRequest(name, (SupplyRequest)resource);
58580    else if (resource instanceof Task)
58581      composeTask(name, (Task)resource);
58582    else if (resource instanceof TerminologyCapabilities)
58583      composeTerminologyCapabilities(name, (TerminologyCapabilities)resource);
58584    else if (resource instanceof TestReport)
58585      composeTestReport(name, (TestReport)resource);
58586    else if (resource instanceof TestScript)
58587      composeTestScript(name, (TestScript)resource);
58588    else if (resource instanceof ValueSet)
58589      composeValueSet(name, (ValueSet)resource);
58590    else if (resource instanceof VerificationResult)
58591      composeVerificationResult(name, (VerificationResult)resource);
58592    else if (resource instanceof VisionPrescription)
58593      composeVisionPrescription(name, (VisionPrescription)resource);
58594    else if (resource instanceof Binary)
58595      composeBinary(name, (Binary)resource);
58596    else
58597      throw new Error("Unhandled resource type "+resource.getClass().getName());
58598  }
58599
58600  protected void composeType(String prefix, Type type) throws IOException {
58601    if (type == null)
58602      ;
58603    else if (type instanceof Extension)
58604       composeExtension(prefix+"Extension", (Extension) type);
58605    else if (type instanceof Narrative)
58606       composeNarrative(prefix+"Narrative", (Narrative) type);
58607    else if (type instanceof Count)
58608       composeCount(prefix+"Count", (Count) type);
58609    else if (type instanceof Dosage)
58610       composeDosage(prefix+"Dosage", (Dosage) type);
58611    else if (type instanceof MarketingStatus)
58612       composeMarketingStatus(prefix+"MarketingStatus", (MarketingStatus) type);
58613    else if (type instanceof SubstanceAmount)
58614       composeSubstanceAmount(prefix+"SubstanceAmount", (SubstanceAmount) type);
58615    else if (type instanceof Population)
58616       composePopulation(prefix+"Population", (Population) type);
58617    else if (type instanceof Distance)
58618       composeDistance(prefix+"Distance", (Distance) type);
58619    else if (type instanceof Age)
58620       composeAge(prefix+"Age", (Age) type);
58621    else if (type instanceof Duration)
58622       composeDuration(prefix+"Duration", (Duration) type);
58623    else if (type instanceof ProductShelfLife)
58624       composeProductShelfLife(prefix+"ProductShelfLife", (ProductShelfLife) type);
58625    else if (type instanceof Timing)
58626       composeTiming(prefix+"Timing", (Timing) type);
58627    else if (type instanceof ProdCharacteristic)
58628       composeProdCharacteristic(prefix+"ProdCharacteristic", (ProdCharacteristic) type);
58629    else if (type instanceof Meta)
58630       composeMeta(prefix+"Meta", (Meta) type);
58631    else if (type instanceof Address)
58632       composeAddress(prefix+"Address", (Address) type);
58633    else if (type instanceof Contributor)
58634       composeContributor(prefix+"Contributor", (Contributor) type);
58635    else if (type instanceof Attachment)
58636       composeAttachment(prefix+"Attachment", (Attachment) type);
58637    else if (type instanceof DataRequirement)
58638       composeDataRequirement(prefix+"DataRequirement", (DataRequirement) type);
58639    else if (type instanceof Money)
58640       composeMoney(prefix+"Money", (Money) type);
58641    else if (type instanceof HumanName)
58642       composeHumanName(prefix+"HumanName", (HumanName) type);
58643    else if (type instanceof ContactPoint)
58644       composeContactPoint(prefix+"ContactPoint", (ContactPoint) type);
58645    else if (type instanceof Identifier)
58646       composeIdentifier(prefix+"Identifier", (Identifier) type);
58647    else if (type instanceof Coding)
58648       composeCoding(prefix+"Coding", (Coding) type);
58649    else if (type instanceof SampledData)
58650       composeSampledData(prefix+"SampledData", (SampledData) type);
58651    else if (type instanceof Ratio)
58652       composeRatio(prefix+"Ratio", (Ratio) type);
58653    else if (type instanceof Reference)
58654       composeReference(prefix+"Reference", (Reference) type);
58655    else if (type instanceof TriggerDefinition)
58656       composeTriggerDefinition(prefix+"TriggerDefinition", (TriggerDefinition) type);
58657    else if (type instanceof Quantity)
58658       composeQuantity(prefix+"Quantity", (Quantity) type);
58659    else if (type instanceof Period)
58660       composePeriod(prefix+"Period", (Period) type);
58661    else if (type instanceof Range)
58662       composeRange(prefix+"Range", (Range) type);
58663    else if (type instanceof RelatedArtifact)
58664       composeRelatedArtifact(prefix+"RelatedArtifact", (RelatedArtifact) type);
58665    else if (type instanceof Annotation)
58666       composeAnnotation(prefix+"Annotation", (Annotation) type);
58667    else if (type instanceof ContactDetail)
58668       composeContactDetail(prefix+"ContactDetail", (ContactDetail) type);
58669    else if (type instanceof UsageContext)
58670       composeUsageContext(prefix+"UsageContext", (UsageContext) type);
58671    else if (type instanceof Expression)
58672       composeExpression(prefix+"Expression", (Expression) type);
58673    else if (type instanceof Signature)
58674       composeSignature(prefix+"Signature", (Signature) type);
58675    else if (type instanceof CodeableConcept)
58676       composeCodeableConcept(prefix+"CodeableConcept", (CodeableConcept) type);
58677    else if (type instanceof ParameterDefinition)
58678       composeParameterDefinition(prefix+"ParameterDefinition", (ParameterDefinition) type);
58679    else if (type instanceof CodeType) {
58680      composeCodeCore(prefix+"Code", (CodeType) type, false);
58681      composeCodeExtras(prefix+"Code", (CodeType) type, false);
58682    }
58683    else if (type instanceof OidType) {
58684      composeOidCore(prefix+"Oid", (OidType) type, false);
58685      composeOidExtras(prefix+"Oid", (OidType) type, false);
58686    }
58687    else if (type instanceof CanonicalType) {
58688      composeCanonicalCore(prefix+"Canonical", (CanonicalType) type, false);
58689      composeCanonicalExtras(prefix+"Canonical", (CanonicalType) type, false);
58690    }
58691    else if (type instanceof UuidType) {
58692      composeUuidCore(prefix+"Uuid", (UuidType) type, false);
58693      composeUuidExtras(prefix+"Uuid", (UuidType) type, false);
58694    }
58695    else if (type instanceof UrlType) {
58696      composeUrlCore(prefix+"Url", (UrlType) type, false);
58697      composeUrlExtras(prefix+"Url", (UrlType) type, false);
58698    }
58699    else if (type instanceof UnsignedIntType) {
58700      composeUnsignedIntCore(prefix+"UnsignedInt", (UnsignedIntType) type, false);
58701      composeUnsignedIntExtras(prefix+"UnsignedInt", (UnsignedIntType) type, false);
58702    }
58703    else if (type instanceof MarkdownType) {
58704      composeMarkdownCore(prefix+"Markdown", (MarkdownType) type, false);
58705      composeMarkdownExtras(prefix+"Markdown", (MarkdownType) type, false);
58706    }
58707    else if (type instanceof IdType) {
58708      composeIdCore(prefix+"Id", (IdType) type, false);
58709      composeIdExtras(prefix+"Id", (IdType) type, false);
58710    }
58711    else if (type instanceof PositiveIntType) {
58712      composePositiveIntCore(prefix+"PositiveInt", (PositiveIntType) type, false);
58713      composePositiveIntExtras(prefix+"PositiveInt", (PositiveIntType) type, false);
58714    }
58715    else if (type instanceof DateType) {
58716      composeDateCore(prefix+"Date", (DateType) type, false);
58717      composeDateExtras(prefix+"Date", (DateType) type, false);
58718    }
58719    else if (type instanceof DateTimeType) {
58720      composeDateTimeCore(prefix+"DateTime", (DateTimeType) type, false);
58721      composeDateTimeExtras(prefix+"DateTime", (DateTimeType) type, false);
58722    }
58723    else if (type instanceof StringType) {
58724      composeStringCore(prefix+"String", (StringType) type, false);
58725      composeStringExtras(prefix+"String", (StringType) type, false);
58726    }
58727    else if (type instanceof IntegerType) {
58728      composeIntegerCore(prefix+"Integer", (IntegerType) type, false);
58729      composeIntegerExtras(prefix+"Integer", (IntegerType) type, false);
58730    }
58731    else if (type instanceof UriType) {
58732      composeUriCore(prefix+"Uri", (UriType) type, false);
58733      composeUriExtras(prefix+"Uri", (UriType) type, false);
58734    }
58735    else if (type instanceof InstantType) {
58736      composeInstantCore(prefix+"Instant", (InstantType) type, false);
58737      composeInstantExtras(prefix+"Instant", (InstantType) type, false);
58738    }
58739    else if (type instanceof BooleanType) {
58740      composeBooleanCore(prefix+"Boolean", (BooleanType) type, false);
58741      composeBooleanExtras(prefix+"Boolean", (BooleanType) type, false);
58742    }
58743    else if (type instanceof Base64BinaryType) {
58744      composeBase64BinaryCore(prefix+"Base64Binary", (Base64BinaryType) type, false);
58745      composeBase64BinaryExtras(prefix+"Base64Binary", (Base64BinaryType) type, false);
58746    }
58747    else if (type instanceof TimeType) {
58748      composeTimeCore(prefix+"Time", (TimeType) type, false);
58749      composeTimeExtras(prefix+"Time", (TimeType) type, false);
58750    }
58751    else if (type instanceof DecimalType) {
58752      composeDecimalCore(prefix+"Decimal", (DecimalType) type, false);
58753      composeDecimalExtras(prefix+"Decimal", (DecimalType) type, false);
58754    }
58755    else
58756      throw new Error("Unhandled type");
58757  }
58758
58759  protected void composeTypeInner(Type type) throws IOException {
58760    if (type == null)
58761      ;
58762    else if (type instanceof Extension)
58763       composeExtensionInner((Extension) type);
58764    else if (type instanceof Narrative)
58765       composeNarrativeInner((Narrative) type);
58766    else if (type instanceof Count)
58767       composeCountInner((Count) type);
58768    else if (type instanceof Dosage)
58769       composeDosageInner((Dosage) type);
58770    else if (type instanceof MarketingStatus)
58771       composeMarketingStatusInner((MarketingStatus) type);
58772    else if (type instanceof SubstanceAmount)
58773       composeSubstanceAmountInner((SubstanceAmount) type);
58774    else if (type instanceof Population)
58775       composePopulationInner((Population) type);
58776    else if (type instanceof Distance)
58777       composeDistanceInner((Distance) type);
58778    else if (type instanceof Age)
58779       composeAgeInner((Age) type);
58780    else if (type instanceof Duration)
58781       composeDurationInner((Duration) type);
58782    else if (type instanceof ProductShelfLife)
58783       composeProductShelfLifeInner((ProductShelfLife) type);
58784    else if (type instanceof Timing)
58785       composeTimingInner((Timing) type);
58786    else if (type instanceof ProdCharacteristic)
58787       composeProdCharacteristicInner((ProdCharacteristic) type);
58788    else if (type instanceof Meta)
58789       composeMetaInner((Meta) type);
58790    else if (type instanceof Address)
58791       composeAddressInner((Address) type);
58792    else if (type instanceof Contributor)
58793       composeContributorInner((Contributor) type);
58794    else if (type instanceof Attachment)
58795       composeAttachmentInner((Attachment) type);
58796    else if (type instanceof DataRequirement)
58797       composeDataRequirementInner((DataRequirement) type);
58798    else if (type instanceof Money)
58799       composeMoneyInner((Money) type);
58800    else if (type instanceof HumanName)
58801       composeHumanNameInner((HumanName) type);
58802    else if (type instanceof ContactPoint)
58803       composeContactPointInner((ContactPoint) type);
58804    else if (type instanceof Identifier)
58805       composeIdentifierInner((Identifier) type);
58806    else if (type instanceof Coding)
58807       composeCodingInner((Coding) type);
58808    else if (type instanceof SampledData)
58809       composeSampledDataInner((SampledData) type);
58810    else if (type instanceof Ratio)
58811       composeRatioInner((Ratio) type);
58812    else if (type instanceof Reference)
58813       composeReferenceInner((Reference) type);
58814    else if (type instanceof TriggerDefinition)
58815       composeTriggerDefinitionInner((TriggerDefinition) type);
58816    else if (type instanceof Quantity)
58817       composeQuantityInner((Quantity) type);
58818    else if (type instanceof Period)
58819       composePeriodInner((Period) type);
58820    else if (type instanceof Range)
58821       composeRangeInner((Range) type);
58822    else if (type instanceof RelatedArtifact)
58823       composeRelatedArtifactInner((RelatedArtifact) type);
58824    else if (type instanceof Annotation)
58825       composeAnnotationInner((Annotation) type);
58826    else if (type instanceof ContactDetail)
58827       composeContactDetailInner((ContactDetail) type);
58828    else if (type instanceof UsageContext)
58829       composeUsageContextInner((UsageContext) type);
58830    else if (type instanceof Expression)
58831       composeExpressionInner((Expression) type);
58832    else if (type instanceof Signature)
58833       composeSignatureInner((Signature) type);
58834    else if (type instanceof CodeableConcept)
58835       composeCodeableConceptInner((CodeableConcept) type);
58836    else if (type instanceof ParameterDefinition)
58837       composeParameterDefinitionInner((ParameterDefinition) type);
58838    else
58839      throw new Error("Unhandled type: "+type.fhirType());
58840  }
58841
58842}