001package org.hl7.fhir.r4.formats;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Thu, Dec 27, 2018 10:06-0500 for FHIR v4.0.0
033
034import org.hl7.fhir.r4.model.DateType;
035import org.hl7.fhir.r4.model.DateTimeType;
036import org.hl7.fhir.r4.model.CodeType;
037import org.hl7.fhir.r4.model.StringType;
038import org.hl7.fhir.r4.model.IntegerType;
039import org.hl7.fhir.r4.model.OidType;
040import org.hl7.fhir.r4.model.CanonicalType;
041import org.hl7.fhir.r4.model.UriType;
042import org.hl7.fhir.r4.model.UuidType;
043import org.hl7.fhir.r4.model.UrlType;
044import org.hl7.fhir.r4.model.InstantType;
045import org.hl7.fhir.r4.model.BooleanType;
046import org.hl7.fhir.r4.model.Base64BinaryType;
047import org.hl7.fhir.r4.model.UnsignedIntType;
048import org.hl7.fhir.r4.model.MarkdownType;
049import org.hl7.fhir.r4.model.TimeType;
050import org.hl7.fhir.r4.model.IdType;
051import org.hl7.fhir.r4.model.PositiveIntType;
052import org.hl7.fhir.r4.model.DecimalType;
053import org.hl7.fhir.r4.model.*;
054import org.hl7.fhir.utilities.Utilities;
055import org.hl7.fhir.r4.utils.formats.JsonTrackingParser.PresentedBigDecimal;
056import org.hl7.fhir.utilities.xhtml.XhtmlNode;
057import org.hl7.fhir.exceptions.FHIRFormatError;
058import org.hl7.fhir.exceptions.FHIRException;
059import com.google.gson.JsonObject;
060import com.google.gson.JsonArray;
061import com.google.gson.JsonElement;
062import java.io.IOException;
063
064public class JsonParser extends JsonParserBase {
065
066  protected void parseElementProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
067    super.parseElementProperties(json, element);
068    if (json.has("extension")) {
069      JsonArray array = json.getAsJsonArray("extension");
070      for (int i = 0; i < array.size(); i++) {
071        element.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
072      }
073    };
074  }
075
076  protected void parseBackboneElementProperties(JsonObject json, BackboneElement element) throws IOException, FHIRFormatError {
077    parseElementProperties(json, element);
078    if (json.has("modifierExtension")) {
079      JsonArray array = json.getAsJsonArray("modifierExtension");
080      for (int i = 0; i < array.size(); i++) {
081        element.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
082      }
083    }
084  }
085
086  protected void parseBackboneElementProperties(JsonObject json, BackboneType element) throws IOException, FHIRFormatError {
087    parseElementProperties(json, element);
088    if (json.has("modifierExtension")) {
089      JsonArray array = json.getAsJsonArray("modifierExtension");
090      for (int i = 0; i < array.size(); i++) {
091        element.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
092      }
093    }
094  }
095
096  protected void parseTypeProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
097    parseElementProperties(json, element);
098  }
099
100  @SuppressWarnings("unchecked")
101  protected <E extends Enum<E>> Enumeration<E> parseEnumeration(String s, E item, EnumFactory e) throws IOException, FHIRFormatError {
102    Enumeration<E> res = new Enumeration<E>(e);
103    if (s != null)
104      res.setValue((E) e.fromCode(s));
105    return res;
106  }
107
108  protected DateType parseDate(String v) throws IOException, FHIRFormatError {
109    DateType res = new DateType(v);
110    return res;
111  }
112
113  protected DateTimeType parseDateTime(String v) throws IOException, FHIRFormatError {
114    DateTimeType res = new DateTimeType(v);
115    return res;
116  }
117
118  protected CodeType parseCode(String v) throws IOException, FHIRFormatError {
119    CodeType res = new CodeType(v);
120    return res;
121  }
122
123  protected StringType parseString(String v) throws IOException, FHIRFormatError {
124    StringType res = new StringType(v);
125    return res;
126  }
127
128  protected IntegerType parseInteger(java.lang.Long v) throws IOException, FHIRFormatError {
129    IntegerType res = new IntegerType(v);
130    return res;
131  }
132
133  protected OidType parseOid(String v) throws IOException, FHIRFormatError {
134    OidType res = new OidType(v);
135    return res;
136  }
137
138  protected CanonicalType parseCanonical(String v) throws IOException, FHIRFormatError {
139    CanonicalType res = new CanonicalType(v);
140    return res;
141  }
142
143  protected UriType parseUri(String v) throws IOException, FHIRFormatError {
144    UriType res = new UriType(v);
145    return res;
146  }
147
148  protected UuidType parseUuid(String v) throws IOException, FHIRFormatError {
149    UuidType res = new UuidType(v);
150    return res;
151  }
152
153  protected UrlType parseUrl(String v) throws IOException, FHIRFormatError {
154    UrlType res = new UrlType(v);
155    return res;
156  }
157
158  protected InstantType parseInstant(String v) throws IOException, FHIRFormatError {
159    InstantType res = new InstantType(v);
160    return res;
161  }
162
163  protected BooleanType parseBoolean(java.lang.Boolean v) throws IOException, FHIRFormatError {
164    BooleanType res = new BooleanType(v);
165    return res;
166  }
167
168  protected Base64BinaryType parseBase64Binary(String v) throws IOException, FHIRFormatError {
169    Base64BinaryType res = new Base64BinaryType(v);
170    return res;
171  }
172
173  protected UnsignedIntType parseUnsignedInt(String v) throws IOException, FHIRFormatError {
174    UnsignedIntType res = new UnsignedIntType(v);
175    return res;
176  }
177
178  protected MarkdownType parseMarkdown(String v) throws IOException, FHIRFormatError {
179    MarkdownType res = new MarkdownType(v);
180    return res;
181  }
182
183  protected TimeType parseTime(String v) throws IOException, FHIRFormatError {
184    TimeType res = new TimeType(v);
185    return res;
186  }
187
188  protected IdType parseId(String v) throws IOException, FHIRFormatError {
189    IdType res = new IdType(v);
190    return res;
191  }
192
193  protected PositiveIntType parsePositiveInt(String v) throws IOException, FHIRFormatError {
194    PositiveIntType res = new PositiveIntType(v);
195    return res;
196  }
197
198  protected DecimalType parseDecimal(java.math.BigDecimal v) throws IOException, FHIRFormatError {
199    DecimalType res = new DecimalType(v);
200    if (v instanceof PresentedBigDecimal)
201      res.setRepresentation(((PresentedBigDecimal) v).getPresentation());
202    return res;
203  }
204
205  protected Extension parseExtension(JsonObject json) throws IOException, FHIRFormatError {
206    Extension res = new Extension();
207    parseExtensionProperties(json, res);
208    return res;
209  }
210
211  protected void parseExtensionProperties(JsonObject json, Extension res) throws IOException, FHIRFormatError {
212    parseTypeProperties(json, res);
213    if (json.has("url"))
214      res.setUrlElement(parseUri(json.get("url").getAsString()));
215    if (json.has("_url"))
216      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
217    Type value = parseType("value", json);
218    if (value != null)
219      res.setValue(value);
220  }
221
222  protected Narrative parseNarrative(JsonObject json) throws IOException, FHIRFormatError {
223    Narrative res = new Narrative();
224    parseNarrativeProperties(json, res);
225    return res;
226  }
227
228  protected void parseNarrativeProperties(JsonObject json, Narrative res) throws IOException, FHIRFormatError {
229    parseTypeProperties(json, res);
230    if (json.has("status"))
231      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Narrative.NarrativeStatus.NULL, new Narrative.NarrativeStatusEnumFactory()));
232    if (json.has("_status"))
233      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
234    if (json.has("div"))
235      res.setDiv(parseXhtml(json.get("div").getAsString()));
236  }
237
238  protected Meta parseMeta(JsonObject json) throws IOException, FHIRFormatError {
239    Meta res = new Meta();
240    parseMetaProperties(json, res);
241    return res;
242  }
243
244  protected void parseMetaProperties(JsonObject json, Meta res) throws IOException, FHIRFormatError {
245    parseElementProperties(json, res);
246    if (json.has("versionId"))
247      res.setVersionIdElement(parseId(json.get("versionId").getAsString()));
248    if (json.has("_versionId"))
249      parseElementProperties(json.getAsJsonObject("_versionId"), res.getVersionIdElement());
250    if (json.has("lastUpdated"))
251      res.setLastUpdatedElement(parseInstant(json.get("lastUpdated").getAsString()));
252    if (json.has("_lastUpdated"))
253      parseElementProperties(json.getAsJsonObject("_lastUpdated"), res.getLastUpdatedElement());
254    if (json.has("source"))
255      res.setSourceElement(parseUri(json.get("source").getAsString()));
256    if (json.has("_source"))
257      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
258    if (json.has("profile")) {
259      JsonArray array = json.getAsJsonArray("profile");
260      for (int i = 0; i < array.size(); i++) {
261        res.getProfile().add(parseCanonical(array.get(i).getAsString()));
262      }
263    };
264    if (json.has("_profile")) {
265      JsonArray array = json.getAsJsonArray("_profile");
266      for (int i = 0; i < array.size(); i++) {
267        if (i == res.getProfile().size())
268          res.getProfile().add(parseCanonical(null));
269        if (array.get(i) instanceof JsonObject) 
270          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
271      }
272    };
273    if (json.has("security")) {
274      JsonArray array = json.getAsJsonArray("security");
275      for (int i = 0; i < array.size(); i++) {
276        res.getSecurity().add(parseCoding(array.get(i).getAsJsonObject()));
277      }
278    };
279    if (json.has("tag")) {
280      JsonArray array = json.getAsJsonArray("tag");
281      for (int i = 0; i < array.size(); i++) {
282        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
283      }
284    };
285  }
286
287  protected Address parseAddress(JsonObject json) throws IOException, FHIRFormatError {
288    Address res = new Address();
289    parseAddressProperties(json, res);
290    return res;
291  }
292
293  protected void parseAddressProperties(JsonObject json, Address res) throws IOException, FHIRFormatError {
294    parseTypeProperties(json, res);
295    if (json.has("use"))
296      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Address.AddressUse.NULL, new Address.AddressUseEnumFactory()));
297    if (json.has("_use"))
298      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
299    if (json.has("type"))
300      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Address.AddressType.NULL, new Address.AddressTypeEnumFactory()));
301    if (json.has("_type"))
302      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
303    if (json.has("text"))
304      res.setTextElement(parseString(json.get("text").getAsString()));
305    if (json.has("_text"))
306      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
307    if (json.has("line")) {
308      JsonArray array = json.getAsJsonArray("line");
309      for (int i = 0; i < array.size(); i++) {
310        res.getLine().add(parseString(array.get(i).getAsString()));
311      }
312    };
313    if (json.has("_line")) {
314      JsonArray array = json.getAsJsonArray("_line");
315      for (int i = 0; i < array.size(); i++) {
316        if (i == res.getLine().size())
317          res.getLine().add(parseString(null));
318        if (array.get(i) instanceof JsonObject) 
319          parseElementProperties(array.get(i).getAsJsonObject(), res.getLine().get(i));
320      }
321    };
322    if (json.has("city"))
323      res.setCityElement(parseString(json.get("city").getAsString()));
324    if (json.has("_city"))
325      parseElementProperties(json.getAsJsonObject("_city"), res.getCityElement());
326    if (json.has("district"))
327      res.setDistrictElement(parseString(json.get("district").getAsString()));
328    if (json.has("_district"))
329      parseElementProperties(json.getAsJsonObject("_district"), res.getDistrictElement());
330    if (json.has("state"))
331      res.setStateElement(parseString(json.get("state").getAsString()));
332    if (json.has("_state"))
333      parseElementProperties(json.getAsJsonObject("_state"), res.getStateElement());
334    if (json.has("postalCode"))
335      res.setPostalCodeElement(parseString(json.get("postalCode").getAsString()));
336    if (json.has("_postalCode"))
337      parseElementProperties(json.getAsJsonObject("_postalCode"), res.getPostalCodeElement());
338    if (json.has("country"))
339      res.setCountryElement(parseString(json.get("country").getAsString()));
340    if (json.has("_country"))
341      parseElementProperties(json.getAsJsonObject("_country"), res.getCountryElement());
342    if (json.has("period"))
343      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
344  }
345
346  protected Contributor parseContributor(JsonObject json) throws IOException, FHIRFormatError {
347    Contributor res = new Contributor();
348    parseContributorProperties(json, res);
349    return res;
350  }
351
352  protected void parseContributorProperties(JsonObject json, Contributor res) throws IOException, FHIRFormatError {
353    parseTypeProperties(json, res);
354    if (json.has("type"))
355      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Contributor.ContributorType.NULL, new Contributor.ContributorTypeEnumFactory()));
356    if (json.has("_type"))
357      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
358    if (json.has("name"))
359      res.setNameElement(parseString(json.get("name").getAsString()));
360    if (json.has("_name"))
361      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
362    if (json.has("contact")) {
363      JsonArray array = json.getAsJsonArray("contact");
364      for (int i = 0; i < array.size(); i++) {
365        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
366      }
367    };
368  }
369
370  protected Attachment parseAttachment(JsonObject json) throws IOException, FHIRFormatError {
371    Attachment res = new Attachment();
372    parseAttachmentProperties(json, res);
373    return res;
374  }
375
376  protected void parseAttachmentProperties(JsonObject json, Attachment res) throws IOException, FHIRFormatError {
377    parseTypeProperties(json, res);
378    if (json.has("contentType"))
379      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
380    if (json.has("_contentType"))
381      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
382    if (json.has("language"))
383      res.setLanguageElement(parseCode(json.get("language").getAsString()));
384    if (json.has("_language"))
385      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
386    if (json.has("data"))
387      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
388    if (json.has("_data"))
389      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
390    if (json.has("url"))
391      res.setUrlElement(parseUrl(json.get("url").getAsString()));
392    if (json.has("_url"))
393      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
394    if (json.has("size"))
395      res.setSizeElement(parseUnsignedInt(json.get("size").getAsString()));
396    if (json.has("_size"))
397      parseElementProperties(json.getAsJsonObject("_size"), res.getSizeElement());
398    if (json.has("hash"))
399      res.setHashElement(parseBase64Binary(json.get("hash").getAsString()));
400    if (json.has("_hash"))
401      parseElementProperties(json.getAsJsonObject("_hash"), res.getHashElement());
402    if (json.has("title"))
403      res.setTitleElement(parseString(json.get("title").getAsString()));
404    if (json.has("_title"))
405      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
406    if (json.has("creation"))
407      res.setCreationElement(parseDateTime(json.get("creation").getAsString()));
408    if (json.has("_creation"))
409      parseElementProperties(json.getAsJsonObject("_creation"), res.getCreationElement());
410  }
411
412  protected Count parseCount(JsonObject json) throws IOException, FHIRFormatError {
413    Count res = new Count();
414    parseCountProperties(json, res);
415    return res;
416  }
417
418  protected void parseCountProperties(JsonObject json, Count res) throws IOException, FHIRFormatError {
419    parseQuantityProperties(json, res);
420  }
421
422  protected DataRequirement parseDataRequirement(JsonObject json) throws IOException, FHIRFormatError {
423    DataRequirement res = new DataRequirement();
424    parseDataRequirementProperties(json, res);
425    return res;
426  }
427
428  protected void parseDataRequirementProperties(JsonObject json, DataRequirement res) throws IOException, FHIRFormatError {
429    parseTypeProperties(json, res);
430    if (json.has("type"))
431      res.setTypeElement(parseCode(json.get("type").getAsString()));
432    if (json.has("_type"))
433      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
434    if (json.has("profile")) {
435      JsonArray array = json.getAsJsonArray("profile");
436      for (int i = 0; i < array.size(); i++) {
437        res.getProfile().add(parseCanonical(array.get(i).getAsString()));
438      }
439    };
440    if (json.has("_profile")) {
441      JsonArray array = json.getAsJsonArray("_profile");
442      for (int i = 0; i < array.size(); i++) {
443        if (i == res.getProfile().size())
444          res.getProfile().add(parseCanonical(null));
445        if (array.get(i) instanceof JsonObject) 
446          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
447      }
448    };
449    Type subject = parseType("subject", json);
450    if (subject != null)
451      res.setSubject(subject);
452    if (json.has("mustSupport")) {
453      JsonArray array = json.getAsJsonArray("mustSupport");
454      for (int i = 0; i < array.size(); i++) {
455        res.getMustSupport().add(parseString(array.get(i).getAsString()));
456      }
457    };
458    if (json.has("_mustSupport")) {
459      JsonArray array = json.getAsJsonArray("_mustSupport");
460      for (int i = 0; i < array.size(); i++) {
461        if (i == res.getMustSupport().size())
462          res.getMustSupport().add(parseString(null));
463        if (array.get(i) instanceof JsonObject) 
464          parseElementProperties(array.get(i).getAsJsonObject(), res.getMustSupport().get(i));
465      }
466    };
467    if (json.has("codeFilter")) {
468      JsonArray array = json.getAsJsonArray("codeFilter");
469      for (int i = 0; i < array.size(); i++) {
470        res.getCodeFilter().add(parseDataRequirementDataRequirementCodeFilterComponent(array.get(i).getAsJsonObject(), res));
471      }
472    };
473    if (json.has("dateFilter")) {
474      JsonArray array = json.getAsJsonArray("dateFilter");
475      for (int i = 0; i < array.size(); i++) {
476        res.getDateFilter().add(parseDataRequirementDataRequirementDateFilterComponent(array.get(i).getAsJsonObject(), res));
477      }
478    };
479    if (json.has("limit"))
480      res.setLimitElement(parsePositiveInt(json.get("limit").getAsString()));
481    if (json.has("_limit"))
482      parseElementProperties(json.getAsJsonObject("_limit"), res.getLimitElement());
483    if (json.has("sort")) {
484      JsonArray array = json.getAsJsonArray("sort");
485      for (int i = 0; i < array.size(); i++) {
486        res.getSort().add(parseDataRequirementDataRequirementSortComponent(array.get(i).getAsJsonObject(), res));
487      }
488    };
489  }
490
491  protected DataRequirement.DataRequirementCodeFilterComponent parseDataRequirementDataRequirementCodeFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
492    DataRequirement.DataRequirementCodeFilterComponent res = new DataRequirement.DataRequirementCodeFilterComponent();
493    parseDataRequirementDataRequirementCodeFilterComponentProperties(json, owner, res);
494    return res;
495  }
496
497  protected void parseDataRequirementDataRequirementCodeFilterComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementCodeFilterComponent res) throws IOException, FHIRFormatError {
498    parseTypeProperties(json, res);
499    if (json.has("path"))
500      res.setPathElement(parseString(json.get("path").getAsString()));
501    if (json.has("_path"))
502      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
503    if (json.has("searchParam"))
504      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
505    if (json.has("_searchParam"))
506      parseElementProperties(json.getAsJsonObject("_searchParam"), res.getSearchParamElement());
507    if (json.has("valueSet"))
508      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
509    if (json.has("_valueSet"))
510      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
511    if (json.has("code")) {
512      JsonArray array = json.getAsJsonArray("code");
513      for (int i = 0; i < array.size(); i++) {
514        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
515      }
516    };
517  }
518
519  protected DataRequirement.DataRequirementDateFilterComponent parseDataRequirementDataRequirementDateFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
520    DataRequirement.DataRequirementDateFilterComponent res = new DataRequirement.DataRequirementDateFilterComponent();
521    parseDataRequirementDataRequirementDateFilterComponentProperties(json, owner, res);
522    return res;
523  }
524
525  protected void parseDataRequirementDataRequirementDateFilterComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementDateFilterComponent res) throws IOException, FHIRFormatError {
526    parseTypeProperties(json, res);
527    if (json.has("path"))
528      res.setPathElement(parseString(json.get("path").getAsString()));
529    if (json.has("_path"))
530      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
531    if (json.has("searchParam"))
532      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
533    if (json.has("_searchParam"))
534      parseElementProperties(json.getAsJsonObject("_searchParam"), res.getSearchParamElement());
535    Type value = parseType("value", json);
536    if (value != null)
537      res.setValue(value);
538  }
539
540  protected DataRequirement.DataRequirementSortComponent parseDataRequirementDataRequirementSortComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
541    DataRequirement.DataRequirementSortComponent res = new DataRequirement.DataRequirementSortComponent();
542    parseDataRequirementDataRequirementSortComponentProperties(json, owner, res);
543    return res;
544  }
545
546  protected void parseDataRequirementDataRequirementSortComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementSortComponent res) throws IOException, FHIRFormatError {
547    parseTypeProperties(json, res);
548    if (json.has("path"))
549      res.setPathElement(parseString(json.get("path").getAsString()));
550    if (json.has("_path"))
551      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
552    if (json.has("direction"))
553      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), DataRequirement.SortDirection.NULL, new DataRequirement.SortDirectionEnumFactory()));
554    if (json.has("_direction"))
555      parseElementProperties(json.getAsJsonObject("_direction"), res.getDirectionElement());
556  }
557
558  protected Dosage parseDosage(JsonObject json) throws IOException, FHIRFormatError {
559    Dosage res = new Dosage();
560    parseDosageProperties(json, res);
561    return res;
562  }
563
564  protected void parseDosageProperties(JsonObject json, Dosage res) throws IOException, FHIRFormatError {
565    parseBackboneElementProperties(json, res);
566    if (json.has("sequence"))
567      res.setSequenceElement(parseInteger(json.get("sequence").getAsLong()));
568    if (json.has("_sequence"))
569      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
570    if (json.has("text"))
571      res.setTextElement(parseString(json.get("text").getAsString()));
572    if (json.has("_text"))
573      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
574    if (json.has("additionalInstruction")) {
575      JsonArray array = json.getAsJsonArray("additionalInstruction");
576      for (int i = 0; i < array.size(); i++) {
577        res.getAdditionalInstruction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
578      }
579    };
580    if (json.has("patientInstruction"))
581      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
582    if (json.has("_patientInstruction"))
583      parseElementProperties(json.getAsJsonObject("_patientInstruction"), res.getPatientInstructionElement());
584    if (json.has("timing"))
585      res.setTiming(parseTiming(json.getAsJsonObject("timing")));
586    Type asNeeded = parseType("asNeeded", json);
587    if (asNeeded != null)
588      res.setAsNeeded(asNeeded);
589    if (json.has("site"))
590      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
591    if (json.has("route"))
592      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
593    if (json.has("method"))
594      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
595    if (json.has("doseAndRate")) {
596      JsonArray array = json.getAsJsonArray("doseAndRate");
597      for (int i = 0; i < array.size(); i++) {
598        res.getDoseAndRate().add(parseDosageDosageDoseAndRateComponent(array.get(i).getAsJsonObject(), res));
599      }
600    };
601    if (json.has("maxDosePerPeriod"))
602      res.setMaxDosePerPeriod(parseRatio(json.getAsJsonObject("maxDosePerPeriod")));
603    if (json.has("maxDosePerAdministration"))
604      res.setMaxDosePerAdministration(parseQuantity(json.getAsJsonObject("maxDosePerAdministration")));
605    if (json.has("maxDosePerLifetime"))
606      res.setMaxDosePerLifetime(parseQuantity(json.getAsJsonObject("maxDosePerLifetime")));
607  }
608
609  protected Dosage.DosageDoseAndRateComponent parseDosageDosageDoseAndRateComponent(JsonObject json, Dosage owner) throws IOException, FHIRFormatError {
610    Dosage.DosageDoseAndRateComponent res = new Dosage.DosageDoseAndRateComponent();
611    parseDosageDosageDoseAndRateComponentProperties(json, owner, res);
612    return res;
613  }
614
615  protected void parseDosageDosageDoseAndRateComponentProperties(JsonObject json, Dosage owner, Dosage.DosageDoseAndRateComponent res) throws IOException, FHIRFormatError {
616    parseTypeProperties(json, res);
617    if (json.has("type"))
618      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
619    Type dose = parseType("dose", json);
620    if (dose != null)
621      res.setDose(dose);
622    Type rate = parseType("rate", json);
623    if (rate != null)
624      res.setRate(rate);
625  }
626
627  protected Money parseMoney(JsonObject json) throws IOException, FHIRFormatError {
628    Money res = new Money();
629    parseMoneyProperties(json, res);
630    return res;
631  }
632
633  protected void parseMoneyProperties(JsonObject json, Money res) throws IOException, FHIRFormatError {
634    parseTypeProperties(json, res);
635    if (json.has("value"))
636      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
637    if (json.has("_value"))
638      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
639    if (json.has("currency"))
640      res.setCurrencyElement(parseCode(json.get("currency").getAsString()));
641    if (json.has("_currency"))
642      parseElementProperties(json.getAsJsonObject("_currency"), res.getCurrencyElement());
643  }
644
645  protected HumanName parseHumanName(JsonObject json) throws IOException, FHIRFormatError {
646    HumanName res = new HumanName();
647    parseHumanNameProperties(json, res);
648    return res;
649  }
650
651  protected void parseHumanNameProperties(JsonObject json, HumanName res) throws IOException, FHIRFormatError {
652    parseTypeProperties(json, res);
653    if (json.has("use"))
654      res.setUseElement(parseEnumeration(json.get("use").getAsString(), HumanName.NameUse.NULL, new HumanName.NameUseEnumFactory()));
655    if (json.has("_use"))
656      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
657    if (json.has("text"))
658      res.setTextElement(parseString(json.get("text").getAsString()));
659    if (json.has("_text"))
660      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
661    if (json.has("family"))
662      res.setFamilyElement(parseString(json.get("family").getAsString()));
663    if (json.has("_family"))
664      parseElementProperties(json.getAsJsonObject("_family"), res.getFamilyElement());
665    if (json.has("given")) {
666      JsonArray array = json.getAsJsonArray("given");
667      for (int i = 0; i < array.size(); i++) {
668        res.getGiven().add(parseString(array.get(i).getAsString()));
669      }
670    };
671    if (json.has("_given")) {
672      JsonArray array = json.getAsJsonArray("_given");
673      for (int i = 0; i < array.size(); i++) {
674        if (i == res.getGiven().size())
675          res.getGiven().add(parseString(null));
676        if (array.get(i) instanceof JsonObject) 
677          parseElementProperties(array.get(i).getAsJsonObject(), res.getGiven().get(i));
678      }
679    };
680    if (json.has("prefix")) {
681      JsonArray array = json.getAsJsonArray("prefix");
682      for (int i = 0; i < array.size(); i++) {
683        res.getPrefix().add(parseString(array.get(i).getAsString()));
684      }
685    };
686    if (json.has("_prefix")) {
687      JsonArray array = json.getAsJsonArray("_prefix");
688      for (int i = 0; i < array.size(); i++) {
689        if (i == res.getPrefix().size())
690          res.getPrefix().add(parseString(null));
691        if (array.get(i) instanceof JsonObject) 
692          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrefix().get(i));
693      }
694    };
695    if (json.has("suffix")) {
696      JsonArray array = json.getAsJsonArray("suffix");
697      for (int i = 0; i < array.size(); i++) {
698        res.getSuffix().add(parseString(array.get(i).getAsString()));
699      }
700    };
701    if (json.has("_suffix")) {
702      JsonArray array = json.getAsJsonArray("_suffix");
703      for (int i = 0; i < array.size(); i++) {
704        if (i == res.getSuffix().size())
705          res.getSuffix().add(parseString(null));
706        if (array.get(i) instanceof JsonObject) 
707          parseElementProperties(array.get(i).getAsJsonObject(), res.getSuffix().get(i));
708      }
709    };
710    if (json.has("period"))
711      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
712  }
713
714  protected ContactPoint parseContactPoint(JsonObject json) throws IOException, FHIRFormatError {
715    ContactPoint res = new ContactPoint();
716    parseContactPointProperties(json, res);
717    return res;
718  }
719
720  protected void parseContactPointProperties(JsonObject json, ContactPoint res) throws IOException, FHIRFormatError {
721    parseTypeProperties(json, res);
722    if (json.has("system"))
723      res.setSystemElement(parseEnumeration(json.get("system").getAsString(), ContactPoint.ContactPointSystem.NULL, new ContactPoint.ContactPointSystemEnumFactory()));
724    if (json.has("_system"))
725      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
726    if (json.has("value"))
727      res.setValueElement(parseString(json.get("value").getAsString()));
728    if (json.has("_value"))
729      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
730    if (json.has("use"))
731      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ContactPoint.ContactPointUse.NULL, new ContactPoint.ContactPointUseEnumFactory()));
732    if (json.has("_use"))
733      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
734    if (json.has("rank"))
735      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
736    if (json.has("_rank"))
737      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
738    if (json.has("period"))
739      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
740  }
741
742  protected MarketingStatus parseMarketingStatus(JsonObject json) throws IOException, FHIRFormatError {
743    MarketingStatus res = new MarketingStatus();
744    parseMarketingStatusProperties(json, res);
745    return res;
746  }
747
748  protected void parseMarketingStatusProperties(JsonObject json, MarketingStatus res) throws IOException, FHIRFormatError {
749    parseBackboneElementProperties(json, res);
750    if (json.has("country"))
751      res.setCountry(parseCodeableConcept(json.getAsJsonObject("country")));
752    if (json.has("jurisdiction"))
753      res.setJurisdiction(parseCodeableConcept(json.getAsJsonObject("jurisdiction")));
754    if (json.has("status"))
755      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
756    if (json.has("dateRange"))
757      res.setDateRange(parsePeriod(json.getAsJsonObject("dateRange")));
758    if (json.has("restoreDate"))
759      res.setRestoreDateElement(parseDateTime(json.get("restoreDate").getAsString()));
760    if (json.has("_restoreDate"))
761      parseElementProperties(json.getAsJsonObject("_restoreDate"), res.getRestoreDateElement());
762  }
763
764  protected Identifier parseIdentifier(JsonObject json) throws IOException, FHIRFormatError {
765    Identifier res = new Identifier();
766    parseIdentifierProperties(json, res);
767    return res;
768  }
769
770  protected void parseIdentifierProperties(JsonObject json, Identifier res) throws IOException, FHIRFormatError {
771    parseTypeProperties(json, res);
772    if (json.has("use"))
773      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Identifier.IdentifierUse.NULL, new Identifier.IdentifierUseEnumFactory()));
774    if (json.has("_use"))
775      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
776    if (json.has("type"))
777      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
778    if (json.has("system"))
779      res.setSystemElement(parseUri(json.get("system").getAsString()));
780    if (json.has("_system"))
781      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
782    if (json.has("value"))
783      res.setValueElement(parseString(json.get("value").getAsString()));
784    if (json.has("_value"))
785      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
786    if (json.has("period"))
787      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
788    if (json.has("assigner"))
789      res.setAssigner(parseReference(json.getAsJsonObject("assigner")));
790  }
791
792  protected SubstanceAmount parseSubstanceAmount(JsonObject json) throws IOException, FHIRFormatError {
793    SubstanceAmount res = new SubstanceAmount();
794    parseSubstanceAmountProperties(json, res);
795    return res;
796  }
797
798  protected void parseSubstanceAmountProperties(JsonObject json, SubstanceAmount res) throws IOException, FHIRFormatError {
799    parseBackboneElementProperties(json, res);
800    Type amount = parseType("amount", json);
801    if (amount != null)
802      res.setAmount(amount);
803    if (json.has("amountType"))
804      res.setAmountType(parseCodeableConcept(json.getAsJsonObject("amountType")));
805    if (json.has("amountText"))
806      res.setAmountTextElement(parseString(json.get("amountText").getAsString()));
807    if (json.has("_amountText"))
808      parseElementProperties(json.getAsJsonObject("_amountText"), res.getAmountTextElement());
809    if (json.has("referenceRange"))
810      res.setReferenceRange(parseSubstanceAmountSubstanceAmountReferenceRangeComponent(json.getAsJsonObject("referenceRange"), res));
811  }
812
813  protected SubstanceAmount.SubstanceAmountReferenceRangeComponent parseSubstanceAmountSubstanceAmountReferenceRangeComponent(JsonObject json, SubstanceAmount owner) throws IOException, FHIRFormatError {
814    SubstanceAmount.SubstanceAmountReferenceRangeComponent res = new SubstanceAmount.SubstanceAmountReferenceRangeComponent();
815    parseSubstanceAmountSubstanceAmountReferenceRangeComponentProperties(json, owner, res);
816    return res;
817  }
818
819  protected void parseSubstanceAmountSubstanceAmountReferenceRangeComponentProperties(JsonObject json, SubstanceAmount owner, SubstanceAmount.SubstanceAmountReferenceRangeComponent res) throws IOException, FHIRFormatError {
820    parseTypeProperties(json, res);
821    if (json.has("lowLimit"))
822      res.setLowLimit(parseQuantity(json.getAsJsonObject("lowLimit")));
823    if (json.has("highLimit"))
824      res.setHighLimit(parseQuantity(json.getAsJsonObject("highLimit")));
825  }
826
827  protected Coding parseCoding(JsonObject json) throws IOException, FHIRFormatError {
828    Coding res = new Coding();
829    parseCodingProperties(json, res);
830    return res;
831  }
832
833  protected void parseCodingProperties(JsonObject json, Coding res) throws IOException, FHIRFormatError {
834    parseTypeProperties(json, res);
835    if (json.has("system"))
836      res.setSystemElement(parseUri(json.get("system").getAsString()));
837    if (json.has("_system"))
838      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
839    if (json.has("version"))
840      res.setVersionElement(parseString(json.get("version").getAsString()));
841    if (json.has("_version"))
842      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
843    if (json.has("code"))
844      res.setCodeElement(parseCode(json.get("code").getAsString()));
845    if (json.has("_code"))
846      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
847    if (json.has("display"))
848      res.setDisplayElement(parseString(json.get("display").getAsString()));
849    if (json.has("_display"))
850      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
851    if (json.has("userSelected"))
852      res.setUserSelectedElement(parseBoolean(json.get("userSelected").getAsBoolean()));
853    if (json.has("_userSelected"))
854      parseElementProperties(json.getAsJsonObject("_userSelected"), res.getUserSelectedElement());
855  }
856
857  protected SampledData parseSampledData(JsonObject json) throws IOException, FHIRFormatError {
858    SampledData res = new SampledData();
859    parseSampledDataProperties(json, res);
860    return res;
861  }
862
863  protected void parseSampledDataProperties(JsonObject json, SampledData res) throws IOException, FHIRFormatError {
864    parseTypeProperties(json, res);
865    if (json.has("origin"))
866      res.setOrigin(parseQuantity(json.getAsJsonObject("origin")));
867    if (json.has("period"))
868      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
869    if (json.has("_period"))
870      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
871    if (json.has("factor"))
872      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
873    if (json.has("_factor"))
874      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
875    if (json.has("lowerLimit"))
876      res.setLowerLimitElement(parseDecimal(json.get("lowerLimit").getAsBigDecimal()));
877    if (json.has("_lowerLimit"))
878      parseElementProperties(json.getAsJsonObject("_lowerLimit"), res.getLowerLimitElement());
879    if (json.has("upperLimit"))
880      res.setUpperLimitElement(parseDecimal(json.get("upperLimit").getAsBigDecimal()));
881    if (json.has("_upperLimit"))
882      parseElementProperties(json.getAsJsonObject("_upperLimit"), res.getUpperLimitElement());
883    if (json.has("dimensions"))
884      res.setDimensionsElement(parsePositiveInt(json.get("dimensions").getAsString()));
885    if (json.has("_dimensions"))
886      parseElementProperties(json.getAsJsonObject("_dimensions"), res.getDimensionsElement());
887    if (json.has("data"))
888      res.setDataElement(parseString(json.get("data").getAsString()));
889    if (json.has("_data"))
890      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
891  }
892
893  protected Population parsePopulation(JsonObject json) throws IOException, FHIRFormatError {
894    Population res = new Population();
895    parsePopulationProperties(json, res);
896    return res;
897  }
898
899  protected void parsePopulationProperties(JsonObject json, Population res) throws IOException, FHIRFormatError {
900    parseBackboneElementProperties(json, res);
901    Type age = parseType("age", json);
902    if (age != null)
903      res.setAge(age);
904    if (json.has("gender"))
905      res.setGender(parseCodeableConcept(json.getAsJsonObject("gender")));
906    if (json.has("race"))
907      res.setRace(parseCodeableConcept(json.getAsJsonObject("race")));
908    if (json.has("physiologicalCondition"))
909      res.setPhysiologicalCondition(parseCodeableConcept(json.getAsJsonObject("physiologicalCondition")));
910  }
911
912  protected Ratio parseRatio(JsonObject json) throws IOException, FHIRFormatError {
913    Ratio res = new Ratio();
914    parseRatioProperties(json, res);
915    return res;
916  }
917
918  protected void parseRatioProperties(JsonObject json, Ratio res) throws IOException, FHIRFormatError {
919    parseTypeProperties(json, res);
920    if (json.has("numerator"))
921      res.setNumerator(parseQuantity(json.getAsJsonObject("numerator")));
922    if (json.has("denominator"))
923      res.setDenominator(parseQuantity(json.getAsJsonObject("denominator")));
924  }
925
926  protected Distance parseDistance(JsonObject json) throws IOException, FHIRFormatError {
927    Distance res = new Distance();
928    parseDistanceProperties(json, res);
929    return res;
930  }
931
932  protected void parseDistanceProperties(JsonObject json, Distance res) throws IOException, FHIRFormatError {
933    parseQuantityProperties(json, res);
934  }
935
936  protected Age parseAge(JsonObject json) throws IOException, FHIRFormatError {
937    Age res = new Age();
938    parseAgeProperties(json, res);
939    return res;
940  }
941
942  protected void parseAgeProperties(JsonObject json, Age res) throws IOException, FHIRFormatError {
943    parseQuantityProperties(json, res);
944  }
945
946  protected Reference parseReference(JsonObject json) throws IOException, FHIRFormatError {
947    Reference res = new Reference();
948    parseReferenceProperties(json, res);
949    return res;
950  }
951
952  protected void parseReferenceProperties(JsonObject json, Reference res) throws IOException, FHIRFormatError {
953    parseTypeProperties(json, res);
954    if (json.has("reference"))
955      res.setReferenceElement(parseString(json.get("reference").getAsString()));
956    if (json.has("_reference"))
957      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
958    if (json.has("type"))
959      res.setTypeElement(parseUri(json.get("type").getAsString()));
960    if (json.has("_type"))
961      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
962    if (json.has("identifier"))
963      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
964    if (json.has("display"))
965      res.setDisplayElement(parseString(json.get("display").getAsString()));
966    if (json.has("_display"))
967      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
968  }
969
970  protected TriggerDefinition parseTriggerDefinition(JsonObject json) throws IOException, FHIRFormatError {
971    TriggerDefinition res = new TriggerDefinition();
972    parseTriggerDefinitionProperties(json, res);
973    return res;
974  }
975
976  protected void parseTriggerDefinitionProperties(JsonObject json, TriggerDefinition res) throws IOException, FHIRFormatError {
977    parseTypeProperties(json, res);
978    if (json.has("type"))
979      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TriggerDefinition.TriggerType.NULL, new TriggerDefinition.TriggerTypeEnumFactory()));
980    if (json.has("_type"))
981      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
982    if (json.has("name"))
983      res.setNameElement(parseString(json.get("name").getAsString()));
984    if (json.has("_name"))
985      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
986    Type timing = parseType("timing", json);
987    if (timing != null)
988      res.setTiming(timing);
989    if (json.has("data")) {
990      JsonArray array = json.getAsJsonArray("data");
991      for (int i = 0; i < array.size(); i++) {
992        res.getData().add(parseDataRequirement(array.get(i).getAsJsonObject()));
993      }
994    };
995    if (json.has("condition"))
996      res.setCondition(parseExpression(json.getAsJsonObject("condition")));
997  }
998
999  protected Quantity parseQuantity(JsonObject json) throws IOException, FHIRFormatError {
1000    Quantity res = new Quantity();
1001    parseQuantityProperties(json, res);
1002    return res;
1003  }
1004
1005  protected void parseQuantityProperties(JsonObject json, Quantity res) throws IOException, FHIRFormatError {
1006    parseTypeProperties(json, res);
1007    if (json.has("value"))
1008      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
1009    if (json.has("_value"))
1010      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
1011    if (json.has("comparator"))
1012      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
1013    if (json.has("_comparator"))
1014      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
1015    if (json.has("unit"))
1016      res.setUnitElement(parseString(json.get("unit").getAsString()));
1017    if (json.has("_unit"))
1018      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
1019    if (json.has("system"))
1020      res.setSystemElement(parseUri(json.get("system").getAsString()));
1021    if (json.has("_system"))
1022      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
1023    if (json.has("code"))
1024      res.setCodeElement(parseCode(json.get("code").getAsString()));
1025    if (json.has("_code"))
1026      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
1027  }
1028
1029  protected Period parsePeriod(JsonObject json) throws IOException, FHIRFormatError {
1030    Period res = new Period();
1031    parsePeriodProperties(json, res);
1032    return res;
1033  }
1034
1035  protected void parsePeriodProperties(JsonObject json, Period res) throws IOException, FHIRFormatError {
1036    parseTypeProperties(json, res);
1037    if (json.has("start"))
1038      res.setStartElement(parseDateTime(json.get("start").getAsString()));
1039    if (json.has("_start"))
1040      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
1041    if (json.has("end"))
1042      res.setEndElement(parseDateTime(json.get("end").getAsString()));
1043    if (json.has("_end"))
1044      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
1045  }
1046
1047  protected Duration parseDuration(JsonObject json) throws IOException, FHIRFormatError {
1048    Duration res = new Duration();
1049    parseDurationProperties(json, res);
1050    return res;
1051  }
1052
1053  protected void parseDurationProperties(JsonObject json, Duration res) throws IOException, FHIRFormatError {
1054    parseQuantityProperties(json, res);
1055  }
1056
1057  protected Range parseRange(JsonObject json) throws IOException, FHIRFormatError {
1058    Range res = new Range();
1059    parseRangeProperties(json, res);
1060    return res;
1061  }
1062
1063  protected void parseRangeProperties(JsonObject json, Range res) throws IOException, FHIRFormatError {
1064    parseTypeProperties(json, res);
1065    if (json.has("low"))
1066      res.setLow(parseQuantity(json.getAsJsonObject("low")));
1067    if (json.has("high"))
1068      res.setHigh(parseQuantity(json.getAsJsonObject("high")));
1069  }
1070
1071  protected RelatedArtifact parseRelatedArtifact(JsonObject json) throws IOException, FHIRFormatError {
1072    RelatedArtifact res = new RelatedArtifact();
1073    parseRelatedArtifactProperties(json, res);
1074    return res;
1075  }
1076
1077  protected void parseRelatedArtifactProperties(JsonObject json, RelatedArtifact res) throws IOException, FHIRFormatError {
1078    parseTypeProperties(json, res);
1079    if (json.has("type"))
1080      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), RelatedArtifact.RelatedArtifactType.NULL, new RelatedArtifact.RelatedArtifactTypeEnumFactory()));
1081    if (json.has("_type"))
1082      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1083    if (json.has("label"))
1084      res.setLabelElement(parseString(json.get("label").getAsString()));
1085    if (json.has("_label"))
1086      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
1087    if (json.has("display"))
1088      res.setDisplayElement(parseString(json.get("display").getAsString()));
1089    if (json.has("_display"))
1090      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
1091    if (json.has("citation"))
1092      res.setCitationElement(parseMarkdown(json.get("citation").getAsString()));
1093    if (json.has("_citation"))
1094      parseElementProperties(json.getAsJsonObject("_citation"), res.getCitationElement());
1095    if (json.has("url"))
1096      res.setUrlElement(parseUrl(json.get("url").getAsString()));
1097    if (json.has("_url"))
1098      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
1099    if (json.has("document"))
1100      res.setDocument(parseAttachment(json.getAsJsonObject("document")));
1101    if (json.has("resource"))
1102      res.setResourceElement(parseCanonical(json.get("resource").getAsString()));
1103    if (json.has("_resource"))
1104      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
1105  }
1106
1107  protected Annotation parseAnnotation(JsonObject json) throws IOException, FHIRFormatError {
1108    Annotation res = new Annotation();
1109    parseAnnotationProperties(json, res);
1110    return res;
1111  }
1112
1113  protected void parseAnnotationProperties(JsonObject json, Annotation res) throws IOException, FHIRFormatError {
1114    parseTypeProperties(json, res);
1115    Type author = parseType("author", json);
1116    if (author != null)
1117      res.setAuthor(author);
1118    if (json.has("time"))
1119      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
1120    if (json.has("_time"))
1121      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
1122    if (json.has("text"))
1123      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
1124    if (json.has("_text"))
1125      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
1126  }
1127
1128  protected ProductShelfLife parseProductShelfLife(JsonObject json) throws IOException, FHIRFormatError {
1129    ProductShelfLife res = new ProductShelfLife();
1130    parseProductShelfLifeProperties(json, res);
1131    return res;
1132  }
1133
1134  protected void parseProductShelfLifeProperties(JsonObject json, ProductShelfLife res) throws IOException, FHIRFormatError {
1135    parseBackboneElementProperties(json, res);
1136    if (json.has("identifier"))
1137      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
1138    if (json.has("type"))
1139      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
1140    if (json.has("period"))
1141      res.setPeriod(parseQuantity(json.getAsJsonObject("period")));
1142    if (json.has("specialPrecautionsForStorage")) {
1143      JsonArray array = json.getAsJsonArray("specialPrecautionsForStorage");
1144      for (int i = 0; i < array.size(); i++) {
1145        res.getSpecialPrecautionsForStorage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1146      }
1147    };
1148  }
1149
1150  protected ContactDetail parseContactDetail(JsonObject json) throws IOException, FHIRFormatError {
1151    ContactDetail res = new ContactDetail();
1152    parseContactDetailProperties(json, res);
1153    return res;
1154  }
1155
1156  protected void parseContactDetailProperties(JsonObject json, ContactDetail res) throws IOException, FHIRFormatError {
1157    parseTypeProperties(json, res);
1158    if (json.has("name"))
1159      res.setNameElement(parseString(json.get("name").getAsString()));
1160    if (json.has("_name"))
1161      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1162    if (json.has("telecom")) {
1163      JsonArray array = json.getAsJsonArray("telecom");
1164      for (int i = 0; i < array.size(); i++) {
1165        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
1166      }
1167    };
1168  }
1169
1170  protected UsageContext parseUsageContext(JsonObject json) throws IOException, FHIRFormatError {
1171    UsageContext res = new UsageContext();
1172    parseUsageContextProperties(json, res);
1173    return res;
1174  }
1175
1176  protected void parseUsageContextProperties(JsonObject json, UsageContext res) throws IOException, FHIRFormatError {
1177    parseTypeProperties(json, res);
1178    if (json.has("code"))
1179      res.setCode(parseCoding(json.getAsJsonObject("code")));
1180    Type value = parseType("value", json);
1181    if (value != null)
1182      res.setValue(value);
1183  }
1184
1185  protected Expression parseExpression(JsonObject json) throws IOException, FHIRFormatError {
1186    Expression res = new Expression();
1187    parseExpressionProperties(json, res);
1188    return res;
1189  }
1190
1191  protected void parseExpressionProperties(JsonObject json, Expression res) throws IOException, FHIRFormatError {
1192    parseElementProperties(json, res);
1193    if (json.has("description"))
1194      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1195    if (json.has("_description"))
1196      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1197    if (json.has("name"))
1198      res.setNameElement(parseId(json.get("name").getAsString()));
1199    if (json.has("_name"))
1200      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1201    if (json.has("language"))
1202      res.setLanguageElement(parseEnumeration(json.get("language").getAsString(), Expression.ExpressionLanguage.NULL, new Expression.ExpressionLanguageEnumFactory()));
1203    if (json.has("_language"))
1204      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1205    if (json.has("expression"))
1206      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1207    if (json.has("_expression"))
1208      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
1209    if (json.has("reference"))
1210      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
1211    if (json.has("_reference"))
1212      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
1213  }
1214
1215  protected Signature parseSignature(JsonObject json) throws IOException, FHIRFormatError {
1216    Signature res = new Signature();
1217    parseSignatureProperties(json, res);
1218    return res;
1219  }
1220
1221  protected void parseSignatureProperties(JsonObject json, Signature res) throws IOException, FHIRFormatError {
1222    parseTypeProperties(json, res);
1223    if (json.has("type")) {
1224      JsonArray array = json.getAsJsonArray("type");
1225      for (int i = 0; i < array.size(); i++) {
1226        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
1227      }
1228    };
1229    if (json.has("when"))
1230      res.setWhenElement(parseInstant(json.get("when").getAsString()));
1231    if (json.has("_when"))
1232      parseElementProperties(json.getAsJsonObject("_when"), res.getWhenElement());
1233    if (json.has("who"))
1234      res.setWho(parseReference(json.getAsJsonObject("who")));
1235    if (json.has("onBehalfOf"))
1236      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
1237    if (json.has("targetFormat"))
1238      res.setTargetFormatElement(parseCode(json.get("targetFormat").getAsString()));
1239    if (json.has("_targetFormat"))
1240      parseElementProperties(json.getAsJsonObject("_targetFormat"), res.getTargetFormatElement());
1241    if (json.has("sigFormat"))
1242      res.setSigFormatElement(parseCode(json.get("sigFormat").getAsString()));
1243    if (json.has("_sigFormat"))
1244      parseElementProperties(json.getAsJsonObject("_sigFormat"), res.getSigFormatElement());
1245    if (json.has("data"))
1246      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
1247    if (json.has("_data"))
1248      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
1249  }
1250
1251  protected Timing parseTiming(JsonObject json) throws IOException, FHIRFormatError {
1252    Timing res = new Timing();
1253    parseTimingProperties(json, res);
1254    return res;
1255  }
1256
1257  protected void parseTimingProperties(JsonObject json, Timing res) throws IOException, FHIRFormatError {
1258    parseBackboneElementProperties(json, res);
1259    if (json.has("event")) {
1260      JsonArray array = json.getAsJsonArray("event");
1261      for (int i = 0; i < array.size(); i++) {
1262        res.getEvent().add(parseDateTime(array.get(i).getAsString()));
1263      }
1264    };
1265    if (json.has("_event")) {
1266      JsonArray array = json.getAsJsonArray("_event");
1267      for (int i = 0; i < array.size(); i++) {
1268        if (i == res.getEvent().size())
1269          res.getEvent().add(parseDateTime(null));
1270        if (array.get(i) instanceof JsonObject) 
1271          parseElementProperties(array.get(i).getAsJsonObject(), res.getEvent().get(i));
1272      }
1273    };
1274    if (json.has("repeat"))
1275      res.setRepeat(parseTimingTimingRepeatComponent(json.getAsJsonObject("repeat"), res));
1276    if (json.has("code"))
1277      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
1278  }
1279
1280  protected Timing.TimingRepeatComponent parseTimingTimingRepeatComponent(JsonObject json, Timing owner) throws IOException, FHIRFormatError {
1281    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
1282    parseTimingTimingRepeatComponentProperties(json, owner, res);
1283    return res;
1284  }
1285
1286  protected void parseTimingTimingRepeatComponentProperties(JsonObject json, Timing owner, Timing.TimingRepeatComponent res) throws IOException, FHIRFormatError {
1287    parseTypeProperties(json, res);
1288    Type bounds = parseType("bounds", json);
1289    if (bounds != null)
1290      res.setBounds(bounds);
1291    if (json.has("count"))
1292      res.setCountElement(parsePositiveInt(json.get("count").getAsString()));
1293    if (json.has("_count"))
1294      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
1295    if (json.has("countMax"))
1296      res.setCountMaxElement(parsePositiveInt(json.get("countMax").getAsString()));
1297    if (json.has("_countMax"))
1298      parseElementProperties(json.getAsJsonObject("_countMax"), res.getCountMaxElement());
1299    if (json.has("duration"))
1300      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
1301    if (json.has("_duration"))
1302      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
1303    if (json.has("durationMax"))
1304      res.setDurationMaxElement(parseDecimal(json.get("durationMax").getAsBigDecimal()));
1305    if (json.has("_durationMax"))
1306      parseElementProperties(json.getAsJsonObject("_durationMax"), res.getDurationMaxElement());
1307    if (json.has("durationUnit"))
1308      res.setDurationUnitElement(parseEnumeration(json.get("durationUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1309    if (json.has("_durationUnit"))
1310      parseElementProperties(json.getAsJsonObject("_durationUnit"), res.getDurationUnitElement());
1311    if (json.has("frequency"))
1312      res.setFrequencyElement(parsePositiveInt(json.get("frequency").getAsString()));
1313    if (json.has("_frequency"))
1314      parseElementProperties(json.getAsJsonObject("_frequency"), res.getFrequencyElement());
1315    if (json.has("frequencyMax"))
1316      res.setFrequencyMaxElement(parsePositiveInt(json.get("frequencyMax").getAsString()));
1317    if (json.has("_frequencyMax"))
1318      parseElementProperties(json.getAsJsonObject("_frequencyMax"), res.getFrequencyMaxElement());
1319    if (json.has("period"))
1320      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
1321    if (json.has("_period"))
1322      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
1323    if (json.has("periodMax"))
1324      res.setPeriodMaxElement(parseDecimal(json.get("periodMax").getAsBigDecimal()));
1325    if (json.has("_periodMax"))
1326      parseElementProperties(json.getAsJsonObject("_periodMax"), res.getPeriodMaxElement());
1327    if (json.has("periodUnit"))
1328      res.setPeriodUnitElement(parseEnumeration(json.get("periodUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1329    if (json.has("_periodUnit"))
1330      parseElementProperties(json.getAsJsonObject("_periodUnit"), res.getPeriodUnitElement());
1331    if (json.has("dayOfWeek")) {
1332      JsonArray array = json.getAsJsonArray("dayOfWeek");
1333      for (int i = 0; i < array.size(); i++) {
1334        res.getDayOfWeek().add(parseEnumeration(array.get(i).getAsString(), Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1335      }
1336    };
1337    if (json.has("_dayOfWeek")) {
1338      JsonArray array = json.getAsJsonArray("_dayOfWeek");
1339      for (int i = 0; i < array.size(); i++) {
1340        if (i == res.getDayOfWeek().size())
1341          res.getDayOfWeek().add(parseEnumeration(null, Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1342        if (array.get(i) instanceof JsonObject) 
1343          parseElementProperties(array.get(i).getAsJsonObject(), res.getDayOfWeek().get(i));
1344      }
1345    };
1346    if (json.has("timeOfDay")) {
1347      JsonArray array = json.getAsJsonArray("timeOfDay");
1348      for (int i = 0; i < array.size(); i++) {
1349        res.getTimeOfDay().add(parseTime(array.get(i).getAsString()));
1350      }
1351    };
1352    if (json.has("_timeOfDay")) {
1353      JsonArray array = json.getAsJsonArray("_timeOfDay");
1354      for (int i = 0; i < array.size(); i++) {
1355        if (i == res.getTimeOfDay().size())
1356          res.getTimeOfDay().add(parseTime(null));
1357        if (array.get(i) instanceof JsonObject) 
1358          parseElementProperties(array.get(i).getAsJsonObject(), res.getTimeOfDay().get(i));
1359      }
1360    };
1361    if (json.has("when")) {
1362      JsonArray array = json.getAsJsonArray("when");
1363      for (int i = 0; i < array.size(); i++) {
1364        res.getWhen().add(parseEnumeration(array.get(i).getAsString(), Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1365      }
1366    };
1367    if (json.has("_when")) {
1368      JsonArray array = json.getAsJsonArray("_when");
1369      for (int i = 0; i < array.size(); i++) {
1370        if (i == res.getWhen().size())
1371          res.getWhen().add(parseEnumeration(null, Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1372        if (array.get(i) instanceof JsonObject) 
1373          parseElementProperties(array.get(i).getAsJsonObject(), res.getWhen().get(i));
1374      }
1375    };
1376    if (json.has("offset"))
1377      res.setOffsetElement(parseUnsignedInt(json.get("offset").getAsString()));
1378    if (json.has("_offset"))
1379      parseElementProperties(json.getAsJsonObject("_offset"), res.getOffsetElement());
1380  }
1381
1382  protected ProdCharacteristic parseProdCharacteristic(JsonObject json) throws IOException, FHIRFormatError {
1383    ProdCharacteristic res = new ProdCharacteristic();
1384    parseProdCharacteristicProperties(json, res);
1385    return res;
1386  }
1387
1388  protected void parseProdCharacteristicProperties(JsonObject json, ProdCharacteristic res) throws IOException, FHIRFormatError {
1389    parseBackboneElementProperties(json, res);
1390    if (json.has("height"))
1391      res.setHeight(parseQuantity(json.getAsJsonObject("height")));
1392    if (json.has("width"))
1393      res.setWidth(parseQuantity(json.getAsJsonObject("width")));
1394    if (json.has("depth"))
1395      res.setDepth(parseQuantity(json.getAsJsonObject("depth")));
1396    if (json.has("weight"))
1397      res.setWeight(parseQuantity(json.getAsJsonObject("weight")));
1398    if (json.has("nominalVolume"))
1399      res.setNominalVolume(parseQuantity(json.getAsJsonObject("nominalVolume")));
1400    if (json.has("externalDiameter"))
1401      res.setExternalDiameter(parseQuantity(json.getAsJsonObject("externalDiameter")));
1402    if (json.has("shape"))
1403      res.setShapeElement(parseString(json.get("shape").getAsString()));
1404    if (json.has("_shape"))
1405      parseElementProperties(json.getAsJsonObject("_shape"), res.getShapeElement());
1406    if (json.has("color")) {
1407      JsonArray array = json.getAsJsonArray("color");
1408      for (int i = 0; i < array.size(); i++) {
1409        res.getColor().add(parseString(array.get(i).getAsString()));
1410      }
1411    };
1412    if (json.has("_color")) {
1413      JsonArray array = json.getAsJsonArray("_color");
1414      for (int i = 0; i < array.size(); i++) {
1415        if (i == res.getColor().size())
1416          res.getColor().add(parseString(null));
1417        if (array.get(i) instanceof JsonObject) 
1418          parseElementProperties(array.get(i).getAsJsonObject(), res.getColor().get(i));
1419      }
1420    };
1421    if (json.has("imprint")) {
1422      JsonArray array = json.getAsJsonArray("imprint");
1423      for (int i = 0; i < array.size(); i++) {
1424        res.getImprint().add(parseString(array.get(i).getAsString()));
1425      }
1426    };
1427    if (json.has("_imprint")) {
1428      JsonArray array = json.getAsJsonArray("_imprint");
1429      for (int i = 0; i < array.size(); i++) {
1430        if (i == res.getImprint().size())
1431          res.getImprint().add(parseString(null));
1432        if (array.get(i) instanceof JsonObject) 
1433          parseElementProperties(array.get(i).getAsJsonObject(), res.getImprint().get(i));
1434      }
1435    };
1436    if (json.has("image")) {
1437      JsonArray array = json.getAsJsonArray("image");
1438      for (int i = 0; i < array.size(); i++) {
1439        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
1440      }
1441    };
1442    if (json.has("scoring"))
1443      res.setScoring(parseCodeableConcept(json.getAsJsonObject("scoring")));
1444  }
1445
1446  protected CodeableConcept parseCodeableConcept(JsonObject json) throws IOException, FHIRFormatError {
1447    CodeableConcept res = new CodeableConcept();
1448    parseCodeableConceptProperties(json, res);
1449    return res;
1450  }
1451
1452  protected void parseCodeableConceptProperties(JsonObject json, CodeableConcept res) throws IOException, FHIRFormatError {
1453    parseTypeProperties(json, res);
1454    if (json.has("coding")) {
1455      JsonArray array = json.getAsJsonArray("coding");
1456      for (int i = 0; i < array.size(); i++) {
1457        res.getCoding().add(parseCoding(array.get(i).getAsJsonObject()));
1458      }
1459    };
1460    if (json.has("text"))
1461      res.setTextElement(parseString(json.get("text").getAsString()));
1462    if (json.has("_text"))
1463      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
1464  }
1465
1466  protected ParameterDefinition parseParameterDefinition(JsonObject json) throws IOException, FHIRFormatError {
1467    ParameterDefinition res = new ParameterDefinition();
1468    parseParameterDefinitionProperties(json, res);
1469    return res;
1470  }
1471
1472  protected void parseParameterDefinitionProperties(JsonObject json, ParameterDefinition res) throws IOException, FHIRFormatError {
1473    parseTypeProperties(json, res);
1474    if (json.has("name"))
1475      res.setNameElement(parseCode(json.get("name").getAsString()));
1476    if (json.has("_name"))
1477      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1478    if (json.has("use"))
1479      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ParameterDefinition.ParameterUse.NULL, new ParameterDefinition.ParameterUseEnumFactory()));
1480    if (json.has("_use"))
1481      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
1482    if (json.has("min"))
1483      res.setMinElement(parseInteger(json.get("min").getAsLong()));
1484    if (json.has("_min"))
1485      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1486    if (json.has("max"))
1487      res.setMaxElement(parseString(json.get("max").getAsString()));
1488    if (json.has("_max"))
1489      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1490    if (json.has("documentation"))
1491      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
1492    if (json.has("_documentation"))
1493      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
1494    if (json.has("type"))
1495      res.setTypeElement(parseCode(json.get("type").getAsString()));
1496    if (json.has("_type"))
1497      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1498    if (json.has("profile"))
1499      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
1500    if (json.has("_profile"))
1501      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
1502  }
1503
1504  protected ElementDefinition parseElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
1505    ElementDefinition res = new ElementDefinition();
1506    parseElementDefinitionProperties(json, res);
1507    return res;
1508  }
1509
1510  protected void parseElementDefinitionProperties(JsonObject json, ElementDefinition res) throws IOException, FHIRFormatError {
1511    parseBackboneElementProperties(json, res);
1512    if (json.has("path"))
1513      res.setPathElement(parseString(json.get("path").getAsString()));
1514    if (json.has("_path"))
1515      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1516    if (json.has("representation")) {
1517      JsonArray array = json.getAsJsonArray("representation");
1518      for (int i = 0; i < array.size(); i++) {
1519        res.getRepresentation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1520      }
1521    };
1522    if (json.has("_representation")) {
1523      JsonArray array = json.getAsJsonArray("_representation");
1524      for (int i = 0; i < array.size(); i++) {
1525        if (i == res.getRepresentation().size())
1526          res.getRepresentation().add(parseEnumeration(null, ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1527        if (array.get(i) instanceof JsonObject) 
1528          parseElementProperties(array.get(i).getAsJsonObject(), res.getRepresentation().get(i));
1529      }
1530    };
1531    if (json.has("sliceName"))
1532      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
1533    if (json.has("_sliceName"))
1534      parseElementProperties(json.getAsJsonObject("_sliceName"), res.getSliceNameElement());
1535    if (json.has("sliceIsConstraining"))
1536      res.setSliceIsConstrainingElement(parseBoolean(json.get("sliceIsConstraining").getAsBoolean()));
1537    if (json.has("_sliceIsConstraining"))
1538      parseElementProperties(json.getAsJsonObject("_sliceIsConstraining"), res.getSliceIsConstrainingElement());
1539    if (json.has("label"))
1540      res.setLabelElement(parseString(json.get("label").getAsString()));
1541    if (json.has("_label"))
1542      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
1543    if (json.has("code")) {
1544      JsonArray array = json.getAsJsonArray("code");
1545      for (int i = 0; i < array.size(); i++) {
1546        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
1547      }
1548    };
1549    if (json.has("slicing"))
1550      res.setSlicing(parseElementDefinitionElementDefinitionSlicingComponent(json.getAsJsonObject("slicing"), res));
1551    if (json.has("short"))
1552      res.setShortElement(parseString(json.get("short").getAsString()));
1553    if (json.has("_short"))
1554      parseElementProperties(json.getAsJsonObject("_short"), res.getShortElement());
1555    if (json.has("definition"))
1556      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
1557    if (json.has("_definition"))
1558      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
1559    if (json.has("comment"))
1560      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
1561    if (json.has("_comment"))
1562      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
1563    if (json.has("requirements"))
1564      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
1565    if (json.has("_requirements"))
1566      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
1567    if (json.has("alias")) {
1568      JsonArray array = json.getAsJsonArray("alias");
1569      for (int i = 0; i < array.size(); i++) {
1570        res.getAlias().add(parseString(array.get(i).getAsString()));
1571      }
1572    };
1573    if (json.has("_alias")) {
1574      JsonArray array = json.getAsJsonArray("_alias");
1575      for (int i = 0; i < array.size(); i++) {
1576        if (i == res.getAlias().size())
1577          res.getAlias().add(parseString(null));
1578        if (array.get(i) instanceof JsonObject) 
1579          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
1580      }
1581    };
1582    if (json.has("min"))
1583      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1584    if (json.has("_min"))
1585      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1586    if (json.has("max"))
1587      res.setMaxElement(parseString(json.get("max").getAsString()));
1588    if (json.has("_max"))
1589      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1590    if (json.has("base"))
1591      res.setBase(parseElementDefinitionElementDefinitionBaseComponent(json.getAsJsonObject("base"), res));
1592    if (json.has("contentReference"))
1593      res.setContentReferenceElement(parseUri(json.get("contentReference").getAsString()));
1594    if (json.has("_contentReference"))
1595      parseElementProperties(json.getAsJsonObject("_contentReference"), res.getContentReferenceElement());
1596    if (json.has("type")) {
1597      JsonArray array = json.getAsJsonArray("type");
1598      for (int i = 0; i < array.size(); i++) {
1599        res.getType().add(parseElementDefinitionTypeRefComponent(array.get(i).getAsJsonObject(), res));
1600      }
1601    };
1602    Type defaultValue = parseType("defaultValue", json);
1603    if (defaultValue != null)
1604      res.setDefaultValue(defaultValue);
1605    if (json.has("meaningWhenMissing"))
1606      res.setMeaningWhenMissingElement(parseMarkdown(json.get("meaningWhenMissing").getAsString()));
1607    if (json.has("_meaningWhenMissing"))
1608      parseElementProperties(json.getAsJsonObject("_meaningWhenMissing"), res.getMeaningWhenMissingElement());
1609    if (json.has("orderMeaning"))
1610      res.setOrderMeaningElement(parseString(json.get("orderMeaning").getAsString()));
1611    if (json.has("_orderMeaning"))
1612      parseElementProperties(json.getAsJsonObject("_orderMeaning"), res.getOrderMeaningElement());
1613    Type fixed = parseType("fixed", json);
1614    if (fixed != null)
1615      res.setFixed(fixed);
1616    Type pattern = parseType("pattern", json);
1617    if (pattern != null)
1618      res.setPattern(pattern);
1619    if (json.has("example")) {
1620      JsonArray array = json.getAsJsonArray("example");
1621      for (int i = 0; i < array.size(); i++) {
1622        res.getExample().add(parseElementDefinitionElementDefinitionExampleComponent(array.get(i).getAsJsonObject(), res));
1623      }
1624    };
1625    Type minValue = parseType("minValue", json);
1626    if (minValue != null)
1627      res.setMinValue(minValue);
1628    Type maxValue = parseType("maxValue", json);
1629    if (maxValue != null)
1630      res.setMaxValue(maxValue);
1631    if (json.has("maxLength"))
1632      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
1633    if (json.has("_maxLength"))
1634      parseElementProperties(json.getAsJsonObject("_maxLength"), res.getMaxLengthElement());
1635    if (json.has("condition")) {
1636      JsonArray array = json.getAsJsonArray("condition");
1637      for (int i = 0; i < array.size(); i++) {
1638        res.getCondition().add(parseId(array.get(i).getAsString()));
1639      }
1640    };
1641    if (json.has("_condition")) {
1642      JsonArray array = json.getAsJsonArray("_condition");
1643      for (int i = 0; i < array.size(); i++) {
1644        if (i == res.getCondition().size())
1645          res.getCondition().add(parseId(null));
1646        if (array.get(i) instanceof JsonObject) 
1647          parseElementProperties(array.get(i).getAsJsonObject(), res.getCondition().get(i));
1648      }
1649    };
1650    if (json.has("constraint")) {
1651      JsonArray array = json.getAsJsonArray("constraint");
1652      for (int i = 0; i < array.size(); i++) {
1653        res.getConstraint().add(parseElementDefinitionElementDefinitionConstraintComponent(array.get(i).getAsJsonObject(), res));
1654      }
1655    };
1656    if (json.has("mustSupport"))
1657      res.setMustSupportElement(parseBoolean(json.get("mustSupport").getAsBoolean()));
1658    if (json.has("_mustSupport"))
1659      parseElementProperties(json.getAsJsonObject("_mustSupport"), res.getMustSupportElement());
1660    if (json.has("isModifier"))
1661      res.setIsModifierElement(parseBoolean(json.get("isModifier").getAsBoolean()));
1662    if (json.has("_isModifier"))
1663      parseElementProperties(json.getAsJsonObject("_isModifier"), res.getIsModifierElement());
1664    if (json.has("isModifierReason"))
1665      res.setIsModifierReasonElement(parseString(json.get("isModifierReason").getAsString()));
1666    if (json.has("_isModifierReason"))
1667      parseElementProperties(json.getAsJsonObject("_isModifierReason"), res.getIsModifierReasonElement());
1668    if (json.has("isSummary"))
1669      res.setIsSummaryElement(parseBoolean(json.get("isSummary").getAsBoolean()));
1670    if (json.has("_isSummary"))
1671      parseElementProperties(json.getAsJsonObject("_isSummary"), res.getIsSummaryElement());
1672    if (json.has("binding"))
1673      res.setBinding(parseElementDefinitionElementDefinitionBindingComponent(json.getAsJsonObject("binding"), res));
1674    if (json.has("mapping")) {
1675      JsonArray array = json.getAsJsonArray("mapping");
1676      for (int i = 0; i < array.size(); i++) {
1677        res.getMapping().add(parseElementDefinitionElementDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
1678      }
1679    };
1680  }
1681
1682  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionElementDefinitionSlicingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1683    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
1684    parseElementDefinitionElementDefinitionSlicingComponentProperties(json, owner, res);
1685    return res;
1686  }
1687
1688  protected void parseElementDefinitionElementDefinitionSlicingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingComponent res) throws IOException, FHIRFormatError {
1689    parseTypeProperties(json, res);
1690    if (json.has("discriminator")) {
1691      JsonArray array = json.getAsJsonArray("discriminator");
1692      for (int i = 0; i < array.size(); i++) {
1693        res.getDiscriminator().add(parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(array.get(i).getAsJsonObject(), owner));
1694      }
1695    };
1696    if (json.has("description"))
1697      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1698    if (json.has("_description"))
1699      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1700    if (json.has("ordered"))
1701      res.setOrderedElement(parseBoolean(json.get("ordered").getAsBoolean()));
1702    if (json.has("_ordered"))
1703      parseElementProperties(json.getAsJsonObject("_ordered"), res.getOrderedElement());
1704    if (json.has("rules"))
1705      res.setRulesElement(parseEnumeration(json.get("rules").getAsString(), ElementDefinition.SlicingRules.NULL, new ElementDefinition.SlicingRulesEnumFactory()));
1706    if (json.has("_rules"))
1707      parseElementProperties(json.getAsJsonObject("_rules"), res.getRulesElement());
1708  }
1709
1710  protected ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1711    ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res = new ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent();
1712    parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(json, owner, res);
1713    return res;
1714  }
1715
1716  protected void parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res) throws IOException, FHIRFormatError {
1717    parseTypeProperties(json, res);
1718    if (json.has("type"))
1719      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ElementDefinition.DiscriminatorType.NULL, new ElementDefinition.DiscriminatorTypeEnumFactory()));
1720    if (json.has("_type"))
1721      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1722    if (json.has("path"))
1723      res.setPathElement(parseString(json.get("path").getAsString()));
1724    if (json.has("_path"))
1725      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1726  }
1727
1728  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionElementDefinitionBaseComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1729    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
1730    parseElementDefinitionElementDefinitionBaseComponentProperties(json, owner, res);
1731    return res;
1732  }
1733
1734  protected void parseElementDefinitionElementDefinitionBaseComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBaseComponent res) throws IOException, FHIRFormatError {
1735    parseTypeProperties(json, res);
1736    if (json.has("path"))
1737      res.setPathElement(parseString(json.get("path").getAsString()));
1738    if (json.has("_path"))
1739      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1740    if (json.has("min"))
1741      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1742    if (json.has("_min"))
1743      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1744    if (json.has("max"))
1745      res.setMaxElement(parseString(json.get("max").getAsString()));
1746    if (json.has("_max"))
1747      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1748  }
1749
1750  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1751    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
1752    parseElementDefinitionTypeRefComponentProperties(json, owner, res);
1753    return res;
1754  }
1755
1756  protected void parseElementDefinitionTypeRefComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.TypeRefComponent res) throws IOException, FHIRFormatError {
1757    parseTypeProperties(json, res);
1758    if (json.has("code"))
1759      res.setCodeElement(parseUri(json.get("code").getAsString()));
1760    if (json.has("_code"))
1761      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
1762    if (json.has("profile")) {
1763      JsonArray array = json.getAsJsonArray("profile");
1764      for (int i = 0; i < array.size(); i++) {
1765        res.getProfile().add(parseCanonical(array.get(i).getAsString()));
1766      }
1767    };
1768    if (json.has("_profile")) {
1769      JsonArray array = json.getAsJsonArray("_profile");
1770      for (int i = 0; i < array.size(); i++) {
1771        if (i == res.getProfile().size())
1772          res.getProfile().add(parseCanonical(null));
1773        if (array.get(i) instanceof JsonObject) 
1774          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
1775      }
1776    };
1777    if (json.has("targetProfile")) {
1778      JsonArray array = json.getAsJsonArray("targetProfile");
1779      for (int i = 0; i < array.size(); i++) {
1780        res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
1781      }
1782    };
1783    if (json.has("_targetProfile")) {
1784      JsonArray array = json.getAsJsonArray("_targetProfile");
1785      for (int i = 0; i < array.size(); i++) {
1786        if (i == res.getTargetProfile().size())
1787          res.getTargetProfile().add(parseCanonical(null));
1788        if (array.get(i) instanceof JsonObject) 
1789          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
1790      }
1791    };
1792    if (json.has("aggregation")) {
1793      JsonArray array = json.getAsJsonArray("aggregation");
1794      for (int i = 0; i < array.size(); i++) {
1795        res.getAggregation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1796      }
1797    };
1798    if (json.has("_aggregation")) {
1799      JsonArray array = json.getAsJsonArray("_aggregation");
1800      for (int i = 0; i < array.size(); i++) {
1801        if (i == res.getAggregation().size())
1802          res.getAggregation().add(parseEnumeration(null, ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1803        if (array.get(i) instanceof JsonObject) 
1804          parseElementProperties(array.get(i).getAsJsonObject(), res.getAggregation().get(i));
1805      }
1806    };
1807    if (json.has("versioning"))
1808      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), ElementDefinition.ReferenceVersionRules.NULL, new ElementDefinition.ReferenceVersionRulesEnumFactory()));
1809    if (json.has("_versioning"))
1810      parseElementProperties(json.getAsJsonObject("_versioning"), res.getVersioningElement());
1811  }
1812
1813  protected ElementDefinition.ElementDefinitionExampleComponent parseElementDefinitionElementDefinitionExampleComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1814    ElementDefinition.ElementDefinitionExampleComponent res = new ElementDefinition.ElementDefinitionExampleComponent();
1815    parseElementDefinitionElementDefinitionExampleComponentProperties(json, owner, res);
1816    return res;
1817  }
1818
1819  protected void parseElementDefinitionElementDefinitionExampleComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionExampleComponent res) throws IOException, FHIRFormatError {
1820    parseTypeProperties(json, res);
1821    if (json.has("label"))
1822      res.setLabelElement(parseString(json.get("label").getAsString()));
1823    if (json.has("_label"))
1824      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
1825    Type value = parseType("value", json);
1826    if (value != null)
1827      res.setValue(value);
1828  }
1829
1830  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionElementDefinitionConstraintComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1831    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
1832    parseElementDefinitionElementDefinitionConstraintComponentProperties(json, owner, res);
1833    return res;
1834  }
1835
1836  protected void parseElementDefinitionElementDefinitionConstraintComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionConstraintComponent res) throws IOException, FHIRFormatError {
1837    parseTypeProperties(json, res);
1838    if (json.has("key"))
1839      res.setKeyElement(parseId(json.get("key").getAsString()));
1840    if (json.has("_key"))
1841      parseElementProperties(json.getAsJsonObject("_key"), res.getKeyElement());
1842    if (json.has("requirements"))
1843      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
1844    if (json.has("_requirements"))
1845      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
1846    if (json.has("severity"))
1847      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
1848    if (json.has("_severity"))
1849      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
1850    if (json.has("human"))
1851      res.setHumanElement(parseString(json.get("human").getAsString()));
1852    if (json.has("_human"))
1853      parseElementProperties(json.getAsJsonObject("_human"), res.getHumanElement());
1854    if (json.has("expression"))
1855      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1856    if (json.has("_expression"))
1857      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
1858    if (json.has("xpath"))
1859      res.setXpathElement(parseString(json.get("xpath").getAsString()));
1860    if (json.has("_xpath"))
1861      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
1862    if (json.has("source"))
1863      res.setSourceElement(parseCanonical(json.get("source").getAsString()));
1864    if (json.has("_source"))
1865      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
1866  }
1867
1868  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionElementDefinitionBindingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1869    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
1870    parseElementDefinitionElementDefinitionBindingComponentProperties(json, owner, res);
1871    return res;
1872  }
1873
1874  protected void parseElementDefinitionElementDefinitionBindingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBindingComponent res) throws IOException, FHIRFormatError {
1875    parseTypeProperties(json, res);
1876    if (json.has("strength"))
1877      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
1878    if (json.has("_strength"))
1879      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
1880    if (json.has("description"))
1881      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1882    if (json.has("_description"))
1883      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1884    if (json.has("valueSet"))
1885      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
1886    if (json.has("_valueSet"))
1887      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
1888  }
1889
1890  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionElementDefinitionMappingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1891    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
1892    parseElementDefinitionElementDefinitionMappingComponentProperties(json, owner, res);
1893    return res;
1894  }
1895
1896  protected void parseElementDefinitionElementDefinitionMappingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionMappingComponent res) throws IOException, FHIRFormatError {
1897    parseTypeProperties(json, res);
1898    if (json.has("identity"))
1899      res.setIdentityElement(parseId(json.get("identity").getAsString()));
1900    if (json.has("_identity"))
1901      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
1902    if (json.has("language"))
1903      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1904    if (json.has("_language"))
1905      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1906    if (json.has("map"))
1907      res.setMapElement(parseString(json.get("map").getAsString()));
1908    if (json.has("_map"))
1909      parseElementProperties(json.getAsJsonObject("_map"), res.getMapElement());
1910    if (json.has("comment"))
1911      res.setCommentElement(parseString(json.get("comment").getAsString()));
1912    if (json.has("_comment"))
1913      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
1914  }
1915
1916  protected void parseDomainResourceProperties(JsonObject json, DomainResource res) throws IOException, FHIRFormatError {
1917    parseResourceProperties(json, res);
1918    if (json.has("text"))
1919      res.setText(parseNarrative(json.getAsJsonObject("text")));
1920    if (json.has("contained")) {
1921      JsonArray array = json.getAsJsonArray("contained");
1922      for (int i = 0; i < array.size(); i++) {
1923        res.getContained().add(parseResource(array.get(i).getAsJsonObject()));
1924      }
1925    };
1926    if (json.has("extension")) {
1927      JsonArray array = json.getAsJsonArray("extension");
1928      for (int i = 0; i < array.size(); i++) {
1929        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1930      }
1931    };
1932    if (json.has("modifierExtension")) {
1933      JsonArray array = json.getAsJsonArray("modifierExtension");
1934      for (int i = 0; i < array.size(); i++) {
1935        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1936      }
1937    };
1938  }
1939
1940  protected Parameters parseParameters(JsonObject json) throws IOException, FHIRFormatError {
1941    Parameters res = new Parameters();
1942    parseParametersProperties(json, res);
1943    return res;
1944  }
1945
1946  protected void parseParametersProperties(JsonObject json, Parameters res) throws IOException, FHIRFormatError {
1947    parseResourceProperties(json, res);
1948    if (json.has("parameter")) {
1949      JsonArray array = json.getAsJsonArray("parameter");
1950      for (int i = 0; i < array.size(); i++) {
1951        res.getParameter().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), res));
1952      }
1953    };
1954  }
1955
1956  protected Parameters.ParametersParameterComponent parseParametersParametersParameterComponent(JsonObject json, Parameters owner) throws IOException, FHIRFormatError {
1957    Parameters.ParametersParameterComponent res = new Parameters.ParametersParameterComponent();
1958    parseParametersParametersParameterComponentProperties(json, owner, res);
1959    return res;
1960  }
1961
1962  protected void parseParametersParametersParameterComponentProperties(JsonObject json, Parameters owner, Parameters.ParametersParameterComponent res) throws IOException, FHIRFormatError {
1963    parseBackboneElementProperties(json, res);
1964    if (json.has("name"))
1965      res.setNameElement(parseString(json.get("name").getAsString()));
1966    if (json.has("_name"))
1967      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1968    Type value = parseType("value", json);
1969    if (value != null)
1970      res.setValue(value);
1971    if (json.has("resource"))
1972      res.setResource(parseResource(json.getAsJsonObject("resource")));
1973    if (json.has("part")) {
1974      JsonArray array = json.getAsJsonArray("part");
1975      for (int i = 0; i < array.size(); i++) {
1976        res.getPart().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), owner));
1977      }
1978    };
1979  }
1980
1981  protected void parseResourceProperties(JsonObject json, Resource res) throws IOException, FHIRFormatError {
1982    if (json.has("id"))
1983      res.setIdElement(parseId(json.get("id").getAsString()));
1984    if (json.has("_id"))
1985      parseElementProperties(json.getAsJsonObject("_id"), res.getIdElement());
1986    if (json.has("meta"))
1987      res.setMeta(parseMeta(json.getAsJsonObject("meta")));
1988    if (json.has("implicitRules"))
1989      res.setImplicitRulesElement(parseUri(json.get("implicitRules").getAsString()));
1990    if (json.has("_implicitRules"))
1991      parseElementProperties(json.getAsJsonObject("_implicitRules"), res.getImplicitRulesElement());
1992    if (json.has("language"))
1993      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1994    if (json.has("_language"))
1995      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1996  }
1997
1998  protected Account parseAccount(JsonObject json) throws IOException, FHIRFormatError {
1999    Account res = new Account();
2000    parseAccountProperties(json, res);
2001    return res;
2002  }
2003
2004  protected void parseAccountProperties(JsonObject json, Account res) throws IOException, FHIRFormatError {
2005    parseDomainResourceProperties(json, res);
2006    if (json.has("identifier")) {
2007      JsonArray array = json.getAsJsonArray("identifier");
2008      for (int i = 0; i < array.size(); i++) {
2009        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2010      }
2011    };
2012    if (json.has("status"))
2013      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Account.AccountStatus.NULL, new Account.AccountStatusEnumFactory()));
2014    if (json.has("_status"))
2015      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2016    if (json.has("type"))
2017      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
2018    if (json.has("name"))
2019      res.setNameElement(parseString(json.get("name").getAsString()));
2020    if (json.has("_name"))
2021      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2022    if (json.has("subject")) {
2023      JsonArray array = json.getAsJsonArray("subject");
2024      for (int i = 0; i < array.size(); i++) {
2025        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
2026      }
2027    };
2028    if (json.has("servicePeriod"))
2029      res.setServicePeriod(parsePeriod(json.getAsJsonObject("servicePeriod")));
2030    if (json.has("coverage")) {
2031      JsonArray array = json.getAsJsonArray("coverage");
2032      for (int i = 0; i < array.size(); i++) {
2033        res.getCoverage().add(parseAccountCoverageComponent(array.get(i).getAsJsonObject(), res));
2034      }
2035    };
2036    if (json.has("owner"))
2037      res.setOwner(parseReference(json.getAsJsonObject("owner")));
2038    if (json.has("description"))
2039      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2040    if (json.has("_description"))
2041      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2042    if (json.has("guarantor")) {
2043      JsonArray array = json.getAsJsonArray("guarantor");
2044      for (int i = 0; i < array.size(); i++) {
2045        res.getGuarantor().add(parseAccountGuarantorComponent(array.get(i).getAsJsonObject(), res));
2046      }
2047    };
2048    if (json.has("partOf"))
2049      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
2050  }
2051
2052  protected Account.CoverageComponent parseAccountCoverageComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
2053    Account.CoverageComponent res = new Account.CoverageComponent();
2054    parseAccountCoverageComponentProperties(json, owner, res);
2055    return res;
2056  }
2057
2058  protected void parseAccountCoverageComponentProperties(JsonObject json, Account owner, Account.CoverageComponent res) throws IOException, FHIRFormatError {
2059    parseBackboneElementProperties(json, res);
2060    if (json.has("coverage"))
2061      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
2062    if (json.has("priority"))
2063      res.setPriorityElement(parsePositiveInt(json.get("priority").getAsString()));
2064    if (json.has("_priority"))
2065      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
2066  }
2067
2068  protected Account.GuarantorComponent parseAccountGuarantorComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
2069    Account.GuarantorComponent res = new Account.GuarantorComponent();
2070    parseAccountGuarantorComponentProperties(json, owner, res);
2071    return res;
2072  }
2073
2074  protected void parseAccountGuarantorComponentProperties(JsonObject json, Account owner, Account.GuarantorComponent res) throws IOException, FHIRFormatError {
2075    parseBackboneElementProperties(json, res);
2076    if (json.has("party"))
2077      res.setParty(parseReference(json.getAsJsonObject("party")));
2078    if (json.has("onHold"))
2079      res.setOnHoldElement(parseBoolean(json.get("onHold").getAsBoolean()));
2080    if (json.has("_onHold"))
2081      parseElementProperties(json.getAsJsonObject("_onHold"), res.getOnHoldElement());
2082    if (json.has("period"))
2083      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
2084  }
2085
2086  protected ActivityDefinition parseActivityDefinition(JsonObject json) throws IOException, FHIRFormatError {
2087    ActivityDefinition res = new ActivityDefinition();
2088    parseActivityDefinitionProperties(json, res);
2089    return res;
2090  }
2091
2092  protected void parseActivityDefinitionProperties(JsonObject json, ActivityDefinition res) throws IOException, FHIRFormatError {
2093    parseDomainResourceProperties(json, res);
2094    if (json.has("url"))
2095      res.setUrlElement(parseUri(json.get("url").getAsString()));
2096    if (json.has("_url"))
2097      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
2098    if (json.has("identifier")) {
2099      JsonArray array = json.getAsJsonArray("identifier");
2100      for (int i = 0; i < array.size(); i++) {
2101        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2102      }
2103    };
2104    if (json.has("version"))
2105      res.setVersionElement(parseString(json.get("version").getAsString()));
2106    if (json.has("_version"))
2107      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
2108    if (json.has("name"))
2109      res.setNameElement(parseString(json.get("name").getAsString()));
2110    if (json.has("_name"))
2111      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2112    if (json.has("title"))
2113      res.setTitleElement(parseString(json.get("title").getAsString()));
2114    if (json.has("_title"))
2115      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
2116    if (json.has("subtitle"))
2117      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
2118    if (json.has("_subtitle"))
2119      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
2120    if (json.has("status"))
2121      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2122    if (json.has("_status"))
2123      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2124    if (json.has("experimental"))
2125      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
2126    if (json.has("_experimental"))
2127      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
2128    Type subject = parseType("subject", json);
2129    if (subject != null)
2130      res.setSubject(subject);
2131    if (json.has("date"))
2132      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2133    if (json.has("_date"))
2134      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
2135    if (json.has("publisher"))
2136      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
2137    if (json.has("_publisher"))
2138      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
2139    if (json.has("contact")) {
2140      JsonArray array = json.getAsJsonArray("contact");
2141      for (int i = 0; i < array.size(); i++) {
2142        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
2143      }
2144    };
2145    if (json.has("description"))
2146      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
2147    if (json.has("_description"))
2148      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2149    if (json.has("useContext")) {
2150      JsonArray array = json.getAsJsonArray("useContext");
2151      for (int i = 0; i < array.size(); i++) {
2152        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
2153      }
2154    };
2155    if (json.has("jurisdiction")) {
2156      JsonArray array = json.getAsJsonArray("jurisdiction");
2157      for (int i = 0; i < array.size(); i++) {
2158        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2159      }
2160    };
2161    if (json.has("purpose"))
2162      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
2163    if (json.has("_purpose"))
2164      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
2165    if (json.has("usage"))
2166      res.setUsageElement(parseString(json.get("usage").getAsString()));
2167    if (json.has("_usage"))
2168      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
2169    if (json.has("copyright"))
2170      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
2171    if (json.has("_copyright"))
2172      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
2173    if (json.has("approvalDate"))
2174      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
2175    if (json.has("_approvalDate"))
2176      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
2177    if (json.has("lastReviewDate"))
2178      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
2179    if (json.has("_lastReviewDate"))
2180      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
2181    if (json.has("effectivePeriod"))
2182      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
2183    if (json.has("topic")) {
2184      JsonArray array = json.getAsJsonArray("topic");
2185      for (int i = 0; i < array.size(); i++) {
2186        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2187      }
2188    };
2189    if (json.has("author")) {
2190      JsonArray array = json.getAsJsonArray("author");
2191      for (int i = 0; i < array.size(); i++) {
2192        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2193      }
2194    };
2195    if (json.has("editor")) {
2196      JsonArray array = json.getAsJsonArray("editor");
2197      for (int i = 0; i < array.size(); i++) {
2198        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2199      }
2200    };
2201    if (json.has("reviewer")) {
2202      JsonArray array = json.getAsJsonArray("reviewer");
2203      for (int i = 0; i < array.size(); i++) {
2204        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
2205      }
2206    };
2207    if (json.has("endorser")) {
2208      JsonArray array = json.getAsJsonArray("endorser");
2209      for (int i = 0; i < array.size(); i++) {
2210        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
2211      }
2212    };
2213    if (json.has("relatedArtifact")) {
2214      JsonArray array = json.getAsJsonArray("relatedArtifact");
2215      for (int i = 0; i < array.size(); i++) {
2216        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
2217      }
2218    };
2219    if (json.has("library")) {
2220      JsonArray array = json.getAsJsonArray("library");
2221      for (int i = 0; i < array.size(); i++) {
2222        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
2223      }
2224    };
2225    if (json.has("_library")) {
2226      JsonArray array = json.getAsJsonArray("_library");
2227      for (int i = 0; i < array.size(); i++) {
2228        if (i == res.getLibrary().size())
2229          res.getLibrary().add(parseCanonical(null));
2230        if (array.get(i) instanceof JsonObject) 
2231          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
2232      }
2233    };
2234    if (json.has("kind"))
2235      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ActivityDefinition.ActivityDefinitionKind.NULL, new ActivityDefinition.ActivityDefinitionKindEnumFactory()));
2236    if (json.has("_kind"))
2237      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
2238    if (json.has("profile"))
2239      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
2240    if (json.has("_profile"))
2241      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
2242    if (json.has("code"))
2243      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2244    if (json.has("intent"))
2245      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), ActivityDefinition.RequestIntent.NULL, new ActivityDefinition.RequestIntentEnumFactory()));
2246    if (json.has("_intent"))
2247      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
2248    if (json.has("priority"))
2249      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ActivityDefinition.RequestPriority.NULL, new ActivityDefinition.RequestPriorityEnumFactory()));
2250    if (json.has("_priority"))
2251      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
2252    if (json.has("doNotPerform"))
2253      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
2254    if (json.has("_doNotPerform"))
2255      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
2256    Type timing = parseType("timing", json);
2257    if (timing != null)
2258      res.setTiming(timing);
2259    if (json.has("location"))
2260      res.setLocation(parseReference(json.getAsJsonObject("location")));
2261    if (json.has("participant")) {
2262      JsonArray array = json.getAsJsonArray("participant");
2263      for (int i = 0; i < array.size(); i++) {
2264        res.getParticipant().add(parseActivityDefinitionActivityDefinitionParticipantComponent(array.get(i).getAsJsonObject(), res));
2265      }
2266    };
2267    Type product = parseType("product", json);
2268    if (product != null)
2269      res.setProduct(product);
2270    if (json.has("quantity"))
2271      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
2272    if (json.has("dosage")) {
2273      JsonArray array = json.getAsJsonArray("dosage");
2274      for (int i = 0; i < array.size(); i++) {
2275        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
2276      }
2277    };
2278    if (json.has("bodySite")) {
2279      JsonArray array = json.getAsJsonArray("bodySite");
2280      for (int i = 0; i < array.size(); i++) {
2281        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2282      }
2283    };
2284    if (json.has("specimenRequirement")) {
2285      JsonArray array = json.getAsJsonArray("specimenRequirement");
2286      for (int i = 0; i < array.size(); i++) {
2287        res.getSpecimenRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2288      }
2289    };
2290    if (json.has("observationRequirement")) {
2291      JsonArray array = json.getAsJsonArray("observationRequirement");
2292      for (int i = 0; i < array.size(); i++) {
2293        res.getObservationRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2294      }
2295    };
2296    if (json.has("observationResultRequirement")) {
2297      JsonArray array = json.getAsJsonArray("observationResultRequirement");
2298      for (int i = 0; i < array.size(); i++) {
2299        res.getObservationResultRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2300      }
2301    };
2302    if (json.has("transform"))
2303      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
2304    if (json.has("_transform"))
2305      parseElementProperties(json.getAsJsonObject("_transform"), res.getTransformElement());
2306    if (json.has("dynamicValue")) {
2307      JsonArray array = json.getAsJsonArray("dynamicValue");
2308      for (int i = 0; i < array.size(); i++) {
2309        res.getDynamicValue().add(parseActivityDefinitionActivityDefinitionDynamicValueComponent(array.get(i).getAsJsonObject(), res));
2310      }
2311    };
2312  }
2313
2314  protected ActivityDefinition.ActivityDefinitionParticipantComponent parseActivityDefinitionActivityDefinitionParticipantComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
2315    ActivityDefinition.ActivityDefinitionParticipantComponent res = new ActivityDefinition.ActivityDefinitionParticipantComponent();
2316    parseActivityDefinitionActivityDefinitionParticipantComponentProperties(json, owner, res);
2317    return res;
2318  }
2319
2320  protected void parseActivityDefinitionActivityDefinitionParticipantComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionParticipantComponent res) throws IOException, FHIRFormatError {
2321    parseBackboneElementProperties(json, res);
2322    if (json.has("type"))
2323      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ActivityDefinition.ActivityParticipantType.NULL, new ActivityDefinition.ActivityParticipantTypeEnumFactory()));
2324    if (json.has("_type"))
2325      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2326    if (json.has("role"))
2327      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
2328  }
2329
2330  protected ActivityDefinition.ActivityDefinitionDynamicValueComponent parseActivityDefinitionActivityDefinitionDynamicValueComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
2331    ActivityDefinition.ActivityDefinitionDynamicValueComponent res = new ActivityDefinition.ActivityDefinitionDynamicValueComponent();
2332    parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(json, owner, res);
2333    return res;
2334  }
2335
2336  protected void parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionDynamicValueComponent res) throws IOException, FHIRFormatError {
2337    parseBackboneElementProperties(json, res);
2338    if (json.has("path"))
2339      res.setPathElement(parseString(json.get("path").getAsString()));
2340    if (json.has("_path"))
2341      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
2342    if (json.has("expression"))
2343      res.setExpression(parseExpression(json.getAsJsonObject("expression")));
2344  }
2345
2346  protected AdverseEvent parseAdverseEvent(JsonObject json) throws IOException, FHIRFormatError {
2347    AdverseEvent res = new AdverseEvent();
2348    parseAdverseEventProperties(json, res);
2349    return res;
2350  }
2351
2352  protected void parseAdverseEventProperties(JsonObject json, AdverseEvent res) throws IOException, FHIRFormatError {
2353    parseDomainResourceProperties(json, res);
2354    if (json.has("identifier"))
2355      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
2356    if (json.has("actuality"))
2357      res.setActualityElement(parseEnumeration(json.get("actuality").getAsString(), AdverseEvent.AdverseEventActuality.NULL, new AdverseEvent.AdverseEventActualityEnumFactory()));
2358    if (json.has("_actuality"))
2359      parseElementProperties(json.getAsJsonObject("_actuality"), res.getActualityElement());
2360    if (json.has("category")) {
2361      JsonArray array = json.getAsJsonArray("category");
2362      for (int i = 0; i < array.size(); i++) {
2363        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2364      }
2365    };
2366    if (json.has("event"))
2367      res.setEvent(parseCodeableConcept(json.getAsJsonObject("event")));
2368    if (json.has("subject"))
2369      res.setSubject(parseReference(json.getAsJsonObject("subject")));
2370    if (json.has("encounter"))
2371      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
2372    if (json.has("date"))
2373      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2374    if (json.has("_date"))
2375      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
2376    if (json.has("detected"))
2377      res.setDetectedElement(parseDateTime(json.get("detected").getAsString()));
2378    if (json.has("_detected"))
2379      parseElementProperties(json.getAsJsonObject("_detected"), res.getDetectedElement());
2380    if (json.has("recordedDate"))
2381      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
2382    if (json.has("_recordedDate"))
2383      parseElementProperties(json.getAsJsonObject("_recordedDate"), res.getRecordedDateElement());
2384    if (json.has("resultingCondition")) {
2385      JsonArray array = json.getAsJsonArray("resultingCondition");
2386      for (int i = 0; i < array.size(); i++) {
2387        res.getResultingCondition().add(parseReference(array.get(i).getAsJsonObject()));
2388      }
2389    };
2390    if (json.has("location"))
2391      res.setLocation(parseReference(json.getAsJsonObject("location")));
2392    if (json.has("seriousness"))
2393      res.setSeriousness(parseCodeableConcept(json.getAsJsonObject("seriousness")));
2394    if (json.has("severity"))
2395      res.setSeverity(parseCodeableConcept(json.getAsJsonObject("severity")));
2396    if (json.has("outcome"))
2397      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
2398    if (json.has("recorder"))
2399      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
2400    if (json.has("contributor")) {
2401      JsonArray array = json.getAsJsonArray("contributor");
2402      for (int i = 0; i < array.size(); i++) {
2403        res.getContributor().add(parseReference(array.get(i).getAsJsonObject()));
2404      }
2405    };
2406    if (json.has("suspectEntity")) {
2407      JsonArray array = json.getAsJsonArray("suspectEntity");
2408      for (int i = 0; i < array.size(); i++) {
2409        res.getSuspectEntity().add(parseAdverseEventAdverseEventSuspectEntityComponent(array.get(i).getAsJsonObject(), res));
2410      }
2411    };
2412    if (json.has("subjectMedicalHistory")) {
2413      JsonArray array = json.getAsJsonArray("subjectMedicalHistory");
2414      for (int i = 0; i < array.size(); i++) {
2415        res.getSubjectMedicalHistory().add(parseReference(array.get(i).getAsJsonObject()));
2416      }
2417    };
2418    if (json.has("referenceDocument")) {
2419      JsonArray array = json.getAsJsonArray("referenceDocument");
2420      for (int i = 0; i < array.size(); i++) {
2421        res.getReferenceDocument().add(parseReference(array.get(i).getAsJsonObject()));
2422      }
2423    };
2424    if (json.has("study")) {
2425      JsonArray array = json.getAsJsonArray("study");
2426      for (int i = 0; i < array.size(); i++) {
2427        res.getStudy().add(parseReference(array.get(i).getAsJsonObject()));
2428      }
2429    };
2430  }
2431
2432  protected AdverseEvent.AdverseEventSuspectEntityComponent parseAdverseEventAdverseEventSuspectEntityComponent(JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2433    AdverseEvent.AdverseEventSuspectEntityComponent res = new AdverseEvent.AdverseEventSuspectEntityComponent();
2434    parseAdverseEventAdverseEventSuspectEntityComponentProperties(json, owner, res);
2435    return res;
2436  }
2437
2438  protected void parseAdverseEventAdverseEventSuspectEntityComponentProperties(JsonObject json, AdverseEvent owner, AdverseEvent.AdverseEventSuspectEntityComponent res) throws IOException, FHIRFormatError {
2439    parseBackboneElementProperties(json, res);
2440    if (json.has("instance"))
2441      res.setInstance(parseReference(json.getAsJsonObject("instance")));
2442    if (json.has("causality")) {
2443      JsonArray array = json.getAsJsonArray("causality");
2444      for (int i = 0; i < array.size(); i++) {
2445        res.getCausality().add(parseAdverseEventAdverseEventSuspectEntityCausalityComponent(array.get(i).getAsJsonObject(), owner));
2446      }
2447    };
2448  }
2449
2450  protected AdverseEvent.AdverseEventSuspectEntityCausalityComponent parseAdverseEventAdverseEventSuspectEntityCausalityComponent(JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2451    AdverseEvent.AdverseEventSuspectEntityCausalityComponent res = new AdverseEvent.AdverseEventSuspectEntityCausalityComponent();
2452    parseAdverseEventAdverseEventSuspectEntityCausalityComponentProperties(json, owner, res);
2453    return res;
2454  }
2455
2456  protected void parseAdverseEventAdverseEventSuspectEntityCausalityComponentProperties(JsonObject json, AdverseEvent owner, AdverseEvent.AdverseEventSuspectEntityCausalityComponent res) throws IOException, FHIRFormatError {
2457    parseBackboneElementProperties(json, res);
2458    if (json.has("assessment"))
2459      res.setAssessment(parseCodeableConcept(json.getAsJsonObject("assessment")));
2460    if (json.has("productRelatedness"))
2461      res.setProductRelatednessElement(parseString(json.get("productRelatedness").getAsString()));
2462    if (json.has("_productRelatedness"))
2463      parseElementProperties(json.getAsJsonObject("_productRelatedness"), res.getProductRelatednessElement());
2464    if (json.has("author"))
2465      res.setAuthor(parseReference(json.getAsJsonObject("author")));
2466    if (json.has("method"))
2467      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
2468  }
2469
2470  protected AllergyIntolerance parseAllergyIntolerance(JsonObject json) throws IOException, FHIRFormatError {
2471    AllergyIntolerance res = new AllergyIntolerance();
2472    parseAllergyIntoleranceProperties(json, res);
2473    return res;
2474  }
2475
2476  protected void parseAllergyIntoleranceProperties(JsonObject json, AllergyIntolerance res) throws IOException, FHIRFormatError {
2477    parseDomainResourceProperties(json, res);
2478    if (json.has("identifier")) {
2479      JsonArray array = json.getAsJsonArray("identifier");
2480      for (int i = 0; i < array.size(); i++) {
2481        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2482      }
2483    };
2484    if (json.has("clinicalStatus"))
2485      res.setClinicalStatus(parseCodeableConcept(json.getAsJsonObject("clinicalStatus")));
2486    if (json.has("verificationStatus"))
2487      res.setVerificationStatus(parseCodeableConcept(json.getAsJsonObject("verificationStatus")));
2488    if (json.has("type"))
2489      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AllergyIntolerance.AllergyIntoleranceType.NULL, new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()));
2490    if (json.has("_type"))
2491      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2492    if (json.has("category")) {
2493      JsonArray array = json.getAsJsonArray("category");
2494      for (int i = 0; i < array.size(); i++) {
2495        res.getCategory().add(parseEnumeration(array.get(i).getAsString(), AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2496      }
2497    };
2498    if (json.has("_category")) {
2499      JsonArray array = json.getAsJsonArray("_category");
2500      for (int i = 0; i < array.size(); i++) {
2501        if (i == res.getCategory().size())
2502          res.getCategory().add(parseEnumeration(null, AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2503        if (array.get(i) instanceof JsonObject) 
2504          parseElementProperties(array.get(i).getAsJsonObject(), res.getCategory().get(i));
2505      }
2506    };
2507    if (json.has("criticality"))
2508      res.setCriticalityElement(parseEnumeration(json.get("criticality").getAsString(), AllergyIntolerance.AllergyIntoleranceCriticality.NULL, new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
2509    if (json.has("_criticality"))
2510      parseElementProperties(json.getAsJsonObject("_criticality"), res.getCriticalityElement());
2511    if (json.has("code"))
2512      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2513    if (json.has("patient"))
2514      res.setPatient(parseReference(json.getAsJsonObject("patient")));
2515    if (json.has("encounter"))
2516      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
2517    Type onset = parseType("onset", json);
2518    if (onset != null)
2519      res.setOnset(onset);
2520    if (json.has("recordedDate"))
2521      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
2522    if (json.has("_recordedDate"))
2523      parseElementProperties(json.getAsJsonObject("_recordedDate"), res.getRecordedDateElement());
2524    if (json.has("recorder"))
2525      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
2526    if (json.has("asserter"))
2527      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
2528    if (json.has("lastOccurrence"))
2529      res.setLastOccurrenceElement(parseDateTime(json.get("lastOccurrence").getAsString()));
2530    if (json.has("_lastOccurrence"))
2531      parseElementProperties(json.getAsJsonObject("_lastOccurrence"), res.getLastOccurrenceElement());
2532    if (json.has("note")) {
2533      JsonArray array = json.getAsJsonArray("note");
2534      for (int i = 0; i < array.size(); i++) {
2535        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2536      }
2537    };
2538    if (json.has("reaction")) {
2539      JsonArray array = json.getAsJsonArray("reaction");
2540      for (int i = 0; i < array.size(); i++) {
2541        res.getReaction().add(parseAllergyIntoleranceAllergyIntoleranceReactionComponent(array.get(i).getAsJsonObject(), res));
2542      }
2543    };
2544  }
2545
2546  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceAllergyIntoleranceReactionComponent(JsonObject json, AllergyIntolerance owner) throws IOException, FHIRFormatError {
2547    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
2548    parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(json, owner, res);
2549    return res;
2550  }
2551
2552  protected void parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(JsonObject json, AllergyIntolerance owner, AllergyIntolerance.AllergyIntoleranceReactionComponent res) throws IOException, FHIRFormatError {
2553    parseBackboneElementProperties(json, res);
2554    if (json.has("substance"))
2555      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
2556    if (json.has("manifestation")) {
2557      JsonArray array = json.getAsJsonArray("manifestation");
2558      for (int i = 0; i < array.size(); i++) {
2559        res.getManifestation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2560      }
2561    };
2562    if (json.has("description"))
2563      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2564    if (json.has("_description"))
2565      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2566    if (json.has("onset"))
2567      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
2568    if (json.has("_onset"))
2569      parseElementProperties(json.getAsJsonObject("_onset"), res.getOnsetElement());
2570    if (json.has("severity"))
2571      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AllergyIntolerance.AllergyIntoleranceSeverity.NULL, new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
2572    if (json.has("_severity"))
2573      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
2574    if (json.has("exposureRoute"))
2575      res.setExposureRoute(parseCodeableConcept(json.getAsJsonObject("exposureRoute")));
2576    if (json.has("note")) {
2577      JsonArray array = json.getAsJsonArray("note");
2578      for (int i = 0; i < array.size(); i++) {
2579        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2580      }
2581    };
2582  }
2583
2584  protected Appointment parseAppointment(JsonObject json) throws IOException, FHIRFormatError {
2585    Appointment res = new Appointment();
2586    parseAppointmentProperties(json, res);
2587    return res;
2588  }
2589
2590  protected void parseAppointmentProperties(JsonObject json, Appointment res) throws IOException, FHIRFormatError {
2591    parseDomainResourceProperties(json, res);
2592    if (json.has("identifier")) {
2593      JsonArray array = json.getAsJsonArray("identifier");
2594      for (int i = 0; i < array.size(); i++) {
2595        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2596      }
2597    };
2598    if (json.has("status"))
2599      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.AppointmentStatus.NULL, new Appointment.AppointmentStatusEnumFactory()));
2600    if (json.has("_status"))
2601      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2602    if (json.has("cancelationReason"))
2603      res.setCancelationReason(parseCodeableConcept(json.getAsJsonObject("cancelationReason")));
2604    if (json.has("serviceCategory")) {
2605      JsonArray array = json.getAsJsonArray("serviceCategory");
2606      for (int i = 0; i < array.size(); i++) {
2607        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2608      }
2609    };
2610    if (json.has("serviceType")) {
2611      JsonArray array = json.getAsJsonArray("serviceType");
2612      for (int i = 0; i < array.size(); i++) {
2613        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2614      }
2615    };
2616    if (json.has("specialty")) {
2617      JsonArray array = json.getAsJsonArray("specialty");
2618      for (int i = 0; i < array.size(); i++) {
2619        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2620      }
2621    };
2622    if (json.has("appointmentType"))
2623      res.setAppointmentType(parseCodeableConcept(json.getAsJsonObject("appointmentType")));
2624    if (json.has("reasonCode")) {
2625      JsonArray array = json.getAsJsonArray("reasonCode");
2626      for (int i = 0; i < array.size(); i++) {
2627        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2628      }
2629    };
2630    if (json.has("reasonReference")) {
2631      JsonArray array = json.getAsJsonArray("reasonReference");
2632      for (int i = 0; i < array.size(); i++) {
2633        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
2634      }
2635    };
2636    if (json.has("priority"))
2637      res.setPriorityElement(parseUnsignedInt(json.get("priority").getAsString()));
2638    if (json.has("_priority"))
2639      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
2640    if (json.has("description"))
2641      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2642    if (json.has("_description"))
2643      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2644    if (json.has("supportingInformation")) {
2645      JsonArray array = json.getAsJsonArray("supportingInformation");
2646      for (int i = 0; i < array.size(); i++) {
2647        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
2648      }
2649    };
2650    if (json.has("start"))
2651      res.setStartElement(parseInstant(json.get("start").getAsString()));
2652    if (json.has("_start"))
2653      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
2654    if (json.has("end"))
2655      res.setEndElement(parseInstant(json.get("end").getAsString()));
2656    if (json.has("_end"))
2657      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
2658    if (json.has("minutesDuration"))
2659      res.setMinutesDurationElement(parsePositiveInt(json.get("minutesDuration").getAsString()));
2660    if (json.has("_minutesDuration"))
2661      parseElementProperties(json.getAsJsonObject("_minutesDuration"), res.getMinutesDurationElement());
2662    if (json.has("slot")) {
2663      JsonArray array = json.getAsJsonArray("slot");
2664      for (int i = 0; i < array.size(); i++) {
2665        res.getSlot().add(parseReference(array.get(i).getAsJsonObject()));
2666      }
2667    };
2668    if (json.has("created"))
2669      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
2670    if (json.has("_created"))
2671      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
2672    if (json.has("comment"))
2673      res.setCommentElement(parseString(json.get("comment").getAsString()));
2674    if (json.has("_comment"))
2675      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
2676    if (json.has("patientInstruction"))
2677      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
2678    if (json.has("_patientInstruction"))
2679      parseElementProperties(json.getAsJsonObject("_patientInstruction"), res.getPatientInstructionElement());
2680    if (json.has("basedOn")) {
2681      JsonArray array = json.getAsJsonArray("basedOn");
2682      for (int i = 0; i < array.size(); i++) {
2683        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
2684      }
2685    };
2686    if (json.has("participant")) {
2687      JsonArray array = json.getAsJsonArray("participant");
2688      for (int i = 0; i < array.size(); i++) {
2689        res.getParticipant().add(parseAppointmentAppointmentParticipantComponent(array.get(i).getAsJsonObject(), res));
2690      }
2691    };
2692    if (json.has("requestedPeriod")) {
2693      JsonArray array = json.getAsJsonArray("requestedPeriod");
2694      for (int i = 0; i < array.size(); i++) {
2695        res.getRequestedPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
2696      }
2697    };
2698  }
2699
2700  protected Appointment.AppointmentParticipantComponent parseAppointmentAppointmentParticipantComponent(JsonObject json, Appointment owner) throws IOException, FHIRFormatError {
2701    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
2702    parseAppointmentAppointmentParticipantComponentProperties(json, owner, res);
2703    return res;
2704  }
2705
2706  protected void parseAppointmentAppointmentParticipantComponentProperties(JsonObject json, Appointment owner, Appointment.AppointmentParticipantComponent res) throws IOException, FHIRFormatError {
2707    parseBackboneElementProperties(json, res);
2708    if (json.has("type")) {
2709      JsonArray array = json.getAsJsonArray("type");
2710      for (int i = 0; i < array.size(); i++) {
2711        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2712      }
2713    };
2714    if (json.has("actor"))
2715      res.setActor(parseReference(json.getAsJsonObject("actor")));
2716    if (json.has("required"))
2717      res.setRequiredElement(parseEnumeration(json.get("required").getAsString(), Appointment.ParticipantRequired.NULL, new Appointment.ParticipantRequiredEnumFactory()));
2718    if (json.has("_required"))
2719      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
2720    if (json.has("status"))
2721      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.ParticipationStatus.NULL, new Appointment.ParticipationStatusEnumFactory()));
2722    if (json.has("_status"))
2723      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2724    if (json.has("period"))
2725      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
2726  }
2727
2728  protected AppointmentResponse parseAppointmentResponse(JsonObject json) throws IOException, FHIRFormatError {
2729    AppointmentResponse res = new AppointmentResponse();
2730    parseAppointmentResponseProperties(json, res);
2731    return res;
2732  }
2733
2734  protected void parseAppointmentResponseProperties(JsonObject json, AppointmentResponse res) throws IOException, FHIRFormatError {
2735    parseDomainResourceProperties(json, res);
2736    if (json.has("identifier")) {
2737      JsonArray array = json.getAsJsonArray("identifier");
2738      for (int i = 0; i < array.size(); i++) {
2739        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2740      }
2741    };
2742    if (json.has("appointment"))
2743      res.setAppointment(parseReference(json.getAsJsonObject("appointment")));
2744    if (json.has("start"))
2745      res.setStartElement(parseInstant(json.get("start").getAsString()));
2746    if (json.has("_start"))
2747      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
2748    if (json.has("end"))
2749      res.setEndElement(parseInstant(json.get("end").getAsString()));
2750    if (json.has("_end"))
2751      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
2752    if (json.has("participantType")) {
2753      JsonArray array = json.getAsJsonArray("participantType");
2754      for (int i = 0; i < array.size(); i++) {
2755        res.getParticipantType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2756      }
2757    };
2758    if (json.has("actor"))
2759      res.setActor(parseReference(json.getAsJsonObject("actor")));
2760    if (json.has("participantStatus"))
2761      res.setParticipantStatusElement(parseEnumeration(json.get("participantStatus").getAsString(), AppointmentResponse.ParticipantStatus.NULL, new AppointmentResponse.ParticipantStatusEnumFactory()));
2762    if (json.has("_participantStatus"))
2763      parseElementProperties(json.getAsJsonObject("_participantStatus"), res.getParticipantStatusElement());
2764    if (json.has("comment"))
2765      res.setCommentElement(parseString(json.get("comment").getAsString()));
2766    if (json.has("_comment"))
2767      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
2768  }
2769
2770  protected AuditEvent parseAuditEvent(JsonObject json) throws IOException, FHIRFormatError {
2771    AuditEvent res = new AuditEvent();
2772    parseAuditEventProperties(json, res);
2773    return res;
2774  }
2775
2776  protected void parseAuditEventProperties(JsonObject json, AuditEvent res) throws IOException, FHIRFormatError {
2777    parseDomainResourceProperties(json, res);
2778    if (json.has("type"))
2779      res.setType(parseCoding(json.getAsJsonObject("type")));
2780    if (json.has("subtype")) {
2781      JsonArray array = json.getAsJsonArray("subtype");
2782      for (int i = 0; i < array.size(); i++) {
2783        res.getSubtype().add(parseCoding(array.get(i).getAsJsonObject()));
2784      }
2785    };
2786    if (json.has("action"))
2787      res.setActionElement(parseEnumeration(json.get("action").getAsString(), AuditEvent.AuditEventAction.NULL, new AuditEvent.AuditEventActionEnumFactory()));
2788    if (json.has("_action"))
2789      parseElementProperties(json.getAsJsonObject("_action"), res.getActionElement());
2790    if (json.has("period"))
2791      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
2792    if (json.has("recorded"))
2793      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
2794    if (json.has("_recorded"))
2795      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
2796    if (json.has("outcome"))
2797      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), AuditEvent.AuditEventOutcome.NULL, new AuditEvent.AuditEventOutcomeEnumFactory()));
2798    if (json.has("_outcome"))
2799      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
2800    if (json.has("outcomeDesc"))
2801      res.setOutcomeDescElement(parseString(json.get("outcomeDesc").getAsString()));
2802    if (json.has("_outcomeDesc"))
2803      parseElementProperties(json.getAsJsonObject("_outcomeDesc"), res.getOutcomeDescElement());
2804    if (json.has("purposeOfEvent")) {
2805      JsonArray array = json.getAsJsonArray("purposeOfEvent");
2806      for (int i = 0; i < array.size(); i++) {
2807        res.getPurposeOfEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2808      }
2809    };
2810    if (json.has("agent")) {
2811      JsonArray array = json.getAsJsonArray("agent");
2812      for (int i = 0; i < array.size(); i++) {
2813        res.getAgent().add(parseAuditEventAuditEventAgentComponent(array.get(i).getAsJsonObject(), res));
2814      }
2815    };
2816    if (json.has("source"))
2817      res.setSource(parseAuditEventAuditEventSourceComponent(json.getAsJsonObject("source"), res));
2818    if (json.has("entity")) {
2819      JsonArray array = json.getAsJsonArray("entity");
2820      for (int i = 0; i < array.size(); i++) {
2821        res.getEntity().add(parseAuditEventAuditEventEntityComponent(array.get(i).getAsJsonObject(), res));
2822      }
2823    };
2824  }
2825
2826  protected AuditEvent.AuditEventAgentComponent parseAuditEventAuditEventAgentComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2827    AuditEvent.AuditEventAgentComponent res = new AuditEvent.AuditEventAgentComponent();
2828    parseAuditEventAuditEventAgentComponentProperties(json, owner, res);
2829    return res;
2830  }
2831
2832  protected void parseAuditEventAuditEventAgentComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentComponent res) throws IOException, FHIRFormatError {
2833    parseBackboneElementProperties(json, res);
2834    if (json.has("type"))
2835      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
2836    if (json.has("role")) {
2837      JsonArray array = json.getAsJsonArray("role");
2838      for (int i = 0; i < array.size(); i++) {
2839        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2840      }
2841    };
2842    if (json.has("who"))
2843      res.setWho(parseReference(json.getAsJsonObject("who")));
2844    if (json.has("altId"))
2845      res.setAltIdElement(parseString(json.get("altId").getAsString()));
2846    if (json.has("_altId"))
2847      parseElementProperties(json.getAsJsonObject("_altId"), res.getAltIdElement());
2848    if (json.has("name"))
2849      res.setNameElement(parseString(json.get("name").getAsString()));
2850    if (json.has("_name"))
2851      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2852    if (json.has("requestor"))
2853      res.setRequestorElement(parseBoolean(json.get("requestor").getAsBoolean()));
2854    if (json.has("_requestor"))
2855      parseElementProperties(json.getAsJsonObject("_requestor"), res.getRequestorElement());
2856    if (json.has("location"))
2857      res.setLocation(parseReference(json.getAsJsonObject("location")));
2858    if (json.has("policy")) {
2859      JsonArray array = json.getAsJsonArray("policy");
2860      for (int i = 0; i < array.size(); i++) {
2861        res.getPolicy().add(parseUri(array.get(i).getAsString()));
2862      }
2863    };
2864    if (json.has("_policy")) {
2865      JsonArray array = json.getAsJsonArray("_policy");
2866      for (int i = 0; i < array.size(); i++) {
2867        if (i == res.getPolicy().size())
2868          res.getPolicy().add(parseUri(null));
2869        if (array.get(i) instanceof JsonObject) 
2870          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
2871      }
2872    };
2873    if (json.has("media"))
2874      res.setMedia(parseCoding(json.getAsJsonObject("media")));
2875    if (json.has("network"))
2876      res.setNetwork(parseAuditEventAuditEventAgentNetworkComponent(json.getAsJsonObject("network"), owner));
2877    if (json.has("purposeOfUse")) {
2878      JsonArray array = json.getAsJsonArray("purposeOfUse");
2879      for (int i = 0; i < array.size(); i++) {
2880        res.getPurposeOfUse().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2881      }
2882    };
2883  }
2884
2885  protected AuditEvent.AuditEventAgentNetworkComponent parseAuditEventAuditEventAgentNetworkComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2886    AuditEvent.AuditEventAgentNetworkComponent res = new AuditEvent.AuditEventAgentNetworkComponent();
2887    parseAuditEventAuditEventAgentNetworkComponentProperties(json, owner, res);
2888    return res;
2889  }
2890
2891  protected void parseAuditEventAuditEventAgentNetworkComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentNetworkComponent res) throws IOException, FHIRFormatError {
2892    parseBackboneElementProperties(json, res);
2893    if (json.has("address"))
2894      res.setAddressElement(parseString(json.get("address").getAsString()));
2895    if (json.has("_address"))
2896      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
2897    if (json.has("type"))
2898      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AuditEvent.AuditEventAgentNetworkType.NULL, new AuditEvent.AuditEventAgentNetworkTypeEnumFactory()));
2899    if (json.has("_type"))
2900      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2901  }
2902
2903  protected AuditEvent.AuditEventSourceComponent parseAuditEventAuditEventSourceComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2904    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
2905    parseAuditEventAuditEventSourceComponentProperties(json, owner, res);
2906    return res;
2907  }
2908
2909  protected void parseAuditEventAuditEventSourceComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventSourceComponent res) throws IOException, FHIRFormatError {
2910    parseBackboneElementProperties(json, res);
2911    if (json.has("site"))
2912      res.setSiteElement(parseString(json.get("site").getAsString()));
2913    if (json.has("_site"))
2914      parseElementProperties(json.getAsJsonObject("_site"), res.getSiteElement());
2915    if (json.has("observer"))
2916      res.setObserver(parseReference(json.getAsJsonObject("observer")));
2917    if (json.has("type")) {
2918      JsonArray array = json.getAsJsonArray("type");
2919      for (int i = 0; i < array.size(); i++) {
2920        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
2921      }
2922    };
2923  }
2924
2925  protected AuditEvent.AuditEventEntityComponent parseAuditEventAuditEventEntityComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2926    AuditEvent.AuditEventEntityComponent res = new AuditEvent.AuditEventEntityComponent();
2927    parseAuditEventAuditEventEntityComponentProperties(json, owner, res);
2928    return res;
2929  }
2930
2931  protected void parseAuditEventAuditEventEntityComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityComponent res) throws IOException, FHIRFormatError {
2932    parseBackboneElementProperties(json, res);
2933    if (json.has("what"))
2934      res.setWhat(parseReference(json.getAsJsonObject("what")));
2935    if (json.has("type"))
2936      res.setType(parseCoding(json.getAsJsonObject("type")));
2937    if (json.has("role"))
2938      res.setRole(parseCoding(json.getAsJsonObject("role")));
2939    if (json.has("lifecycle"))
2940      res.setLifecycle(parseCoding(json.getAsJsonObject("lifecycle")));
2941    if (json.has("securityLabel")) {
2942      JsonArray array = json.getAsJsonArray("securityLabel");
2943      for (int i = 0; i < array.size(); i++) {
2944        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
2945      }
2946    };
2947    if (json.has("name"))
2948      res.setNameElement(parseString(json.get("name").getAsString()));
2949    if (json.has("_name"))
2950      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2951    if (json.has("description"))
2952      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2953    if (json.has("_description"))
2954      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2955    if (json.has("query"))
2956      res.setQueryElement(parseBase64Binary(json.get("query").getAsString()));
2957    if (json.has("_query"))
2958      parseElementProperties(json.getAsJsonObject("_query"), res.getQueryElement());
2959    if (json.has("detail")) {
2960      JsonArray array = json.getAsJsonArray("detail");
2961      for (int i = 0; i < array.size(); i++) {
2962        res.getDetail().add(parseAuditEventAuditEventEntityDetailComponent(array.get(i).getAsJsonObject(), owner));
2963      }
2964    };
2965  }
2966
2967  protected AuditEvent.AuditEventEntityDetailComponent parseAuditEventAuditEventEntityDetailComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2968    AuditEvent.AuditEventEntityDetailComponent res = new AuditEvent.AuditEventEntityDetailComponent();
2969    parseAuditEventAuditEventEntityDetailComponentProperties(json, owner, res);
2970    return res;
2971  }
2972
2973  protected void parseAuditEventAuditEventEntityDetailComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityDetailComponent res) throws IOException, FHIRFormatError {
2974    parseBackboneElementProperties(json, res);
2975    if (json.has("type"))
2976      res.setTypeElement(parseString(json.get("type").getAsString()));
2977    if (json.has("_type"))
2978      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2979    Type value = parseType("value", json);
2980    if (value != null)
2981      res.setValue(value);
2982  }
2983
2984  protected Basic parseBasic(JsonObject json) throws IOException, FHIRFormatError {
2985    Basic res = new Basic();
2986    parseBasicProperties(json, res);
2987    return res;
2988  }
2989
2990  protected void parseBasicProperties(JsonObject json, Basic res) throws IOException, FHIRFormatError {
2991    parseDomainResourceProperties(json, res);
2992    if (json.has("identifier")) {
2993      JsonArray array = json.getAsJsonArray("identifier");
2994      for (int i = 0; i < array.size(); i++) {
2995        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2996      }
2997    };
2998    if (json.has("code"))
2999      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
3000    if (json.has("subject"))
3001      res.setSubject(parseReference(json.getAsJsonObject("subject")));
3002    if (json.has("created"))
3003      res.setCreatedElement(parseDate(json.get("created").getAsString()));
3004    if (json.has("_created"))
3005      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
3006    if (json.has("author"))
3007      res.setAuthor(parseReference(json.getAsJsonObject("author")));
3008  }
3009
3010  protected Binary parseBinary(JsonObject json) throws IOException, FHIRFormatError {
3011    Binary res = new Binary();
3012    parseBinaryProperties(json, res);
3013    return res;
3014  }
3015
3016  protected void parseBinaryProperties(JsonObject json, Binary res) throws IOException, FHIRFormatError {
3017    parseResourceProperties(json, res);
3018    if (json.has("contentType"))
3019      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
3020    if (json.has("_contentType"))
3021      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
3022    if (json.has("securityContext"))
3023      res.setSecurityContext(parseReference(json.getAsJsonObject("securityContext")));
3024    if (json.has("data"))
3025      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
3026    if (json.has("_data"))
3027      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
3028  }
3029
3030  protected BiologicallyDerivedProduct parseBiologicallyDerivedProduct(JsonObject json) throws IOException, FHIRFormatError {
3031    BiologicallyDerivedProduct res = new BiologicallyDerivedProduct();
3032    parseBiologicallyDerivedProductProperties(json, res);
3033    return res;
3034  }
3035
3036  protected void parseBiologicallyDerivedProductProperties(JsonObject json, BiologicallyDerivedProduct res) throws IOException, FHIRFormatError {
3037    parseDomainResourceProperties(json, res);
3038    if (json.has("identifier")) {
3039      JsonArray array = json.getAsJsonArray("identifier");
3040      for (int i = 0; i < array.size(); i++) {
3041        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3042      }
3043    };
3044    if (json.has("productCategory"))
3045      res.setProductCategoryElement(parseEnumeration(json.get("productCategory").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory()));
3046    if (json.has("_productCategory"))
3047      parseElementProperties(json.getAsJsonObject("_productCategory"), res.getProductCategoryElement());
3048    if (json.has("productCode"))
3049      res.setProductCode(parseCodeableConcept(json.getAsJsonObject("productCode")));
3050    if (json.has("status"))
3051      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductStatus.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory()));
3052    if (json.has("_status"))
3053      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3054    if (json.has("request")) {
3055      JsonArray array = json.getAsJsonArray("request");
3056      for (int i = 0; i < array.size(); i++) {
3057        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
3058      }
3059    };
3060    if (json.has("quantity"))
3061      res.setQuantityElement(parseInteger(json.get("quantity").getAsLong()));
3062    if (json.has("_quantity"))
3063      parseElementProperties(json.getAsJsonObject("_quantity"), res.getQuantityElement());
3064    if (json.has("parent")) {
3065      JsonArray array = json.getAsJsonArray("parent");
3066      for (int i = 0; i < array.size(); i++) {
3067        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
3068      }
3069    };
3070    if (json.has("collection"))
3071      res.setCollection(parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(json.getAsJsonObject("collection"), res));
3072    if (json.has("processing")) {
3073      JsonArray array = json.getAsJsonArray("processing");
3074      for (int i = 0; i < array.size(); i++) {
3075        res.getProcessing().add(parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(array.get(i).getAsJsonObject(), res));
3076      }
3077    };
3078    if (json.has("manipulation"))
3079      res.setManipulation(parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(json.getAsJsonObject("manipulation"), res));
3080    if (json.has("storage")) {
3081      JsonArray array = json.getAsJsonArray("storage");
3082      for (int i = 0; i < array.size(); i++) {
3083        res.getStorage().add(parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(array.get(i).getAsJsonObject(), res));
3084      }
3085    };
3086  }
3087
3088  protected BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3089    BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent();
3090    parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentProperties(json, owner, res);
3091    return res;
3092  }
3093
3094  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res) throws IOException, FHIRFormatError {
3095    parseBackboneElementProperties(json, res);
3096    if (json.has("collector"))
3097      res.setCollector(parseReference(json.getAsJsonObject("collector")));
3098    if (json.has("source"))
3099      res.setSource(parseReference(json.getAsJsonObject("source")));
3100    Type collected = parseType("collected", json);
3101    if (collected != null)
3102      res.setCollected(collected);
3103  }
3104
3105  protected BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3106    BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent();
3107    parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentProperties(json, owner, res);
3108    return res;
3109  }
3110
3111  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res) throws IOException, FHIRFormatError {
3112    parseBackboneElementProperties(json, res);
3113    if (json.has("description"))
3114      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3115    if (json.has("_description"))
3116      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3117    if (json.has("procedure"))
3118      res.setProcedure(parseCodeableConcept(json.getAsJsonObject("procedure")));
3119    if (json.has("additive"))
3120      res.setAdditive(parseReference(json.getAsJsonObject("additive")));
3121    Type time = parseType("time", json);
3122    if (time != null)
3123      res.setTime(time);
3124  }
3125
3126  protected BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3127    BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent();
3128    parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentProperties(json, owner, res);
3129    return res;
3130  }
3131
3132  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res) throws IOException, FHIRFormatError {
3133    parseBackboneElementProperties(json, res);
3134    if (json.has("description"))
3135      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3136    if (json.has("_description"))
3137      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3138    Type time = parseType("time", json);
3139    if (time != null)
3140      res.setTime(time);
3141  }
3142
3143  protected BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3144    BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent();
3145    parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentProperties(json, owner, res);
3146    return res;
3147  }
3148
3149  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res) throws IOException, FHIRFormatError {
3150    parseBackboneElementProperties(json, res);
3151    if (json.has("description"))
3152      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3153    if (json.has("_description"))
3154      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3155    if (json.has("temperature"))
3156      res.setTemperatureElement(parseDecimal(json.get("temperature").getAsBigDecimal()));
3157    if (json.has("_temperature"))
3158      parseElementProperties(json.getAsJsonObject("_temperature"), res.getTemperatureElement());
3159    if (json.has("scale"))
3160      res.setScaleElement(parseEnumeration(json.get("scale").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory()));
3161    if (json.has("_scale"))
3162      parseElementProperties(json.getAsJsonObject("_scale"), res.getScaleElement());
3163    if (json.has("duration"))
3164      res.setDuration(parsePeriod(json.getAsJsonObject("duration")));
3165  }
3166
3167  protected BodyStructure parseBodyStructure(JsonObject json) throws IOException, FHIRFormatError {
3168    BodyStructure res = new BodyStructure();
3169    parseBodyStructureProperties(json, res);
3170    return res;
3171  }
3172
3173  protected void parseBodyStructureProperties(JsonObject json, BodyStructure res) throws IOException, FHIRFormatError {
3174    parseDomainResourceProperties(json, res);
3175    if (json.has("identifier")) {
3176      JsonArray array = json.getAsJsonArray("identifier");
3177      for (int i = 0; i < array.size(); i++) {
3178        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3179      }
3180    };
3181    if (json.has("active"))
3182      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
3183    if (json.has("_active"))
3184      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
3185    if (json.has("morphology"))
3186      res.setMorphology(parseCodeableConcept(json.getAsJsonObject("morphology")));
3187    if (json.has("location"))
3188      res.setLocation(parseCodeableConcept(json.getAsJsonObject("location")));
3189    if (json.has("locationQualifier")) {
3190      JsonArray array = json.getAsJsonArray("locationQualifier");
3191      for (int i = 0; i < array.size(); i++) {
3192        res.getLocationQualifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3193      }
3194    };
3195    if (json.has("description"))
3196      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3197    if (json.has("_description"))
3198      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3199    if (json.has("image")) {
3200      JsonArray array = json.getAsJsonArray("image");
3201      for (int i = 0; i < array.size(); i++) {
3202        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
3203      }
3204    };
3205    if (json.has("patient"))
3206      res.setPatient(parseReference(json.getAsJsonObject("patient")));
3207  }
3208
3209  protected Bundle parseBundle(JsonObject json) throws IOException, FHIRFormatError {
3210    Bundle res = new Bundle();
3211    parseBundleProperties(json, res);
3212    return res;
3213  }
3214
3215  protected void parseBundleProperties(JsonObject json, Bundle res) throws IOException, FHIRFormatError {
3216    parseResourceProperties(json, res);
3217    if (json.has("identifier"))
3218      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
3219    if (json.has("type"))
3220      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
3221    if (json.has("_type"))
3222      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3223    if (json.has("timestamp"))
3224      res.setTimestampElement(parseInstant(json.get("timestamp").getAsString()));
3225    if (json.has("_timestamp"))
3226      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
3227    if (json.has("total"))
3228      res.setTotalElement(parseUnsignedInt(json.get("total").getAsString()));
3229    if (json.has("_total"))
3230      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
3231    if (json.has("link")) {
3232      JsonArray array = json.getAsJsonArray("link");
3233      for (int i = 0; i < array.size(); i++) {
3234        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), res));
3235      }
3236    };
3237    if (json.has("entry")) {
3238      JsonArray array = json.getAsJsonArray("entry");
3239      for (int i = 0; i < array.size(); i++) {
3240        res.getEntry().add(parseBundleBundleEntryComponent(array.get(i).getAsJsonObject(), res));
3241      }
3242    };
3243    if (json.has("signature"))
3244      res.setSignature(parseSignature(json.getAsJsonObject("signature")));
3245  }
3246
3247  protected Bundle.BundleLinkComponent parseBundleBundleLinkComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3248    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
3249    parseBundleBundleLinkComponentProperties(json, owner, res);
3250    return res;
3251  }
3252
3253  protected void parseBundleBundleLinkComponentProperties(JsonObject json, Bundle owner, Bundle.BundleLinkComponent res) throws IOException, FHIRFormatError {
3254    parseBackboneElementProperties(json, res);
3255    if (json.has("relation"))
3256      res.setRelationElement(parseString(json.get("relation").getAsString()));
3257    if (json.has("_relation"))
3258      parseElementProperties(json.getAsJsonObject("_relation"), res.getRelationElement());
3259    if (json.has("url"))
3260      res.setUrlElement(parseUri(json.get("url").getAsString()));
3261    if (json.has("_url"))
3262      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3263  }
3264
3265  protected Bundle.BundleEntryComponent parseBundleBundleEntryComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3266    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
3267    parseBundleBundleEntryComponentProperties(json, owner, res);
3268    return res;
3269  }
3270
3271  protected void parseBundleBundleEntryComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryComponent res) throws IOException, FHIRFormatError {
3272    parseBackboneElementProperties(json, res);
3273    if (json.has("link")) {
3274      JsonArray array = json.getAsJsonArray("link");
3275      for (int i = 0; i < array.size(); i++) {
3276        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), owner));
3277      }
3278    };
3279    if (json.has("fullUrl"))
3280      res.setFullUrlElement(parseUri(json.get("fullUrl").getAsString()));
3281    if (json.has("_fullUrl"))
3282      parseElementProperties(json.getAsJsonObject("_fullUrl"), res.getFullUrlElement());
3283    if (json.has("resource"))
3284      res.setResource(parseResource(json.getAsJsonObject("resource")));
3285    if (json.has("search"))
3286      res.setSearch(parseBundleBundleEntrySearchComponent(json.getAsJsonObject("search"), owner));
3287    if (json.has("request"))
3288      res.setRequest(parseBundleBundleEntryRequestComponent(json.getAsJsonObject("request"), owner));
3289    if (json.has("response"))
3290      res.setResponse(parseBundleBundleEntryResponseComponent(json.getAsJsonObject("response"), owner));
3291  }
3292
3293  protected Bundle.BundleEntrySearchComponent parseBundleBundleEntrySearchComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3294    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
3295    parseBundleBundleEntrySearchComponentProperties(json, owner, res);
3296    return res;
3297  }
3298
3299  protected void parseBundleBundleEntrySearchComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntrySearchComponent res) throws IOException, FHIRFormatError {
3300    parseBackboneElementProperties(json, res);
3301    if (json.has("mode"))
3302      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Bundle.SearchEntryMode.NULL, new Bundle.SearchEntryModeEnumFactory()));
3303    if (json.has("_mode"))
3304      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3305    if (json.has("score"))
3306      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
3307    if (json.has("_score"))
3308      parseElementProperties(json.getAsJsonObject("_score"), res.getScoreElement());
3309  }
3310
3311  protected Bundle.BundleEntryRequestComponent parseBundleBundleEntryRequestComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3312    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
3313    parseBundleBundleEntryRequestComponentProperties(json, owner, res);
3314    return res;
3315  }
3316
3317  protected void parseBundleBundleEntryRequestComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryRequestComponent res) throws IOException, FHIRFormatError {
3318    parseBackboneElementProperties(json, res);
3319    if (json.has("method"))
3320      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
3321    if (json.has("_method"))
3322      parseElementProperties(json.getAsJsonObject("_method"), res.getMethodElement());
3323    if (json.has("url"))
3324      res.setUrlElement(parseUri(json.get("url").getAsString()));
3325    if (json.has("_url"))
3326      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3327    if (json.has("ifNoneMatch"))
3328      res.setIfNoneMatchElement(parseString(json.get("ifNoneMatch").getAsString()));
3329    if (json.has("_ifNoneMatch"))
3330      parseElementProperties(json.getAsJsonObject("_ifNoneMatch"), res.getIfNoneMatchElement());
3331    if (json.has("ifModifiedSince"))
3332      res.setIfModifiedSinceElement(parseInstant(json.get("ifModifiedSince").getAsString()));
3333    if (json.has("_ifModifiedSince"))
3334      parseElementProperties(json.getAsJsonObject("_ifModifiedSince"), res.getIfModifiedSinceElement());
3335    if (json.has("ifMatch"))
3336      res.setIfMatchElement(parseString(json.get("ifMatch").getAsString()));
3337    if (json.has("_ifMatch"))
3338      parseElementProperties(json.getAsJsonObject("_ifMatch"), res.getIfMatchElement());
3339    if (json.has("ifNoneExist"))
3340      res.setIfNoneExistElement(parseString(json.get("ifNoneExist").getAsString()));
3341    if (json.has("_ifNoneExist"))
3342      parseElementProperties(json.getAsJsonObject("_ifNoneExist"), res.getIfNoneExistElement());
3343  }
3344
3345  protected Bundle.BundleEntryResponseComponent parseBundleBundleEntryResponseComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3346    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
3347    parseBundleBundleEntryResponseComponentProperties(json, owner, res);
3348    return res;
3349  }
3350
3351  protected void parseBundleBundleEntryResponseComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryResponseComponent res) throws IOException, FHIRFormatError {
3352    parseBackboneElementProperties(json, res);
3353    if (json.has("status"))
3354      res.setStatusElement(parseString(json.get("status").getAsString()));
3355    if (json.has("_status"))
3356      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3357    if (json.has("location"))
3358      res.setLocationElement(parseUri(json.get("location").getAsString()));
3359    if (json.has("_location"))
3360      parseElementProperties(json.getAsJsonObject("_location"), res.getLocationElement());
3361    if (json.has("etag"))
3362      res.setEtagElement(parseString(json.get("etag").getAsString()));
3363    if (json.has("_etag"))
3364      parseElementProperties(json.getAsJsonObject("_etag"), res.getEtagElement());
3365    if (json.has("lastModified"))
3366      res.setLastModifiedElement(parseInstant(json.get("lastModified").getAsString()));
3367    if (json.has("_lastModified"))
3368      parseElementProperties(json.getAsJsonObject("_lastModified"), res.getLastModifiedElement());
3369    if (json.has("outcome"))
3370      res.setOutcome(parseResource(json.getAsJsonObject("outcome")));
3371  }
3372
3373  protected CapabilityStatement parseCapabilityStatement(JsonObject json) throws IOException, FHIRFormatError {
3374    CapabilityStatement res = new CapabilityStatement();
3375    parseCapabilityStatementProperties(json, res);
3376    return res;
3377  }
3378
3379  protected void parseCapabilityStatementProperties(JsonObject json, CapabilityStatement res) throws IOException, FHIRFormatError {
3380    parseDomainResourceProperties(json, res);
3381    if (json.has("url"))
3382      res.setUrlElement(parseUri(json.get("url").getAsString()));
3383    if (json.has("_url"))
3384      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3385    if (json.has("version"))
3386      res.setVersionElement(parseString(json.get("version").getAsString()));
3387    if (json.has("_version"))
3388      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
3389    if (json.has("name"))
3390      res.setNameElement(parseString(json.get("name").getAsString()));
3391    if (json.has("_name"))
3392      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3393    if (json.has("title"))
3394      res.setTitleElement(parseString(json.get("title").getAsString()));
3395    if (json.has("_title"))
3396      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
3397    if (json.has("status"))
3398      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
3399    if (json.has("_status"))
3400      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3401    if (json.has("experimental"))
3402      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
3403    if (json.has("_experimental"))
3404      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
3405    if (json.has("date"))
3406      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3407    if (json.has("_date"))
3408      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
3409    if (json.has("publisher"))
3410      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
3411    if (json.has("_publisher"))
3412      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
3413    if (json.has("contact")) {
3414      JsonArray array = json.getAsJsonArray("contact");
3415      for (int i = 0; i < array.size(); i++) {
3416        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
3417      }
3418    };
3419    if (json.has("description"))
3420      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
3421    if (json.has("_description"))
3422      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3423    if (json.has("useContext")) {
3424      JsonArray array = json.getAsJsonArray("useContext");
3425      for (int i = 0; i < array.size(); i++) {
3426        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
3427      }
3428    };
3429    if (json.has("jurisdiction")) {
3430      JsonArray array = json.getAsJsonArray("jurisdiction");
3431      for (int i = 0; i < array.size(); i++) {
3432        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3433      }
3434    };
3435    if (json.has("purpose"))
3436      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
3437    if (json.has("_purpose"))
3438      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
3439    if (json.has("copyright"))
3440      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
3441    if (json.has("_copyright"))
3442      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
3443    if (json.has("kind"))
3444      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CapabilityStatement.CapabilityStatementKind.NULL, new CapabilityStatement.CapabilityStatementKindEnumFactory()));
3445    if (json.has("_kind"))
3446      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
3447    if (json.has("instantiates")) {
3448      JsonArray array = json.getAsJsonArray("instantiates");
3449      for (int i = 0; i < array.size(); i++) {
3450        res.getInstantiates().add(parseCanonical(array.get(i).getAsString()));
3451      }
3452    };
3453    if (json.has("_instantiates")) {
3454      JsonArray array = json.getAsJsonArray("_instantiates");
3455      for (int i = 0; i < array.size(); i++) {
3456        if (i == res.getInstantiates().size())
3457          res.getInstantiates().add(parseCanonical(null));
3458        if (array.get(i) instanceof JsonObject) 
3459          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
3460      }
3461    };
3462    if (json.has("imports")) {
3463      JsonArray array = json.getAsJsonArray("imports");
3464      for (int i = 0; i < array.size(); i++) {
3465        res.getImports().add(parseCanonical(array.get(i).getAsString()));
3466      }
3467    };
3468    if (json.has("_imports")) {
3469      JsonArray array = json.getAsJsonArray("_imports");
3470      for (int i = 0; i < array.size(); i++) {
3471        if (i == res.getImports().size())
3472          res.getImports().add(parseCanonical(null));
3473        if (array.get(i) instanceof JsonObject) 
3474          parseElementProperties(array.get(i).getAsJsonObject(), res.getImports().get(i));
3475      }
3476    };
3477    if (json.has("software"))
3478      res.setSoftware(parseCapabilityStatementCapabilityStatementSoftwareComponent(json.getAsJsonObject("software"), res));
3479    if (json.has("implementation"))
3480      res.setImplementation(parseCapabilityStatementCapabilityStatementImplementationComponent(json.getAsJsonObject("implementation"), res));
3481    if (json.has("fhirVersion"))
3482      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
3483    if (json.has("_fhirVersion"))
3484      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
3485    if (json.has("format")) {
3486      JsonArray array = json.getAsJsonArray("format");
3487      for (int i = 0; i < array.size(); i++) {
3488        res.getFormat().add(parseCode(array.get(i).getAsString()));
3489      }
3490    };
3491    if (json.has("_format")) {
3492      JsonArray array = json.getAsJsonArray("_format");
3493      for (int i = 0; i < array.size(); i++) {
3494        if (i == res.getFormat().size())
3495          res.getFormat().add(parseCode(null));
3496        if (array.get(i) instanceof JsonObject) 
3497          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
3498      }
3499    };
3500    if (json.has("patchFormat")) {
3501      JsonArray array = json.getAsJsonArray("patchFormat");
3502      for (int i = 0; i < array.size(); i++) {
3503        res.getPatchFormat().add(parseCode(array.get(i).getAsString()));
3504      }
3505    };
3506    if (json.has("_patchFormat")) {
3507      JsonArray array = json.getAsJsonArray("_patchFormat");
3508      for (int i = 0; i < array.size(); i++) {
3509        if (i == res.getPatchFormat().size())
3510          res.getPatchFormat().add(parseCode(null));
3511        if (array.get(i) instanceof JsonObject) 
3512          parseElementProperties(array.get(i).getAsJsonObject(), res.getPatchFormat().get(i));
3513      }
3514    };
3515    if (json.has("implementationGuide")) {
3516      JsonArray array = json.getAsJsonArray("implementationGuide");
3517      for (int i = 0; i < array.size(); i++) {
3518        res.getImplementationGuide().add(parseCanonical(array.get(i).getAsString()));
3519      }
3520    };
3521    if (json.has("_implementationGuide")) {
3522      JsonArray array = json.getAsJsonArray("_implementationGuide");
3523      for (int i = 0; i < array.size(); i++) {
3524        if (i == res.getImplementationGuide().size())
3525          res.getImplementationGuide().add(parseCanonical(null));
3526        if (array.get(i) instanceof JsonObject) 
3527          parseElementProperties(array.get(i).getAsJsonObject(), res.getImplementationGuide().get(i));
3528      }
3529    };
3530    if (json.has("rest")) {
3531      JsonArray array = json.getAsJsonArray("rest");
3532      for (int i = 0; i < array.size(); i++) {
3533        res.getRest().add(parseCapabilityStatementCapabilityStatementRestComponent(array.get(i).getAsJsonObject(), res));
3534      }
3535    };
3536    if (json.has("messaging")) {
3537      JsonArray array = json.getAsJsonArray("messaging");
3538      for (int i = 0; i < array.size(); i++) {
3539        res.getMessaging().add(parseCapabilityStatementCapabilityStatementMessagingComponent(array.get(i).getAsJsonObject(), res));
3540      }
3541    };
3542    if (json.has("document")) {
3543      JsonArray array = json.getAsJsonArray("document");
3544      for (int i = 0; i < array.size(); i++) {
3545        res.getDocument().add(parseCapabilityStatementCapabilityStatementDocumentComponent(array.get(i).getAsJsonObject(), res));
3546      }
3547    };
3548  }
3549
3550  protected CapabilityStatement.CapabilityStatementSoftwareComponent parseCapabilityStatementCapabilityStatementSoftwareComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3551    CapabilityStatement.CapabilityStatementSoftwareComponent res = new CapabilityStatement.CapabilityStatementSoftwareComponent();
3552    parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(json, owner, res);
3553    return res;
3554  }
3555
3556  protected void parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementSoftwareComponent res) throws IOException, FHIRFormatError {
3557    parseBackboneElementProperties(json, res);
3558    if (json.has("name"))
3559      res.setNameElement(parseString(json.get("name").getAsString()));
3560    if (json.has("_name"))
3561      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3562    if (json.has("version"))
3563      res.setVersionElement(parseString(json.get("version").getAsString()));
3564    if (json.has("_version"))
3565      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
3566    if (json.has("releaseDate"))
3567      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
3568    if (json.has("_releaseDate"))
3569      parseElementProperties(json.getAsJsonObject("_releaseDate"), res.getReleaseDateElement());
3570  }
3571
3572  protected CapabilityStatement.CapabilityStatementImplementationComponent parseCapabilityStatementCapabilityStatementImplementationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3573    CapabilityStatement.CapabilityStatementImplementationComponent res = new CapabilityStatement.CapabilityStatementImplementationComponent();
3574    parseCapabilityStatementCapabilityStatementImplementationComponentProperties(json, owner, res);
3575    return res;
3576  }
3577
3578  protected void parseCapabilityStatementCapabilityStatementImplementationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementImplementationComponent res) throws IOException, FHIRFormatError {
3579    parseBackboneElementProperties(json, res);
3580    if (json.has("description"))
3581      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3582    if (json.has("_description"))
3583      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3584    if (json.has("url"))
3585      res.setUrlElement(parseUrl(json.get("url").getAsString()));
3586    if (json.has("_url"))
3587      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3588    if (json.has("custodian"))
3589      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
3590  }
3591
3592  protected CapabilityStatement.CapabilityStatementRestComponent parseCapabilityStatementCapabilityStatementRestComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3593    CapabilityStatement.CapabilityStatementRestComponent res = new CapabilityStatement.CapabilityStatementRestComponent();
3594    parseCapabilityStatementCapabilityStatementRestComponentProperties(json, owner, res);
3595    return res;
3596  }
3597
3598  protected void parseCapabilityStatementCapabilityStatementRestComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestComponent res) throws IOException, FHIRFormatError {
3599    parseBackboneElementProperties(json, res);
3600    if (json.has("mode"))
3601      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.RestfulCapabilityMode.NULL, new CapabilityStatement.RestfulCapabilityModeEnumFactory()));
3602    if (json.has("_mode"))
3603      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3604    if (json.has("documentation"))
3605      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3606    if (json.has("_documentation"))
3607      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3608    if (json.has("security"))
3609      res.setSecurity(parseCapabilityStatementCapabilityStatementRestSecurityComponent(json.getAsJsonObject("security"), owner));
3610    if (json.has("resource")) {
3611      JsonArray array = json.getAsJsonArray("resource");
3612      for (int i = 0; i < array.size(); i++) {
3613        res.getResource().add(parseCapabilityStatementCapabilityStatementRestResourceComponent(array.get(i).getAsJsonObject(), owner));
3614      }
3615    };
3616    if (json.has("interaction")) {
3617      JsonArray array = json.getAsJsonArray("interaction");
3618      for (int i = 0; i < array.size(); i++) {
3619        res.getInteraction().add(parseCapabilityStatementSystemInteractionComponent(array.get(i).getAsJsonObject(), owner));
3620      }
3621    };
3622    if (json.has("searchParam")) {
3623      JsonArray array = json.getAsJsonArray("searchParam");
3624      for (int i = 0; i < array.size(); i++) {
3625        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3626      }
3627    };
3628    if (json.has("operation")) {
3629      JsonArray array = json.getAsJsonArray("operation");
3630      for (int i = 0; i < array.size(); i++) {
3631        res.getOperation().add(parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject(), owner));
3632      }
3633    };
3634    if (json.has("compartment")) {
3635      JsonArray array = json.getAsJsonArray("compartment");
3636      for (int i = 0; i < array.size(); i++) {
3637        res.getCompartment().add(parseCanonical(array.get(i).getAsString()));
3638      }
3639    };
3640    if (json.has("_compartment")) {
3641      JsonArray array = json.getAsJsonArray("_compartment");
3642      for (int i = 0; i < array.size(); i++) {
3643        if (i == res.getCompartment().size())
3644          res.getCompartment().add(parseCanonical(null));
3645        if (array.get(i) instanceof JsonObject) 
3646          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
3647      }
3648    };
3649  }
3650
3651  protected CapabilityStatement.CapabilityStatementRestSecurityComponent parseCapabilityStatementCapabilityStatementRestSecurityComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3652    CapabilityStatement.CapabilityStatementRestSecurityComponent res = new CapabilityStatement.CapabilityStatementRestSecurityComponent();
3653    parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(json, owner, res);
3654    return res;
3655  }
3656
3657  protected void parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestSecurityComponent res) throws IOException, FHIRFormatError {
3658    parseBackboneElementProperties(json, res);
3659    if (json.has("cors"))
3660      res.setCorsElement(parseBoolean(json.get("cors").getAsBoolean()));
3661    if (json.has("_cors"))
3662      parseElementProperties(json.getAsJsonObject("_cors"), res.getCorsElement());
3663    if (json.has("service")) {
3664      JsonArray array = json.getAsJsonArray("service");
3665      for (int i = 0; i < array.size(); i++) {
3666        res.getService().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3667      }
3668    };
3669    if (json.has("description"))
3670      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
3671    if (json.has("_description"))
3672      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3673  }
3674
3675  protected CapabilityStatement.CapabilityStatementRestResourceComponent parseCapabilityStatementCapabilityStatementRestResourceComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3676    CapabilityStatement.CapabilityStatementRestResourceComponent res = new CapabilityStatement.CapabilityStatementRestResourceComponent();
3677    parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(json, owner, res);
3678    return res;
3679  }
3680
3681  protected void parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceComponent res) throws IOException, FHIRFormatError {
3682    parseBackboneElementProperties(json, res);
3683    if (json.has("type"))
3684      res.setTypeElement(parseCode(json.get("type").getAsString()));
3685    if (json.has("_type"))
3686      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3687    if (json.has("profile"))
3688      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
3689    if (json.has("_profile"))
3690      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
3691    if (json.has("supportedProfile")) {
3692      JsonArray array = json.getAsJsonArray("supportedProfile");
3693      for (int i = 0; i < array.size(); i++) {
3694        res.getSupportedProfile().add(parseCanonical(array.get(i).getAsString()));
3695      }
3696    };
3697    if (json.has("_supportedProfile")) {
3698      JsonArray array = json.getAsJsonArray("_supportedProfile");
3699      for (int i = 0; i < array.size(); i++) {
3700        if (i == res.getSupportedProfile().size())
3701          res.getSupportedProfile().add(parseCanonical(null));
3702        if (array.get(i) instanceof JsonObject) 
3703          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportedProfile().get(i));
3704      }
3705    };
3706    if (json.has("documentation"))
3707      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3708    if (json.has("_documentation"))
3709      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3710    if (json.has("interaction")) {
3711      JsonArray array = json.getAsJsonArray("interaction");
3712      for (int i = 0; i < array.size(); i++) {
3713        res.getInteraction().add(parseCapabilityStatementResourceInteractionComponent(array.get(i).getAsJsonObject(), owner));
3714      }
3715    };
3716    if (json.has("versioning"))
3717      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), CapabilityStatement.ResourceVersionPolicy.NULL, new CapabilityStatement.ResourceVersionPolicyEnumFactory()));
3718    if (json.has("_versioning"))
3719      parseElementProperties(json.getAsJsonObject("_versioning"), res.getVersioningElement());
3720    if (json.has("readHistory"))
3721      res.setReadHistoryElement(parseBoolean(json.get("readHistory").getAsBoolean()));
3722    if (json.has("_readHistory"))
3723      parseElementProperties(json.getAsJsonObject("_readHistory"), res.getReadHistoryElement());
3724    if (json.has("updateCreate"))
3725      res.setUpdateCreateElement(parseBoolean(json.get("updateCreate").getAsBoolean()));
3726    if (json.has("_updateCreate"))
3727      parseElementProperties(json.getAsJsonObject("_updateCreate"), res.getUpdateCreateElement());
3728    if (json.has("conditionalCreate"))
3729      res.setConditionalCreateElement(parseBoolean(json.get("conditionalCreate").getAsBoolean()));
3730    if (json.has("_conditionalCreate"))
3731      parseElementProperties(json.getAsJsonObject("_conditionalCreate"), res.getConditionalCreateElement());
3732    if (json.has("conditionalRead"))
3733      res.setConditionalReadElement(parseEnumeration(json.get("conditionalRead").getAsString(), CapabilityStatement.ConditionalReadStatus.NULL, new CapabilityStatement.ConditionalReadStatusEnumFactory()));
3734    if (json.has("_conditionalRead"))
3735      parseElementProperties(json.getAsJsonObject("_conditionalRead"), res.getConditionalReadElement());
3736    if (json.has("conditionalUpdate"))
3737      res.setConditionalUpdateElement(parseBoolean(json.get("conditionalUpdate").getAsBoolean()));
3738    if (json.has("_conditionalUpdate"))
3739      parseElementProperties(json.getAsJsonObject("_conditionalUpdate"), res.getConditionalUpdateElement());
3740    if (json.has("conditionalDelete"))
3741      res.setConditionalDeleteElement(parseEnumeration(json.get("conditionalDelete").getAsString(), CapabilityStatement.ConditionalDeleteStatus.NULL, new CapabilityStatement.ConditionalDeleteStatusEnumFactory()));
3742    if (json.has("_conditionalDelete"))
3743      parseElementProperties(json.getAsJsonObject("_conditionalDelete"), res.getConditionalDeleteElement());
3744    if (json.has("referencePolicy")) {
3745      JsonArray array = json.getAsJsonArray("referencePolicy");
3746      for (int i = 0; i < array.size(); i++) {
3747        res.getReferencePolicy().add(parseEnumeration(array.get(i).getAsString(), CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3748      }
3749    };
3750    if (json.has("_referencePolicy")) {
3751      JsonArray array = json.getAsJsonArray("_referencePolicy");
3752      for (int i = 0; i < array.size(); i++) {
3753        if (i == res.getReferencePolicy().size())
3754          res.getReferencePolicy().add(parseEnumeration(null, CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3755        if (array.get(i) instanceof JsonObject) 
3756          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferencePolicy().get(i));
3757      }
3758    };
3759    if (json.has("searchInclude")) {
3760      JsonArray array = json.getAsJsonArray("searchInclude");
3761      for (int i = 0; i < array.size(); i++) {
3762        res.getSearchInclude().add(parseString(array.get(i).getAsString()));
3763      }
3764    };
3765    if (json.has("_searchInclude")) {
3766      JsonArray array = json.getAsJsonArray("_searchInclude");
3767      for (int i = 0; i < array.size(); i++) {
3768        if (i == res.getSearchInclude().size())
3769          res.getSearchInclude().add(parseString(null));
3770        if (array.get(i) instanceof JsonObject) 
3771          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchInclude().get(i));
3772      }
3773    };
3774    if (json.has("searchRevInclude")) {
3775      JsonArray array = json.getAsJsonArray("searchRevInclude");
3776      for (int i = 0; i < array.size(); i++) {
3777        res.getSearchRevInclude().add(parseString(array.get(i).getAsString()));
3778      }
3779    };
3780    if (json.has("_searchRevInclude")) {
3781      JsonArray array = json.getAsJsonArray("_searchRevInclude");
3782      for (int i = 0; i < array.size(); i++) {
3783        if (i == res.getSearchRevInclude().size())
3784          res.getSearchRevInclude().add(parseString(null));
3785        if (array.get(i) instanceof JsonObject) 
3786          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchRevInclude().get(i));
3787      }
3788    };
3789    if (json.has("searchParam")) {
3790      JsonArray array = json.getAsJsonArray("searchParam");
3791      for (int i = 0; i < array.size(); i++) {
3792        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3793      }
3794    };
3795    if (json.has("operation")) {
3796      JsonArray array = json.getAsJsonArray("operation");
3797      for (int i = 0; i < array.size(); i++) {
3798        res.getOperation().add(parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject(), owner));
3799      }
3800    };
3801  }
3802
3803  protected CapabilityStatement.ResourceInteractionComponent parseCapabilityStatementResourceInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3804    CapabilityStatement.ResourceInteractionComponent res = new CapabilityStatement.ResourceInteractionComponent();
3805    parseCapabilityStatementResourceInteractionComponentProperties(json, owner, res);
3806    return res;
3807  }
3808
3809  protected void parseCapabilityStatementResourceInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.ResourceInteractionComponent res) throws IOException, FHIRFormatError {
3810    parseBackboneElementProperties(json, res);
3811    if (json.has("code"))
3812      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.TypeRestfulInteraction.NULL, new CapabilityStatement.TypeRestfulInteractionEnumFactory()));
3813    if (json.has("_code"))
3814      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3815    if (json.has("documentation"))
3816      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3817    if (json.has("_documentation"))
3818      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3819  }
3820
3821  protected CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3822    CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
3823    parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(json, owner, res);
3824    return res;
3825  }
3826
3827  protected void parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res) throws IOException, FHIRFormatError {
3828    parseBackboneElementProperties(json, res);
3829    if (json.has("name"))
3830      res.setNameElement(parseString(json.get("name").getAsString()));
3831    if (json.has("_name"))
3832      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3833    if (json.has("definition"))
3834      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
3835    if (json.has("_definition"))
3836      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
3837    if (json.has("type"))
3838      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
3839    if (json.has("_type"))
3840      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3841    if (json.has("documentation"))
3842      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3843    if (json.has("_documentation"))
3844      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3845  }
3846
3847  protected CapabilityStatement.CapabilityStatementRestResourceOperationComponent parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3848    CapabilityStatement.CapabilityStatementRestResourceOperationComponent res = new CapabilityStatement.CapabilityStatementRestResourceOperationComponent();
3849    parseCapabilityStatementCapabilityStatementRestResourceOperationComponentProperties(json, owner, res);
3850    return res;
3851  }
3852
3853  protected void parseCapabilityStatementCapabilityStatementRestResourceOperationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceOperationComponent res) throws IOException, FHIRFormatError {
3854    parseBackboneElementProperties(json, res);
3855    if (json.has("name"))
3856      res.setNameElement(parseString(json.get("name").getAsString()));
3857    if (json.has("_name"))
3858      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3859    if (json.has("definition"))
3860      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
3861    if (json.has("_definition"))
3862      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
3863    if (json.has("documentation"))
3864      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3865    if (json.has("_documentation"))
3866      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3867  }
3868
3869  protected CapabilityStatement.SystemInteractionComponent parseCapabilityStatementSystemInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3870    CapabilityStatement.SystemInteractionComponent res = new CapabilityStatement.SystemInteractionComponent();
3871    parseCapabilityStatementSystemInteractionComponentProperties(json, owner, res);
3872    return res;
3873  }
3874
3875  protected void parseCapabilityStatementSystemInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.SystemInteractionComponent res) throws IOException, FHIRFormatError {
3876    parseBackboneElementProperties(json, res);
3877    if (json.has("code"))
3878      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.SystemRestfulInteraction.NULL, new CapabilityStatement.SystemRestfulInteractionEnumFactory()));
3879    if (json.has("_code"))
3880      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3881    if (json.has("documentation"))
3882      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3883    if (json.has("_documentation"))
3884      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3885  }
3886
3887  protected CapabilityStatement.CapabilityStatementMessagingComponent parseCapabilityStatementCapabilityStatementMessagingComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3888    CapabilityStatement.CapabilityStatementMessagingComponent res = new CapabilityStatement.CapabilityStatementMessagingComponent();
3889    parseCapabilityStatementCapabilityStatementMessagingComponentProperties(json, owner, res);
3890    return res;
3891  }
3892
3893  protected void parseCapabilityStatementCapabilityStatementMessagingComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingComponent res) throws IOException, FHIRFormatError {
3894    parseBackboneElementProperties(json, res);
3895    if (json.has("endpoint")) {
3896      JsonArray array = json.getAsJsonArray("endpoint");
3897      for (int i = 0; i < array.size(); i++) {
3898        res.getEndpoint().add(parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(array.get(i).getAsJsonObject(), owner));
3899      }
3900    };
3901    if (json.has("reliableCache"))
3902      res.setReliableCacheElement(parseUnsignedInt(json.get("reliableCache").getAsString()));
3903    if (json.has("_reliableCache"))
3904      parseElementProperties(json.getAsJsonObject("_reliableCache"), res.getReliableCacheElement());
3905    if (json.has("documentation"))
3906      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3907    if (json.has("_documentation"))
3908      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3909    if (json.has("supportedMessage")) {
3910      JsonArray array = json.getAsJsonArray("supportedMessage");
3911      for (int i = 0; i < array.size(); i++) {
3912        res.getSupportedMessage().add(parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(array.get(i).getAsJsonObject(), owner));
3913      }
3914    };
3915  }
3916
3917  protected CapabilityStatement.CapabilityStatementMessagingEndpointComponent parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3918    CapabilityStatement.CapabilityStatementMessagingEndpointComponent res = new CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
3919    parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(json, owner, res);
3920    return res;
3921  }
3922
3923  protected void parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingEndpointComponent res) throws IOException, FHIRFormatError {
3924    parseBackboneElementProperties(json, res);
3925    if (json.has("protocol"))
3926      res.setProtocol(parseCoding(json.getAsJsonObject("protocol")));
3927    if (json.has("address"))
3928      res.setAddressElement(parseUrl(json.get("address").getAsString()));
3929    if (json.has("_address"))
3930      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
3931  }
3932
3933  protected CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3934    CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res = new CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
3935    parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(json, owner, res);
3936    return res;
3937  }
3938
3939  protected void parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res) throws IOException, FHIRFormatError {
3940    parseBackboneElementProperties(json, res);
3941    if (json.has("mode"))
3942      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
3943    if (json.has("_mode"))
3944      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3945    if (json.has("definition"))
3946      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
3947    if (json.has("_definition"))
3948      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
3949  }
3950
3951  protected CapabilityStatement.CapabilityStatementDocumentComponent parseCapabilityStatementCapabilityStatementDocumentComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3952    CapabilityStatement.CapabilityStatementDocumentComponent res = new CapabilityStatement.CapabilityStatementDocumentComponent();
3953    parseCapabilityStatementCapabilityStatementDocumentComponentProperties(json, owner, res);
3954    return res;
3955  }
3956
3957  protected void parseCapabilityStatementCapabilityStatementDocumentComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementDocumentComponent res) throws IOException, FHIRFormatError {
3958    parseBackboneElementProperties(json, res);
3959    if (json.has("mode"))
3960      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.DocumentMode.NULL, new CapabilityStatement.DocumentModeEnumFactory()));
3961    if (json.has("_mode"))
3962      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3963    if (json.has("documentation"))
3964      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3965    if (json.has("_documentation"))
3966      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3967    if (json.has("profile"))
3968      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
3969    if (json.has("_profile"))
3970      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
3971  }
3972
3973  protected CarePlan parseCarePlan(JsonObject json) throws IOException, FHIRFormatError {
3974    CarePlan res = new CarePlan();
3975    parseCarePlanProperties(json, res);
3976    return res;
3977  }
3978
3979  protected void parseCarePlanProperties(JsonObject json, CarePlan res) throws IOException, FHIRFormatError {
3980    parseDomainResourceProperties(json, res);
3981    if (json.has("identifier")) {
3982      JsonArray array = json.getAsJsonArray("identifier");
3983      for (int i = 0; i < array.size(); i++) {
3984        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3985      }
3986    };
3987    if (json.has("instantiatesCanonical")) {
3988      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
3989      for (int i = 0; i < array.size(); i++) {
3990        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
3991      }
3992    };
3993    if (json.has("_instantiatesCanonical")) {
3994      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
3995      for (int i = 0; i < array.size(); i++) {
3996        if (i == res.getInstantiatesCanonical().size())
3997          res.getInstantiatesCanonical().add(parseCanonical(null));
3998        if (array.get(i) instanceof JsonObject) 
3999          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
4000      }
4001    };
4002    if (json.has("instantiatesUri")) {
4003      JsonArray array = json.getAsJsonArray("instantiatesUri");
4004      for (int i = 0; i < array.size(); i++) {
4005        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
4006      }
4007    };
4008    if (json.has("_instantiatesUri")) {
4009      JsonArray array = json.getAsJsonArray("_instantiatesUri");
4010      for (int i = 0; i < array.size(); i++) {
4011        if (i == res.getInstantiatesUri().size())
4012          res.getInstantiatesUri().add(parseUri(null));
4013        if (array.get(i) instanceof JsonObject) 
4014          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
4015      }
4016    };
4017    if (json.has("basedOn")) {
4018      JsonArray array = json.getAsJsonArray("basedOn");
4019      for (int i = 0; i < array.size(); i++) {
4020        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
4021      }
4022    };
4023    if (json.has("replaces")) {
4024      JsonArray array = json.getAsJsonArray("replaces");
4025      for (int i = 0; i < array.size(); i++) {
4026        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
4027      }
4028    };
4029    if (json.has("partOf")) {
4030      JsonArray array = json.getAsJsonArray("partOf");
4031      for (int i = 0; i < array.size(); i++) {
4032        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
4033      }
4034    };
4035    if (json.has("status"))
4036      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanStatus.NULL, new CarePlan.CarePlanStatusEnumFactory()));
4037    if (json.has("_status"))
4038      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4039    if (json.has("intent"))
4040      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), CarePlan.CarePlanIntent.NULL, new CarePlan.CarePlanIntentEnumFactory()));
4041    if (json.has("_intent"))
4042      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
4043    if (json.has("category")) {
4044      JsonArray array = json.getAsJsonArray("category");
4045      for (int i = 0; i < array.size(); i++) {
4046        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4047      }
4048    };
4049    if (json.has("title"))
4050      res.setTitleElement(parseString(json.get("title").getAsString()));
4051    if (json.has("_title"))
4052      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
4053    if (json.has("description"))
4054      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4055    if (json.has("_description"))
4056      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4057    if (json.has("subject"))
4058      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4059    if (json.has("encounter"))
4060      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
4061    if (json.has("period"))
4062      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
4063    if (json.has("created"))
4064      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4065    if (json.has("_created"))
4066      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
4067    if (json.has("author"))
4068      res.setAuthor(parseReference(json.getAsJsonObject("author")));
4069    if (json.has("contributor")) {
4070      JsonArray array = json.getAsJsonArray("contributor");
4071      for (int i = 0; i < array.size(); i++) {
4072        res.getContributor().add(parseReference(array.get(i).getAsJsonObject()));
4073      }
4074    };
4075    if (json.has("careTeam")) {
4076      JsonArray array = json.getAsJsonArray("careTeam");
4077      for (int i = 0; i < array.size(); i++) {
4078        res.getCareTeam().add(parseReference(array.get(i).getAsJsonObject()));
4079      }
4080    };
4081    if (json.has("addresses")) {
4082      JsonArray array = json.getAsJsonArray("addresses");
4083      for (int i = 0; i < array.size(); i++) {
4084        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
4085      }
4086    };
4087    if (json.has("supportingInfo")) {
4088      JsonArray array = json.getAsJsonArray("supportingInfo");
4089      for (int i = 0; i < array.size(); i++) {
4090        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
4091      }
4092    };
4093    if (json.has("goal")) {
4094      JsonArray array = json.getAsJsonArray("goal");
4095      for (int i = 0; i < array.size(); i++) {
4096        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
4097      }
4098    };
4099    if (json.has("activity")) {
4100      JsonArray array = json.getAsJsonArray("activity");
4101      for (int i = 0; i < array.size(); i++) {
4102        res.getActivity().add(parseCarePlanCarePlanActivityComponent(array.get(i).getAsJsonObject(), res));
4103      }
4104    };
4105    if (json.has("note")) {
4106      JsonArray array = json.getAsJsonArray("note");
4107      for (int i = 0; i < array.size(); i++) {
4108        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4109      }
4110    };
4111  }
4112
4113  protected CarePlan.CarePlanActivityComponent parseCarePlanCarePlanActivityComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
4114    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
4115    parseCarePlanCarePlanActivityComponentProperties(json, owner, res);
4116    return res;
4117  }
4118
4119  protected void parseCarePlanCarePlanActivityComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityComponent res) throws IOException, FHIRFormatError {
4120    parseBackboneElementProperties(json, res);
4121    if (json.has("outcomeCodeableConcept")) {
4122      JsonArray array = json.getAsJsonArray("outcomeCodeableConcept");
4123      for (int i = 0; i < array.size(); i++) {
4124        res.getOutcomeCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4125      }
4126    };
4127    if (json.has("outcomeReference")) {
4128      JsonArray array = json.getAsJsonArray("outcomeReference");
4129      for (int i = 0; i < array.size(); i++) {
4130        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
4131      }
4132    };
4133    if (json.has("progress")) {
4134      JsonArray array = json.getAsJsonArray("progress");
4135      for (int i = 0; i < array.size(); i++) {
4136        res.getProgress().add(parseAnnotation(array.get(i).getAsJsonObject()));
4137      }
4138    };
4139    if (json.has("reference"))
4140      res.setReference(parseReference(json.getAsJsonObject("reference")));
4141    if (json.has("detail"))
4142      res.setDetail(parseCarePlanCarePlanActivityDetailComponent(json.getAsJsonObject("detail"), owner));
4143  }
4144
4145  protected CarePlan.CarePlanActivityDetailComponent parseCarePlanCarePlanActivityDetailComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
4146    CarePlan.CarePlanActivityDetailComponent res = new CarePlan.CarePlanActivityDetailComponent();
4147    parseCarePlanCarePlanActivityDetailComponentProperties(json, owner, res);
4148    return res;
4149  }
4150
4151  protected void parseCarePlanCarePlanActivityDetailComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityDetailComponent res) throws IOException, FHIRFormatError {
4152    parseBackboneElementProperties(json, res);
4153    if (json.has("kind"))
4154      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CarePlan.CarePlanActivityKind.NULL, new CarePlan.CarePlanActivityKindEnumFactory()));
4155    if (json.has("_kind"))
4156      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
4157    if (json.has("instantiatesCanonical")) {
4158      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
4159      for (int i = 0; i < array.size(); i++) {
4160        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
4161      }
4162    };
4163    if (json.has("_instantiatesCanonical")) {
4164      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
4165      for (int i = 0; i < array.size(); i++) {
4166        if (i == res.getInstantiatesCanonical().size())
4167          res.getInstantiatesCanonical().add(parseCanonical(null));
4168        if (array.get(i) instanceof JsonObject) 
4169          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
4170      }
4171    };
4172    if (json.has("instantiatesUri")) {
4173      JsonArray array = json.getAsJsonArray("instantiatesUri");
4174      for (int i = 0; i < array.size(); i++) {
4175        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
4176      }
4177    };
4178    if (json.has("_instantiatesUri")) {
4179      JsonArray array = json.getAsJsonArray("_instantiatesUri");
4180      for (int i = 0; i < array.size(); i++) {
4181        if (i == res.getInstantiatesUri().size())
4182          res.getInstantiatesUri().add(parseUri(null));
4183        if (array.get(i) instanceof JsonObject) 
4184          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
4185      }
4186    };
4187    if (json.has("code"))
4188      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4189    if (json.has("reasonCode")) {
4190      JsonArray array = json.getAsJsonArray("reasonCode");
4191      for (int i = 0; i < array.size(); i++) {
4192        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4193      }
4194    };
4195    if (json.has("reasonReference")) {
4196      JsonArray array = json.getAsJsonArray("reasonReference");
4197      for (int i = 0; i < array.size(); i++) {
4198        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
4199      }
4200    };
4201    if (json.has("goal")) {
4202      JsonArray array = json.getAsJsonArray("goal");
4203      for (int i = 0; i < array.size(); i++) {
4204        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
4205      }
4206    };
4207    if (json.has("status"))
4208      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanActivityStatus.NULL, new CarePlan.CarePlanActivityStatusEnumFactory()));
4209    if (json.has("_status"))
4210      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4211    if (json.has("statusReason"))
4212      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
4213    if (json.has("doNotPerform"))
4214      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
4215    if (json.has("_doNotPerform"))
4216      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
4217    Type scheduled = parseType("scheduled", json);
4218    if (scheduled != null)
4219      res.setScheduled(scheduled);
4220    if (json.has("location"))
4221      res.setLocation(parseReference(json.getAsJsonObject("location")));
4222    if (json.has("performer")) {
4223      JsonArray array = json.getAsJsonArray("performer");
4224      for (int i = 0; i < array.size(); i++) {
4225        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
4226      }
4227    };
4228    Type product = parseType("product", json);
4229    if (product != null)
4230      res.setProduct(product);
4231    if (json.has("dailyAmount"))
4232      res.setDailyAmount(parseQuantity(json.getAsJsonObject("dailyAmount")));
4233    if (json.has("quantity"))
4234      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
4235    if (json.has("description"))
4236      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4237    if (json.has("_description"))
4238      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4239  }
4240
4241  protected CareTeam parseCareTeam(JsonObject json) throws IOException, FHIRFormatError {
4242    CareTeam res = new CareTeam();
4243    parseCareTeamProperties(json, res);
4244    return res;
4245  }
4246
4247  protected void parseCareTeamProperties(JsonObject json, CareTeam res) throws IOException, FHIRFormatError {
4248    parseDomainResourceProperties(json, res);
4249    if (json.has("identifier")) {
4250      JsonArray array = json.getAsJsonArray("identifier");
4251      for (int i = 0; i < array.size(); i++) {
4252        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4253      }
4254    };
4255    if (json.has("status"))
4256      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CareTeam.CareTeamStatus.NULL, new CareTeam.CareTeamStatusEnumFactory()));
4257    if (json.has("_status"))
4258      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4259    if (json.has("category")) {
4260      JsonArray array = json.getAsJsonArray("category");
4261      for (int i = 0; i < array.size(); i++) {
4262        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4263      }
4264    };
4265    if (json.has("name"))
4266      res.setNameElement(parseString(json.get("name").getAsString()));
4267    if (json.has("_name"))
4268      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4269    if (json.has("subject"))
4270      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4271    if (json.has("encounter"))
4272      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
4273    if (json.has("period"))
4274      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
4275    if (json.has("participant")) {
4276      JsonArray array = json.getAsJsonArray("participant");
4277      for (int i = 0; i < array.size(); i++) {
4278        res.getParticipant().add(parseCareTeamCareTeamParticipantComponent(array.get(i).getAsJsonObject(), res));
4279      }
4280    };
4281    if (json.has("reasonCode")) {
4282      JsonArray array = json.getAsJsonArray("reasonCode");
4283      for (int i = 0; i < array.size(); i++) {
4284        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4285      }
4286    };
4287    if (json.has("reasonReference")) {
4288      JsonArray array = json.getAsJsonArray("reasonReference");
4289      for (int i = 0; i < array.size(); i++) {
4290        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
4291      }
4292    };
4293    if (json.has("managingOrganization")) {
4294      JsonArray array = json.getAsJsonArray("managingOrganization");
4295      for (int i = 0; i < array.size(); i++) {
4296        res.getManagingOrganization().add(parseReference(array.get(i).getAsJsonObject()));
4297      }
4298    };
4299    if (json.has("telecom")) {
4300      JsonArray array = json.getAsJsonArray("telecom");
4301      for (int i = 0; i < array.size(); i++) {
4302        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
4303      }
4304    };
4305    if (json.has("note")) {
4306      JsonArray array = json.getAsJsonArray("note");
4307      for (int i = 0; i < array.size(); i++) {
4308        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4309      }
4310    };
4311  }
4312
4313  protected CareTeam.CareTeamParticipantComponent parseCareTeamCareTeamParticipantComponent(JsonObject json, CareTeam owner) throws IOException, FHIRFormatError {
4314    CareTeam.CareTeamParticipantComponent res = new CareTeam.CareTeamParticipantComponent();
4315    parseCareTeamCareTeamParticipantComponentProperties(json, owner, res);
4316    return res;
4317  }
4318
4319  protected void parseCareTeamCareTeamParticipantComponentProperties(JsonObject json, CareTeam owner, CareTeam.CareTeamParticipantComponent res) throws IOException, FHIRFormatError {
4320    parseBackboneElementProperties(json, res);
4321    if (json.has("role")) {
4322      JsonArray array = json.getAsJsonArray("role");
4323      for (int i = 0; i < array.size(); i++) {
4324        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4325      }
4326    };
4327    if (json.has("member"))
4328      res.setMember(parseReference(json.getAsJsonObject("member")));
4329    if (json.has("onBehalfOf"))
4330      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
4331    if (json.has("period"))
4332      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
4333  }
4334
4335  protected CatalogEntry parseCatalogEntry(JsonObject json) throws IOException, FHIRFormatError {
4336    CatalogEntry res = new CatalogEntry();
4337    parseCatalogEntryProperties(json, res);
4338    return res;
4339  }
4340
4341  protected void parseCatalogEntryProperties(JsonObject json, CatalogEntry res) throws IOException, FHIRFormatError {
4342    parseDomainResourceProperties(json, res);
4343    if (json.has("identifier")) {
4344      JsonArray array = json.getAsJsonArray("identifier");
4345      for (int i = 0; i < array.size(); i++) {
4346        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4347      }
4348    };
4349    if (json.has("type"))
4350      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4351    if (json.has("orderable"))
4352      res.setOrderableElement(parseBoolean(json.get("orderable").getAsBoolean()));
4353    if (json.has("_orderable"))
4354      parseElementProperties(json.getAsJsonObject("_orderable"), res.getOrderableElement());
4355    if (json.has("referencedItem"))
4356      res.setReferencedItem(parseReference(json.getAsJsonObject("referencedItem")));
4357    if (json.has("additionalIdentifier")) {
4358      JsonArray array = json.getAsJsonArray("additionalIdentifier");
4359      for (int i = 0; i < array.size(); i++) {
4360        res.getAdditionalIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4361      }
4362    };
4363    if (json.has("classification")) {
4364      JsonArray array = json.getAsJsonArray("classification");
4365      for (int i = 0; i < array.size(); i++) {
4366        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4367      }
4368    };
4369    if (json.has("status"))
4370      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
4371    if (json.has("_status"))
4372      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4373    if (json.has("validityPeriod"))
4374      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
4375    if (json.has("validTo"))
4376      res.setValidToElement(parseDateTime(json.get("validTo").getAsString()));
4377    if (json.has("_validTo"))
4378      parseElementProperties(json.getAsJsonObject("_validTo"), res.getValidToElement());
4379    if (json.has("lastUpdated"))
4380      res.setLastUpdatedElement(parseDateTime(json.get("lastUpdated").getAsString()));
4381    if (json.has("_lastUpdated"))
4382      parseElementProperties(json.getAsJsonObject("_lastUpdated"), res.getLastUpdatedElement());
4383    if (json.has("additionalCharacteristic")) {
4384      JsonArray array = json.getAsJsonArray("additionalCharacteristic");
4385      for (int i = 0; i < array.size(); i++) {
4386        res.getAdditionalCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4387      }
4388    };
4389    if (json.has("additionalClassification")) {
4390      JsonArray array = json.getAsJsonArray("additionalClassification");
4391      for (int i = 0; i < array.size(); i++) {
4392        res.getAdditionalClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4393      }
4394    };
4395    if (json.has("relatedEntry")) {
4396      JsonArray array = json.getAsJsonArray("relatedEntry");
4397      for (int i = 0; i < array.size(); i++) {
4398        res.getRelatedEntry().add(parseCatalogEntryCatalogEntryRelatedEntryComponent(array.get(i).getAsJsonObject(), res));
4399      }
4400    };
4401  }
4402
4403  protected CatalogEntry.CatalogEntryRelatedEntryComponent parseCatalogEntryCatalogEntryRelatedEntryComponent(JsonObject json, CatalogEntry owner) throws IOException, FHIRFormatError {
4404    CatalogEntry.CatalogEntryRelatedEntryComponent res = new CatalogEntry.CatalogEntryRelatedEntryComponent();
4405    parseCatalogEntryCatalogEntryRelatedEntryComponentProperties(json, owner, res);
4406    return res;
4407  }
4408
4409  protected void parseCatalogEntryCatalogEntryRelatedEntryComponentProperties(JsonObject json, CatalogEntry owner, CatalogEntry.CatalogEntryRelatedEntryComponent res) throws IOException, FHIRFormatError {
4410    parseBackboneElementProperties(json, res);
4411    if (json.has("relationtype"))
4412      res.setRelationtypeElement(parseEnumeration(json.get("relationtype").getAsString(), CatalogEntry.CatalogEntryRelationType.NULL, new CatalogEntry.CatalogEntryRelationTypeEnumFactory()));
4413    if (json.has("_relationtype"))
4414      parseElementProperties(json.getAsJsonObject("_relationtype"), res.getRelationtypeElement());
4415    if (json.has("item"))
4416      res.setItem(parseReference(json.getAsJsonObject("item")));
4417  }
4418
4419  protected ChargeItem parseChargeItem(JsonObject json) throws IOException, FHIRFormatError {
4420    ChargeItem res = new ChargeItem();
4421    parseChargeItemProperties(json, res);
4422    return res;
4423  }
4424
4425  protected void parseChargeItemProperties(JsonObject json, ChargeItem res) throws IOException, FHIRFormatError {
4426    parseDomainResourceProperties(json, res);
4427    if (json.has("identifier")) {
4428      JsonArray array = json.getAsJsonArray("identifier");
4429      for (int i = 0; i < array.size(); i++) {
4430        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4431      }
4432    };
4433    if (json.has("definitionUri")) {
4434      JsonArray array = json.getAsJsonArray("definitionUri");
4435      for (int i = 0; i < array.size(); i++) {
4436        res.getDefinitionUri().add(parseUri(array.get(i).getAsString()));
4437      }
4438    };
4439    if (json.has("_definitionUri")) {
4440      JsonArray array = json.getAsJsonArray("_definitionUri");
4441      for (int i = 0; i < array.size(); i++) {
4442        if (i == res.getDefinitionUri().size())
4443          res.getDefinitionUri().add(parseUri(null));
4444        if (array.get(i) instanceof JsonObject) 
4445          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionUri().get(i));
4446      }
4447    };
4448    if (json.has("definitionCanonical")) {
4449      JsonArray array = json.getAsJsonArray("definitionCanonical");
4450      for (int i = 0; i < array.size(); i++) {
4451        res.getDefinitionCanonical().add(parseCanonical(array.get(i).getAsString()));
4452      }
4453    };
4454    if (json.has("_definitionCanonical")) {
4455      JsonArray array = json.getAsJsonArray("_definitionCanonical");
4456      for (int i = 0; i < array.size(); i++) {
4457        if (i == res.getDefinitionCanonical().size())
4458          res.getDefinitionCanonical().add(parseCanonical(null));
4459        if (array.get(i) instanceof JsonObject) 
4460          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionCanonical().get(i));
4461      }
4462    };
4463    if (json.has("status"))
4464      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ChargeItem.ChargeItemStatus.NULL, new ChargeItem.ChargeItemStatusEnumFactory()));
4465    if (json.has("_status"))
4466      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4467    if (json.has("partOf")) {
4468      JsonArray array = json.getAsJsonArray("partOf");
4469      for (int i = 0; i < array.size(); i++) {
4470        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
4471      }
4472    };
4473    if (json.has("code"))
4474      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4475    if (json.has("subject"))
4476      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4477    if (json.has("context"))
4478      res.setContext(parseReference(json.getAsJsonObject("context")));
4479    Type occurrence = parseType("occurrence", json);
4480    if (occurrence != null)
4481      res.setOccurrence(occurrence);
4482    if (json.has("performer")) {
4483      JsonArray array = json.getAsJsonArray("performer");
4484      for (int i = 0; i < array.size(); i++) {
4485        res.getPerformer().add(parseChargeItemChargeItemPerformerComponent(array.get(i).getAsJsonObject(), res));
4486      }
4487    };
4488    if (json.has("performingOrganization"))
4489      res.setPerformingOrganization(parseReference(json.getAsJsonObject("performingOrganization")));
4490    if (json.has("requestingOrganization"))
4491      res.setRequestingOrganization(parseReference(json.getAsJsonObject("requestingOrganization")));
4492    if (json.has("costCenter"))
4493      res.setCostCenter(parseReference(json.getAsJsonObject("costCenter")));
4494    if (json.has("quantity"))
4495      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
4496    if (json.has("bodysite")) {
4497      JsonArray array = json.getAsJsonArray("bodysite");
4498      for (int i = 0; i < array.size(); i++) {
4499        res.getBodysite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4500      }
4501    };
4502    if (json.has("factorOverride"))
4503      res.setFactorOverrideElement(parseDecimal(json.get("factorOverride").getAsBigDecimal()));
4504    if (json.has("_factorOverride"))
4505      parseElementProperties(json.getAsJsonObject("_factorOverride"), res.getFactorOverrideElement());
4506    if (json.has("priceOverride"))
4507      res.setPriceOverride(parseMoney(json.getAsJsonObject("priceOverride")));
4508    if (json.has("overrideReason"))
4509      res.setOverrideReasonElement(parseString(json.get("overrideReason").getAsString()));
4510    if (json.has("_overrideReason"))
4511      parseElementProperties(json.getAsJsonObject("_overrideReason"), res.getOverrideReasonElement());
4512    if (json.has("enterer"))
4513      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
4514    if (json.has("enteredDate"))
4515      res.setEnteredDateElement(parseDateTime(json.get("enteredDate").getAsString()));
4516    if (json.has("_enteredDate"))
4517      parseElementProperties(json.getAsJsonObject("_enteredDate"), res.getEnteredDateElement());
4518    if (json.has("reason")) {
4519      JsonArray array = json.getAsJsonArray("reason");
4520      for (int i = 0; i < array.size(); i++) {
4521        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4522      }
4523    };
4524    if (json.has("service")) {
4525      JsonArray array = json.getAsJsonArray("service");
4526      for (int i = 0; i < array.size(); i++) {
4527        res.getService().add(parseReference(array.get(i).getAsJsonObject()));
4528      }
4529    };
4530    Type product = parseType("product", json);
4531    if (product != null)
4532      res.setProduct(product);
4533    if (json.has("account")) {
4534      JsonArray array = json.getAsJsonArray("account");
4535      for (int i = 0; i < array.size(); i++) {
4536        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
4537      }
4538    };
4539    if (json.has("note")) {
4540      JsonArray array = json.getAsJsonArray("note");
4541      for (int i = 0; i < array.size(); i++) {
4542        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4543      }
4544    };
4545    if (json.has("supportingInformation")) {
4546      JsonArray array = json.getAsJsonArray("supportingInformation");
4547      for (int i = 0; i < array.size(); i++) {
4548        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
4549      }
4550    };
4551  }
4552
4553  protected ChargeItem.ChargeItemPerformerComponent parseChargeItemChargeItemPerformerComponent(JsonObject json, ChargeItem owner) throws IOException, FHIRFormatError {
4554    ChargeItem.ChargeItemPerformerComponent res = new ChargeItem.ChargeItemPerformerComponent();
4555    parseChargeItemChargeItemPerformerComponentProperties(json, owner, res);
4556    return res;
4557  }
4558
4559  protected void parseChargeItemChargeItemPerformerComponentProperties(JsonObject json, ChargeItem owner, ChargeItem.ChargeItemPerformerComponent res) throws IOException, FHIRFormatError {
4560    parseBackboneElementProperties(json, res);
4561    if (json.has("function"))
4562      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
4563    if (json.has("actor"))
4564      res.setActor(parseReference(json.getAsJsonObject("actor")));
4565  }
4566
4567  protected ChargeItemDefinition parseChargeItemDefinition(JsonObject json) throws IOException, FHIRFormatError {
4568    ChargeItemDefinition res = new ChargeItemDefinition();
4569    parseChargeItemDefinitionProperties(json, res);
4570    return res;
4571  }
4572
4573  protected void parseChargeItemDefinitionProperties(JsonObject json, ChargeItemDefinition res) throws IOException, FHIRFormatError {
4574    parseDomainResourceProperties(json, res);
4575    if (json.has("url"))
4576      res.setUrlElement(parseUri(json.get("url").getAsString()));
4577    if (json.has("_url"))
4578      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
4579    if (json.has("identifier")) {
4580      JsonArray array = json.getAsJsonArray("identifier");
4581      for (int i = 0; i < array.size(); i++) {
4582        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4583      }
4584    };
4585    if (json.has("version"))
4586      res.setVersionElement(parseString(json.get("version").getAsString()));
4587    if (json.has("_version"))
4588      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
4589    if (json.has("title"))
4590      res.setTitleElement(parseString(json.get("title").getAsString()));
4591    if (json.has("_title"))
4592      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
4593    if (json.has("derivedFromUri")) {
4594      JsonArray array = json.getAsJsonArray("derivedFromUri");
4595      for (int i = 0; i < array.size(); i++) {
4596        res.getDerivedFromUri().add(parseUri(array.get(i).getAsString()));
4597      }
4598    };
4599    if (json.has("_derivedFromUri")) {
4600      JsonArray array = json.getAsJsonArray("_derivedFromUri");
4601      for (int i = 0; i < array.size(); i++) {
4602        if (i == res.getDerivedFromUri().size())
4603          res.getDerivedFromUri().add(parseUri(null));
4604        if (array.get(i) instanceof JsonObject) 
4605          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromUri().get(i));
4606      }
4607    };
4608    if (json.has("partOf")) {
4609      JsonArray array = json.getAsJsonArray("partOf");
4610      for (int i = 0; i < array.size(); i++) {
4611        res.getPartOf().add(parseCanonical(array.get(i).getAsString()));
4612      }
4613    };
4614    if (json.has("_partOf")) {
4615      JsonArray array = json.getAsJsonArray("_partOf");
4616      for (int i = 0; i < array.size(); i++) {
4617        if (i == res.getPartOf().size())
4618          res.getPartOf().add(parseCanonical(null));
4619        if (array.get(i) instanceof JsonObject) 
4620          parseElementProperties(array.get(i).getAsJsonObject(), res.getPartOf().get(i));
4621      }
4622    };
4623    if (json.has("replaces")) {
4624      JsonArray array = json.getAsJsonArray("replaces");
4625      for (int i = 0; i < array.size(); i++) {
4626        res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
4627      }
4628    };
4629    if (json.has("_replaces")) {
4630      JsonArray array = json.getAsJsonArray("_replaces");
4631      for (int i = 0; i < array.size(); i++) {
4632        if (i == res.getReplaces().size())
4633          res.getReplaces().add(parseCanonical(null));
4634        if (array.get(i) instanceof JsonObject) 
4635          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
4636      }
4637    };
4638    if (json.has("status"))
4639      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
4640    if (json.has("_status"))
4641      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4642    if (json.has("experimental"))
4643      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
4644    if (json.has("_experimental"))
4645      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
4646    if (json.has("date"))
4647      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4648    if (json.has("_date"))
4649      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4650    if (json.has("publisher"))
4651      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
4652    if (json.has("_publisher"))
4653      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
4654    if (json.has("contact")) {
4655      JsonArray array = json.getAsJsonArray("contact");
4656      for (int i = 0; i < array.size(); i++) {
4657        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
4658      }
4659    };
4660    if (json.has("description"))
4661      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
4662    if (json.has("_description"))
4663      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4664    if (json.has("useContext")) {
4665      JsonArray array = json.getAsJsonArray("useContext");
4666      for (int i = 0; i < array.size(); i++) {
4667        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
4668      }
4669    };
4670    if (json.has("jurisdiction")) {
4671      JsonArray array = json.getAsJsonArray("jurisdiction");
4672      for (int i = 0; i < array.size(); i++) {
4673        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4674      }
4675    };
4676    if (json.has("copyright"))
4677      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
4678    if (json.has("_copyright"))
4679      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
4680    if (json.has("approvalDate"))
4681      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
4682    if (json.has("_approvalDate"))
4683      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
4684    if (json.has("lastReviewDate"))
4685      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
4686    if (json.has("_lastReviewDate"))
4687      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
4688    if (json.has("effectivePeriod"))
4689      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
4690    if (json.has("code"))
4691      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4692    if (json.has("instance")) {
4693      JsonArray array = json.getAsJsonArray("instance");
4694      for (int i = 0; i < array.size(); i++) {
4695        res.getInstance().add(parseReference(array.get(i).getAsJsonObject()));
4696      }
4697    };
4698    if (json.has("applicability")) {
4699      JsonArray array = json.getAsJsonArray("applicability");
4700      for (int i = 0; i < array.size(); i++) {
4701        res.getApplicability().add(parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject(), res));
4702      }
4703    };
4704    if (json.has("propertyGroup")) {
4705      JsonArray array = json.getAsJsonArray("propertyGroup");
4706      for (int i = 0; i < array.size(); i++) {
4707        res.getPropertyGroup().add(parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(array.get(i).getAsJsonObject(), res));
4708      }
4709    };
4710  }
4711
4712  protected ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(JsonObject json, ChargeItemDefinition owner) throws IOException, FHIRFormatError {
4713    ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res = new ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent();
4714    parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponentProperties(json, owner, res);
4715    return res;
4716  }
4717
4718  protected void parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponentProperties(JsonObject json, ChargeItemDefinition owner, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res) throws IOException, FHIRFormatError {
4719    parseBackboneElementProperties(json, res);
4720    if (json.has("description"))
4721      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4722    if (json.has("_description"))
4723      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4724    if (json.has("language"))
4725      res.setLanguageElement(parseString(json.get("language").getAsString()));
4726    if (json.has("_language"))
4727      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
4728    if (json.has("expression"))
4729      res.setExpressionElement(parseString(json.get("expression").getAsString()));
4730    if (json.has("_expression"))
4731      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
4732  }
4733
4734  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(JsonObject json, ChargeItemDefinition owner) throws IOException, FHIRFormatError {
4735    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent();
4736    parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentProperties(json, owner, res);
4737    return res;
4738  }
4739
4740  protected void parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentProperties(JsonObject json, ChargeItemDefinition owner, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res) throws IOException, FHIRFormatError {
4741    parseBackboneElementProperties(json, res);
4742    if (json.has("applicability")) {
4743      JsonArray array = json.getAsJsonArray("applicability");
4744      for (int i = 0; i < array.size(); i++) {
4745        res.getApplicability().add(parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject(), owner));
4746      }
4747    };
4748    if (json.has("priceComponent")) {
4749      JsonArray array = json.getAsJsonArray("priceComponent");
4750      for (int i = 0; i < array.size(); i++) {
4751        res.getPriceComponent().add(parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(array.get(i).getAsJsonObject(), owner));
4752      }
4753    };
4754  }
4755
4756  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(JsonObject json, ChargeItemDefinition owner) throws IOException, FHIRFormatError {
4757    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent();
4758    parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(json, owner, res);
4759    return res;
4760  }
4761
4762  protected void parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(JsonObject json, ChargeItemDefinition owner, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res) throws IOException, FHIRFormatError {
4763    parseBackboneElementProperties(json, res);
4764    if (json.has("type"))
4765      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.NULL, new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory()));
4766    if (json.has("_type"))
4767      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
4768    if (json.has("code"))
4769      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4770    if (json.has("factor"))
4771      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4772    if (json.has("_factor"))
4773      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
4774    if (json.has("amount"))
4775      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
4776  }
4777
4778  protected Claim parseClaim(JsonObject json) throws IOException, FHIRFormatError {
4779    Claim res = new Claim();
4780    parseClaimProperties(json, res);
4781    return res;
4782  }
4783
4784  protected void parseClaimProperties(JsonObject json, Claim res) throws IOException, FHIRFormatError {
4785    parseDomainResourceProperties(json, res);
4786    if (json.has("identifier")) {
4787      JsonArray array = json.getAsJsonArray("identifier");
4788      for (int i = 0; i < array.size(); i++) {
4789        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4790      }
4791    };
4792    if (json.has("status"))
4793      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Claim.ClaimStatus.NULL, new Claim.ClaimStatusEnumFactory()));
4794    if (json.has("_status"))
4795      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4796    if (json.has("type"))
4797      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4798    if (json.has("subType"))
4799      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
4800    if (json.has("use"))
4801      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Claim.Use.NULL, new Claim.UseEnumFactory()));
4802    if (json.has("_use"))
4803      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
4804    if (json.has("patient"))
4805      res.setPatient(parseReference(json.getAsJsonObject("patient")));
4806    if (json.has("billablePeriod"))
4807      res.setBillablePeriod(parsePeriod(json.getAsJsonObject("billablePeriod")));
4808    if (json.has("created"))
4809      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4810    if (json.has("_created"))
4811      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
4812    if (json.has("enterer"))
4813      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
4814    if (json.has("insurer"))
4815      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
4816    if (json.has("provider"))
4817      res.setProvider(parseReference(json.getAsJsonObject("provider")));
4818    if (json.has("priority"))
4819      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
4820    if (json.has("fundsReserve"))
4821      res.setFundsReserve(parseCodeableConcept(json.getAsJsonObject("fundsReserve")));
4822    if (json.has("related")) {
4823      JsonArray array = json.getAsJsonArray("related");
4824      for (int i = 0; i < array.size(); i++) {
4825        res.getRelated().add(parseClaimRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
4826      }
4827    };
4828    if (json.has("prescription"))
4829      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
4830    if (json.has("originalPrescription"))
4831      res.setOriginalPrescription(parseReference(json.getAsJsonObject("originalPrescription")));
4832    if (json.has("payee"))
4833      res.setPayee(parseClaimPayeeComponent(json.getAsJsonObject("payee"), res));
4834    if (json.has("referral"))
4835      res.setReferral(parseReference(json.getAsJsonObject("referral")));
4836    if (json.has("facility"))
4837      res.setFacility(parseReference(json.getAsJsonObject("facility")));
4838    if (json.has("careTeam")) {
4839      JsonArray array = json.getAsJsonArray("careTeam");
4840      for (int i = 0; i < array.size(); i++) {
4841        res.getCareTeam().add(parseClaimCareTeamComponent(array.get(i).getAsJsonObject(), res));
4842      }
4843    };
4844    if (json.has("supportingInfo")) {
4845      JsonArray array = json.getAsJsonArray("supportingInfo");
4846      for (int i = 0; i < array.size(); i++) {
4847        res.getSupportingInfo().add(parseClaimSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
4848      }
4849    };
4850    if (json.has("diagnosis")) {
4851      JsonArray array = json.getAsJsonArray("diagnosis");
4852      for (int i = 0; i < array.size(); i++) {
4853        res.getDiagnosis().add(parseClaimDiagnosisComponent(array.get(i).getAsJsonObject(), res));
4854      }
4855    };
4856    if (json.has("procedure")) {
4857      JsonArray array = json.getAsJsonArray("procedure");
4858      for (int i = 0; i < array.size(); i++) {
4859        res.getProcedure().add(parseClaimProcedureComponent(array.get(i).getAsJsonObject(), res));
4860      }
4861    };
4862    if (json.has("insurance")) {
4863      JsonArray array = json.getAsJsonArray("insurance");
4864      for (int i = 0; i < array.size(); i++) {
4865        res.getInsurance().add(parseClaimInsuranceComponent(array.get(i).getAsJsonObject(), res));
4866      }
4867    };
4868    if (json.has("accident"))
4869      res.setAccident(parseClaimAccidentComponent(json.getAsJsonObject("accident"), res));
4870    if (json.has("item")) {
4871      JsonArray array = json.getAsJsonArray("item");
4872      for (int i = 0; i < array.size(); i++) {
4873        res.getItem().add(parseClaimItemComponent(array.get(i).getAsJsonObject(), res));
4874      }
4875    };
4876    if (json.has("total"))
4877      res.setTotal(parseMoney(json.getAsJsonObject("total")));
4878  }
4879
4880  protected Claim.RelatedClaimComponent parseClaimRelatedClaimComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4881    Claim.RelatedClaimComponent res = new Claim.RelatedClaimComponent();
4882    parseClaimRelatedClaimComponentProperties(json, owner, res);
4883    return res;
4884  }
4885
4886  protected void parseClaimRelatedClaimComponentProperties(JsonObject json, Claim owner, Claim.RelatedClaimComponent res) throws IOException, FHIRFormatError {
4887    parseBackboneElementProperties(json, res);
4888    if (json.has("claim"))
4889      res.setClaim(parseReference(json.getAsJsonObject("claim")));
4890    if (json.has("relationship"))
4891      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
4892    if (json.has("reference"))
4893      res.setReference(parseIdentifier(json.getAsJsonObject("reference")));
4894  }
4895
4896  protected Claim.PayeeComponent parseClaimPayeeComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4897    Claim.PayeeComponent res = new Claim.PayeeComponent();
4898    parseClaimPayeeComponentProperties(json, owner, res);
4899    return res;
4900  }
4901
4902  protected void parseClaimPayeeComponentProperties(JsonObject json, Claim owner, Claim.PayeeComponent res) throws IOException, FHIRFormatError {
4903    parseBackboneElementProperties(json, res);
4904    if (json.has("type"))
4905      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4906    if (json.has("party"))
4907      res.setParty(parseReference(json.getAsJsonObject("party")));
4908  }
4909
4910  protected Claim.CareTeamComponent parseClaimCareTeamComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4911    Claim.CareTeamComponent res = new Claim.CareTeamComponent();
4912    parseClaimCareTeamComponentProperties(json, owner, res);
4913    return res;
4914  }
4915
4916  protected void parseClaimCareTeamComponentProperties(JsonObject json, Claim owner, Claim.CareTeamComponent res) throws IOException, FHIRFormatError {
4917    parseBackboneElementProperties(json, res);
4918    if (json.has("sequence"))
4919      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4920    if (json.has("_sequence"))
4921      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4922    if (json.has("provider"))
4923      res.setProvider(parseReference(json.getAsJsonObject("provider")));
4924    if (json.has("responsible"))
4925      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
4926    if (json.has("_responsible"))
4927      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
4928    if (json.has("role"))
4929      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
4930    if (json.has("qualification"))
4931      res.setQualification(parseCodeableConcept(json.getAsJsonObject("qualification")));
4932  }
4933
4934  protected Claim.SupportingInformationComponent parseClaimSupportingInformationComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4935    Claim.SupportingInformationComponent res = new Claim.SupportingInformationComponent();
4936    parseClaimSupportingInformationComponentProperties(json, owner, res);
4937    return res;
4938  }
4939
4940  protected void parseClaimSupportingInformationComponentProperties(JsonObject json, Claim owner, Claim.SupportingInformationComponent res) throws IOException, FHIRFormatError {
4941    parseBackboneElementProperties(json, res);
4942    if (json.has("sequence"))
4943      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4944    if (json.has("_sequence"))
4945      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4946    if (json.has("category"))
4947      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4948    if (json.has("code"))
4949      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4950    Type timing = parseType("timing", json);
4951    if (timing != null)
4952      res.setTiming(timing);
4953    Type value = parseType("value", json);
4954    if (value != null)
4955      res.setValue(value);
4956    if (json.has("reason"))
4957      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
4958  }
4959
4960  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4961    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
4962    parseClaimDiagnosisComponentProperties(json, owner, res);
4963    return res;
4964  }
4965
4966  protected void parseClaimDiagnosisComponentProperties(JsonObject json, Claim owner, Claim.DiagnosisComponent res) throws IOException, FHIRFormatError {
4967    parseBackboneElementProperties(json, res);
4968    if (json.has("sequence"))
4969      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4970    if (json.has("_sequence"))
4971      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4972    Type diagnosis = parseType("diagnosis", json);
4973    if (diagnosis != null)
4974      res.setDiagnosis(diagnosis);
4975    if (json.has("type")) {
4976      JsonArray array = json.getAsJsonArray("type");
4977      for (int i = 0; i < array.size(); i++) {
4978        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4979      }
4980    };
4981    if (json.has("onAdmission"))
4982      res.setOnAdmission(parseCodeableConcept(json.getAsJsonObject("onAdmission")));
4983    if (json.has("packageCode"))
4984      res.setPackageCode(parseCodeableConcept(json.getAsJsonObject("packageCode")));
4985  }
4986
4987  protected Claim.ProcedureComponent parseClaimProcedureComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4988    Claim.ProcedureComponent res = new Claim.ProcedureComponent();
4989    parseClaimProcedureComponentProperties(json, owner, res);
4990    return res;
4991  }
4992
4993  protected void parseClaimProcedureComponentProperties(JsonObject json, Claim owner, Claim.ProcedureComponent res) throws IOException, FHIRFormatError {
4994    parseBackboneElementProperties(json, res);
4995    if (json.has("sequence"))
4996      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4997    if (json.has("_sequence"))
4998      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4999    if (json.has("type")) {
5000      JsonArray array = json.getAsJsonArray("type");
5001      for (int i = 0; i < array.size(); i++) {
5002        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5003      }
5004    };
5005    if (json.has("date"))
5006      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5007    if (json.has("_date"))
5008      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5009    Type procedure = parseType("procedure", json);
5010    if (procedure != null)
5011      res.setProcedure(procedure);
5012    if (json.has("udi")) {
5013      JsonArray array = json.getAsJsonArray("udi");
5014      for (int i = 0; i < array.size(); i++) {
5015        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5016      }
5017    };
5018  }
5019
5020  protected Claim.InsuranceComponent parseClaimInsuranceComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5021    Claim.InsuranceComponent res = new Claim.InsuranceComponent();
5022    parseClaimInsuranceComponentProperties(json, owner, res);
5023    return res;
5024  }
5025
5026  protected void parseClaimInsuranceComponentProperties(JsonObject json, Claim owner, Claim.InsuranceComponent res) throws IOException, FHIRFormatError {
5027    parseBackboneElementProperties(json, res);
5028    if (json.has("sequence"))
5029      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5030    if (json.has("_sequence"))
5031      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5032    if (json.has("focal"))
5033      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
5034    if (json.has("_focal"))
5035      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
5036    if (json.has("identifier"))
5037      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5038    if (json.has("coverage"))
5039      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
5040    if (json.has("businessArrangement"))
5041      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
5042    if (json.has("_businessArrangement"))
5043      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
5044    if (json.has("preAuthRef")) {
5045      JsonArray array = json.getAsJsonArray("preAuthRef");
5046      for (int i = 0; i < array.size(); i++) {
5047        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
5048      }
5049    };
5050    if (json.has("_preAuthRef")) {
5051      JsonArray array = json.getAsJsonArray("_preAuthRef");
5052      for (int i = 0; i < array.size(); i++) {
5053        if (i == res.getPreAuthRef().size())
5054          res.getPreAuthRef().add(parseString(null));
5055        if (array.get(i) instanceof JsonObject) 
5056          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
5057      }
5058    };
5059    if (json.has("claimResponse"))
5060      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
5061  }
5062
5063  protected Claim.AccidentComponent parseClaimAccidentComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5064    Claim.AccidentComponent res = new Claim.AccidentComponent();
5065    parseClaimAccidentComponentProperties(json, owner, res);
5066    return res;
5067  }
5068
5069  protected void parseClaimAccidentComponentProperties(JsonObject json, Claim owner, Claim.AccidentComponent res) throws IOException, FHIRFormatError {
5070    parseBackboneElementProperties(json, res);
5071    if (json.has("date"))
5072      res.setDateElement(parseDate(json.get("date").getAsString()));
5073    if (json.has("_date"))
5074      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5075    if (json.has("type"))
5076      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5077    Type location = parseType("location", json);
5078    if (location != null)
5079      res.setLocation(location);
5080  }
5081
5082  protected Claim.ItemComponent parseClaimItemComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5083    Claim.ItemComponent res = new Claim.ItemComponent();
5084    parseClaimItemComponentProperties(json, owner, res);
5085    return res;
5086  }
5087
5088  protected void parseClaimItemComponentProperties(JsonObject json, Claim owner, Claim.ItemComponent res) throws IOException, FHIRFormatError {
5089    parseBackboneElementProperties(json, res);
5090    if (json.has("sequence"))
5091      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5092    if (json.has("_sequence"))
5093      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5094    if (json.has("careTeamSequence")) {
5095      JsonArray array = json.getAsJsonArray("careTeamSequence");
5096      for (int i = 0; i < array.size(); i++) {
5097        res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
5098      }
5099    };
5100    if (json.has("_careTeamSequence")) {
5101      JsonArray array = json.getAsJsonArray("_careTeamSequence");
5102      for (int i = 0; i < array.size(); i++) {
5103        if (i == res.getCareTeamSequence().size())
5104          res.getCareTeamSequence().add(parsePositiveInt(null));
5105        if (array.get(i) instanceof JsonObject) 
5106          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
5107      }
5108    };
5109    if (json.has("diagnosisSequence")) {
5110      JsonArray array = json.getAsJsonArray("diagnosisSequence");
5111      for (int i = 0; i < array.size(); i++) {
5112        res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
5113      }
5114    };
5115    if (json.has("_diagnosisSequence")) {
5116      JsonArray array = json.getAsJsonArray("_diagnosisSequence");
5117      for (int i = 0; i < array.size(); i++) {
5118        if (i == res.getDiagnosisSequence().size())
5119          res.getDiagnosisSequence().add(parsePositiveInt(null));
5120        if (array.get(i) instanceof JsonObject) 
5121          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
5122      }
5123    };
5124    if (json.has("procedureSequence")) {
5125      JsonArray array = json.getAsJsonArray("procedureSequence");
5126      for (int i = 0; i < array.size(); i++) {
5127        res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
5128      }
5129    };
5130    if (json.has("_procedureSequence")) {
5131      JsonArray array = json.getAsJsonArray("_procedureSequence");
5132      for (int i = 0; i < array.size(); i++) {
5133        if (i == res.getProcedureSequence().size())
5134          res.getProcedureSequence().add(parsePositiveInt(null));
5135        if (array.get(i) instanceof JsonObject) 
5136          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
5137      }
5138    };
5139    if (json.has("informationSequence")) {
5140      JsonArray array = json.getAsJsonArray("informationSequence");
5141      for (int i = 0; i < array.size(); i++) {
5142        res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
5143      }
5144    };
5145    if (json.has("_informationSequence")) {
5146      JsonArray array = json.getAsJsonArray("_informationSequence");
5147      for (int i = 0; i < array.size(); i++) {
5148        if (i == res.getInformationSequence().size())
5149          res.getInformationSequence().add(parsePositiveInt(null));
5150        if (array.get(i) instanceof JsonObject) 
5151          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
5152      }
5153    };
5154    if (json.has("revenue"))
5155      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
5156    if (json.has("category"))
5157      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5158    if (json.has("productOrService"))
5159      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
5160    if (json.has("modifier")) {
5161      JsonArray array = json.getAsJsonArray("modifier");
5162      for (int i = 0; i < array.size(); i++) {
5163        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5164      }
5165    };
5166    if (json.has("programCode")) {
5167      JsonArray array = json.getAsJsonArray("programCode");
5168      for (int i = 0; i < array.size(); i++) {
5169        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5170      }
5171    };
5172    Type serviced = parseType("serviced", json);
5173    if (serviced != null)
5174      res.setServiced(serviced);
5175    Type location = parseType("location", json);
5176    if (location != null)
5177      res.setLocation(location);
5178    if (json.has("quantity"))
5179      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5180    if (json.has("unitPrice"))
5181      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
5182    if (json.has("factor"))
5183      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5184    if (json.has("_factor"))
5185      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5186    if (json.has("net"))
5187      res.setNet(parseMoney(json.getAsJsonObject("net")));
5188    if (json.has("udi")) {
5189      JsonArray array = json.getAsJsonArray("udi");
5190      for (int i = 0; i < array.size(); i++) {
5191        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5192      }
5193    };
5194    if (json.has("bodySite"))
5195      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
5196    if (json.has("subSite")) {
5197      JsonArray array = json.getAsJsonArray("subSite");
5198      for (int i = 0; i < array.size(); i++) {
5199        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5200      }
5201    };
5202    if (json.has("encounter")) {
5203      JsonArray array = json.getAsJsonArray("encounter");
5204      for (int i = 0; i < array.size(); i++) {
5205        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
5206      }
5207    };
5208    if (json.has("detail")) {
5209      JsonArray array = json.getAsJsonArray("detail");
5210      for (int i = 0; i < array.size(); i++) {
5211        res.getDetail().add(parseClaimDetailComponent(array.get(i).getAsJsonObject(), owner));
5212      }
5213    };
5214  }
5215
5216  protected Claim.DetailComponent parseClaimDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5217    Claim.DetailComponent res = new Claim.DetailComponent();
5218    parseClaimDetailComponentProperties(json, owner, res);
5219    return res;
5220  }
5221
5222  protected void parseClaimDetailComponentProperties(JsonObject json, Claim owner, Claim.DetailComponent res) throws IOException, FHIRFormatError {
5223    parseBackboneElementProperties(json, res);
5224    if (json.has("sequence"))
5225      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5226    if (json.has("_sequence"))
5227      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5228    if (json.has("revenue"))
5229      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
5230    if (json.has("category"))
5231      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5232    if (json.has("productOrService"))
5233      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
5234    if (json.has("modifier")) {
5235      JsonArray array = json.getAsJsonArray("modifier");
5236      for (int i = 0; i < array.size(); i++) {
5237        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5238      }
5239    };
5240    if (json.has("programCode")) {
5241      JsonArray array = json.getAsJsonArray("programCode");
5242      for (int i = 0; i < array.size(); i++) {
5243        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5244      }
5245    };
5246    if (json.has("quantity"))
5247      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5248    if (json.has("unitPrice"))
5249      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
5250    if (json.has("factor"))
5251      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5252    if (json.has("_factor"))
5253      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5254    if (json.has("net"))
5255      res.setNet(parseMoney(json.getAsJsonObject("net")));
5256    if (json.has("udi")) {
5257      JsonArray array = json.getAsJsonArray("udi");
5258      for (int i = 0; i < array.size(); i++) {
5259        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5260      }
5261    };
5262    if (json.has("subDetail")) {
5263      JsonArray array = json.getAsJsonArray("subDetail");
5264      for (int i = 0; i < array.size(); i++) {
5265        res.getSubDetail().add(parseClaimSubDetailComponent(array.get(i).getAsJsonObject(), owner));
5266      }
5267    };
5268  }
5269
5270  protected Claim.SubDetailComponent parseClaimSubDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5271    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
5272    parseClaimSubDetailComponentProperties(json, owner, res);
5273    return res;
5274  }
5275
5276  protected void parseClaimSubDetailComponentProperties(JsonObject json, Claim owner, Claim.SubDetailComponent res) throws IOException, FHIRFormatError {
5277    parseBackboneElementProperties(json, res);
5278    if (json.has("sequence"))
5279      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5280    if (json.has("_sequence"))
5281      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5282    if (json.has("revenue"))
5283      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
5284    if (json.has("category"))
5285      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5286    if (json.has("productOrService"))
5287      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
5288    if (json.has("modifier")) {
5289      JsonArray array = json.getAsJsonArray("modifier");
5290      for (int i = 0; i < array.size(); i++) {
5291        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5292      }
5293    };
5294    if (json.has("programCode")) {
5295      JsonArray array = json.getAsJsonArray("programCode");
5296      for (int i = 0; i < array.size(); i++) {
5297        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5298      }
5299    };
5300    if (json.has("quantity"))
5301      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5302    if (json.has("unitPrice"))
5303      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
5304    if (json.has("factor"))
5305      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5306    if (json.has("_factor"))
5307      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5308    if (json.has("net"))
5309      res.setNet(parseMoney(json.getAsJsonObject("net")));
5310    if (json.has("udi")) {
5311      JsonArray array = json.getAsJsonArray("udi");
5312      for (int i = 0; i < array.size(); i++) {
5313        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5314      }
5315    };
5316  }
5317
5318  protected ClaimResponse parseClaimResponse(JsonObject json) throws IOException, FHIRFormatError {
5319    ClaimResponse res = new ClaimResponse();
5320    parseClaimResponseProperties(json, res);
5321    return res;
5322  }
5323
5324  protected void parseClaimResponseProperties(JsonObject json, ClaimResponse res) throws IOException, FHIRFormatError {
5325    parseDomainResourceProperties(json, res);
5326    if (json.has("identifier")) {
5327      JsonArray array = json.getAsJsonArray("identifier");
5328      for (int i = 0; i < array.size(); i++) {
5329        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5330      }
5331    };
5332    if (json.has("status"))
5333      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClaimResponse.ClaimResponseStatus.NULL, new ClaimResponse.ClaimResponseStatusEnumFactory()));
5334    if (json.has("_status"))
5335      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5336    if (json.has("type"))
5337      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5338    if (json.has("subType"))
5339      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
5340    if (json.has("use"))
5341      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ClaimResponse.Use.NULL, new ClaimResponse.UseEnumFactory()));
5342    if (json.has("_use"))
5343      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
5344    if (json.has("patient"))
5345      res.setPatient(parseReference(json.getAsJsonObject("patient")));
5346    if (json.has("created"))
5347      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5348    if (json.has("_created"))
5349      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
5350    if (json.has("insurer"))
5351      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
5352    if (json.has("requestor"))
5353      res.setRequestor(parseReference(json.getAsJsonObject("requestor")));
5354    if (json.has("request"))
5355      res.setRequest(parseReference(json.getAsJsonObject("request")));
5356    if (json.has("outcome"))
5357      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), ClaimResponse.RemittanceOutcome.NULL, new ClaimResponse.RemittanceOutcomeEnumFactory()));
5358    if (json.has("_outcome"))
5359      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
5360    if (json.has("disposition"))
5361      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
5362    if (json.has("_disposition"))
5363      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
5364    if (json.has("preAuthRef"))
5365      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
5366    if (json.has("_preAuthRef"))
5367      parseElementProperties(json.getAsJsonObject("_preAuthRef"), res.getPreAuthRefElement());
5368    if (json.has("preAuthPeriod"))
5369      res.setPreAuthPeriod(parsePeriod(json.getAsJsonObject("preAuthPeriod")));
5370    if (json.has("payeeType"))
5371      res.setPayeeType(parseCodeableConcept(json.getAsJsonObject("payeeType")));
5372    if (json.has("item")) {
5373      JsonArray array = json.getAsJsonArray("item");
5374      for (int i = 0; i < array.size(); i++) {
5375        res.getItem().add(parseClaimResponseItemComponent(array.get(i).getAsJsonObject(), res));
5376      }
5377    };
5378    if (json.has("addItem")) {
5379      JsonArray array = json.getAsJsonArray("addItem");
5380      for (int i = 0; i < array.size(); i++) {
5381        res.getAddItem().add(parseClaimResponseAddedItemComponent(array.get(i).getAsJsonObject(), res));
5382      }
5383    };
5384    if (json.has("adjudication")) {
5385      JsonArray array = json.getAsJsonArray("adjudication");
5386      for (int i = 0; i < array.size(); i++) {
5387        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), res));
5388      }
5389    };
5390    if (json.has("total")) {
5391      JsonArray array = json.getAsJsonArray("total");
5392      for (int i = 0; i < array.size(); i++) {
5393        res.getTotal().add(parseClaimResponseTotalComponent(array.get(i).getAsJsonObject(), res));
5394      }
5395    };
5396    if (json.has("payment"))
5397      res.setPayment(parseClaimResponsePaymentComponent(json.getAsJsonObject("payment"), res));
5398    if (json.has("fundsReserve"))
5399      res.setFundsReserve(parseCodeableConcept(json.getAsJsonObject("fundsReserve")));
5400    if (json.has("formCode"))
5401      res.setFormCode(parseCodeableConcept(json.getAsJsonObject("formCode")));
5402    if (json.has("form"))
5403      res.setForm(parseAttachment(json.getAsJsonObject("form")));
5404    if (json.has("processNote")) {
5405      JsonArray array = json.getAsJsonArray("processNote");
5406      for (int i = 0; i < array.size(); i++) {
5407        res.getProcessNote().add(parseClaimResponseNoteComponent(array.get(i).getAsJsonObject(), res));
5408      }
5409    };
5410    if (json.has("communicationRequest")) {
5411      JsonArray array = json.getAsJsonArray("communicationRequest");
5412      for (int i = 0; i < array.size(); i++) {
5413        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
5414      }
5415    };
5416    if (json.has("insurance")) {
5417      JsonArray array = json.getAsJsonArray("insurance");
5418      for (int i = 0; i < array.size(); i++) {
5419        res.getInsurance().add(parseClaimResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
5420      }
5421    };
5422    if (json.has("error")) {
5423      JsonArray array = json.getAsJsonArray("error");
5424      for (int i = 0; i < array.size(); i++) {
5425        res.getError().add(parseClaimResponseErrorComponent(array.get(i).getAsJsonObject(), res));
5426      }
5427    };
5428  }
5429
5430  protected ClaimResponse.ItemComponent parseClaimResponseItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5431    ClaimResponse.ItemComponent res = new ClaimResponse.ItemComponent();
5432    parseClaimResponseItemComponentProperties(json, owner, res);
5433    return res;
5434  }
5435
5436  protected void parseClaimResponseItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemComponent res) throws IOException, FHIRFormatError {
5437    parseBackboneElementProperties(json, res);
5438    if (json.has("itemSequence"))
5439      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
5440    if (json.has("_itemSequence"))
5441      parseElementProperties(json.getAsJsonObject("_itemSequence"), res.getItemSequenceElement());
5442    if (json.has("noteNumber")) {
5443      JsonArray array = json.getAsJsonArray("noteNumber");
5444      for (int i = 0; i < array.size(); i++) {
5445        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5446      }
5447    };
5448    if (json.has("_noteNumber")) {
5449      JsonArray array = json.getAsJsonArray("_noteNumber");
5450      for (int i = 0; i < array.size(); i++) {
5451        if (i == res.getNoteNumber().size())
5452          res.getNoteNumber().add(parsePositiveInt(null));
5453        if (array.get(i) instanceof JsonObject) 
5454          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5455      }
5456    };
5457    if (json.has("adjudication")) {
5458      JsonArray array = json.getAsJsonArray("adjudication");
5459      for (int i = 0; i < array.size(); i++) {
5460        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5461      }
5462    };
5463    if (json.has("detail")) {
5464      JsonArray array = json.getAsJsonArray("detail");
5465      for (int i = 0; i < array.size(); i++) {
5466        res.getDetail().add(parseClaimResponseItemDetailComponent(array.get(i).getAsJsonObject(), owner));
5467      }
5468    };
5469  }
5470
5471  protected ClaimResponse.AdjudicationComponent parseClaimResponseAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5472    ClaimResponse.AdjudicationComponent res = new ClaimResponse.AdjudicationComponent();
5473    parseClaimResponseAdjudicationComponentProperties(json, owner, res);
5474    return res;
5475  }
5476
5477  protected void parseClaimResponseAdjudicationComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AdjudicationComponent res) throws IOException, FHIRFormatError {
5478    parseBackboneElementProperties(json, res);
5479    if (json.has("category"))
5480      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5481    if (json.has("reason"))
5482      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
5483    if (json.has("amount"))
5484      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
5485    if (json.has("value"))
5486      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
5487    if (json.has("_value"))
5488      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
5489  }
5490
5491  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5492    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
5493    parseClaimResponseItemDetailComponentProperties(json, owner, res);
5494    return res;
5495  }
5496
5497  protected void parseClaimResponseItemDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemDetailComponent res) throws IOException, FHIRFormatError {
5498    parseBackboneElementProperties(json, res);
5499    if (json.has("detailSequence"))
5500      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
5501    if (json.has("_detailSequence"))
5502      parseElementProperties(json.getAsJsonObject("_detailSequence"), res.getDetailSequenceElement());
5503    if (json.has("noteNumber")) {
5504      JsonArray array = json.getAsJsonArray("noteNumber");
5505      for (int i = 0; i < array.size(); i++) {
5506        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5507      }
5508    };
5509    if (json.has("_noteNumber")) {
5510      JsonArray array = json.getAsJsonArray("_noteNumber");
5511      for (int i = 0; i < array.size(); i++) {
5512        if (i == res.getNoteNumber().size())
5513          res.getNoteNumber().add(parsePositiveInt(null));
5514        if (array.get(i) instanceof JsonObject) 
5515          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5516      }
5517    };
5518    if (json.has("adjudication")) {
5519      JsonArray array = json.getAsJsonArray("adjudication");
5520      for (int i = 0; i < array.size(); i++) {
5521        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5522      }
5523    };
5524    if (json.has("subDetail")) {
5525      JsonArray array = json.getAsJsonArray("subDetail");
5526      for (int i = 0; i < array.size(); i++) {
5527        res.getSubDetail().add(parseClaimResponseSubDetailComponent(array.get(i).getAsJsonObject(), owner));
5528      }
5529    };
5530  }
5531
5532  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5533    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
5534    parseClaimResponseSubDetailComponentProperties(json, owner, res);
5535    return res;
5536  }
5537
5538  protected void parseClaimResponseSubDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.SubDetailComponent res) throws IOException, FHIRFormatError {
5539    parseBackboneElementProperties(json, res);
5540    if (json.has("subDetailSequence"))
5541      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
5542    if (json.has("_subDetailSequence"))
5543      parseElementProperties(json.getAsJsonObject("_subDetailSequence"), res.getSubDetailSequenceElement());
5544    if (json.has("noteNumber")) {
5545      JsonArray array = json.getAsJsonArray("noteNumber");
5546      for (int i = 0; i < array.size(); i++) {
5547        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5548      }
5549    };
5550    if (json.has("_noteNumber")) {
5551      JsonArray array = json.getAsJsonArray("_noteNumber");
5552      for (int i = 0; i < array.size(); i++) {
5553        if (i == res.getNoteNumber().size())
5554          res.getNoteNumber().add(parsePositiveInt(null));
5555        if (array.get(i) instanceof JsonObject) 
5556          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5557      }
5558    };
5559    if (json.has("adjudication")) {
5560      JsonArray array = json.getAsJsonArray("adjudication");
5561      for (int i = 0; i < array.size(); i++) {
5562        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5563      }
5564    };
5565  }
5566
5567  protected ClaimResponse.AddedItemComponent parseClaimResponseAddedItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5568    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
5569    parseClaimResponseAddedItemComponentProperties(json, owner, res);
5570    return res;
5571  }
5572
5573  protected void parseClaimResponseAddedItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemComponent res) throws IOException, FHIRFormatError {
5574    parseBackboneElementProperties(json, res);
5575    if (json.has("itemSequence")) {
5576      JsonArray array = json.getAsJsonArray("itemSequence");
5577      for (int i = 0; i < array.size(); i++) {
5578        res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
5579      }
5580    };
5581    if (json.has("_itemSequence")) {
5582      JsonArray array = json.getAsJsonArray("_itemSequence");
5583      for (int i = 0; i < array.size(); i++) {
5584        if (i == res.getItemSequence().size())
5585          res.getItemSequence().add(parsePositiveInt(null));
5586        if (array.get(i) instanceof JsonObject) 
5587          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
5588      }
5589    };
5590    if (json.has("detailSequence")) {
5591      JsonArray array = json.getAsJsonArray("detailSequence");
5592      for (int i = 0; i < array.size(); i++) {
5593        res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
5594      }
5595    };
5596    if (json.has("_detailSequence")) {
5597      JsonArray array = json.getAsJsonArray("_detailSequence");
5598      for (int i = 0; i < array.size(); i++) {
5599        if (i == res.getDetailSequence().size())
5600          res.getDetailSequence().add(parsePositiveInt(null));
5601        if (array.get(i) instanceof JsonObject) 
5602          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
5603      }
5604    };
5605    if (json.has("subdetailSequence")) {
5606      JsonArray array = json.getAsJsonArray("subdetailSequence");
5607      for (int i = 0; i < array.size(); i++) {
5608        res.getSubdetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
5609      }
5610    };
5611    if (json.has("_subdetailSequence")) {
5612      JsonArray array = json.getAsJsonArray("_subdetailSequence");
5613      for (int i = 0; i < array.size(); i++) {
5614        if (i == res.getSubdetailSequence().size())
5615          res.getSubdetailSequence().add(parsePositiveInt(null));
5616        if (array.get(i) instanceof JsonObject) 
5617          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubdetailSequence().get(i));
5618      }
5619    };
5620    if (json.has("provider")) {
5621      JsonArray array = json.getAsJsonArray("provider");
5622      for (int i = 0; i < array.size(); i++) {
5623        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
5624      }
5625    };
5626    if (json.has("productOrService"))
5627      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
5628    if (json.has("modifier")) {
5629      JsonArray array = json.getAsJsonArray("modifier");
5630      for (int i = 0; i < array.size(); i++) {
5631        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5632      }
5633    };
5634    if (json.has("programCode")) {
5635      JsonArray array = json.getAsJsonArray("programCode");
5636      for (int i = 0; i < array.size(); i++) {
5637        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5638      }
5639    };
5640    Type serviced = parseType("serviced", json);
5641    if (serviced != null)
5642      res.setServiced(serviced);
5643    Type location = parseType("location", json);
5644    if (location != null)
5645      res.setLocation(location);
5646    if (json.has("quantity"))
5647      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5648    if (json.has("unitPrice"))
5649      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
5650    if (json.has("factor"))
5651      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5652    if (json.has("_factor"))
5653      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5654    if (json.has("net"))
5655      res.setNet(parseMoney(json.getAsJsonObject("net")));
5656    if (json.has("bodySite"))
5657      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
5658    if (json.has("subSite")) {
5659      JsonArray array = json.getAsJsonArray("subSite");
5660      for (int i = 0; i < array.size(); i++) {
5661        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5662      }
5663    };
5664    if (json.has("noteNumber")) {
5665      JsonArray array = json.getAsJsonArray("noteNumber");
5666      for (int i = 0; i < array.size(); i++) {
5667        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5668      }
5669    };
5670    if (json.has("_noteNumber")) {
5671      JsonArray array = json.getAsJsonArray("_noteNumber");
5672      for (int i = 0; i < array.size(); i++) {
5673        if (i == res.getNoteNumber().size())
5674          res.getNoteNumber().add(parsePositiveInt(null));
5675        if (array.get(i) instanceof JsonObject) 
5676          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5677      }
5678    };
5679    if (json.has("adjudication")) {
5680      JsonArray array = json.getAsJsonArray("adjudication");
5681      for (int i = 0; i < array.size(); i++) {
5682        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5683      }
5684    };
5685    if (json.has("detail")) {
5686      JsonArray array = json.getAsJsonArray("detail");
5687      for (int i = 0; i < array.size(); i++) {
5688        res.getDetail().add(parseClaimResponseAddedItemDetailComponent(array.get(i).getAsJsonObject(), owner));
5689      }
5690    };
5691  }
5692
5693  protected ClaimResponse.AddedItemDetailComponent parseClaimResponseAddedItemDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5694    ClaimResponse.AddedItemDetailComponent res = new ClaimResponse.AddedItemDetailComponent();
5695    parseClaimResponseAddedItemDetailComponentProperties(json, owner, res);
5696    return res;
5697  }
5698
5699  protected void parseClaimResponseAddedItemDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemDetailComponent res) throws IOException, FHIRFormatError {
5700    parseBackboneElementProperties(json, res);
5701    if (json.has("productOrService"))
5702      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
5703    if (json.has("modifier")) {
5704      JsonArray array = json.getAsJsonArray("modifier");
5705      for (int i = 0; i < array.size(); i++) {
5706        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5707      }
5708    };
5709    if (json.has("quantity"))
5710      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5711    if (json.has("unitPrice"))
5712      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
5713    if (json.has("factor"))
5714      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5715    if (json.has("_factor"))
5716      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5717    if (json.has("net"))
5718      res.setNet(parseMoney(json.getAsJsonObject("net")));
5719    if (json.has("noteNumber")) {
5720      JsonArray array = json.getAsJsonArray("noteNumber");
5721      for (int i = 0; i < array.size(); i++) {
5722        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5723      }
5724    };
5725    if (json.has("_noteNumber")) {
5726      JsonArray array = json.getAsJsonArray("_noteNumber");
5727      for (int i = 0; i < array.size(); i++) {
5728        if (i == res.getNoteNumber().size())
5729          res.getNoteNumber().add(parsePositiveInt(null));
5730        if (array.get(i) instanceof JsonObject) 
5731          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5732      }
5733    };
5734    if (json.has("adjudication")) {
5735      JsonArray array = json.getAsJsonArray("adjudication");
5736      for (int i = 0; i < array.size(); i++) {
5737        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5738      }
5739    };
5740    if (json.has("subDetail")) {
5741      JsonArray array = json.getAsJsonArray("subDetail");
5742      for (int i = 0; i < array.size(); i++) {
5743        res.getSubDetail().add(parseClaimResponseAddedItemSubDetailComponent(array.get(i).getAsJsonObject(), owner));
5744      }
5745    };
5746  }
5747
5748  protected ClaimResponse.AddedItemSubDetailComponent parseClaimResponseAddedItemSubDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5749    ClaimResponse.AddedItemSubDetailComponent res = new ClaimResponse.AddedItemSubDetailComponent();
5750    parseClaimResponseAddedItemSubDetailComponentProperties(json, owner, res);
5751    return res;
5752  }
5753
5754  protected void parseClaimResponseAddedItemSubDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemSubDetailComponent res) throws IOException, FHIRFormatError {
5755    parseBackboneElementProperties(json, res);
5756    if (json.has("productOrService"))
5757      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
5758    if (json.has("modifier")) {
5759      JsonArray array = json.getAsJsonArray("modifier");
5760      for (int i = 0; i < array.size(); i++) {
5761        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5762      }
5763    };
5764    if (json.has("quantity"))
5765      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5766    if (json.has("unitPrice"))
5767      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
5768    if (json.has("factor"))
5769      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5770    if (json.has("_factor"))
5771      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5772    if (json.has("net"))
5773      res.setNet(parseMoney(json.getAsJsonObject("net")));
5774    if (json.has("noteNumber")) {
5775      JsonArray array = json.getAsJsonArray("noteNumber");
5776      for (int i = 0; i < array.size(); i++) {
5777        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5778      }
5779    };
5780    if (json.has("_noteNumber")) {
5781      JsonArray array = json.getAsJsonArray("_noteNumber");
5782      for (int i = 0; i < array.size(); i++) {
5783        if (i == res.getNoteNumber().size())
5784          res.getNoteNumber().add(parsePositiveInt(null));
5785        if (array.get(i) instanceof JsonObject) 
5786          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5787      }
5788    };
5789    if (json.has("adjudication")) {
5790      JsonArray array = json.getAsJsonArray("adjudication");
5791      for (int i = 0; i < array.size(); i++) {
5792        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5793      }
5794    };
5795  }
5796
5797  protected ClaimResponse.TotalComponent parseClaimResponseTotalComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5798    ClaimResponse.TotalComponent res = new ClaimResponse.TotalComponent();
5799    parseClaimResponseTotalComponentProperties(json, owner, res);
5800    return res;
5801  }
5802
5803  protected void parseClaimResponseTotalComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.TotalComponent res) throws IOException, FHIRFormatError {
5804    parseBackboneElementProperties(json, res);
5805    if (json.has("category"))
5806      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5807    if (json.has("amount"))
5808      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
5809  }
5810
5811  protected ClaimResponse.PaymentComponent parseClaimResponsePaymentComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5812    ClaimResponse.PaymentComponent res = new ClaimResponse.PaymentComponent();
5813    parseClaimResponsePaymentComponentProperties(json, owner, res);
5814    return res;
5815  }
5816
5817  protected void parseClaimResponsePaymentComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.PaymentComponent res) throws IOException, FHIRFormatError {
5818    parseBackboneElementProperties(json, res);
5819    if (json.has("type"))
5820      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5821    if (json.has("adjustment"))
5822      res.setAdjustment(parseMoney(json.getAsJsonObject("adjustment")));
5823    if (json.has("adjustmentReason"))
5824      res.setAdjustmentReason(parseCodeableConcept(json.getAsJsonObject("adjustmentReason")));
5825    if (json.has("date"))
5826      res.setDateElement(parseDate(json.get("date").getAsString()));
5827    if (json.has("_date"))
5828      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5829    if (json.has("amount"))
5830      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
5831    if (json.has("identifier"))
5832      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5833  }
5834
5835  protected ClaimResponse.NoteComponent parseClaimResponseNoteComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5836    ClaimResponse.NoteComponent res = new ClaimResponse.NoteComponent();
5837    parseClaimResponseNoteComponentProperties(json, owner, res);
5838    return res;
5839  }
5840
5841  protected void parseClaimResponseNoteComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.NoteComponent res) throws IOException, FHIRFormatError {
5842    parseBackboneElementProperties(json, res);
5843    if (json.has("number"))
5844      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
5845    if (json.has("_number"))
5846      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
5847    if (json.has("type"))
5848      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
5849    if (json.has("_type"))
5850      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
5851    if (json.has("text"))
5852      res.setTextElement(parseString(json.get("text").getAsString()));
5853    if (json.has("_text"))
5854      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
5855    if (json.has("language"))
5856      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
5857  }
5858
5859  protected ClaimResponse.InsuranceComponent parseClaimResponseInsuranceComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5860    ClaimResponse.InsuranceComponent res = new ClaimResponse.InsuranceComponent();
5861    parseClaimResponseInsuranceComponentProperties(json, owner, res);
5862    return res;
5863  }
5864
5865  protected void parseClaimResponseInsuranceComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
5866    parseBackboneElementProperties(json, res);
5867    if (json.has("sequence"))
5868      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5869    if (json.has("_sequence"))
5870      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5871    if (json.has("focal"))
5872      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
5873    if (json.has("_focal"))
5874      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
5875    if (json.has("coverage"))
5876      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
5877    if (json.has("businessArrangement"))
5878      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
5879    if (json.has("_businessArrangement"))
5880      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
5881    if (json.has("claimResponse"))
5882      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
5883  }
5884
5885  protected ClaimResponse.ErrorComponent parseClaimResponseErrorComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5886    ClaimResponse.ErrorComponent res = new ClaimResponse.ErrorComponent();
5887    parseClaimResponseErrorComponentProperties(json, owner, res);
5888    return res;
5889  }
5890
5891  protected void parseClaimResponseErrorComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ErrorComponent res) throws IOException, FHIRFormatError {
5892    parseBackboneElementProperties(json, res);
5893    if (json.has("itemSequence"))
5894      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
5895    if (json.has("_itemSequence"))
5896      parseElementProperties(json.getAsJsonObject("_itemSequence"), res.getItemSequenceElement());
5897    if (json.has("detailSequence"))
5898      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
5899    if (json.has("_detailSequence"))
5900      parseElementProperties(json.getAsJsonObject("_detailSequence"), res.getDetailSequenceElement());
5901    if (json.has("subDetailSequence"))
5902      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
5903    if (json.has("_subDetailSequence"))
5904      parseElementProperties(json.getAsJsonObject("_subDetailSequence"), res.getSubDetailSequenceElement());
5905    if (json.has("code"))
5906      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5907  }
5908
5909  protected ClinicalImpression parseClinicalImpression(JsonObject json) throws IOException, FHIRFormatError {
5910    ClinicalImpression res = new ClinicalImpression();
5911    parseClinicalImpressionProperties(json, res);
5912    return res;
5913  }
5914
5915  protected void parseClinicalImpressionProperties(JsonObject json, ClinicalImpression res) throws IOException, FHIRFormatError {
5916    parseDomainResourceProperties(json, res);
5917    if (json.has("identifier")) {
5918      JsonArray array = json.getAsJsonArray("identifier");
5919      for (int i = 0; i < array.size(); i++) {
5920        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5921      }
5922    };
5923    if (json.has("status"))
5924      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClinicalImpression.ClinicalImpressionStatus.NULL, new ClinicalImpression.ClinicalImpressionStatusEnumFactory()));
5925    if (json.has("_status"))
5926      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5927    if (json.has("statusReason"))
5928      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
5929    if (json.has("code"))
5930      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5931    if (json.has("description"))
5932      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5933    if (json.has("_description"))
5934      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5935    if (json.has("subject"))
5936      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5937    if (json.has("encounter"))
5938      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
5939    Type effective = parseType("effective", json);
5940    if (effective != null)
5941      res.setEffective(effective);
5942    if (json.has("date"))
5943      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5944    if (json.has("_date"))
5945      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5946    if (json.has("assessor"))
5947      res.setAssessor(parseReference(json.getAsJsonObject("assessor")));
5948    if (json.has("previous"))
5949      res.setPrevious(parseReference(json.getAsJsonObject("previous")));
5950    if (json.has("problem")) {
5951      JsonArray array = json.getAsJsonArray("problem");
5952      for (int i = 0; i < array.size(); i++) {
5953        res.getProblem().add(parseReference(array.get(i).getAsJsonObject()));
5954      }
5955    };
5956    if (json.has("investigation")) {
5957      JsonArray array = json.getAsJsonArray("investigation");
5958      for (int i = 0; i < array.size(); i++) {
5959        res.getInvestigation().add(parseClinicalImpressionClinicalImpressionInvestigationComponent(array.get(i).getAsJsonObject(), res));
5960      }
5961    };
5962    if (json.has("protocol")) {
5963      JsonArray array = json.getAsJsonArray("protocol");
5964      for (int i = 0; i < array.size(); i++) {
5965        res.getProtocol().add(parseUri(array.get(i).getAsString()));
5966      }
5967    };
5968    if (json.has("_protocol")) {
5969      JsonArray array = json.getAsJsonArray("_protocol");
5970      for (int i = 0; i < array.size(); i++) {
5971        if (i == res.getProtocol().size())
5972          res.getProtocol().add(parseUri(null));
5973        if (array.get(i) instanceof JsonObject) 
5974          parseElementProperties(array.get(i).getAsJsonObject(), res.getProtocol().get(i));
5975      }
5976    };
5977    if (json.has("summary"))
5978      res.setSummaryElement(parseString(json.get("summary").getAsString()));
5979    if (json.has("_summary"))
5980      parseElementProperties(json.getAsJsonObject("_summary"), res.getSummaryElement());
5981    if (json.has("finding")) {
5982      JsonArray array = json.getAsJsonArray("finding");
5983      for (int i = 0; i < array.size(); i++) {
5984        res.getFinding().add(parseClinicalImpressionClinicalImpressionFindingComponent(array.get(i).getAsJsonObject(), res));
5985      }
5986    };
5987    if (json.has("prognosisCodeableConcept")) {
5988      JsonArray array = json.getAsJsonArray("prognosisCodeableConcept");
5989      for (int i = 0; i < array.size(); i++) {
5990        res.getPrognosisCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5991      }
5992    };
5993    if (json.has("prognosisReference")) {
5994      JsonArray array = json.getAsJsonArray("prognosisReference");
5995      for (int i = 0; i < array.size(); i++) {
5996        res.getPrognosisReference().add(parseReference(array.get(i).getAsJsonObject()));
5997      }
5998    };
5999    if (json.has("supportingInfo")) {
6000      JsonArray array = json.getAsJsonArray("supportingInfo");
6001      for (int i = 0; i < array.size(); i++) {
6002        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
6003      }
6004    };
6005    if (json.has("note")) {
6006      JsonArray array = json.getAsJsonArray("note");
6007      for (int i = 0; i < array.size(); i++) {
6008        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6009      }
6010    };
6011  }
6012
6013  protected ClinicalImpression.ClinicalImpressionInvestigationComponent parseClinicalImpressionClinicalImpressionInvestigationComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
6014    ClinicalImpression.ClinicalImpressionInvestigationComponent res = new ClinicalImpression.ClinicalImpressionInvestigationComponent();
6015    parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(json, owner, res);
6016    return res;
6017  }
6018
6019  protected void parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(JsonObject json, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionInvestigationComponent res) throws IOException, FHIRFormatError {
6020    parseBackboneElementProperties(json, res);
6021    if (json.has("code"))
6022      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
6023    if (json.has("item")) {
6024      JsonArray array = json.getAsJsonArray("item");
6025      for (int i = 0; i < array.size(); i++) {
6026        res.getItem().add(parseReference(array.get(i).getAsJsonObject()));
6027      }
6028    };
6029  }
6030
6031  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionClinicalImpressionFindingComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
6032    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
6033    parseClinicalImpressionClinicalImpressionFindingComponentProperties(json, owner, res);
6034    return res;
6035  }
6036
6037  protected void parseClinicalImpressionClinicalImpressionFindingComponentProperties(JsonObject json, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionFindingComponent res) throws IOException, FHIRFormatError {
6038    parseBackboneElementProperties(json, res);
6039    if (json.has("itemCodeableConcept"))
6040      res.setItemCodeableConcept(parseCodeableConcept(json.getAsJsonObject("itemCodeableConcept")));
6041    if (json.has("itemReference"))
6042      res.setItemReference(parseReference(json.getAsJsonObject("itemReference")));
6043    if (json.has("basis"))
6044      res.setBasisElement(parseString(json.get("basis").getAsString()));
6045    if (json.has("_basis"))
6046      parseElementProperties(json.getAsJsonObject("_basis"), res.getBasisElement());
6047  }
6048
6049  protected CodeSystem parseCodeSystem(JsonObject json) throws IOException, FHIRFormatError {
6050    CodeSystem res = new CodeSystem();
6051    parseCodeSystemProperties(json, res);
6052    return res;
6053  }
6054
6055  protected void parseCodeSystemProperties(JsonObject json, CodeSystem res) throws IOException, FHIRFormatError {
6056    parseDomainResourceProperties(json, res);
6057    if (json.has("url"))
6058      res.setUrlElement(parseUri(json.get("url").getAsString()));
6059    if (json.has("_url"))
6060      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6061    if (json.has("identifier")) {
6062      JsonArray array = json.getAsJsonArray("identifier");
6063      for (int i = 0; i < array.size(); i++) {
6064        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6065      }
6066    };
6067    if (json.has("version"))
6068      res.setVersionElement(parseString(json.get("version").getAsString()));
6069    if (json.has("_version"))
6070      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
6071    if (json.has("name"))
6072      res.setNameElement(parseString(json.get("name").getAsString()));
6073    if (json.has("_name"))
6074      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6075    if (json.has("title"))
6076      res.setTitleElement(parseString(json.get("title").getAsString()));
6077    if (json.has("_title"))
6078      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6079    if (json.has("status"))
6080      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
6081    if (json.has("_status"))
6082      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6083    if (json.has("experimental"))
6084      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6085    if (json.has("_experimental"))
6086      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
6087    if (json.has("date"))
6088      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6089    if (json.has("_date"))
6090      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6091    if (json.has("publisher"))
6092      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6093    if (json.has("_publisher"))
6094      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
6095    if (json.has("contact")) {
6096      JsonArray array = json.getAsJsonArray("contact");
6097      for (int i = 0; i < array.size(); i++) {
6098        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
6099      }
6100    };
6101    if (json.has("description"))
6102      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
6103    if (json.has("_description"))
6104      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6105    if (json.has("useContext")) {
6106      JsonArray array = json.getAsJsonArray("useContext");
6107      for (int i = 0; i < array.size(); i++) {
6108        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
6109      }
6110    };
6111    if (json.has("jurisdiction")) {
6112      JsonArray array = json.getAsJsonArray("jurisdiction");
6113      for (int i = 0; i < array.size(); i++) {
6114        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6115      }
6116    };
6117    if (json.has("purpose"))
6118      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
6119    if (json.has("_purpose"))
6120      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
6121    if (json.has("copyright"))
6122      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
6123    if (json.has("_copyright"))
6124      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
6125    if (json.has("caseSensitive"))
6126      res.setCaseSensitiveElement(parseBoolean(json.get("caseSensitive").getAsBoolean()));
6127    if (json.has("_caseSensitive"))
6128      parseElementProperties(json.getAsJsonObject("_caseSensitive"), res.getCaseSensitiveElement());
6129    if (json.has("valueSet"))
6130      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
6131    if (json.has("_valueSet"))
6132      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
6133    if (json.has("hierarchyMeaning"))
6134      res.setHierarchyMeaningElement(parseEnumeration(json.get("hierarchyMeaning").getAsString(), CodeSystem.CodeSystemHierarchyMeaning.NULL, new CodeSystem.CodeSystemHierarchyMeaningEnumFactory()));
6135    if (json.has("_hierarchyMeaning"))
6136      parseElementProperties(json.getAsJsonObject("_hierarchyMeaning"), res.getHierarchyMeaningElement());
6137    if (json.has("compositional"))
6138      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
6139    if (json.has("_compositional"))
6140      parseElementProperties(json.getAsJsonObject("_compositional"), res.getCompositionalElement());
6141    if (json.has("versionNeeded"))
6142      res.setVersionNeededElement(parseBoolean(json.get("versionNeeded").getAsBoolean()));
6143    if (json.has("_versionNeeded"))
6144      parseElementProperties(json.getAsJsonObject("_versionNeeded"), res.getVersionNeededElement());
6145    if (json.has("content"))
6146      res.setContentElement(parseEnumeration(json.get("content").getAsString(), CodeSystem.CodeSystemContentMode.NULL, new CodeSystem.CodeSystemContentModeEnumFactory()));
6147    if (json.has("_content"))
6148      parseElementProperties(json.getAsJsonObject("_content"), res.getContentElement());
6149    if (json.has("supplements"))
6150      res.setSupplementsElement(parseCanonical(json.get("supplements").getAsString()));
6151    if (json.has("_supplements"))
6152      parseElementProperties(json.getAsJsonObject("_supplements"), res.getSupplementsElement());
6153    if (json.has("count"))
6154      res.setCountElement(parseUnsignedInt(json.get("count").getAsString()));
6155    if (json.has("_count"))
6156      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
6157    if (json.has("filter")) {
6158      JsonArray array = json.getAsJsonArray("filter");
6159      for (int i = 0; i < array.size(); i++) {
6160        res.getFilter().add(parseCodeSystemCodeSystemFilterComponent(array.get(i).getAsJsonObject(), res));
6161      }
6162    };
6163    if (json.has("property")) {
6164      JsonArray array = json.getAsJsonArray("property");
6165      for (int i = 0; i < array.size(); i++) {
6166        res.getProperty().add(parseCodeSystemPropertyComponent(array.get(i).getAsJsonObject(), res));
6167      }
6168    };
6169    if (json.has("concept")) {
6170      JsonArray array = json.getAsJsonArray("concept");
6171      for (int i = 0; i < array.size(); i++) {
6172        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), res));
6173      }
6174    };
6175  }
6176
6177  protected CodeSystem.CodeSystemFilterComponent parseCodeSystemCodeSystemFilterComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6178    CodeSystem.CodeSystemFilterComponent res = new CodeSystem.CodeSystemFilterComponent();
6179    parseCodeSystemCodeSystemFilterComponentProperties(json, owner, res);
6180    return res;
6181  }
6182
6183  protected void parseCodeSystemCodeSystemFilterComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.CodeSystemFilterComponent res) throws IOException, FHIRFormatError {
6184    parseBackboneElementProperties(json, res);
6185    if (json.has("code"))
6186      res.setCodeElement(parseCode(json.get("code").getAsString()));
6187    if (json.has("_code"))
6188      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6189    if (json.has("description"))
6190      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6191    if (json.has("_description"))
6192      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6193    if (json.has("operator")) {
6194      JsonArray array = json.getAsJsonArray("operator");
6195      for (int i = 0; i < array.size(); i++) {
6196        res.getOperator().add(parseEnumeration(array.get(i).getAsString(), CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
6197      }
6198    };
6199    if (json.has("_operator")) {
6200      JsonArray array = json.getAsJsonArray("_operator");
6201      for (int i = 0; i < array.size(); i++) {
6202        if (i == res.getOperator().size())
6203          res.getOperator().add(parseEnumeration(null, CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
6204        if (array.get(i) instanceof JsonObject) 
6205          parseElementProperties(array.get(i).getAsJsonObject(), res.getOperator().get(i));
6206      }
6207    };
6208    if (json.has("value"))
6209      res.setValueElement(parseString(json.get("value").getAsString()));
6210    if (json.has("_value"))
6211      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
6212  }
6213
6214  protected CodeSystem.PropertyComponent parseCodeSystemPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6215    CodeSystem.PropertyComponent res = new CodeSystem.PropertyComponent();
6216    parseCodeSystemPropertyComponentProperties(json, owner, res);
6217    return res;
6218  }
6219
6220  protected void parseCodeSystemPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.PropertyComponent res) throws IOException, FHIRFormatError {
6221    parseBackboneElementProperties(json, res);
6222    if (json.has("code"))
6223      res.setCodeElement(parseCode(json.get("code").getAsString()));
6224    if (json.has("_code"))
6225      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6226    if (json.has("uri"))
6227      res.setUriElement(parseUri(json.get("uri").getAsString()));
6228    if (json.has("_uri"))
6229      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
6230    if (json.has("description"))
6231      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6232    if (json.has("_description"))
6233      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6234    if (json.has("type"))
6235      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CodeSystem.PropertyType.NULL, new CodeSystem.PropertyTypeEnumFactory()));
6236    if (json.has("_type"))
6237      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
6238  }
6239
6240  protected CodeSystem.ConceptDefinitionComponent parseCodeSystemConceptDefinitionComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6241    CodeSystem.ConceptDefinitionComponent res = new CodeSystem.ConceptDefinitionComponent();
6242    parseCodeSystemConceptDefinitionComponentProperties(json, owner, res);
6243    return res;
6244  }
6245
6246  protected void parseCodeSystemConceptDefinitionComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionComponent res) throws IOException, FHIRFormatError {
6247    parseBackboneElementProperties(json, res);
6248    if (json.has("code"))
6249      res.setCodeElement(parseCode(json.get("code").getAsString()));
6250    if (json.has("_code"))
6251      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6252    if (json.has("display"))
6253      res.setDisplayElement(parseString(json.get("display").getAsString()));
6254    if (json.has("_display"))
6255      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
6256    if (json.has("definition"))
6257      res.setDefinitionElement(parseString(json.get("definition").getAsString()));
6258    if (json.has("_definition"))
6259      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
6260    if (json.has("designation")) {
6261      JsonArray array = json.getAsJsonArray("designation");
6262      for (int i = 0; i < array.size(); i++) {
6263        res.getDesignation().add(parseCodeSystemConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject(), owner));
6264      }
6265    };
6266    if (json.has("property")) {
6267      JsonArray array = json.getAsJsonArray("property");
6268      for (int i = 0; i < array.size(); i++) {
6269        res.getProperty().add(parseCodeSystemConceptPropertyComponent(array.get(i).getAsJsonObject(), owner));
6270      }
6271    };
6272    if (json.has("concept")) {
6273      JsonArray array = json.getAsJsonArray("concept");
6274      for (int i = 0; i < array.size(); i++) {
6275        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), owner));
6276      }
6277    };
6278  }
6279
6280  protected CodeSystem.ConceptDefinitionDesignationComponent parseCodeSystemConceptDefinitionDesignationComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6281    CodeSystem.ConceptDefinitionDesignationComponent res = new CodeSystem.ConceptDefinitionDesignationComponent();
6282    parseCodeSystemConceptDefinitionDesignationComponentProperties(json, owner, res);
6283    return res;
6284  }
6285
6286  protected void parseCodeSystemConceptDefinitionDesignationComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionDesignationComponent res) throws IOException, FHIRFormatError {
6287    parseBackboneElementProperties(json, res);
6288    if (json.has("language"))
6289      res.setLanguageElement(parseCode(json.get("language").getAsString()));
6290    if (json.has("_language"))
6291      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
6292    if (json.has("use"))
6293      res.setUse(parseCoding(json.getAsJsonObject("use")));
6294    if (json.has("value"))
6295      res.setValueElement(parseString(json.get("value").getAsString()));
6296    if (json.has("_value"))
6297      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
6298  }
6299
6300  protected CodeSystem.ConceptPropertyComponent parseCodeSystemConceptPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6301    CodeSystem.ConceptPropertyComponent res = new CodeSystem.ConceptPropertyComponent();
6302    parseCodeSystemConceptPropertyComponentProperties(json, owner, res);
6303    return res;
6304  }
6305
6306  protected void parseCodeSystemConceptPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptPropertyComponent res) throws IOException, FHIRFormatError {
6307    parseBackboneElementProperties(json, res);
6308    if (json.has("code"))
6309      res.setCodeElement(parseCode(json.get("code").getAsString()));
6310    if (json.has("_code"))
6311      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6312    Type value = parseType("value", json);
6313    if (value != null)
6314      res.setValue(value);
6315  }
6316
6317  protected Communication parseCommunication(JsonObject json) throws IOException, FHIRFormatError {
6318    Communication res = new Communication();
6319    parseCommunicationProperties(json, res);
6320    return res;
6321  }
6322
6323  protected void parseCommunicationProperties(JsonObject json, Communication res) throws IOException, FHIRFormatError {
6324    parseDomainResourceProperties(json, res);
6325    if (json.has("identifier")) {
6326      JsonArray array = json.getAsJsonArray("identifier");
6327      for (int i = 0; i < array.size(); i++) {
6328        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6329      }
6330    };
6331    if (json.has("instantiatesCanonical")) {
6332      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
6333      for (int i = 0; i < array.size(); i++) {
6334        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
6335      }
6336    };
6337    if (json.has("_instantiatesCanonical")) {
6338      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
6339      for (int i = 0; i < array.size(); i++) {
6340        if (i == res.getInstantiatesCanonical().size())
6341          res.getInstantiatesCanonical().add(parseCanonical(null));
6342        if (array.get(i) instanceof JsonObject) 
6343          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
6344      }
6345    };
6346    if (json.has("instantiatesUri")) {
6347      JsonArray array = json.getAsJsonArray("instantiatesUri");
6348      for (int i = 0; i < array.size(); i++) {
6349        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
6350      }
6351    };
6352    if (json.has("_instantiatesUri")) {
6353      JsonArray array = json.getAsJsonArray("_instantiatesUri");
6354      for (int i = 0; i < array.size(); i++) {
6355        if (i == res.getInstantiatesUri().size())
6356          res.getInstantiatesUri().add(parseUri(null));
6357        if (array.get(i) instanceof JsonObject) 
6358          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
6359      }
6360    };
6361    if (json.has("basedOn")) {
6362      JsonArray array = json.getAsJsonArray("basedOn");
6363      for (int i = 0; i < array.size(); i++) {
6364        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
6365      }
6366    };
6367    if (json.has("partOf")) {
6368      JsonArray array = json.getAsJsonArray("partOf");
6369      for (int i = 0; i < array.size(); i++) {
6370        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
6371      }
6372    };
6373    if (json.has("inResponseTo")) {
6374      JsonArray array = json.getAsJsonArray("inResponseTo");
6375      for (int i = 0; i < array.size(); i++) {
6376        res.getInResponseTo().add(parseReference(array.get(i).getAsJsonObject()));
6377      }
6378    };
6379    if (json.has("status"))
6380      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Communication.CommunicationStatus.NULL, new Communication.CommunicationStatusEnumFactory()));
6381    if (json.has("_status"))
6382      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6383    if (json.has("statusReason"))
6384      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
6385    if (json.has("category")) {
6386      JsonArray array = json.getAsJsonArray("category");
6387      for (int i = 0; i < array.size(); i++) {
6388        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6389      }
6390    };
6391    if (json.has("priority"))
6392      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Communication.CommunicationPriority.NULL, new Communication.CommunicationPriorityEnumFactory()));
6393    if (json.has("_priority"))
6394      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
6395    if (json.has("medium")) {
6396      JsonArray array = json.getAsJsonArray("medium");
6397      for (int i = 0; i < array.size(); i++) {
6398        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6399      }
6400    };
6401    if (json.has("subject"))
6402      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6403    if (json.has("topic"))
6404      res.setTopic(parseCodeableConcept(json.getAsJsonObject("topic")));
6405    if (json.has("about")) {
6406      JsonArray array = json.getAsJsonArray("about");
6407      for (int i = 0; i < array.size(); i++) {
6408        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
6409      }
6410    };
6411    if (json.has("encounter"))
6412      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
6413    if (json.has("sent"))
6414      res.setSentElement(parseDateTime(json.get("sent").getAsString()));
6415    if (json.has("_sent"))
6416      parseElementProperties(json.getAsJsonObject("_sent"), res.getSentElement());
6417    if (json.has("received"))
6418      res.setReceivedElement(parseDateTime(json.get("received").getAsString()));
6419    if (json.has("_received"))
6420      parseElementProperties(json.getAsJsonObject("_received"), res.getReceivedElement());
6421    if (json.has("recipient")) {
6422      JsonArray array = json.getAsJsonArray("recipient");
6423      for (int i = 0; i < array.size(); i++) {
6424        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
6425      }
6426    };
6427    if (json.has("sender"))
6428      res.setSender(parseReference(json.getAsJsonObject("sender")));
6429    if (json.has("reasonCode")) {
6430      JsonArray array = json.getAsJsonArray("reasonCode");
6431      for (int i = 0; i < array.size(); i++) {
6432        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6433      }
6434    };
6435    if (json.has("reasonReference")) {
6436      JsonArray array = json.getAsJsonArray("reasonReference");
6437      for (int i = 0; i < array.size(); i++) {
6438        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
6439      }
6440    };
6441    if (json.has("payload")) {
6442      JsonArray array = json.getAsJsonArray("payload");
6443      for (int i = 0; i < array.size(); i++) {
6444        res.getPayload().add(parseCommunicationCommunicationPayloadComponent(array.get(i).getAsJsonObject(), res));
6445      }
6446    };
6447    if (json.has("note")) {
6448      JsonArray array = json.getAsJsonArray("note");
6449      for (int i = 0; i < array.size(); i++) {
6450        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6451      }
6452    };
6453  }
6454
6455  protected Communication.CommunicationPayloadComponent parseCommunicationCommunicationPayloadComponent(JsonObject json, Communication owner) throws IOException, FHIRFormatError {
6456    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
6457    parseCommunicationCommunicationPayloadComponentProperties(json, owner, res);
6458    return res;
6459  }
6460
6461  protected void parseCommunicationCommunicationPayloadComponentProperties(JsonObject json, Communication owner, Communication.CommunicationPayloadComponent res) throws IOException, FHIRFormatError {
6462    parseBackboneElementProperties(json, res);
6463    Type content = parseType("content", json);
6464    if (content != null)
6465      res.setContent(content);
6466  }
6467
6468  protected CommunicationRequest parseCommunicationRequest(JsonObject json) throws IOException, FHIRFormatError {
6469    CommunicationRequest res = new CommunicationRequest();
6470    parseCommunicationRequestProperties(json, res);
6471    return res;
6472  }
6473
6474  protected void parseCommunicationRequestProperties(JsonObject json, CommunicationRequest res) throws IOException, FHIRFormatError {
6475    parseDomainResourceProperties(json, res);
6476    if (json.has("identifier")) {
6477      JsonArray array = json.getAsJsonArray("identifier");
6478      for (int i = 0; i < array.size(); i++) {
6479        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6480      }
6481    };
6482    if (json.has("basedOn")) {
6483      JsonArray array = json.getAsJsonArray("basedOn");
6484      for (int i = 0; i < array.size(); i++) {
6485        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
6486      }
6487    };
6488    if (json.has("replaces")) {
6489      JsonArray array = json.getAsJsonArray("replaces");
6490      for (int i = 0; i < array.size(); i++) {
6491        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
6492      }
6493    };
6494    if (json.has("groupIdentifier"))
6495      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
6496    if (json.has("status"))
6497      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CommunicationRequest.CommunicationRequestStatus.NULL, new CommunicationRequest.CommunicationRequestStatusEnumFactory()));
6498    if (json.has("_status"))
6499      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6500    if (json.has("statusReason"))
6501      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
6502    if (json.has("category")) {
6503      JsonArray array = json.getAsJsonArray("category");
6504      for (int i = 0; i < array.size(); i++) {
6505        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6506      }
6507    };
6508    if (json.has("priority"))
6509      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), CommunicationRequest.CommunicationPriority.NULL, new CommunicationRequest.CommunicationPriorityEnumFactory()));
6510    if (json.has("_priority"))
6511      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
6512    if (json.has("doNotPerform"))
6513      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
6514    if (json.has("_doNotPerform"))
6515      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
6516    if (json.has("medium")) {
6517      JsonArray array = json.getAsJsonArray("medium");
6518      for (int i = 0; i < array.size(); i++) {
6519        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6520      }
6521    };
6522    if (json.has("subject"))
6523      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6524    if (json.has("about")) {
6525      JsonArray array = json.getAsJsonArray("about");
6526      for (int i = 0; i < array.size(); i++) {
6527        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
6528      }
6529    };
6530    if (json.has("encounter"))
6531      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
6532    if (json.has("payload")) {
6533      JsonArray array = json.getAsJsonArray("payload");
6534      for (int i = 0; i < array.size(); i++) {
6535        res.getPayload().add(parseCommunicationRequestCommunicationRequestPayloadComponent(array.get(i).getAsJsonObject(), res));
6536      }
6537    };
6538    Type occurrence = parseType("occurrence", json);
6539    if (occurrence != null)
6540      res.setOccurrence(occurrence);
6541    if (json.has("authoredOn"))
6542      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
6543    if (json.has("_authoredOn"))
6544      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
6545    if (json.has("requester"))
6546      res.setRequester(parseReference(json.getAsJsonObject("requester")));
6547    if (json.has("recipient")) {
6548      JsonArray array = json.getAsJsonArray("recipient");
6549      for (int i = 0; i < array.size(); i++) {
6550        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
6551      }
6552    };
6553    if (json.has("sender"))
6554      res.setSender(parseReference(json.getAsJsonObject("sender")));
6555    if (json.has("reasonCode")) {
6556      JsonArray array = json.getAsJsonArray("reasonCode");
6557      for (int i = 0; i < array.size(); i++) {
6558        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6559      }
6560    };
6561    if (json.has("reasonReference")) {
6562      JsonArray array = json.getAsJsonArray("reasonReference");
6563      for (int i = 0; i < array.size(); i++) {
6564        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
6565      }
6566    };
6567    if (json.has("note")) {
6568      JsonArray array = json.getAsJsonArray("note");
6569      for (int i = 0; i < array.size(); i++) {
6570        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6571      }
6572    };
6573  }
6574
6575  protected CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestCommunicationRequestPayloadComponent(JsonObject json, CommunicationRequest owner) throws IOException, FHIRFormatError {
6576    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
6577    parseCommunicationRequestCommunicationRequestPayloadComponentProperties(json, owner, res);
6578    return res;
6579  }
6580
6581  protected void parseCommunicationRequestCommunicationRequestPayloadComponentProperties(JsonObject json, CommunicationRequest owner, CommunicationRequest.CommunicationRequestPayloadComponent res) throws IOException, FHIRFormatError {
6582    parseBackboneElementProperties(json, res);
6583    Type content = parseType("content", json);
6584    if (content != null)
6585      res.setContent(content);
6586  }
6587
6588  protected CompartmentDefinition parseCompartmentDefinition(JsonObject json) throws IOException, FHIRFormatError {
6589    CompartmentDefinition res = new CompartmentDefinition();
6590    parseCompartmentDefinitionProperties(json, res);
6591    return res;
6592  }
6593
6594  protected void parseCompartmentDefinitionProperties(JsonObject json, CompartmentDefinition res) throws IOException, FHIRFormatError {
6595    parseDomainResourceProperties(json, res);
6596    if (json.has("url"))
6597      res.setUrlElement(parseUri(json.get("url").getAsString()));
6598    if (json.has("_url"))
6599      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6600    if (json.has("version"))
6601      res.setVersionElement(parseString(json.get("version").getAsString()));
6602    if (json.has("_version"))
6603      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
6604    if (json.has("name"))
6605      res.setNameElement(parseString(json.get("name").getAsString()));
6606    if (json.has("_name"))
6607      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6608    if (json.has("status"))
6609      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
6610    if (json.has("_status"))
6611      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6612    if (json.has("experimental"))
6613      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6614    if (json.has("_experimental"))
6615      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
6616    if (json.has("date"))
6617      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6618    if (json.has("_date"))
6619      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6620    if (json.has("publisher"))
6621      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6622    if (json.has("_publisher"))
6623      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
6624    if (json.has("contact")) {
6625      JsonArray array = json.getAsJsonArray("contact");
6626      for (int i = 0; i < array.size(); i++) {
6627        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
6628      }
6629    };
6630    if (json.has("description"))
6631      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
6632    if (json.has("_description"))
6633      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6634    if (json.has("useContext")) {
6635      JsonArray array = json.getAsJsonArray("useContext");
6636      for (int i = 0; i < array.size(); i++) {
6637        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
6638      }
6639    };
6640    if (json.has("purpose"))
6641      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
6642    if (json.has("_purpose"))
6643      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
6644    if (json.has("code"))
6645      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CompartmentDefinition.CompartmentType.NULL, new CompartmentDefinition.CompartmentTypeEnumFactory()));
6646    if (json.has("_code"))
6647      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6648    if (json.has("search"))
6649      res.setSearchElement(parseBoolean(json.get("search").getAsBoolean()));
6650    if (json.has("_search"))
6651      parseElementProperties(json.getAsJsonObject("_search"), res.getSearchElement());
6652    if (json.has("resource")) {
6653      JsonArray array = json.getAsJsonArray("resource");
6654      for (int i = 0; i < array.size(); i++) {
6655        res.getResource().add(parseCompartmentDefinitionCompartmentDefinitionResourceComponent(array.get(i).getAsJsonObject(), res));
6656      }
6657    };
6658  }
6659
6660  protected CompartmentDefinition.CompartmentDefinitionResourceComponent parseCompartmentDefinitionCompartmentDefinitionResourceComponent(JsonObject json, CompartmentDefinition owner) throws IOException, FHIRFormatError {
6661    CompartmentDefinition.CompartmentDefinitionResourceComponent res = new CompartmentDefinition.CompartmentDefinitionResourceComponent();
6662    parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(json, owner, res);
6663    return res;
6664  }
6665
6666  protected void parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(JsonObject json, CompartmentDefinition owner, CompartmentDefinition.CompartmentDefinitionResourceComponent res) throws IOException, FHIRFormatError {
6667    parseBackboneElementProperties(json, res);
6668    if (json.has("code"))
6669      res.setCodeElement(parseCode(json.get("code").getAsString()));
6670    if (json.has("_code"))
6671      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6672    if (json.has("param")) {
6673      JsonArray array = json.getAsJsonArray("param");
6674      for (int i = 0; i < array.size(); i++) {
6675        res.getParam().add(parseString(array.get(i).getAsString()));
6676      }
6677    };
6678    if (json.has("_param")) {
6679      JsonArray array = json.getAsJsonArray("_param");
6680      for (int i = 0; i < array.size(); i++) {
6681        if (i == res.getParam().size())
6682          res.getParam().add(parseString(null));
6683        if (array.get(i) instanceof JsonObject) 
6684          parseElementProperties(array.get(i).getAsJsonObject(), res.getParam().get(i));
6685      }
6686    };
6687    if (json.has("documentation"))
6688      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
6689    if (json.has("_documentation"))
6690      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
6691  }
6692
6693  protected Composition parseComposition(JsonObject json) throws IOException, FHIRFormatError {
6694    Composition res = new Composition();
6695    parseCompositionProperties(json, res);
6696    return res;
6697  }
6698
6699  protected void parseCompositionProperties(JsonObject json, Composition res) throws IOException, FHIRFormatError {
6700    parseDomainResourceProperties(json, res);
6701    if (json.has("identifier"))
6702      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6703    if (json.has("status"))
6704      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Composition.CompositionStatus.NULL, new Composition.CompositionStatusEnumFactory()));
6705    if (json.has("_status"))
6706      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6707    if (json.has("type"))
6708      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6709    if (json.has("category")) {
6710      JsonArray array = json.getAsJsonArray("category");
6711      for (int i = 0; i < array.size(); i++) {
6712        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6713      }
6714    };
6715    if (json.has("subject"))
6716      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6717    if (json.has("encounter"))
6718      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
6719    if (json.has("date"))
6720      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6721    if (json.has("_date"))
6722      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6723    if (json.has("author")) {
6724      JsonArray array = json.getAsJsonArray("author");
6725      for (int i = 0; i < array.size(); i++) {
6726        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
6727      }
6728    };
6729    if (json.has("title"))
6730      res.setTitleElement(parseString(json.get("title").getAsString()));
6731    if (json.has("_title"))
6732      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6733    if (json.has("confidentiality"))
6734      res.setConfidentialityElement(parseEnumeration(json.get("confidentiality").getAsString(), Composition.DocumentConfidentiality.NULL, new Composition.DocumentConfidentialityEnumFactory()));
6735    if (json.has("_confidentiality"))
6736      parseElementProperties(json.getAsJsonObject("_confidentiality"), res.getConfidentialityElement());
6737    if (json.has("attester")) {
6738      JsonArray array = json.getAsJsonArray("attester");
6739      for (int i = 0; i < array.size(); i++) {
6740        res.getAttester().add(parseCompositionCompositionAttesterComponent(array.get(i).getAsJsonObject(), res));
6741      }
6742    };
6743    if (json.has("custodian"))
6744      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
6745    if (json.has("relatesTo")) {
6746      JsonArray array = json.getAsJsonArray("relatesTo");
6747      for (int i = 0; i < array.size(); i++) {
6748        res.getRelatesTo().add(parseCompositionCompositionRelatesToComponent(array.get(i).getAsJsonObject(), res));
6749      }
6750    };
6751    if (json.has("event")) {
6752      JsonArray array = json.getAsJsonArray("event");
6753      for (int i = 0; i < array.size(); i++) {
6754        res.getEvent().add(parseCompositionCompositionEventComponent(array.get(i).getAsJsonObject(), res));
6755      }
6756    };
6757    if (json.has("section")) {
6758      JsonArray array = json.getAsJsonArray("section");
6759      for (int i = 0; i < array.size(); i++) {
6760        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), res));
6761      }
6762    };
6763  }
6764
6765  protected Composition.CompositionAttesterComponent parseCompositionCompositionAttesterComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
6766    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
6767    parseCompositionCompositionAttesterComponentProperties(json, owner, res);
6768    return res;
6769  }
6770
6771  protected void parseCompositionCompositionAttesterComponentProperties(JsonObject json, Composition owner, Composition.CompositionAttesterComponent res) throws IOException, FHIRFormatError {
6772    parseBackboneElementProperties(json, res);
6773    if (json.has("mode"))
6774      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
6775    if (json.has("_mode"))
6776      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
6777    if (json.has("time"))
6778      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
6779    if (json.has("_time"))
6780      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
6781    if (json.has("party"))
6782      res.setParty(parseReference(json.getAsJsonObject("party")));
6783  }
6784
6785  protected Composition.CompositionRelatesToComponent parseCompositionCompositionRelatesToComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
6786    Composition.CompositionRelatesToComponent res = new Composition.CompositionRelatesToComponent();
6787    parseCompositionCompositionRelatesToComponentProperties(json, owner, res);
6788    return res;
6789  }
6790
6791  protected void parseCompositionCompositionRelatesToComponentProperties(JsonObject json, Composition owner, Composition.CompositionRelatesToComponent res) throws IOException, FHIRFormatError {
6792    parseBackboneElementProperties(json, res);
6793    if (json.has("code"))
6794      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Composition.DocumentRelationshipType.NULL, new Composition.DocumentRelationshipTypeEnumFactory()));
6795    if (json.has("_code"))
6796      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6797    Type target = parseType("target", json);
6798    if (target != null)
6799      res.setTarget(target);
6800  }
6801
6802  protected Composition.CompositionEventComponent parseCompositionCompositionEventComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
6803    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
6804    parseCompositionCompositionEventComponentProperties(json, owner, res);
6805    return res;
6806  }
6807
6808  protected void parseCompositionCompositionEventComponentProperties(JsonObject json, Composition owner, Composition.CompositionEventComponent res) throws IOException, FHIRFormatError {
6809    parseBackboneElementProperties(json, res);
6810    if (json.has("code")) {
6811      JsonArray array = json.getAsJsonArray("code");
6812      for (int i = 0; i < array.size(); i++) {
6813        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6814      }
6815    };
6816    if (json.has("period"))
6817      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
6818    if (json.has("detail")) {
6819      JsonArray array = json.getAsJsonArray("detail");
6820      for (int i = 0; i < array.size(); i++) {
6821        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
6822      }
6823    };
6824  }
6825
6826  protected Composition.SectionComponent parseCompositionSectionComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
6827    Composition.SectionComponent res = new Composition.SectionComponent();
6828    parseCompositionSectionComponentProperties(json, owner, res);
6829    return res;
6830  }
6831
6832  protected void parseCompositionSectionComponentProperties(JsonObject json, Composition owner, Composition.SectionComponent res) throws IOException, FHIRFormatError {
6833    parseBackboneElementProperties(json, res);
6834    if (json.has("title"))
6835      res.setTitleElement(parseString(json.get("title").getAsString()));
6836    if (json.has("_title"))
6837      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6838    if (json.has("code"))
6839      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
6840    if (json.has("author")) {
6841      JsonArray array = json.getAsJsonArray("author");
6842      for (int i = 0; i < array.size(); i++) {
6843        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
6844      }
6845    };
6846    if (json.has("focus"))
6847      res.setFocus(parseReference(json.getAsJsonObject("focus")));
6848    if (json.has("text"))
6849      res.setText(parseNarrative(json.getAsJsonObject("text")));
6850    if (json.has("mode"))
6851      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.SectionMode.NULL, new Composition.SectionModeEnumFactory()));
6852    if (json.has("_mode"))
6853      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
6854    if (json.has("orderedBy"))
6855      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
6856    if (json.has("entry")) {
6857      JsonArray array = json.getAsJsonArray("entry");
6858      for (int i = 0; i < array.size(); i++) {
6859        res.getEntry().add(parseReference(array.get(i).getAsJsonObject()));
6860      }
6861    };
6862    if (json.has("emptyReason"))
6863      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
6864    if (json.has("section")) {
6865      JsonArray array = json.getAsJsonArray("section");
6866      for (int i = 0; i < array.size(); i++) {
6867        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), owner));
6868      }
6869    };
6870  }
6871
6872  protected ConceptMap parseConceptMap(JsonObject json) throws IOException, FHIRFormatError {
6873    ConceptMap res = new ConceptMap();
6874    parseConceptMapProperties(json, res);
6875    return res;
6876  }
6877
6878  protected void parseConceptMapProperties(JsonObject json, ConceptMap res) throws IOException, FHIRFormatError {
6879    parseDomainResourceProperties(json, res);
6880    if (json.has("url"))
6881      res.setUrlElement(parseUri(json.get("url").getAsString()));
6882    if (json.has("_url"))
6883      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6884    if (json.has("identifier"))
6885      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6886    if (json.has("version"))
6887      res.setVersionElement(parseString(json.get("version").getAsString()));
6888    if (json.has("_version"))
6889      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
6890    if (json.has("name"))
6891      res.setNameElement(parseString(json.get("name").getAsString()));
6892    if (json.has("_name"))
6893      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6894    if (json.has("title"))
6895      res.setTitleElement(parseString(json.get("title").getAsString()));
6896    if (json.has("_title"))
6897      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6898    if (json.has("status"))
6899      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
6900    if (json.has("_status"))
6901      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6902    if (json.has("experimental"))
6903      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6904    if (json.has("_experimental"))
6905      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
6906    if (json.has("date"))
6907      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6908    if (json.has("_date"))
6909      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6910    if (json.has("publisher"))
6911      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6912    if (json.has("_publisher"))
6913      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
6914    if (json.has("contact")) {
6915      JsonArray array = json.getAsJsonArray("contact");
6916      for (int i = 0; i < array.size(); i++) {
6917        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
6918      }
6919    };
6920    if (json.has("description"))
6921      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
6922    if (json.has("_description"))
6923      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6924    if (json.has("useContext")) {
6925      JsonArray array = json.getAsJsonArray("useContext");
6926      for (int i = 0; i < array.size(); i++) {
6927        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
6928      }
6929    };
6930    if (json.has("jurisdiction")) {
6931      JsonArray array = json.getAsJsonArray("jurisdiction");
6932      for (int i = 0; i < array.size(); i++) {
6933        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6934      }
6935    };
6936    if (json.has("purpose"))
6937      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
6938    if (json.has("_purpose"))
6939      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
6940    if (json.has("copyright"))
6941      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
6942    if (json.has("_copyright"))
6943      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
6944    Type source = parseType("source", json);
6945    if (source != null)
6946      res.setSource(source);
6947    Type target = parseType("target", json);
6948    if (target != null)
6949      res.setTarget(target);
6950    if (json.has("group")) {
6951      JsonArray array = json.getAsJsonArray("group");
6952      for (int i = 0; i < array.size(); i++) {
6953        res.getGroup().add(parseConceptMapConceptMapGroupComponent(array.get(i).getAsJsonObject(), res));
6954      }
6955    };
6956  }
6957
6958  protected ConceptMap.ConceptMapGroupComponent parseConceptMapConceptMapGroupComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6959    ConceptMap.ConceptMapGroupComponent res = new ConceptMap.ConceptMapGroupComponent();
6960    parseConceptMapConceptMapGroupComponentProperties(json, owner, res);
6961    return res;
6962  }
6963
6964  protected void parseConceptMapConceptMapGroupComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupComponent res) throws IOException, FHIRFormatError {
6965    parseBackboneElementProperties(json, res);
6966    if (json.has("source"))
6967      res.setSourceElement(parseUri(json.get("source").getAsString()));
6968    if (json.has("_source"))
6969      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
6970    if (json.has("sourceVersion"))
6971      res.setSourceVersionElement(parseString(json.get("sourceVersion").getAsString()));
6972    if (json.has("_sourceVersion"))
6973      parseElementProperties(json.getAsJsonObject("_sourceVersion"), res.getSourceVersionElement());
6974    if (json.has("target"))
6975      res.setTargetElement(parseUri(json.get("target").getAsString()));
6976    if (json.has("_target"))
6977      parseElementProperties(json.getAsJsonObject("_target"), res.getTargetElement());
6978    if (json.has("targetVersion"))
6979      res.setTargetVersionElement(parseString(json.get("targetVersion").getAsString()));
6980    if (json.has("_targetVersion"))
6981      parseElementProperties(json.getAsJsonObject("_targetVersion"), res.getTargetVersionElement());
6982    if (json.has("element")) {
6983      JsonArray array = json.getAsJsonArray("element");
6984      for (int i = 0; i < array.size(); i++) {
6985        res.getElement().add(parseConceptMapSourceElementComponent(array.get(i).getAsJsonObject(), owner));
6986      }
6987    };
6988    if (json.has("unmapped"))
6989      res.setUnmapped(parseConceptMapConceptMapGroupUnmappedComponent(json.getAsJsonObject("unmapped"), owner));
6990  }
6991
6992  protected ConceptMap.SourceElementComponent parseConceptMapSourceElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6993    ConceptMap.SourceElementComponent res = new ConceptMap.SourceElementComponent();
6994    parseConceptMapSourceElementComponentProperties(json, owner, res);
6995    return res;
6996  }
6997
6998  protected void parseConceptMapSourceElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.SourceElementComponent res) throws IOException, FHIRFormatError {
6999    parseBackboneElementProperties(json, res);
7000    if (json.has("code"))
7001      res.setCodeElement(parseCode(json.get("code").getAsString()));
7002    if (json.has("_code"))
7003      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7004    if (json.has("display"))
7005      res.setDisplayElement(parseString(json.get("display").getAsString()));
7006    if (json.has("_display"))
7007      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
7008    if (json.has("target")) {
7009      JsonArray array = json.getAsJsonArray("target");
7010      for (int i = 0; i < array.size(); i++) {
7011        res.getTarget().add(parseConceptMapTargetElementComponent(array.get(i).getAsJsonObject(), owner));
7012      }
7013    };
7014  }
7015
7016  protected ConceptMap.TargetElementComponent parseConceptMapTargetElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
7017    ConceptMap.TargetElementComponent res = new ConceptMap.TargetElementComponent();
7018    parseConceptMapTargetElementComponentProperties(json, owner, res);
7019    return res;
7020  }
7021
7022  protected void parseConceptMapTargetElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.TargetElementComponent res) throws IOException, FHIRFormatError {
7023    parseBackboneElementProperties(json, res);
7024    if (json.has("code"))
7025      res.setCodeElement(parseCode(json.get("code").getAsString()));
7026    if (json.has("_code"))
7027      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7028    if (json.has("display"))
7029      res.setDisplayElement(parseString(json.get("display").getAsString()));
7030    if (json.has("_display"))
7031      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
7032    if (json.has("equivalence"))
7033      res.setEquivalenceElement(parseEnumeration(json.get("equivalence").getAsString(), Enumerations.ConceptMapEquivalence.NULL, new Enumerations.ConceptMapEquivalenceEnumFactory()));
7034    if (json.has("_equivalence"))
7035      parseElementProperties(json.getAsJsonObject("_equivalence"), res.getEquivalenceElement());
7036    if (json.has("comment"))
7037      res.setCommentElement(parseString(json.get("comment").getAsString()));
7038    if (json.has("_comment"))
7039      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
7040    if (json.has("dependsOn")) {
7041      JsonArray array = json.getAsJsonArray("dependsOn");
7042      for (int i = 0; i < array.size(); i++) {
7043        res.getDependsOn().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
7044      }
7045    };
7046    if (json.has("product")) {
7047      JsonArray array = json.getAsJsonArray("product");
7048      for (int i = 0; i < array.size(); i++) {
7049        res.getProduct().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
7050      }
7051    };
7052  }
7053
7054  protected ConceptMap.OtherElementComponent parseConceptMapOtherElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
7055    ConceptMap.OtherElementComponent res = new ConceptMap.OtherElementComponent();
7056    parseConceptMapOtherElementComponentProperties(json, owner, res);
7057    return res;
7058  }
7059
7060  protected void parseConceptMapOtherElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.OtherElementComponent res) throws IOException, FHIRFormatError {
7061    parseBackboneElementProperties(json, res);
7062    if (json.has("property"))
7063      res.setPropertyElement(parseUri(json.get("property").getAsString()));
7064    if (json.has("_property"))
7065      parseElementProperties(json.getAsJsonObject("_property"), res.getPropertyElement());
7066    if (json.has("system"))
7067      res.setSystemElement(parseCanonical(json.get("system").getAsString()));
7068    if (json.has("_system"))
7069      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
7070    if (json.has("value"))
7071      res.setValueElement(parseString(json.get("value").getAsString()));
7072    if (json.has("_value"))
7073      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
7074    if (json.has("display"))
7075      res.setDisplayElement(parseString(json.get("display").getAsString()));
7076    if (json.has("_display"))
7077      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
7078  }
7079
7080  protected ConceptMap.ConceptMapGroupUnmappedComponent parseConceptMapConceptMapGroupUnmappedComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
7081    ConceptMap.ConceptMapGroupUnmappedComponent res = new ConceptMap.ConceptMapGroupUnmappedComponent();
7082    parseConceptMapConceptMapGroupUnmappedComponentProperties(json, owner, res);
7083    return res;
7084  }
7085
7086  protected void parseConceptMapConceptMapGroupUnmappedComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupUnmappedComponent res) throws IOException, FHIRFormatError {
7087    parseBackboneElementProperties(json, res);
7088    if (json.has("mode"))
7089      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ConceptMap.ConceptMapGroupUnmappedMode.NULL, new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory()));
7090    if (json.has("_mode"))
7091      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
7092    if (json.has("code"))
7093      res.setCodeElement(parseCode(json.get("code").getAsString()));
7094    if (json.has("_code"))
7095      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7096    if (json.has("display"))
7097      res.setDisplayElement(parseString(json.get("display").getAsString()));
7098    if (json.has("_display"))
7099      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
7100    if (json.has("url"))
7101      res.setUrlElement(parseCanonical(json.get("url").getAsString()));
7102    if (json.has("_url"))
7103      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
7104  }
7105
7106  protected Condition parseCondition(JsonObject json) throws IOException, FHIRFormatError {
7107    Condition res = new Condition();
7108    parseConditionProperties(json, res);
7109    return res;
7110  }
7111
7112  protected void parseConditionProperties(JsonObject json, Condition res) throws IOException, FHIRFormatError {
7113    parseDomainResourceProperties(json, res);
7114    if (json.has("identifier")) {
7115      JsonArray array = json.getAsJsonArray("identifier");
7116      for (int i = 0; i < array.size(); i++) {
7117        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7118      }
7119    };
7120    if (json.has("clinicalStatus"))
7121      res.setClinicalStatus(parseCodeableConcept(json.getAsJsonObject("clinicalStatus")));
7122    if (json.has("verificationStatus"))
7123      res.setVerificationStatus(parseCodeableConcept(json.getAsJsonObject("verificationStatus")));
7124    if (json.has("category")) {
7125      JsonArray array = json.getAsJsonArray("category");
7126      for (int i = 0; i < array.size(); i++) {
7127        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7128      }
7129    };
7130    if (json.has("severity"))
7131      res.setSeverity(parseCodeableConcept(json.getAsJsonObject("severity")));
7132    if (json.has("code"))
7133      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
7134    if (json.has("bodySite")) {
7135      JsonArray array = json.getAsJsonArray("bodySite");
7136      for (int i = 0; i < array.size(); i++) {
7137        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7138      }
7139    };
7140    if (json.has("subject"))
7141      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7142    if (json.has("encounter"))
7143      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
7144    Type onset = parseType("onset", json);
7145    if (onset != null)
7146      res.setOnset(onset);
7147    Type abatement = parseType("abatement", json);
7148    if (abatement != null)
7149      res.setAbatement(abatement);
7150    if (json.has("recordedDate"))
7151      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
7152    if (json.has("_recordedDate"))
7153      parseElementProperties(json.getAsJsonObject("_recordedDate"), res.getRecordedDateElement());
7154    if (json.has("recorder"))
7155      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
7156    if (json.has("asserter"))
7157      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
7158    if (json.has("stage")) {
7159      JsonArray array = json.getAsJsonArray("stage");
7160      for (int i = 0; i < array.size(); i++) {
7161        res.getStage().add(parseConditionConditionStageComponent(array.get(i).getAsJsonObject(), res));
7162      }
7163    };
7164    if (json.has("evidence")) {
7165      JsonArray array = json.getAsJsonArray("evidence");
7166      for (int i = 0; i < array.size(); i++) {
7167        res.getEvidence().add(parseConditionConditionEvidenceComponent(array.get(i).getAsJsonObject(), res));
7168      }
7169    };
7170    if (json.has("note")) {
7171      JsonArray array = json.getAsJsonArray("note");
7172      for (int i = 0; i < array.size(); i++) {
7173        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7174      }
7175    };
7176  }
7177
7178  protected Condition.ConditionStageComponent parseConditionConditionStageComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
7179    Condition.ConditionStageComponent res = new Condition.ConditionStageComponent();
7180    parseConditionConditionStageComponentProperties(json, owner, res);
7181    return res;
7182  }
7183
7184  protected void parseConditionConditionStageComponentProperties(JsonObject json, Condition owner, Condition.ConditionStageComponent res) throws IOException, FHIRFormatError {
7185    parseBackboneElementProperties(json, res);
7186    if (json.has("summary"))
7187      res.setSummary(parseCodeableConcept(json.getAsJsonObject("summary")));
7188    if (json.has("assessment")) {
7189      JsonArray array = json.getAsJsonArray("assessment");
7190      for (int i = 0; i < array.size(); i++) {
7191        res.getAssessment().add(parseReference(array.get(i).getAsJsonObject()));
7192      }
7193    };
7194    if (json.has("type"))
7195      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7196  }
7197
7198  protected Condition.ConditionEvidenceComponent parseConditionConditionEvidenceComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
7199    Condition.ConditionEvidenceComponent res = new Condition.ConditionEvidenceComponent();
7200    parseConditionConditionEvidenceComponentProperties(json, owner, res);
7201    return res;
7202  }
7203
7204  protected void parseConditionConditionEvidenceComponentProperties(JsonObject json, Condition owner, Condition.ConditionEvidenceComponent res) throws IOException, FHIRFormatError {
7205    parseBackboneElementProperties(json, res);
7206    if (json.has("code")) {
7207      JsonArray array = json.getAsJsonArray("code");
7208      for (int i = 0; i < array.size(); i++) {
7209        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7210      }
7211    };
7212    if (json.has("detail")) {
7213      JsonArray array = json.getAsJsonArray("detail");
7214      for (int i = 0; i < array.size(); i++) {
7215        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
7216      }
7217    };
7218  }
7219
7220  protected Consent parseConsent(JsonObject json) throws IOException, FHIRFormatError {
7221    Consent res = new Consent();
7222    parseConsentProperties(json, res);
7223    return res;
7224  }
7225
7226  protected void parseConsentProperties(JsonObject json, Consent res) throws IOException, FHIRFormatError {
7227    parseDomainResourceProperties(json, res);
7228    if (json.has("identifier")) {
7229      JsonArray array = json.getAsJsonArray("identifier");
7230      for (int i = 0; i < array.size(); i++) {
7231        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7232      }
7233    };
7234    if (json.has("status"))
7235      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Consent.ConsentState.NULL, new Consent.ConsentStateEnumFactory()));
7236    if (json.has("_status"))
7237      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7238    if (json.has("scope"))
7239      res.setScope(parseCodeableConcept(json.getAsJsonObject("scope")));
7240    if (json.has("category")) {
7241      JsonArray array = json.getAsJsonArray("category");
7242      for (int i = 0; i < array.size(); i++) {
7243        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7244      }
7245    };
7246    if (json.has("patient"))
7247      res.setPatient(parseReference(json.getAsJsonObject("patient")));
7248    if (json.has("dateTime"))
7249      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
7250    if (json.has("_dateTime"))
7251      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
7252    if (json.has("performer")) {
7253      JsonArray array = json.getAsJsonArray("performer");
7254      for (int i = 0; i < array.size(); i++) {
7255        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
7256      }
7257    };
7258    if (json.has("organization")) {
7259      JsonArray array = json.getAsJsonArray("organization");
7260      for (int i = 0; i < array.size(); i++) {
7261        res.getOrganization().add(parseReference(array.get(i).getAsJsonObject()));
7262      }
7263    };
7264    Type source = parseType("source", json);
7265    if (source != null)
7266      res.setSource(source);
7267    if (json.has("policy")) {
7268      JsonArray array = json.getAsJsonArray("policy");
7269      for (int i = 0; i < array.size(); i++) {
7270        res.getPolicy().add(parseConsentConsentPolicyComponent(array.get(i).getAsJsonObject(), res));
7271      }
7272    };
7273    if (json.has("policyRule"))
7274      res.setPolicyRule(parseCodeableConcept(json.getAsJsonObject("policyRule")));
7275    if (json.has("verification")) {
7276      JsonArray array = json.getAsJsonArray("verification");
7277      for (int i = 0; i < array.size(); i++) {
7278        res.getVerification().add(parseConsentConsentVerificationComponent(array.get(i).getAsJsonObject(), res));
7279      }
7280    };
7281    if (json.has("provision"))
7282      res.setProvision(parseConsentprovisionComponent(json.getAsJsonObject("provision"), res));
7283  }
7284
7285  protected Consent.ConsentPolicyComponent parseConsentConsentPolicyComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7286    Consent.ConsentPolicyComponent res = new Consent.ConsentPolicyComponent();
7287    parseConsentConsentPolicyComponentProperties(json, owner, res);
7288    return res;
7289  }
7290
7291  protected void parseConsentConsentPolicyComponentProperties(JsonObject json, Consent owner, Consent.ConsentPolicyComponent res) throws IOException, FHIRFormatError {
7292    parseBackboneElementProperties(json, res);
7293    if (json.has("authority"))
7294      res.setAuthorityElement(parseUri(json.get("authority").getAsString()));
7295    if (json.has("_authority"))
7296      parseElementProperties(json.getAsJsonObject("_authority"), res.getAuthorityElement());
7297    if (json.has("uri"))
7298      res.setUriElement(parseUri(json.get("uri").getAsString()));
7299    if (json.has("_uri"))
7300      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
7301  }
7302
7303  protected Consent.ConsentVerificationComponent parseConsentConsentVerificationComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7304    Consent.ConsentVerificationComponent res = new Consent.ConsentVerificationComponent();
7305    parseConsentConsentVerificationComponentProperties(json, owner, res);
7306    return res;
7307  }
7308
7309  protected void parseConsentConsentVerificationComponentProperties(JsonObject json, Consent owner, Consent.ConsentVerificationComponent res) throws IOException, FHIRFormatError {
7310    parseBackboneElementProperties(json, res);
7311    if (json.has("verified"))
7312      res.setVerifiedElement(parseBoolean(json.get("verified").getAsBoolean()));
7313    if (json.has("_verified"))
7314      parseElementProperties(json.getAsJsonObject("_verified"), res.getVerifiedElement());
7315    if (json.has("verifiedWith"))
7316      res.setVerifiedWith(parseReference(json.getAsJsonObject("verifiedWith")));
7317    if (json.has("verificationDate"))
7318      res.setVerificationDateElement(parseDateTime(json.get("verificationDate").getAsString()));
7319    if (json.has("_verificationDate"))
7320      parseElementProperties(json.getAsJsonObject("_verificationDate"), res.getVerificationDateElement());
7321  }
7322
7323  protected Consent.provisionComponent parseConsentprovisionComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7324    Consent.provisionComponent res = new Consent.provisionComponent();
7325    parseConsentprovisionComponentProperties(json, owner, res);
7326    return res;
7327  }
7328
7329  protected void parseConsentprovisionComponentProperties(JsonObject json, Consent owner, Consent.provisionComponent res) throws IOException, FHIRFormatError {
7330    parseBackboneElementProperties(json, res);
7331    if (json.has("type"))
7332      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Consent.ConsentProvisionType.NULL, new Consent.ConsentProvisionTypeEnumFactory()));
7333    if (json.has("_type"))
7334      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
7335    if (json.has("period"))
7336      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
7337    if (json.has("actor")) {
7338      JsonArray array = json.getAsJsonArray("actor");
7339      for (int i = 0; i < array.size(); i++) {
7340        res.getActor().add(parseConsentprovisionActorComponent(array.get(i).getAsJsonObject(), owner));
7341      }
7342    };
7343    if (json.has("action")) {
7344      JsonArray array = json.getAsJsonArray("action");
7345      for (int i = 0; i < array.size(); i++) {
7346        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7347      }
7348    };
7349    if (json.has("securityLabel")) {
7350      JsonArray array = json.getAsJsonArray("securityLabel");
7351      for (int i = 0; i < array.size(); i++) {
7352        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
7353      }
7354    };
7355    if (json.has("purpose")) {
7356      JsonArray array = json.getAsJsonArray("purpose");
7357      for (int i = 0; i < array.size(); i++) {
7358        res.getPurpose().add(parseCoding(array.get(i).getAsJsonObject()));
7359      }
7360    };
7361    if (json.has("class")) {
7362      JsonArray array = json.getAsJsonArray("class");
7363      for (int i = 0; i < array.size(); i++) {
7364        res.getClass_().add(parseCoding(array.get(i).getAsJsonObject()));
7365      }
7366    };
7367    if (json.has("code")) {
7368      JsonArray array = json.getAsJsonArray("code");
7369      for (int i = 0; i < array.size(); i++) {
7370        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7371      }
7372    };
7373    if (json.has("dataPeriod"))
7374      res.setDataPeriod(parsePeriod(json.getAsJsonObject("dataPeriod")));
7375    if (json.has("data")) {
7376      JsonArray array = json.getAsJsonArray("data");
7377      for (int i = 0; i < array.size(); i++) {
7378        res.getData().add(parseConsentprovisionDataComponent(array.get(i).getAsJsonObject(), owner));
7379      }
7380    };
7381    if (json.has("provision")) {
7382      JsonArray array = json.getAsJsonArray("provision");
7383      for (int i = 0; i < array.size(); i++) {
7384        res.getProvision().add(parseConsentprovisionComponent(array.get(i).getAsJsonObject(), owner));
7385      }
7386    };
7387  }
7388
7389  protected Consent.provisionActorComponent parseConsentprovisionActorComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7390    Consent.provisionActorComponent res = new Consent.provisionActorComponent();
7391    parseConsentprovisionActorComponentProperties(json, owner, res);
7392    return res;
7393  }
7394
7395  protected void parseConsentprovisionActorComponentProperties(JsonObject json, Consent owner, Consent.provisionActorComponent res) throws IOException, FHIRFormatError {
7396    parseBackboneElementProperties(json, res);
7397    if (json.has("role"))
7398      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
7399    if (json.has("reference"))
7400      res.setReference(parseReference(json.getAsJsonObject("reference")));
7401  }
7402
7403  protected Consent.provisionDataComponent parseConsentprovisionDataComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7404    Consent.provisionDataComponent res = new Consent.provisionDataComponent();
7405    parseConsentprovisionDataComponentProperties(json, owner, res);
7406    return res;
7407  }
7408
7409  protected void parseConsentprovisionDataComponentProperties(JsonObject json, Consent owner, Consent.provisionDataComponent res) throws IOException, FHIRFormatError {
7410    parseBackboneElementProperties(json, res);
7411    if (json.has("meaning"))
7412      res.setMeaningElement(parseEnumeration(json.get("meaning").getAsString(), Consent.ConsentDataMeaning.NULL, new Consent.ConsentDataMeaningEnumFactory()));
7413    if (json.has("_meaning"))
7414      parseElementProperties(json.getAsJsonObject("_meaning"), res.getMeaningElement());
7415    if (json.has("reference"))
7416      res.setReference(parseReference(json.getAsJsonObject("reference")));
7417  }
7418
7419  protected Contract parseContract(JsonObject json) throws IOException, FHIRFormatError {
7420    Contract res = new Contract();
7421    parseContractProperties(json, res);
7422    return res;
7423  }
7424
7425  protected void parseContractProperties(JsonObject json, Contract res) throws IOException, FHIRFormatError {
7426    parseDomainResourceProperties(json, res);
7427    if (json.has("identifier")) {
7428      JsonArray array = json.getAsJsonArray("identifier");
7429      for (int i = 0; i < array.size(); i++) {
7430        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7431      }
7432    };
7433    if (json.has("url"))
7434      res.setUrlElement(parseUri(json.get("url").getAsString()));
7435    if (json.has("_url"))
7436      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
7437    if (json.has("version"))
7438      res.setVersionElement(parseString(json.get("version").getAsString()));
7439    if (json.has("_version"))
7440      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
7441    if (json.has("status"))
7442      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Contract.ContractStatus.NULL, new Contract.ContractStatusEnumFactory()));
7443    if (json.has("_status"))
7444      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7445    if (json.has("legalState"))
7446      res.setLegalState(parseCodeableConcept(json.getAsJsonObject("legalState")));
7447    if (json.has("instantiatesCanonical"))
7448      res.setInstantiatesCanonical(parseReference(json.getAsJsonObject("instantiatesCanonical")));
7449    if (json.has("instantiatesUri"))
7450      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
7451    if (json.has("_instantiatesUri"))
7452      parseElementProperties(json.getAsJsonObject("_instantiatesUri"), res.getInstantiatesUriElement());
7453    if (json.has("contentDerivative"))
7454      res.setContentDerivative(parseCodeableConcept(json.getAsJsonObject("contentDerivative")));
7455    if (json.has("issued"))
7456      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
7457    if (json.has("_issued"))
7458      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
7459    if (json.has("applies"))
7460      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
7461    if (json.has("expirationType"))
7462      res.setExpirationType(parseCodeableConcept(json.getAsJsonObject("expirationType")));
7463    if (json.has("subject")) {
7464      JsonArray array = json.getAsJsonArray("subject");
7465      for (int i = 0; i < array.size(); i++) {
7466        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
7467      }
7468    };
7469    if (json.has("authority")) {
7470      JsonArray array = json.getAsJsonArray("authority");
7471      for (int i = 0; i < array.size(); i++) {
7472        res.getAuthority().add(parseReference(array.get(i).getAsJsonObject()));
7473      }
7474    };
7475    if (json.has("domain")) {
7476      JsonArray array = json.getAsJsonArray("domain");
7477      for (int i = 0; i < array.size(); i++) {
7478        res.getDomain().add(parseReference(array.get(i).getAsJsonObject()));
7479      }
7480    };
7481    if (json.has("site")) {
7482      JsonArray array = json.getAsJsonArray("site");
7483      for (int i = 0; i < array.size(); i++) {
7484        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
7485      }
7486    };
7487    if (json.has("name"))
7488      res.setNameElement(parseString(json.get("name").getAsString()));
7489    if (json.has("_name"))
7490      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7491    if (json.has("title"))
7492      res.setTitleElement(parseString(json.get("title").getAsString()));
7493    if (json.has("_title"))
7494      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
7495    if (json.has("subtitle"))
7496      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
7497    if (json.has("_subtitle"))
7498      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
7499    if (json.has("alias")) {
7500      JsonArray array = json.getAsJsonArray("alias");
7501      for (int i = 0; i < array.size(); i++) {
7502        res.getAlias().add(parseString(array.get(i).getAsString()));
7503      }
7504    };
7505    if (json.has("_alias")) {
7506      JsonArray array = json.getAsJsonArray("_alias");
7507      for (int i = 0; i < array.size(); i++) {
7508        if (i == res.getAlias().size())
7509          res.getAlias().add(parseString(null));
7510        if (array.get(i) instanceof JsonObject) 
7511          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
7512      }
7513    };
7514    if (json.has("author"))
7515      res.setAuthor(parseReference(json.getAsJsonObject("author")));
7516    if (json.has("scope"))
7517      res.setScope(parseCodeableConcept(json.getAsJsonObject("scope")));
7518    Type topic = parseType("topic", json);
7519    if (topic != null)
7520      res.setTopic(topic);
7521    if (json.has("type"))
7522      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7523    if (json.has("subType")) {
7524      JsonArray array = json.getAsJsonArray("subType");
7525      for (int i = 0; i < array.size(); i++) {
7526        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7527      }
7528    };
7529    if (json.has("contentDefinition"))
7530      res.setContentDefinition(parseContractContentDefinitionComponent(json.getAsJsonObject("contentDefinition"), res));
7531    if (json.has("term")) {
7532      JsonArray array = json.getAsJsonArray("term");
7533      for (int i = 0; i < array.size(); i++) {
7534        res.getTerm().add(parseContractTermComponent(array.get(i).getAsJsonObject(), res));
7535      }
7536    };
7537    if (json.has("supportingInfo")) {
7538      JsonArray array = json.getAsJsonArray("supportingInfo");
7539      for (int i = 0; i < array.size(); i++) {
7540        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
7541      }
7542    };
7543    if (json.has("relevantHistory")) {
7544      JsonArray array = json.getAsJsonArray("relevantHistory");
7545      for (int i = 0; i < array.size(); i++) {
7546        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
7547      }
7548    };
7549    if (json.has("signer")) {
7550      JsonArray array = json.getAsJsonArray("signer");
7551      for (int i = 0; i < array.size(); i++) {
7552        res.getSigner().add(parseContractSignatoryComponent(array.get(i).getAsJsonObject(), res));
7553      }
7554    };
7555    if (json.has("friendly")) {
7556      JsonArray array = json.getAsJsonArray("friendly");
7557      for (int i = 0; i < array.size(); i++) {
7558        res.getFriendly().add(parseContractFriendlyLanguageComponent(array.get(i).getAsJsonObject(), res));
7559      }
7560    };
7561    if (json.has("legal")) {
7562      JsonArray array = json.getAsJsonArray("legal");
7563      for (int i = 0; i < array.size(); i++) {
7564        res.getLegal().add(parseContractLegalLanguageComponent(array.get(i).getAsJsonObject(), res));
7565      }
7566    };
7567    if (json.has("rule")) {
7568      JsonArray array = json.getAsJsonArray("rule");
7569      for (int i = 0; i < array.size(); i++) {
7570        res.getRule().add(parseContractComputableLanguageComponent(array.get(i).getAsJsonObject(), res));
7571      }
7572    };
7573    Type legallyBinding = parseType("legallyBinding", json);
7574    if (legallyBinding != null)
7575      res.setLegallyBinding(legallyBinding);
7576  }
7577
7578  protected Contract.ContentDefinitionComponent parseContractContentDefinitionComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7579    Contract.ContentDefinitionComponent res = new Contract.ContentDefinitionComponent();
7580    parseContractContentDefinitionComponentProperties(json, owner, res);
7581    return res;
7582  }
7583
7584  protected void parseContractContentDefinitionComponentProperties(JsonObject json, Contract owner, Contract.ContentDefinitionComponent res) throws IOException, FHIRFormatError {
7585    parseBackboneElementProperties(json, res);
7586    if (json.has("type"))
7587      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7588    if (json.has("subType"))
7589      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
7590    if (json.has("publisher"))
7591      res.setPublisher(parseReference(json.getAsJsonObject("publisher")));
7592    if (json.has("publicationDate"))
7593      res.setPublicationDateElement(parseDateTime(json.get("publicationDate").getAsString()));
7594    if (json.has("_publicationDate"))
7595      parseElementProperties(json.getAsJsonObject("_publicationDate"), res.getPublicationDateElement());
7596    if (json.has("publicationStatus"))
7597      res.setPublicationStatusElement(parseEnumeration(json.get("publicationStatus").getAsString(), Contract.ContractPublicationStatus.NULL, new Contract.ContractPublicationStatusEnumFactory()));
7598    if (json.has("_publicationStatus"))
7599      parseElementProperties(json.getAsJsonObject("_publicationStatus"), res.getPublicationStatusElement());
7600    if (json.has("copyright"))
7601      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
7602    if (json.has("_copyright"))
7603      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
7604  }
7605
7606  protected Contract.TermComponent parseContractTermComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7607    Contract.TermComponent res = new Contract.TermComponent();
7608    parseContractTermComponentProperties(json, owner, res);
7609    return res;
7610  }
7611
7612  protected void parseContractTermComponentProperties(JsonObject json, Contract owner, Contract.TermComponent res) throws IOException, FHIRFormatError {
7613    parseBackboneElementProperties(json, res);
7614    if (json.has("identifier"))
7615      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
7616    if (json.has("issued"))
7617      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
7618    if (json.has("_issued"))
7619      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
7620    if (json.has("applies"))
7621      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
7622    Type topic = parseType("topic", json);
7623    if (topic != null)
7624      res.setTopic(topic);
7625    if (json.has("type"))
7626      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7627    if (json.has("subType"))
7628      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
7629    if (json.has("text"))
7630      res.setTextElement(parseString(json.get("text").getAsString()));
7631    if (json.has("_text"))
7632      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7633    if (json.has("securityLabel")) {
7634      JsonArray array = json.getAsJsonArray("securityLabel");
7635      for (int i = 0; i < array.size(); i++) {
7636        res.getSecurityLabel().add(parseContractSecurityLabelComponent(array.get(i).getAsJsonObject(), owner));
7637      }
7638    };
7639    if (json.has("offer"))
7640      res.setOffer(parseContractContractOfferComponent(json.getAsJsonObject("offer"), owner));
7641    if (json.has("asset")) {
7642      JsonArray array = json.getAsJsonArray("asset");
7643      for (int i = 0; i < array.size(); i++) {
7644        res.getAsset().add(parseContractContractAssetComponent(array.get(i).getAsJsonObject(), owner));
7645      }
7646    };
7647    if (json.has("action")) {
7648      JsonArray array = json.getAsJsonArray("action");
7649      for (int i = 0; i < array.size(); i++) {
7650        res.getAction().add(parseContractActionComponent(array.get(i).getAsJsonObject(), owner));
7651      }
7652    };
7653    if (json.has("group")) {
7654      JsonArray array = json.getAsJsonArray("group");
7655      for (int i = 0; i < array.size(); i++) {
7656        res.getGroup().add(parseContractTermComponent(array.get(i).getAsJsonObject(), owner));
7657      }
7658    };
7659  }
7660
7661  protected Contract.SecurityLabelComponent parseContractSecurityLabelComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7662    Contract.SecurityLabelComponent res = new Contract.SecurityLabelComponent();
7663    parseContractSecurityLabelComponentProperties(json, owner, res);
7664    return res;
7665  }
7666
7667  protected void parseContractSecurityLabelComponentProperties(JsonObject json, Contract owner, Contract.SecurityLabelComponent res) throws IOException, FHIRFormatError {
7668    parseBackboneElementProperties(json, res);
7669    if (json.has("number")) {
7670      JsonArray array = json.getAsJsonArray("number");
7671      for (int i = 0; i < array.size(); i++) {
7672        res.getNumber().add(parseUnsignedInt(array.get(i).getAsString()));
7673      }
7674    };
7675    if (json.has("_number")) {
7676      JsonArray array = json.getAsJsonArray("_number");
7677      for (int i = 0; i < array.size(); i++) {
7678        if (i == res.getNumber().size())
7679          res.getNumber().add(parseUnsignedInt(null));
7680        if (array.get(i) instanceof JsonObject) 
7681          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumber().get(i));
7682      }
7683    };
7684    if (json.has("classification"))
7685      res.setClassification(parseCoding(json.getAsJsonObject("classification")));
7686    if (json.has("category")) {
7687      JsonArray array = json.getAsJsonArray("category");
7688      for (int i = 0; i < array.size(); i++) {
7689        res.getCategory().add(parseCoding(array.get(i).getAsJsonObject()));
7690      }
7691    };
7692    if (json.has("control")) {
7693      JsonArray array = json.getAsJsonArray("control");
7694      for (int i = 0; i < array.size(); i++) {
7695        res.getControl().add(parseCoding(array.get(i).getAsJsonObject()));
7696      }
7697    };
7698  }
7699
7700  protected Contract.ContractOfferComponent parseContractContractOfferComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7701    Contract.ContractOfferComponent res = new Contract.ContractOfferComponent();
7702    parseContractContractOfferComponentProperties(json, owner, res);
7703    return res;
7704  }
7705
7706  protected void parseContractContractOfferComponentProperties(JsonObject json, Contract owner, Contract.ContractOfferComponent res) throws IOException, FHIRFormatError {
7707    parseBackboneElementProperties(json, res);
7708    if (json.has("identifier")) {
7709      JsonArray array = json.getAsJsonArray("identifier");
7710      for (int i = 0; i < array.size(); i++) {
7711        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7712      }
7713    };
7714    if (json.has("party")) {
7715      JsonArray array = json.getAsJsonArray("party");
7716      for (int i = 0; i < array.size(); i++) {
7717        res.getParty().add(parseContractContractPartyComponent(array.get(i).getAsJsonObject(), owner));
7718      }
7719    };
7720    if (json.has("topic"))
7721      res.setTopic(parseReference(json.getAsJsonObject("topic")));
7722    if (json.has("type"))
7723      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7724    if (json.has("decision"))
7725      res.setDecision(parseCodeableConcept(json.getAsJsonObject("decision")));
7726    if (json.has("decisionMode")) {
7727      JsonArray array = json.getAsJsonArray("decisionMode");
7728      for (int i = 0; i < array.size(); i++) {
7729        res.getDecisionMode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7730      }
7731    };
7732    if (json.has("answer")) {
7733      JsonArray array = json.getAsJsonArray("answer");
7734      for (int i = 0; i < array.size(); i++) {
7735        res.getAnswer().add(parseContractAnswerComponent(array.get(i).getAsJsonObject(), owner));
7736      }
7737    };
7738    if (json.has("text"))
7739      res.setTextElement(parseString(json.get("text").getAsString()));
7740    if (json.has("_text"))
7741      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7742    if (json.has("linkId")) {
7743      JsonArray array = json.getAsJsonArray("linkId");
7744      for (int i = 0; i < array.size(); i++) {
7745        res.getLinkId().add(parseString(array.get(i).getAsString()));
7746      }
7747    };
7748    if (json.has("_linkId")) {
7749      JsonArray array = json.getAsJsonArray("_linkId");
7750      for (int i = 0; i < array.size(); i++) {
7751        if (i == res.getLinkId().size())
7752          res.getLinkId().add(parseString(null));
7753        if (array.get(i) instanceof JsonObject) 
7754          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
7755      }
7756    };
7757    if (json.has("securityLabelNumber")) {
7758      JsonArray array = json.getAsJsonArray("securityLabelNumber");
7759      for (int i = 0; i < array.size(); i++) {
7760        res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
7761      }
7762    };
7763    if (json.has("_securityLabelNumber")) {
7764      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
7765      for (int i = 0; i < array.size(); i++) {
7766        if (i == res.getSecurityLabelNumber().size())
7767          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
7768        if (array.get(i) instanceof JsonObject) 
7769          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
7770      }
7771    };
7772  }
7773
7774  protected Contract.ContractPartyComponent parseContractContractPartyComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7775    Contract.ContractPartyComponent res = new Contract.ContractPartyComponent();
7776    parseContractContractPartyComponentProperties(json, owner, res);
7777    return res;
7778  }
7779
7780  protected void parseContractContractPartyComponentProperties(JsonObject json, Contract owner, Contract.ContractPartyComponent res) throws IOException, FHIRFormatError {
7781    parseBackboneElementProperties(json, res);
7782    if (json.has("reference")) {
7783      JsonArray array = json.getAsJsonArray("reference");
7784      for (int i = 0; i < array.size(); i++) {
7785        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
7786      }
7787    };
7788    if (json.has("role"))
7789      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
7790  }
7791
7792  protected Contract.AnswerComponent parseContractAnswerComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7793    Contract.AnswerComponent res = new Contract.AnswerComponent();
7794    parseContractAnswerComponentProperties(json, owner, res);
7795    return res;
7796  }
7797
7798  protected void parseContractAnswerComponentProperties(JsonObject json, Contract owner, Contract.AnswerComponent res) throws IOException, FHIRFormatError {
7799    parseBackboneElementProperties(json, res);
7800    Type value = parseType("value", json);
7801    if (value != null)
7802      res.setValue(value);
7803  }
7804
7805  protected Contract.ContractAssetComponent parseContractContractAssetComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7806    Contract.ContractAssetComponent res = new Contract.ContractAssetComponent();
7807    parseContractContractAssetComponentProperties(json, owner, res);
7808    return res;
7809  }
7810
7811  protected void parseContractContractAssetComponentProperties(JsonObject json, Contract owner, Contract.ContractAssetComponent res) throws IOException, FHIRFormatError {
7812    parseBackboneElementProperties(json, res);
7813    if (json.has("scope"))
7814      res.setScope(parseCodeableConcept(json.getAsJsonObject("scope")));
7815    if (json.has("type")) {
7816      JsonArray array = json.getAsJsonArray("type");
7817      for (int i = 0; i < array.size(); i++) {
7818        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7819      }
7820    };
7821    if (json.has("typeReference")) {
7822      JsonArray array = json.getAsJsonArray("typeReference");
7823      for (int i = 0; i < array.size(); i++) {
7824        res.getTypeReference().add(parseReference(array.get(i).getAsJsonObject()));
7825      }
7826    };
7827    if (json.has("subtype")) {
7828      JsonArray array = json.getAsJsonArray("subtype");
7829      for (int i = 0; i < array.size(); i++) {
7830        res.getSubtype().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7831      }
7832    };
7833    if (json.has("relationship"))
7834      res.setRelationship(parseCoding(json.getAsJsonObject("relationship")));
7835    if (json.has("context")) {
7836      JsonArray array = json.getAsJsonArray("context");
7837      for (int i = 0; i < array.size(); i++) {
7838        res.getContext().add(parseContractAssetContextComponent(array.get(i).getAsJsonObject(), owner));
7839      }
7840    };
7841    if (json.has("condition"))
7842      res.setConditionElement(parseString(json.get("condition").getAsString()));
7843    if (json.has("_condition"))
7844      parseElementProperties(json.getAsJsonObject("_condition"), res.getConditionElement());
7845    if (json.has("periodType")) {
7846      JsonArray array = json.getAsJsonArray("periodType");
7847      for (int i = 0; i < array.size(); i++) {
7848        res.getPeriodType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7849      }
7850    };
7851    if (json.has("period")) {
7852      JsonArray array = json.getAsJsonArray("period");
7853      for (int i = 0; i < array.size(); i++) {
7854        res.getPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
7855      }
7856    };
7857    if (json.has("usePeriod")) {
7858      JsonArray array = json.getAsJsonArray("usePeriod");
7859      for (int i = 0; i < array.size(); i++) {
7860        res.getUsePeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
7861      }
7862    };
7863    if (json.has("text"))
7864      res.setTextElement(parseString(json.get("text").getAsString()));
7865    if (json.has("_text"))
7866      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7867    if (json.has("linkId")) {
7868      JsonArray array = json.getAsJsonArray("linkId");
7869      for (int i = 0; i < array.size(); i++) {
7870        res.getLinkId().add(parseString(array.get(i).getAsString()));
7871      }
7872    };
7873    if (json.has("_linkId")) {
7874      JsonArray array = json.getAsJsonArray("_linkId");
7875      for (int i = 0; i < array.size(); i++) {
7876        if (i == res.getLinkId().size())
7877          res.getLinkId().add(parseString(null));
7878        if (array.get(i) instanceof JsonObject) 
7879          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
7880      }
7881    };
7882    if (json.has("answer")) {
7883      JsonArray array = json.getAsJsonArray("answer");
7884      for (int i = 0; i < array.size(); i++) {
7885        res.getAnswer().add(parseContractAnswerComponent(array.get(i).getAsJsonObject(), owner));
7886      }
7887    };
7888    if (json.has("securityLabelNumber")) {
7889      JsonArray array = json.getAsJsonArray("securityLabelNumber");
7890      for (int i = 0; i < array.size(); i++) {
7891        res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
7892      }
7893    };
7894    if (json.has("_securityLabelNumber")) {
7895      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
7896      for (int i = 0; i < array.size(); i++) {
7897        if (i == res.getSecurityLabelNumber().size())
7898          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
7899        if (array.get(i) instanceof JsonObject) 
7900          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
7901      }
7902    };
7903    if (json.has("valuedItem")) {
7904      JsonArray array = json.getAsJsonArray("valuedItem");
7905      for (int i = 0; i < array.size(); i++) {
7906        res.getValuedItem().add(parseContractValuedItemComponent(array.get(i).getAsJsonObject(), owner));
7907      }
7908    };
7909  }
7910
7911  protected Contract.AssetContextComponent parseContractAssetContextComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7912    Contract.AssetContextComponent res = new Contract.AssetContextComponent();
7913    parseContractAssetContextComponentProperties(json, owner, res);
7914    return res;
7915  }
7916
7917  protected void parseContractAssetContextComponentProperties(JsonObject json, Contract owner, Contract.AssetContextComponent res) throws IOException, FHIRFormatError {
7918    parseBackboneElementProperties(json, res);
7919    if (json.has("reference"))
7920      res.setReference(parseReference(json.getAsJsonObject("reference")));
7921    if (json.has("code")) {
7922      JsonArray array = json.getAsJsonArray("code");
7923      for (int i = 0; i < array.size(); i++) {
7924        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7925      }
7926    };
7927    if (json.has("text"))
7928      res.setTextElement(parseString(json.get("text").getAsString()));
7929    if (json.has("_text"))
7930      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7931  }
7932
7933  protected Contract.ValuedItemComponent parseContractValuedItemComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7934    Contract.ValuedItemComponent res = new Contract.ValuedItemComponent();
7935    parseContractValuedItemComponentProperties(json, owner, res);
7936    return res;
7937  }
7938
7939  protected void parseContractValuedItemComponentProperties(JsonObject json, Contract owner, Contract.ValuedItemComponent res) throws IOException, FHIRFormatError {
7940    parseBackboneElementProperties(json, res);
7941    Type entity = parseType("entity", json);
7942    if (entity != null)
7943      res.setEntity(entity);
7944    if (json.has("identifier"))
7945      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
7946    if (json.has("effectiveTime"))
7947      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
7948    if (json.has("_effectiveTime"))
7949      parseElementProperties(json.getAsJsonObject("_effectiveTime"), res.getEffectiveTimeElement());
7950    if (json.has("quantity"))
7951      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
7952    if (json.has("unitPrice"))
7953      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
7954    if (json.has("factor"))
7955      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7956    if (json.has("_factor"))
7957      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
7958    if (json.has("points"))
7959      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
7960    if (json.has("_points"))
7961      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
7962    if (json.has("net"))
7963      res.setNet(parseMoney(json.getAsJsonObject("net")));
7964    if (json.has("payment"))
7965      res.setPaymentElement(parseString(json.get("payment").getAsString()));
7966    if (json.has("_payment"))
7967      parseElementProperties(json.getAsJsonObject("_payment"), res.getPaymentElement());
7968    if (json.has("paymentDate"))
7969      res.setPaymentDateElement(parseDateTime(json.get("paymentDate").getAsString()));
7970    if (json.has("_paymentDate"))
7971      parseElementProperties(json.getAsJsonObject("_paymentDate"), res.getPaymentDateElement());
7972    if (json.has("responsible"))
7973      res.setResponsible(parseReference(json.getAsJsonObject("responsible")));
7974    if (json.has("recipient"))
7975      res.setRecipient(parseReference(json.getAsJsonObject("recipient")));
7976    if (json.has("linkId")) {
7977      JsonArray array = json.getAsJsonArray("linkId");
7978      for (int i = 0; i < array.size(); i++) {
7979        res.getLinkId().add(parseString(array.get(i).getAsString()));
7980      }
7981    };
7982    if (json.has("_linkId")) {
7983      JsonArray array = json.getAsJsonArray("_linkId");
7984      for (int i = 0; i < array.size(); i++) {
7985        if (i == res.getLinkId().size())
7986          res.getLinkId().add(parseString(null));
7987        if (array.get(i) instanceof JsonObject) 
7988          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
7989      }
7990    };
7991    if (json.has("securityLabelNumber")) {
7992      JsonArray array = json.getAsJsonArray("securityLabelNumber");
7993      for (int i = 0; i < array.size(); i++) {
7994        res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
7995      }
7996    };
7997    if (json.has("_securityLabelNumber")) {
7998      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
7999      for (int i = 0; i < array.size(); i++) {
8000        if (i == res.getSecurityLabelNumber().size())
8001          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
8002        if (array.get(i) instanceof JsonObject) 
8003          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
8004      }
8005    };
8006  }
8007
8008  protected Contract.ActionComponent parseContractActionComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8009    Contract.ActionComponent res = new Contract.ActionComponent();
8010    parseContractActionComponentProperties(json, owner, res);
8011    return res;
8012  }
8013
8014  protected void parseContractActionComponentProperties(JsonObject json, Contract owner, Contract.ActionComponent res) throws IOException, FHIRFormatError {
8015    parseBackboneElementProperties(json, res);
8016    if (json.has("doNotPerform"))
8017      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
8018    if (json.has("_doNotPerform"))
8019      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
8020    if (json.has("type"))
8021      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8022    if (json.has("subject")) {
8023      JsonArray array = json.getAsJsonArray("subject");
8024      for (int i = 0; i < array.size(); i++) {
8025        res.getSubject().add(parseContractActionSubjectComponent(array.get(i).getAsJsonObject(), owner));
8026      }
8027    };
8028    if (json.has("intent"))
8029      res.setIntent(parseCodeableConcept(json.getAsJsonObject("intent")));
8030    if (json.has("linkId")) {
8031      JsonArray array = json.getAsJsonArray("linkId");
8032      for (int i = 0; i < array.size(); i++) {
8033        res.getLinkId().add(parseString(array.get(i).getAsString()));
8034      }
8035    };
8036    if (json.has("_linkId")) {
8037      JsonArray array = json.getAsJsonArray("_linkId");
8038      for (int i = 0; i < array.size(); i++) {
8039        if (i == res.getLinkId().size())
8040          res.getLinkId().add(parseString(null));
8041        if (array.get(i) instanceof JsonObject) 
8042          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
8043      }
8044    };
8045    if (json.has("status"))
8046      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
8047    if (json.has("context"))
8048      res.setContext(parseReference(json.getAsJsonObject("context")));
8049    if (json.has("contextLinkId")) {
8050      JsonArray array = json.getAsJsonArray("contextLinkId");
8051      for (int i = 0; i < array.size(); i++) {
8052        res.getContextLinkId().add(parseString(array.get(i).getAsString()));
8053      }
8054    };
8055    if (json.has("_contextLinkId")) {
8056      JsonArray array = json.getAsJsonArray("_contextLinkId");
8057      for (int i = 0; i < array.size(); i++) {
8058        if (i == res.getContextLinkId().size())
8059          res.getContextLinkId().add(parseString(null));
8060        if (array.get(i) instanceof JsonObject) 
8061          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextLinkId().get(i));
8062      }
8063    };
8064    Type occurrence = parseType("occurrence", json);
8065    if (occurrence != null)
8066      res.setOccurrence(occurrence);
8067    if (json.has("requester")) {
8068      JsonArray array = json.getAsJsonArray("requester");
8069      for (int i = 0; i < array.size(); i++) {
8070        res.getRequester().add(parseReference(array.get(i).getAsJsonObject()));
8071      }
8072    };
8073    if (json.has("requesterLinkId")) {
8074      JsonArray array = json.getAsJsonArray("requesterLinkId");
8075      for (int i = 0; i < array.size(); i++) {
8076        res.getRequesterLinkId().add(parseString(array.get(i).getAsString()));
8077      }
8078    };
8079    if (json.has("_requesterLinkId")) {
8080      JsonArray array = json.getAsJsonArray("_requesterLinkId");
8081      for (int i = 0; i < array.size(); i++) {
8082        if (i == res.getRequesterLinkId().size())
8083          res.getRequesterLinkId().add(parseString(null));
8084        if (array.get(i) instanceof JsonObject) 
8085          parseElementProperties(array.get(i).getAsJsonObject(), res.getRequesterLinkId().get(i));
8086      }
8087    };
8088    if (json.has("performerType")) {
8089      JsonArray array = json.getAsJsonArray("performerType");
8090      for (int i = 0; i < array.size(); i++) {
8091        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8092      }
8093    };
8094    if (json.has("performerRole"))
8095      res.setPerformerRole(parseCodeableConcept(json.getAsJsonObject("performerRole")));
8096    if (json.has("performer"))
8097      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
8098    if (json.has("performerLinkId")) {
8099      JsonArray array = json.getAsJsonArray("performerLinkId");
8100      for (int i = 0; i < array.size(); i++) {
8101        res.getPerformerLinkId().add(parseString(array.get(i).getAsString()));
8102      }
8103    };
8104    if (json.has("_performerLinkId")) {
8105      JsonArray array = json.getAsJsonArray("_performerLinkId");
8106      for (int i = 0; i < array.size(); i++) {
8107        if (i == res.getPerformerLinkId().size())
8108          res.getPerformerLinkId().add(parseString(null));
8109        if (array.get(i) instanceof JsonObject) 
8110          parseElementProperties(array.get(i).getAsJsonObject(), res.getPerformerLinkId().get(i));
8111      }
8112    };
8113    if (json.has("reasonCode")) {
8114      JsonArray array = json.getAsJsonArray("reasonCode");
8115      for (int i = 0; i < array.size(); i++) {
8116        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8117      }
8118    };
8119    if (json.has("reasonReference")) {
8120      JsonArray array = json.getAsJsonArray("reasonReference");
8121      for (int i = 0; i < array.size(); i++) {
8122        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
8123      }
8124    };
8125    if (json.has("reason")) {
8126      JsonArray array = json.getAsJsonArray("reason");
8127      for (int i = 0; i < array.size(); i++) {
8128        res.getReason().add(parseString(array.get(i).getAsString()));
8129      }
8130    };
8131    if (json.has("_reason")) {
8132      JsonArray array = json.getAsJsonArray("_reason");
8133      for (int i = 0; i < array.size(); i++) {
8134        if (i == res.getReason().size())
8135          res.getReason().add(parseString(null));
8136        if (array.get(i) instanceof JsonObject) 
8137          parseElementProperties(array.get(i).getAsJsonObject(), res.getReason().get(i));
8138      }
8139    };
8140    if (json.has("reasonLinkId")) {
8141      JsonArray array = json.getAsJsonArray("reasonLinkId");
8142      for (int i = 0; i < array.size(); i++) {
8143        res.getReasonLinkId().add(parseString(array.get(i).getAsString()));
8144      }
8145    };
8146    if (json.has("_reasonLinkId")) {
8147      JsonArray array = json.getAsJsonArray("_reasonLinkId");
8148      for (int i = 0; i < array.size(); i++) {
8149        if (i == res.getReasonLinkId().size())
8150          res.getReasonLinkId().add(parseString(null));
8151        if (array.get(i) instanceof JsonObject) 
8152          parseElementProperties(array.get(i).getAsJsonObject(), res.getReasonLinkId().get(i));
8153      }
8154    };
8155    if (json.has("note")) {
8156      JsonArray array = json.getAsJsonArray("note");
8157      for (int i = 0; i < array.size(); i++) {
8158        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8159      }
8160    };
8161    if (json.has("securityLabelNumber")) {
8162      JsonArray array = json.getAsJsonArray("securityLabelNumber");
8163      for (int i = 0; i < array.size(); i++) {
8164        res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
8165      }
8166    };
8167    if (json.has("_securityLabelNumber")) {
8168      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
8169      for (int i = 0; i < array.size(); i++) {
8170        if (i == res.getSecurityLabelNumber().size())
8171          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
8172        if (array.get(i) instanceof JsonObject) 
8173          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
8174      }
8175    };
8176  }
8177
8178  protected Contract.ActionSubjectComponent parseContractActionSubjectComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8179    Contract.ActionSubjectComponent res = new Contract.ActionSubjectComponent();
8180    parseContractActionSubjectComponentProperties(json, owner, res);
8181    return res;
8182  }
8183
8184  protected void parseContractActionSubjectComponentProperties(JsonObject json, Contract owner, Contract.ActionSubjectComponent res) throws IOException, FHIRFormatError {
8185    parseBackboneElementProperties(json, res);
8186    if (json.has("reference")) {
8187      JsonArray array = json.getAsJsonArray("reference");
8188      for (int i = 0; i < array.size(); i++) {
8189        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
8190      }
8191    };
8192    if (json.has("role"))
8193      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
8194  }
8195
8196  protected Contract.SignatoryComponent parseContractSignatoryComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8197    Contract.SignatoryComponent res = new Contract.SignatoryComponent();
8198    parseContractSignatoryComponentProperties(json, owner, res);
8199    return res;
8200  }
8201
8202  protected void parseContractSignatoryComponentProperties(JsonObject json, Contract owner, Contract.SignatoryComponent res) throws IOException, FHIRFormatError {
8203    parseBackboneElementProperties(json, res);
8204    if (json.has("type"))
8205      res.setType(parseCoding(json.getAsJsonObject("type")));
8206    if (json.has("party"))
8207      res.setParty(parseReference(json.getAsJsonObject("party")));
8208    if (json.has("signature")) {
8209      JsonArray array = json.getAsJsonArray("signature");
8210      for (int i = 0; i < array.size(); i++) {
8211        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
8212      }
8213    };
8214  }
8215
8216  protected Contract.FriendlyLanguageComponent parseContractFriendlyLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8217    Contract.FriendlyLanguageComponent res = new Contract.FriendlyLanguageComponent();
8218    parseContractFriendlyLanguageComponentProperties(json, owner, res);
8219    return res;
8220  }
8221
8222  protected void parseContractFriendlyLanguageComponentProperties(JsonObject json, Contract owner, Contract.FriendlyLanguageComponent res) throws IOException, FHIRFormatError {
8223    parseBackboneElementProperties(json, res);
8224    Type content = parseType("content", json);
8225    if (content != null)
8226      res.setContent(content);
8227  }
8228
8229  protected Contract.LegalLanguageComponent parseContractLegalLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8230    Contract.LegalLanguageComponent res = new Contract.LegalLanguageComponent();
8231    parseContractLegalLanguageComponentProperties(json, owner, res);
8232    return res;
8233  }
8234
8235  protected void parseContractLegalLanguageComponentProperties(JsonObject json, Contract owner, Contract.LegalLanguageComponent res) throws IOException, FHIRFormatError {
8236    parseBackboneElementProperties(json, res);
8237    Type content = parseType("content", json);
8238    if (content != null)
8239      res.setContent(content);
8240  }
8241
8242  protected Contract.ComputableLanguageComponent parseContractComputableLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8243    Contract.ComputableLanguageComponent res = new Contract.ComputableLanguageComponent();
8244    parseContractComputableLanguageComponentProperties(json, owner, res);
8245    return res;
8246  }
8247
8248  protected void parseContractComputableLanguageComponentProperties(JsonObject json, Contract owner, Contract.ComputableLanguageComponent res) throws IOException, FHIRFormatError {
8249    parseBackboneElementProperties(json, res);
8250    Type content = parseType("content", json);
8251    if (content != null)
8252      res.setContent(content);
8253  }
8254
8255  protected Coverage parseCoverage(JsonObject json) throws IOException, FHIRFormatError {
8256    Coverage res = new Coverage();
8257    parseCoverageProperties(json, res);
8258    return res;
8259  }
8260
8261  protected void parseCoverageProperties(JsonObject json, Coverage res) throws IOException, FHIRFormatError {
8262    parseDomainResourceProperties(json, res);
8263    if (json.has("identifier")) {
8264      JsonArray array = json.getAsJsonArray("identifier");
8265      for (int i = 0; i < array.size(); i++) {
8266        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8267      }
8268    };
8269    if (json.has("status"))
8270      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Coverage.CoverageStatus.NULL, new Coverage.CoverageStatusEnumFactory()));
8271    if (json.has("_status"))
8272      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8273    if (json.has("type"))
8274      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8275    if (json.has("policyHolder"))
8276      res.setPolicyHolder(parseReference(json.getAsJsonObject("policyHolder")));
8277    if (json.has("subscriber"))
8278      res.setSubscriber(parseReference(json.getAsJsonObject("subscriber")));
8279    if (json.has("subscriberId"))
8280      res.setSubscriberIdElement(parseString(json.get("subscriberId").getAsString()));
8281    if (json.has("_subscriberId"))
8282      parseElementProperties(json.getAsJsonObject("_subscriberId"), res.getSubscriberIdElement());
8283    if (json.has("beneficiary"))
8284      res.setBeneficiary(parseReference(json.getAsJsonObject("beneficiary")));
8285    if (json.has("dependent"))
8286      res.setDependentElement(parseString(json.get("dependent").getAsString()));
8287    if (json.has("_dependent"))
8288      parseElementProperties(json.getAsJsonObject("_dependent"), res.getDependentElement());
8289    if (json.has("relationship"))
8290      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
8291    if (json.has("period"))
8292      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8293    if (json.has("payor")) {
8294      JsonArray array = json.getAsJsonArray("payor");
8295      for (int i = 0; i < array.size(); i++) {
8296        res.getPayor().add(parseReference(array.get(i).getAsJsonObject()));
8297      }
8298    };
8299    if (json.has("class")) {
8300      JsonArray array = json.getAsJsonArray("class");
8301      for (int i = 0; i < array.size(); i++) {
8302        res.getClass_().add(parseCoverageClassComponent(array.get(i).getAsJsonObject(), res));
8303      }
8304    };
8305    if (json.has("order"))
8306      res.setOrderElement(parsePositiveInt(json.get("order").getAsString()));
8307    if (json.has("_order"))
8308      parseElementProperties(json.getAsJsonObject("_order"), res.getOrderElement());
8309    if (json.has("network"))
8310      res.setNetworkElement(parseString(json.get("network").getAsString()));
8311    if (json.has("_network"))
8312      parseElementProperties(json.getAsJsonObject("_network"), res.getNetworkElement());
8313    if (json.has("costToBeneficiary")) {
8314      JsonArray array = json.getAsJsonArray("costToBeneficiary");
8315      for (int i = 0; i < array.size(); i++) {
8316        res.getCostToBeneficiary().add(parseCoverageCostToBeneficiaryComponent(array.get(i).getAsJsonObject(), res));
8317      }
8318    };
8319    if (json.has("subrogation"))
8320      res.setSubrogationElement(parseBoolean(json.get("subrogation").getAsBoolean()));
8321    if (json.has("_subrogation"))
8322      parseElementProperties(json.getAsJsonObject("_subrogation"), res.getSubrogationElement());
8323    if (json.has("contract")) {
8324      JsonArray array = json.getAsJsonArray("contract");
8325      for (int i = 0; i < array.size(); i++) {
8326        res.getContract().add(parseReference(array.get(i).getAsJsonObject()));
8327      }
8328    };
8329  }
8330
8331  protected Coverage.ClassComponent parseCoverageClassComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
8332    Coverage.ClassComponent res = new Coverage.ClassComponent();
8333    parseCoverageClassComponentProperties(json, owner, res);
8334    return res;
8335  }
8336
8337  protected void parseCoverageClassComponentProperties(JsonObject json, Coverage owner, Coverage.ClassComponent res) throws IOException, FHIRFormatError {
8338    parseBackboneElementProperties(json, res);
8339    if (json.has("type"))
8340      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8341    if (json.has("value"))
8342      res.setValueElement(parseString(json.get("value").getAsString()));
8343    if (json.has("_value"))
8344      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
8345    if (json.has("name"))
8346      res.setNameElement(parseString(json.get("name").getAsString()));
8347    if (json.has("_name"))
8348      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8349  }
8350
8351  protected Coverage.CostToBeneficiaryComponent parseCoverageCostToBeneficiaryComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
8352    Coverage.CostToBeneficiaryComponent res = new Coverage.CostToBeneficiaryComponent();
8353    parseCoverageCostToBeneficiaryComponentProperties(json, owner, res);
8354    return res;
8355  }
8356
8357  protected void parseCoverageCostToBeneficiaryComponentProperties(JsonObject json, Coverage owner, Coverage.CostToBeneficiaryComponent res) throws IOException, FHIRFormatError {
8358    parseBackboneElementProperties(json, res);
8359    if (json.has("type"))
8360      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8361    Type value = parseType("value", json);
8362    if (value != null)
8363      res.setValue(value);
8364    if (json.has("exception")) {
8365      JsonArray array = json.getAsJsonArray("exception");
8366      for (int i = 0; i < array.size(); i++) {
8367        res.getException().add(parseCoverageExemptionComponent(array.get(i).getAsJsonObject(), owner));
8368      }
8369    };
8370  }
8371
8372  protected Coverage.ExemptionComponent parseCoverageExemptionComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
8373    Coverage.ExemptionComponent res = new Coverage.ExemptionComponent();
8374    parseCoverageExemptionComponentProperties(json, owner, res);
8375    return res;
8376  }
8377
8378  protected void parseCoverageExemptionComponentProperties(JsonObject json, Coverage owner, Coverage.ExemptionComponent res) throws IOException, FHIRFormatError {
8379    parseBackboneElementProperties(json, res);
8380    if (json.has("type"))
8381      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8382    if (json.has("period"))
8383      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8384  }
8385
8386  protected CoverageEligibilityRequest parseCoverageEligibilityRequest(JsonObject json) throws IOException, FHIRFormatError {
8387    CoverageEligibilityRequest res = new CoverageEligibilityRequest();
8388    parseCoverageEligibilityRequestProperties(json, res);
8389    return res;
8390  }
8391
8392  protected void parseCoverageEligibilityRequestProperties(JsonObject json, CoverageEligibilityRequest res) throws IOException, FHIRFormatError {
8393    parseDomainResourceProperties(json, res);
8394    if (json.has("identifier")) {
8395      JsonArray array = json.getAsJsonArray("identifier");
8396      for (int i = 0; i < array.size(); i++) {
8397        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8398      }
8399    };
8400    if (json.has("status"))
8401      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CoverageEligibilityRequest.EligibilityRequestStatus.NULL, new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory()));
8402    if (json.has("_status"))
8403      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8404    if (json.has("priority"))
8405      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
8406    if (json.has("purpose")) {
8407      JsonArray array = json.getAsJsonArray("purpose");
8408      for (int i = 0; i < array.size(); i++) {
8409        res.getPurpose().add(parseEnumeration(array.get(i).getAsString(), CoverageEligibilityRequest.EligibilityRequestPurpose.NULL, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory()));
8410      }
8411    };
8412    if (json.has("_purpose")) {
8413      JsonArray array = json.getAsJsonArray("_purpose");
8414      for (int i = 0; i < array.size(); i++) {
8415        if (i == res.getPurpose().size())
8416          res.getPurpose().add(parseEnumeration(null, CoverageEligibilityRequest.EligibilityRequestPurpose.NULL, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory()));
8417        if (array.get(i) instanceof JsonObject) 
8418          parseElementProperties(array.get(i).getAsJsonObject(), res.getPurpose().get(i));
8419      }
8420    };
8421    if (json.has("patient"))
8422      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8423    Type serviced = parseType("serviced", json);
8424    if (serviced != null)
8425      res.setServiced(serviced);
8426    if (json.has("created"))
8427      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8428    if (json.has("_created"))
8429      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8430    if (json.has("enterer"))
8431      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
8432    if (json.has("provider"))
8433      res.setProvider(parseReference(json.getAsJsonObject("provider")));
8434    if (json.has("insurer"))
8435      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
8436    if (json.has("facility"))
8437      res.setFacility(parseReference(json.getAsJsonObject("facility")));
8438    if (json.has("supportingInfo")) {
8439      JsonArray array = json.getAsJsonArray("supportingInfo");
8440      for (int i = 0; i < array.size(); i++) {
8441        res.getSupportingInfo().add(parseCoverageEligibilityRequestSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
8442      }
8443    };
8444    if (json.has("insurance")) {
8445      JsonArray array = json.getAsJsonArray("insurance");
8446      for (int i = 0; i < array.size(); i++) {
8447        res.getInsurance().add(parseCoverageEligibilityRequestInsuranceComponent(array.get(i).getAsJsonObject(), res));
8448      }
8449    };
8450    if (json.has("item")) {
8451      JsonArray array = json.getAsJsonArray("item");
8452      for (int i = 0; i < array.size(); i++) {
8453        res.getItem().add(parseCoverageEligibilityRequestDetailsComponent(array.get(i).getAsJsonObject(), res));
8454      }
8455    };
8456  }
8457
8458  protected CoverageEligibilityRequest.SupportingInformationComponent parseCoverageEligibilityRequestSupportingInformationComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
8459    CoverageEligibilityRequest.SupportingInformationComponent res = new CoverageEligibilityRequest.SupportingInformationComponent();
8460    parseCoverageEligibilityRequestSupportingInformationComponentProperties(json, owner, res);
8461    return res;
8462  }
8463
8464  protected void parseCoverageEligibilityRequestSupportingInformationComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.SupportingInformationComponent res) throws IOException, FHIRFormatError {
8465    parseBackboneElementProperties(json, res);
8466    if (json.has("sequence"))
8467      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
8468    if (json.has("_sequence"))
8469      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
8470    if (json.has("information"))
8471      res.setInformation(parseReference(json.getAsJsonObject("information")));
8472    if (json.has("appliesToAll"))
8473      res.setAppliesToAllElement(parseBoolean(json.get("appliesToAll").getAsBoolean()));
8474    if (json.has("_appliesToAll"))
8475      parseElementProperties(json.getAsJsonObject("_appliesToAll"), res.getAppliesToAllElement());
8476  }
8477
8478  protected CoverageEligibilityRequest.InsuranceComponent parseCoverageEligibilityRequestInsuranceComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
8479    CoverageEligibilityRequest.InsuranceComponent res = new CoverageEligibilityRequest.InsuranceComponent();
8480    parseCoverageEligibilityRequestInsuranceComponentProperties(json, owner, res);
8481    return res;
8482  }
8483
8484  protected void parseCoverageEligibilityRequestInsuranceComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.InsuranceComponent res) throws IOException, FHIRFormatError {
8485    parseBackboneElementProperties(json, res);
8486    if (json.has("focal"))
8487      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
8488    if (json.has("_focal"))
8489      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
8490    if (json.has("coverage"))
8491      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
8492    if (json.has("businessArrangement"))
8493      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
8494    if (json.has("_businessArrangement"))
8495      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
8496  }
8497
8498  protected CoverageEligibilityRequest.DetailsComponent parseCoverageEligibilityRequestDetailsComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
8499    CoverageEligibilityRequest.DetailsComponent res = new CoverageEligibilityRequest.DetailsComponent();
8500    parseCoverageEligibilityRequestDetailsComponentProperties(json, owner, res);
8501    return res;
8502  }
8503
8504  protected void parseCoverageEligibilityRequestDetailsComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.DetailsComponent res) throws IOException, FHIRFormatError {
8505    parseBackboneElementProperties(json, res);
8506    if (json.has("supportingInfoSequence")) {
8507      JsonArray array = json.getAsJsonArray("supportingInfoSequence");
8508      for (int i = 0; i < array.size(); i++) {
8509        res.getSupportingInfoSequence().add(parsePositiveInt(array.get(i).getAsString()));
8510      }
8511    };
8512    if (json.has("_supportingInfoSequence")) {
8513      JsonArray array = json.getAsJsonArray("_supportingInfoSequence");
8514      for (int i = 0; i < array.size(); i++) {
8515        if (i == res.getSupportingInfoSequence().size())
8516          res.getSupportingInfoSequence().add(parsePositiveInt(null));
8517        if (array.get(i) instanceof JsonObject) 
8518          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportingInfoSequence().get(i));
8519      }
8520    };
8521    if (json.has("category"))
8522      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
8523    if (json.has("productOrService"))
8524      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
8525    if (json.has("modifier")) {
8526      JsonArray array = json.getAsJsonArray("modifier");
8527      for (int i = 0; i < array.size(); i++) {
8528        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8529      }
8530    };
8531    if (json.has("provider"))
8532      res.setProvider(parseReference(json.getAsJsonObject("provider")));
8533    if (json.has("quantity"))
8534      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
8535    if (json.has("unitPrice"))
8536      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
8537    if (json.has("facility"))
8538      res.setFacility(parseReference(json.getAsJsonObject("facility")));
8539    if (json.has("diagnosis")) {
8540      JsonArray array = json.getAsJsonArray("diagnosis");
8541      for (int i = 0; i < array.size(); i++) {
8542        res.getDiagnosis().add(parseCoverageEligibilityRequestDiagnosisComponent(array.get(i).getAsJsonObject(), owner));
8543      }
8544    };
8545    if (json.has("detail")) {
8546      JsonArray array = json.getAsJsonArray("detail");
8547      for (int i = 0; i < array.size(); i++) {
8548        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
8549      }
8550    };
8551  }
8552
8553  protected CoverageEligibilityRequest.DiagnosisComponent parseCoverageEligibilityRequestDiagnosisComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
8554    CoverageEligibilityRequest.DiagnosisComponent res = new CoverageEligibilityRequest.DiagnosisComponent();
8555    parseCoverageEligibilityRequestDiagnosisComponentProperties(json, owner, res);
8556    return res;
8557  }
8558
8559  protected void parseCoverageEligibilityRequestDiagnosisComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.DiagnosisComponent res) throws IOException, FHIRFormatError {
8560    parseBackboneElementProperties(json, res);
8561    Type diagnosis = parseType("diagnosis", json);
8562    if (diagnosis != null)
8563      res.setDiagnosis(diagnosis);
8564  }
8565
8566  protected CoverageEligibilityResponse parseCoverageEligibilityResponse(JsonObject json) throws IOException, FHIRFormatError {
8567    CoverageEligibilityResponse res = new CoverageEligibilityResponse();
8568    parseCoverageEligibilityResponseProperties(json, res);
8569    return res;
8570  }
8571
8572  protected void parseCoverageEligibilityResponseProperties(JsonObject json, CoverageEligibilityResponse res) throws IOException, FHIRFormatError {
8573    parseDomainResourceProperties(json, res);
8574    if (json.has("identifier")) {
8575      JsonArray array = json.getAsJsonArray("identifier");
8576      for (int i = 0; i < array.size(); i++) {
8577        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8578      }
8579    };
8580    if (json.has("status"))
8581      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CoverageEligibilityResponse.EligibilityResponseStatus.NULL, new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory()));
8582    if (json.has("_status"))
8583      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8584    if (json.has("purpose")) {
8585      JsonArray array = json.getAsJsonArray("purpose");
8586      for (int i = 0; i < array.size(); i++) {
8587        res.getPurpose().add(parseEnumeration(array.get(i).getAsString(), CoverageEligibilityResponse.EligibilityResponsePurpose.NULL, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory()));
8588      }
8589    };
8590    if (json.has("_purpose")) {
8591      JsonArray array = json.getAsJsonArray("_purpose");
8592      for (int i = 0; i < array.size(); i++) {
8593        if (i == res.getPurpose().size())
8594          res.getPurpose().add(parseEnumeration(null, CoverageEligibilityResponse.EligibilityResponsePurpose.NULL, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory()));
8595        if (array.get(i) instanceof JsonObject) 
8596          parseElementProperties(array.get(i).getAsJsonObject(), res.getPurpose().get(i));
8597      }
8598    };
8599    if (json.has("patient"))
8600      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8601    Type serviced = parseType("serviced", json);
8602    if (serviced != null)
8603      res.setServiced(serviced);
8604    if (json.has("created"))
8605      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8606    if (json.has("_created"))
8607      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8608    if (json.has("requestor"))
8609      res.setRequestor(parseReference(json.getAsJsonObject("requestor")));
8610    if (json.has("request"))
8611      res.setRequest(parseReference(json.getAsJsonObject("request")));
8612    if (json.has("outcome"))
8613      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
8614    if (json.has("_outcome"))
8615      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
8616    if (json.has("disposition"))
8617      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
8618    if (json.has("_disposition"))
8619      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
8620    if (json.has("insurer"))
8621      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
8622    if (json.has("insurance")) {
8623      JsonArray array = json.getAsJsonArray("insurance");
8624      for (int i = 0; i < array.size(); i++) {
8625        res.getInsurance().add(parseCoverageEligibilityResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
8626      }
8627    };
8628    if (json.has("preAuthRef"))
8629      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
8630    if (json.has("_preAuthRef"))
8631      parseElementProperties(json.getAsJsonObject("_preAuthRef"), res.getPreAuthRefElement());
8632    if (json.has("form"))
8633      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
8634    if (json.has("error")) {
8635      JsonArray array = json.getAsJsonArray("error");
8636      for (int i = 0; i < array.size(); i++) {
8637        res.getError().add(parseCoverageEligibilityResponseErrorsComponent(array.get(i).getAsJsonObject(), res));
8638      }
8639    };
8640  }
8641
8642  protected CoverageEligibilityResponse.InsuranceComponent parseCoverageEligibilityResponseInsuranceComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
8643    CoverageEligibilityResponse.InsuranceComponent res = new CoverageEligibilityResponse.InsuranceComponent();
8644    parseCoverageEligibilityResponseInsuranceComponentProperties(json, owner, res);
8645    return res;
8646  }
8647
8648  protected void parseCoverageEligibilityResponseInsuranceComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
8649    parseBackboneElementProperties(json, res);
8650    if (json.has("coverage"))
8651      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
8652    if (json.has("inforce"))
8653      res.setInforceElement(parseBoolean(json.get("inforce").getAsBoolean()));
8654    if (json.has("_inforce"))
8655      parseElementProperties(json.getAsJsonObject("_inforce"), res.getInforceElement());
8656    if (json.has("benefitPeriod"))
8657      res.setBenefitPeriod(parsePeriod(json.getAsJsonObject("benefitPeriod")));
8658    if (json.has("item")) {
8659      JsonArray array = json.getAsJsonArray("item");
8660      for (int i = 0; i < array.size(); i++) {
8661        res.getItem().add(parseCoverageEligibilityResponseItemsComponent(array.get(i).getAsJsonObject(), owner));
8662      }
8663    };
8664  }
8665
8666  protected CoverageEligibilityResponse.ItemsComponent parseCoverageEligibilityResponseItemsComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
8667    CoverageEligibilityResponse.ItemsComponent res = new CoverageEligibilityResponse.ItemsComponent();
8668    parseCoverageEligibilityResponseItemsComponentProperties(json, owner, res);
8669    return res;
8670  }
8671
8672  protected void parseCoverageEligibilityResponseItemsComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.ItemsComponent res) throws IOException, FHIRFormatError {
8673    parseBackboneElementProperties(json, res);
8674    if (json.has("category"))
8675      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
8676    if (json.has("productOrService"))
8677      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
8678    if (json.has("modifier")) {
8679      JsonArray array = json.getAsJsonArray("modifier");
8680      for (int i = 0; i < array.size(); i++) {
8681        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8682      }
8683    };
8684    if (json.has("provider"))
8685      res.setProvider(parseReference(json.getAsJsonObject("provider")));
8686    if (json.has("excluded"))
8687      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
8688    if (json.has("_excluded"))
8689      parseElementProperties(json.getAsJsonObject("_excluded"), res.getExcludedElement());
8690    if (json.has("name"))
8691      res.setNameElement(parseString(json.get("name").getAsString()));
8692    if (json.has("_name"))
8693      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8694    if (json.has("description"))
8695      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8696    if (json.has("_description"))
8697      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
8698    if (json.has("network"))
8699      res.setNetwork(parseCodeableConcept(json.getAsJsonObject("network")));
8700    if (json.has("unit"))
8701      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
8702    if (json.has("term"))
8703      res.setTerm(parseCodeableConcept(json.getAsJsonObject("term")));
8704    if (json.has("benefit")) {
8705      JsonArray array = json.getAsJsonArray("benefit");
8706      for (int i = 0; i < array.size(); i++) {
8707        res.getBenefit().add(parseCoverageEligibilityResponseBenefitComponent(array.get(i).getAsJsonObject(), owner));
8708      }
8709    };
8710    if (json.has("authorizationRequired"))
8711      res.setAuthorizationRequiredElement(parseBoolean(json.get("authorizationRequired").getAsBoolean()));
8712    if (json.has("_authorizationRequired"))
8713      parseElementProperties(json.getAsJsonObject("_authorizationRequired"), res.getAuthorizationRequiredElement());
8714    if (json.has("authorizationSupporting")) {
8715      JsonArray array = json.getAsJsonArray("authorizationSupporting");
8716      for (int i = 0; i < array.size(); i++) {
8717        res.getAuthorizationSupporting().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8718      }
8719    };
8720    if (json.has("authorizationUrl"))
8721      res.setAuthorizationUrlElement(parseUri(json.get("authorizationUrl").getAsString()));
8722    if (json.has("_authorizationUrl"))
8723      parseElementProperties(json.getAsJsonObject("_authorizationUrl"), res.getAuthorizationUrlElement());
8724  }
8725
8726  protected CoverageEligibilityResponse.BenefitComponent parseCoverageEligibilityResponseBenefitComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
8727    CoverageEligibilityResponse.BenefitComponent res = new CoverageEligibilityResponse.BenefitComponent();
8728    parseCoverageEligibilityResponseBenefitComponentProperties(json, owner, res);
8729    return res;
8730  }
8731
8732  protected void parseCoverageEligibilityResponseBenefitComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.BenefitComponent res) throws IOException, FHIRFormatError {
8733    parseBackboneElementProperties(json, res);
8734    if (json.has("type"))
8735      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8736    Type allowed = parseType("allowed", json);
8737    if (allowed != null)
8738      res.setAllowed(allowed);
8739    Type used = parseType("used", json);
8740    if (used != null)
8741      res.setUsed(used);
8742  }
8743
8744  protected CoverageEligibilityResponse.ErrorsComponent parseCoverageEligibilityResponseErrorsComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
8745    CoverageEligibilityResponse.ErrorsComponent res = new CoverageEligibilityResponse.ErrorsComponent();
8746    parseCoverageEligibilityResponseErrorsComponentProperties(json, owner, res);
8747    return res;
8748  }
8749
8750  protected void parseCoverageEligibilityResponseErrorsComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.ErrorsComponent res) throws IOException, FHIRFormatError {
8751    parseBackboneElementProperties(json, res);
8752    if (json.has("code"))
8753      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8754  }
8755
8756  protected DetectedIssue parseDetectedIssue(JsonObject json) throws IOException, FHIRFormatError {
8757    DetectedIssue res = new DetectedIssue();
8758    parseDetectedIssueProperties(json, res);
8759    return res;
8760  }
8761
8762  protected void parseDetectedIssueProperties(JsonObject json, DetectedIssue res) throws IOException, FHIRFormatError {
8763    parseDomainResourceProperties(json, res);
8764    if (json.has("identifier")) {
8765      JsonArray array = json.getAsJsonArray("identifier");
8766      for (int i = 0; i < array.size(); i++) {
8767        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8768      }
8769    };
8770    if (json.has("status"))
8771      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DetectedIssue.DetectedIssueStatus.NULL, new DetectedIssue.DetectedIssueStatusEnumFactory()));
8772    if (json.has("_status"))
8773      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8774    if (json.has("code"))
8775      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8776    if (json.has("severity"))
8777      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), DetectedIssue.DetectedIssueSeverity.NULL, new DetectedIssue.DetectedIssueSeverityEnumFactory()));
8778    if (json.has("_severity"))
8779      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
8780    if (json.has("patient"))
8781      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8782    Type identified = parseType("identified", json);
8783    if (identified != null)
8784      res.setIdentified(identified);
8785    if (json.has("author"))
8786      res.setAuthor(parseReference(json.getAsJsonObject("author")));
8787    if (json.has("implicated")) {
8788      JsonArray array = json.getAsJsonArray("implicated");
8789      for (int i = 0; i < array.size(); i++) {
8790        res.getImplicated().add(parseReference(array.get(i).getAsJsonObject()));
8791      }
8792    };
8793    if (json.has("evidence")) {
8794      JsonArray array = json.getAsJsonArray("evidence");
8795      for (int i = 0; i < array.size(); i++) {
8796        res.getEvidence().add(parseDetectedIssueDetectedIssueEvidenceComponent(array.get(i).getAsJsonObject(), res));
8797      }
8798    };
8799    if (json.has("detail"))
8800      res.setDetailElement(parseString(json.get("detail").getAsString()));
8801    if (json.has("_detail"))
8802      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
8803    if (json.has("reference"))
8804      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
8805    if (json.has("_reference"))
8806      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
8807    if (json.has("mitigation")) {
8808      JsonArray array = json.getAsJsonArray("mitigation");
8809      for (int i = 0; i < array.size(); i++) {
8810        res.getMitigation().add(parseDetectedIssueDetectedIssueMitigationComponent(array.get(i).getAsJsonObject(), res));
8811      }
8812    };
8813  }
8814
8815  protected DetectedIssue.DetectedIssueEvidenceComponent parseDetectedIssueDetectedIssueEvidenceComponent(JsonObject json, DetectedIssue owner) throws IOException, FHIRFormatError {
8816    DetectedIssue.DetectedIssueEvidenceComponent res = new DetectedIssue.DetectedIssueEvidenceComponent();
8817    parseDetectedIssueDetectedIssueEvidenceComponentProperties(json, owner, res);
8818    return res;
8819  }
8820
8821  protected void parseDetectedIssueDetectedIssueEvidenceComponentProperties(JsonObject json, DetectedIssue owner, DetectedIssue.DetectedIssueEvidenceComponent res) throws IOException, FHIRFormatError {
8822    parseBackboneElementProperties(json, res);
8823    if (json.has("code")) {
8824      JsonArray array = json.getAsJsonArray("code");
8825      for (int i = 0; i < array.size(); i++) {
8826        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8827      }
8828    };
8829    if (json.has("detail")) {
8830      JsonArray array = json.getAsJsonArray("detail");
8831      for (int i = 0; i < array.size(); i++) {
8832        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
8833      }
8834    };
8835  }
8836
8837  protected DetectedIssue.DetectedIssueMitigationComponent parseDetectedIssueDetectedIssueMitigationComponent(JsonObject json, DetectedIssue owner) throws IOException, FHIRFormatError {
8838    DetectedIssue.DetectedIssueMitigationComponent res = new DetectedIssue.DetectedIssueMitigationComponent();
8839    parseDetectedIssueDetectedIssueMitigationComponentProperties(json, owner, res);
8840    return res;
8841  }
8842
8843  protected void parseDetectedIssueDetectedIssueMitigationComponentProperties(JsonObject json, DetectedIssue owner, DetectedIssue.DetectedIssueMitigationComponent res) throws IOException, FHIRFormatError {
8844    parseBackboneElementProperties(json, res);
8845    if (json.has("action"))
8846      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
8847    if (json.has("date"))
8848      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8849    if (json.has("_date"))
8850      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8851    if (json.has("author"))
8852      res.setAuthor(parseReference(json.getAsJsonObject("author")));
8853  }
8854
8855  protected Device parseDevice(JsonObject json) throws IOException, FHIRFormatError {
8856    Device res = new Device();
8857    parseDeviceProperties(json, res);
8858    return res;
8859  }
8860
8861  protected void parseDeviceProperties(JsonObject json, Device res) throws IOException, FHIRFormatError {
8862    parseDomainResourceProperties(json, res);
8863    if (json.has("identifier")) {
8864      JsonArray array = json.getAsJsonArray("identifier");
8865      for (int i = 0; i < array.size(); i++) {
8866        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8867      }
8868    };
8869    if (json.has("definition"))
8870      res.setDefinition(parseReference(json.getAsJsonObject("definition")));
8871    if (json.has("udiCarrier")) {
8872      JsonArray array = json.getAsJsonArray("udiCarrier");
8873      for (int i = 0; i < array.size(); i++) {
8874        res.getUdiCarrier().add(parseDeviceDeviceUdiCarrierComponent(array.get(i).getAsJsonObject(), res));
8875      }
8876    };
8877    if (json.has("status"))
8878      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Device.FHIRDeviceStatus.NULL, new Device.FHIRDeviceStatusEnumFactory()));
8879    if (json.has("_status"))
8880      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8881    if (json.has("statusReason")) {
8882      JsonArray array = json.getAsJsonArray("statusReason");
8883      for (int i = 0; i < array.size(); i++) {
8884        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8885      }
8886    };
8887    if (json.has("distinctIdentifier"))
8888      res.setDistinctIdentifierElement(parseString(json.get("distinctIdentifier").getAsString()));
8889    if (json.has("_distinctIdentifier"))
8890      parseElementProperties(json.getAsJsonObject("_distinctIdentifier"), res.getDistinctIdentifierElement());
8891    if (json.has("manufacturer"))
8892      res.setManufacturerElement(parseString(json.get("manufacturer").getAsString()));
8893    if (json.has("_manufacturer"))
8894      parseElementProperties(json.getAsJsonObject("_manufacturer"), res.getManufacturerElement());
8895    if (json.has("manufactureDate"))
8896      res.setManufactureDateElement(parseDateTime(json.get("manufactureDate").getAsString()));
8897    if (json.has("_manufactureDate"))
8898      parseElementProperties(json.getAsJsonObject("_manufactureDate"), res.getManufactureDateElement());
8899    if (json.has("expirationDate"))
8900      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
8901    if (json.has("_expirationDate"))
8902      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
8903    if (json.has("lotNumber"))
8904      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
8905    if (json.has("_lotNumber"))
8906      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
8907    if (json.has("serialNumber"))
8908      res.setSerialNumberElement(parseString(json.get("serialNumber").getAsString()));
8909    if (json.has("_serialNumber"))
8910      parseElementProperties(json.getAsJsonObject("_serialNumber"), res.getSerialNumberElement());
8911    if (json.has("deviceName")) {
8912      JsonArray array = json.getAsJsonArray("deviceName");
8913      for (int i = 0; i < array.size(); i++) {
8914        res.getDeviceName().add(parseDeviceDeviceDeviceNameComponent(array.get(i).getAsJsonObject(), res));
8915      }
8916    };
8917    if (json.has("modelNumber"))
8918      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
8919    if (json.has("_modelNumber"))
8920      parseElementProperties(json.getAsJsonObject("_modelNumber"), res.getModelNumberElement());
8921    if (json.has("partNumber"))
8922      res.setPartNumberElement(parseString(json.get("partNumber").getAsString()));
8923    if (json.has("_partNumber"))
8924      parseElementProperties(json.getAsJsonObject("_partNumber"), res.getPartNumberElement());
8925    if (json.has("type"))
8926      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8927    if (json.has("specialization")) {
8928      JsonArray array = json.getAsJsonArray("specialization");
8929      for (int i = 0; i < array.size(); i++) {
8930        res.getSpecialization().add(parseDeviceDeviceSpecializationComponent(array.get(i).getAsJsonObject(), res));
8931      }
8932    };
8933    if (json.has("version")) {
8934      JsonArray array = json.getAsJsonArray("version");
8935      for (int i = 0; i < array.size(); i++) {
8936        res.getVersion().add(parseDeviceDeviceVersionComponent(array.get(i).getAsJsonObject(), res));
8937      }
8938    };
8939    if (json.has("property")) {
8940      JsonArray array = json.getAsJsonArray("property");
8941      for (int i = 0; i < array.size(); i++) {
8942        res.getProperty().add(parseDeviceDevicePropertyComponent(array.get(i).getAsJsonObject(), res));
8943      }
8944    };
8945    if (json.has("patient"))
8946      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8947    if (json.has("owner"))
8948      res.setOwner(parseReference(json.getAsJsonObject("owner")));
8949    if (json.has("contact")) {
8950      JsonArray array = json.getAsJsonArray("contact");
8951      for (int i = 0; i < array.size(); i++) {
8952        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
8953      }
8954    };
8955    if (json.has("location"))
8956      res.setLocation(parseReference(json.getAsJsonObject("location")));
8957    if (json.has("url"))
8958      res.setUrlElement(parseUri(json.get("url").getAsString()));
8959    if (json.has("_url"))
8960      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8961    if (json.has("note")) {
8962      JsonArray array = json.getAsJsonArray("note");
8963      for (int i = 0; i < array.size(); i++) {
8964        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8965      }
8966    };
8967    if (json.has("safety")) {
8968      JsonArray array = json.getAsJsonArray("safety");
8969      for (int i = 0; i < array.size(); i++) {
8970        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8971      }
8972    };
8973    if (json.has("parent"))
8974      res.setParent(parseReference(json.getAsJsonObject("parent")));
8975  }
8976
8977  protected Device.DeviceUdiCarrierComponent parseDeviceDeviceUdiCarrierComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
8978    Device.DeviceUdiCarrierComponent res = new Device.DeviceUdiCarrierComponent();
8979    parseDeviceDeviceUdiCarrierComponentProperties(json, owner, res);
8980    return res;
8981  }
8982
8983  protected void parseDeviceDeviceUdiCarrierComponentProperties(JsonObject json, Device owner, Device.DeviceUdiCarrierComponent res) throws IOException, FHIRFormatError {
8984    parseBackboneElementProperties(json, res);
8985    if (json.has("deviceIdentifier"))
8986      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
8987    if (json.has("_deviceIdentifier"))
8988      parseElementProperties(json.getAsJsonObject("_deviceIdentifier"), res.getDeviceIdentifierElement());
8989    if (json.has("issuer"))
8990      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
8991    if (json.has("_issuer"))
8992      parseElementProperties(json.getAsJsonObject("_issuer"), res.getIssuerElement());
8993    if (json.has("jurisdiction"))
8994      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
8995    if (json.has("_jurisdiction"))
8996      parseElementProperties(json.getAsJsonObject("_jurisdiction"), res.getJurisdictionElement());
8997    if (json.has("carrierAIDC"))
8998      res.setCarrierAIDCElement(parseBase64Binary(json.get("carrierAIDC").getAsString()));
8999    if (json.has("_carrierAIDC"))
9000      parseElementProperties(json.getAsJsonObject("_carrierAIDC"), res.getCarrierAIDCElement());
9001    if (json.has("carrierHRF"))
9002      res.setCarrierHRFElement(parseString(json.get("carrierHRF").getAsString()));
9003    if (json.has("_carrierHRF"))
9004      parseElementProperties(json.getAsJsonObject("_carrierHRF"), res.getCarrierHRFElement());
9005    if (json.has("entryType"))
9006      res.setEntryTypeElement(parseEnumeration(json.get("entryType").getAsString(), Device.UDIEntryType.NULL, new Device.UDIEntryTypeEnumFactory()));
9007    if (json.has("_entryType"))
9008      parseElementProperties(json.getAsJsonObject("_entryType"), res.getEntryTypeElement());
9009  }
9010
9011  protected Device.DeviceDeviceNameComponent parseDeviceDeviceDeviceNameComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
9012    Device.DeviceDeviceNameComponent res = new Device.DeviceDeviceNameComponent();
9013    parseDeviceDeviceDeviceNameComponentProperties(json, owner, res);
9014    return res;
9015  }
9016
9017  protected void parseDeviceDeviceDeviceNameComponentProperties(JsonObject json, Device owner, Device.DeviceDeviceNameComponent res) throws IOException, FHIRFormatError {
9018    parseBackboneElementProperties(json, res);
9019    if (json.has("name"))
9020      res.setNameElement(parseString(json.get("name").getAsString()));
9021    if (json.has("_name"))
9022      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9023    if (json.has("type"))
9024      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Device.DeviceNameType.NULL, new Device.DeviceNameTypeEnumFactory()));
9025    if (json.has("_type"))
9026      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9027  }
9028
9029  protected Device.DeviceSpecializationComponent parseDeviceDeviceSpecializationComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
9030    Device.DeviceSpecializationComponent res = new Device.DeviceSpecializationComponent();
9031    parseDeviceDeviceSpecializationComponentProperties(json, owner, res);
9032    return res;
9033  }
9034
9035  protected void parseDeviceDeviceSpecializationComponentProperties(JsonObject json, Device owner, Device.DeviceSpecializationComponent res) throws IOException, FHIRFormatError {
9036    parseBackboneElementProperties(json, res);
9037    if (json.has("systemType"))
9038      res.setSystemType(parseCodeableConcept(json.getAsJsonObject("systemType")));
9039    if (json.has("version"))
9040      res.setVersionElement(parseString(json.get("version").getAsString()));
9041    if (json.has("_version"))
9042      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9043  }
9044
9045  protected Device.DeviceVersionComponent parseDeviceDeviceVersionComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
9046    Device.DeviceVersionComponent res = new Device.DeviceVersionComponent();
9047    parseDeviceDeviceVersionComponentProperties(json, owner, res);
9048    return res;
9049  }
9050
9051  protected void parseDeviceDeviceVersionComponentProperties(JsonObject json, Device owner, Device.DeviceVersionComponent res) throws IOException, FHIRFormatError {
9052    parseBackboneElementProperties(json, res);
9053    if (json.has("type"))
9054      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9055    if (json.has("component"))
9056      res.setComponent(parseIdentifier(json.getAsJsonObject("component")));
9057    if (json.has("value"))
9058      res.setValueElement(parseString(json.get("value").getAsString()));
9059    if (json.has("_value"))
9060      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
9061  }
9062
9063  protected Device.DevicePropertyComponent parseDeviceDevicePropertyComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
9064    Device.DevicePropertyComponent res = new Device.DevicePropertyComponent();
9065    parseDeviceDevicePropertyComponentProperties(json, owner, res);
9066    return res;
9067  }
9068
9069  protected void parseDeviceDevicePropertyComponentProperties(JsonObject json, Device owner, Device.DevicePropertyComponent res) throws IOException, FHIRFormatError {
9070    parseBackboneElementProperties(json, res);
9071    if (json.has("type"))
9072      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9073    if (json.has("valueQuantity")) {
9074      JsonArray array = json.getAsJsonArray("valueQuantity");
9075      for (int i = 0; i < array.size(); i++) {
9076        res.getValueQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
9077      }
9078    };
9079    if (json.has("valueCode")) {
9080      JsonArray array = json.getAsJsonArray("valueCode");
9081      for (int i = 0; i < array.size(); i++) {
9082        res.getValueCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9083      }
9084    };
9085  }
9086
9087  protected DeviceDefinition parseDeviceDefinition(JsonObject json) throws IOException, FHIRFormatError {
9088    DeviceDefinition res = new DeviceDefinition();
9089    parseDeviceDefinitionProperties(json, res);
9090    return res;
9091  }
9092
9093  protected void parseDeviceDefinitionProperties(JsonObject json, DeviceDefinition res) throws IOException, FHIRFormatError {
9094    parseDomainResourceProperties(json, res);
9095    if (json.has("identifier")) {
9096      JsonArray array = json.getAsJsonArray("identifier");
9097      for (int i = 0; i < array.size(); i++) {
9098        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9099      }
9100    };
9101    if (json.has("udiDeviceIdentifier")) {
9102      JsonArray array = json.getAsJsonArray("udiDeviceIdentifier");
9103      for (int i = 0; i < array.size(); i++) {
9104        res.getUdiDeviceIdentifier().add(parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(array.get(i).getAsJsonObject(), res));
9105      }
9106    };
9107    Type manufacturer = parseType("manufacturer", json);
9108    if (manufacturer != null)
9109      res.setManufacturer(manufacturer);
9110    if (json.has("deviceName")) {
9111      JsonArray array = json.getAsJsonArray("deviceName");
9112      for (int i = 0; i < array.size(); i++) {
9113        res.getDeviceName().add(parseDeviceDefinitionDeviceDefinitionDeviceNameComponent(array.get(i).getAsJsonObject(), res));
9114      }
9115    };
9116    if (json.has("modelNumber"))
9117      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
9118    if (json.has("_modelNumber"))
9119      parseElementProperties(json.getAsJsonObject("_modelNumber"), res.getModelNumberElement());
9120    if (json.has("type"))
9121      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9122    if (json.has("specialization")) {
9123      JsonArray array = json.getAsJsonArray("specialization");
9124      for (int i = 0; i < array.size(); i++) {
9125        res.getSpecialization().add(parseDeviceDefinitionDeviceDefinitionSpecializationComponent(array.get(i).getAsJsonObject(), res));
9126      }
9127    };
9128    if (json.has("version")) {
9129      JsonArray array = json.getAsJsonArray("version");
9130      for (int i = 0; i < array.size(); i++) {
9131        res.getVersion().add(parseString(array.get(i).getAsString()));
9132      }
9133    };
9134    if (json.has("_version")) {
9135      JsonArray array = json.getAsJsonArray("_version");
9136      for (int i = 0; i < array.size(); i++) {
9137        if (i == res.getVersion().size())
9138          res.getVersion().add(parseString(null));
9139        if (array.get(i) instanceof JsonObject) 
9140          parseElementProperties(array.get(i).getAsJsonObject(), res.getVersion().get(i));
9141      }
9142    };
9143    if (json.has("safety")) {
9144      JsonArray array = json.getAsJsonArray("safety");
9145      for (int i = 0; i < array.size(); i++) {
9146        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9147      }
9148    };
9149    if (json.has("shelfLifeStorage")) {
9150      JsonArray array = json.getAsJsonArray("shelfLifeStorage");
9151      for (int i = 0; i < array.size(); i++) {
9152        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
9153      }
9154    };
9155    if (json.has("physicalCharacteristics"))
9156      res.setPhysicalCharacteristics(parseProdCharacteristic(json.getAsJsonObject("physicalCharacteristics")));
9157    if (json.has("languageCode")) {
9158      JsonArray array = json.getAsJsonArray("languageCode");
9159      for (int i = 0; i < array.size(); i++) {
9160        res.getLanguageCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9161      }
9162    };
9163    if (json.has("capability")) {
9164      JsonArray array = json.getAsJsonArray("capability");
9165      for (int i = 0; i < array.size(); i++) {
9166        res.getCapability().add(parseDeviceDefinitionDeviceDefinitionCapabilityComponent(array.get(i).getAsJsonObject(), res));
9167      }
9168    };
9169    if (json.has("property")) {
9170      JsonArray array = json.getAsJsonArray("property");
9171      for (int i = 0; i < array.size(); i++) {
9172        res.getProperty().add(parseDeviceDefinitionDeviceDefinitionPropertyComponent(array.get(i).getAsJsonObject(), res));
9173      }
9174    };
9175    if (json.has("owner"))
9176      res.setOwner(parseReference(json.getAsJsonObject("owner")));
9177    if (json.has("contact")) {
9178      JsonArray array = json.getAsJsonArray("contact");
9179      for (int i = 0; i < array.size(); i++) {
9180        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
9181      }
9182    };
9183    if (json.has("url"))
9184      res.setUrlElement(parseUri(json.get("url").getAsString()));
9185    if (json.has("_url"))
9186      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
9187    if (json.has("onlineInformation"))
9188      res.setOnlineInformationElement(parseUri(json.get("onlineInformation").getAsString()));
9189    if (json.has("_onlineInformation"))
9190      parseElementProperties(json.getAsJsonObject("_onlineInformation"), res.getOnlineInformationElement());
9191    if (json.has("note")) {
9192      JsonArray array = json.getAsJsonArray("note");
9193      for (int i = 0; i < array.size(); i++) {
9194        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9195      }
9196    };
9197    if (json.has("quantity"))
9198      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
9199    if (json.has("parentDevice"))
9200      res.setParentDevice(parseReference(json.getAsJsonObject("parentDevice")));
9201    if (json.has("material")) {
9202      JsonArray array = json.getAsJsonArray("material");
9203      for (int i = 0; i < array.size(); i++) {
9204        res.getMaterial().add(parseDeviceDefinitionDeviceDefinitionMaterialComponent(array.get(i).getAsJsonObject(), res));
9205      }
9206    };
9207  }
9208
9209  protected DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9210    DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent res = new DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent();
9211    parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentProperties(json, owner, res);
9212    return res;
9213  }
9214
9215  protected void parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent res) throws IOException, FHIRFormatError {
9216    parseBackboneElementProperties(json, res);
9217    if (json.has("deviceIdentifier"))
9218      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
9219    if (json.has("_deviceIdentifier"))
9220      parseElementProperties(json.getAsJsonObject("_deviceIdentifier"), res.getDeviceIdentifierElement());
9221    if (json.has("issuer"))
9222      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
9223    if (json.has("_issuer"))
9224      parseElementProperties(json.getAsJsonObject("_issuer"), res.getIssuerElement());
9225    if (json.has("jurisdiction"))
9226      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
9227    if (json.has("_jurisdiction"))
9228      parseElementProperties(json.getAsJsonObject("_jurisdiction"), res.getJurisdictionElement());
9229  }
9230
9231  protected DeviceDefinition.DeviceDefinitionDeviceNameComponent parseDeviceDefinitionDeviceDefinitionDeviceNameComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9232    DeviceDefinition.DeviceDefinitionDeviceNameComponent res = new DeviceDefinition.DeviceDefinitionDeviceNameComponent();
9233    parseDeviceDefinitionDeviceDefinitionDeviceNameComponentProperties(json, owner, res);
9234    return res;
9235  }
9236
9237  protected void parseDeviceDefinitionDeviceDefinitionDeviceNameComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionDeviceNameComponent res) throws IOException, FHIRFormatError {
9238    parseBackboneElementProperties(json, res);
9239    if (json.has("name"))
9240      res.setNameElement(parseString(json.get("name").getAsString()));
9241    if (json.has("_name"))
9242      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9243    if (json.has("type"))
9244      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceDefinition.DeviceNameType.NULL, new DeviceDefinition.DeviceNameTypeEnumFactory()));
9245    if (json.has("_type"))
9246      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9247  }
9248
9249  protected DeviceDefinition.DeviceDefinitionSpecializationComponent parseDeviceDefinitionDeviceDefinitionSpecializationComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9250    DeviceDefinition.DeviceDefinitionSpecializationComponent res = new DeviceDefinition.DeviceDefinitionSpecializationComponent();
9251    parseDeviceDefinitionDeviceDefinitionSpecializationComponentProperties(json, owner, res);
9252    return res;
9253  }
9254
9255  protected void parseDeviceDefinitionDeviceDefinitionSpecializationComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionSpecializationComponent res) throws IOException, FHIRFormatError {
9256    parseBackboneElementProperties(json, res);
9257    if (json.has("systemType"))
9258      res.setSystemTypeElement(parseString(json.get("systemType").getAsString()));
9259    if (json.has("_systemType"))
9260      parseElementProperties(json.getAsJsonObject("_systemType"), res.getSystemTypeElement());
9261    if (json.has("version"))
9262      res.setVersionElement(parseString(json.get("version").getAsString()));
9263    if (json.has("_version"))
9264      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9265  }
9266
9267  protected DeviceDefinition.DeviceDefinitionCapabilityComponent parseDeviceDefinitionDeviceDefinitionCapabilityComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9268    DeviceDefinition.DeviceDefinitionCapabilityComponent res = new DeviceDefinition.DeviceDefinitionCapabilityComponent();
9269    parseDeviceDefinitionDeviceDefinitionCapabilityComponentProperties(json, owner, res);
9270    return res;
9271  }
9272
9273  protected void parseDeviceDefinitionDeviceDefinitionCapabilityComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionCapabilityComponent res) throws IOException, FHIRFormatError {
9274    parseBackboneElementProperties(json, res);
9275    if (json.has("type"))
9276      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9277    if (json.has("description")) {
9278      JsonArray array = json.getAsJsonArray("description");
9279      for (int i = 0; i < array.size(); i++) {
9280        res.getDescription().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9281      }
9282    };
9283  }
9284
9285  protected DeviceDefinition.DeviceDefinitionPropertyComponent parseDeviceDefinitionDeviceDefinitionPropertyComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9286    DeviceDefinition.DeviceDefinitionPropertyComponent res = new DeviceDefinition.DeviceDefinitionPropertyComponent();
9287    parseDeviceDefinitionDeviceDefinitionPropertyComponentProperties(json, owner, res);
9288    return res;
9289  }
9290
9291  protected void parseDeviceDefinitionDeviceDefinitionPropertyComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionPropertyComponent res) throws IOException, FHIRFormatError {
9292    parseBackboneElementProperties(json, res);
9293    if (json.has("type"))
9294      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9295    if (json.has("valueQuantity")) {
9296      JsonArray array = json.getAsJsonArray("valueQuantity");
9297      for (int i = 0; i < array.size(); i++) {
9298        res.getValueQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
9299      }
9300    };
9301    if (json.has("valueCode")) {
9302      JsonArray array = json.getAsJsonArray("valueCode");
9303      for (int i = 0; i < array.size(); i++) {
9304        res.getValueCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9305      }
9306    };
9307  }
9308
9309  protected DeviceDefinition.DeviceDefinitionMaterialComponent parseDeviceDefinitionDeviceDefinitionMaterialComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9310    DeviceDefinition.DeviceDefinitionMaterialComponent res = new DeviceDefinition.DeviceDefinitionMaterialComponent();
9311    parseDeviceDefinitionDeviceDefinitionMaterialComponentProperties(json, owner, res);
9312    return res;
9313  }
9314
9315  protected void parseDeviceDefinitionDeviceDefinitionMaterialComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionMaterialComponent res) throws IOException, FHIRFormatError {
9316    parseBackboneElementProperties(json, res);
9317    if (json.has("substance"))
9318      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
9319    if (json.has("alternate"))
9320      res.setAlternateElement(parseBoolean(json.get("alternate").getAsBoolean()));
9321    if (json.has("_alternate"))
9322      parseElementProperties(json.getAsJsonObject("_alternate"), res.getAlternateElement());
9323    if (json.has("allergenicIndicator"))
9324      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
9325    if (json.has("_allergenicIndicator"))
9326      parseElementProperties(json.getAsJsonObject("_allergenicIndicator"), res.getAllergenicIndicatorElement());
9327  }
9328
9329  protected DeviceMetric parseDeviceMetric(JsonObject json) throws IOException, FHIRFormatError {
9330    DeviceMetric res = new DeviceMetric();
9331    parseDeviceMetricProperties(json, res);
9332    return res;
9333  }
9334
9335  protected void parseDeviceMetricProperties(JsonObject json, DeviceMetric res) throws IOException, FHIRFormatError {
9336    parseDomainResourceProperties(json, res);
9337    if (json.has("identifier")) {
9338      JsonArray array = json.getAsJsonArray("identifier");
9339      for (int i = 0; i < array.size(); i++) {
9340        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9341      }
9342    };
9343    if (json.has("type"))
9344      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9345    if (json.has("unit"))
9346      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
9347    if (json.has("source"))
9348      res.setSource(parseReference(json.getAsJsonObject("source")));
9349    if (json.has("parent"))
9350      res.setParent(parseReference(json.getAsJsonObject("parent")));
9351    if (json.has("operationalStatus"))
9352      res.setOperationalStatusElement(parseEnumeration(json.get("operationalStatus").getAsString(), DeviceMetric.DeviceMetricOperationalStatus.NULL, new DeviceMetric.DeviceMetricOperationalStatusEnumFactory()));
9353    if (json.has("_operationalStatus"))
9354      parseElementProperties(json.getAsJsonObject("_operationalStatus"), res.getOperationalStatusElement());
9355    if (json.has("color"))
9356      res.setColorElement(parseEnumeration(json.get("color").getAsString(), DeviceMetric.DeviceMetricColor.NULL, new DeviceMetric.DeviceMetricColorEnumFactory()));
9357    if (json.has("_color"))
9358      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
9359    if (json.has("category"))
9360      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), DeviceMetric.DeviceMetricCategory.NULL, new DeviceMetric.DeviceMetricCategoryEnumFactory()));
9361    if (json.has("_category"))
9362      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
9363    if (json.has("measurementPeriod"))
9364      res.setMeasurementPeriod(parseTiming(json.getAsJsonObject("measurementPeriod")));
9365    if (json.has("calibration")) {
9366      JsonArray array = json.getAsJsonArray("calibration");
9367      for (int i = 0; i < array.size(); i++) {
9368        res.getCalibration().add(parseDeviceMetricDeviceMetricCalibrationComponent(array.get(i).getAsJsonObject(), res));
9369      }
9370    };
9371  }
9372
9373  protected DeviceMetric.DeviceMetricCalibrationComponent parseDeviceMetricDeviceMetricCalibrationComponent(JsonObject json, DeviceMetric owner) throws IOException, FHIRFormatError {
9374    DeviceMetric.DeviceMetricCalibrationComponent res = new DeviceMetric.DeviceMetricCalibrationComponent();
9375    parseDeviceMetricDeviceMetricCalibrationComponentProperties(json, owner, res);
9376    return res;
9377  }
9378
9379  protected void parseDeviceMetricDeviceMetricCalibrationComponentProperties(JsonObject json, DeviceMetric owner, DeviceMetric.DeviceMetricCalibrationComponent res) throws IOException, FHIRFormatError {
9380    parseBackboneElementProperties(json, res);
9381    if (json.has("type"))
9382      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceMetric.DeviceMetricCalibrationType.NULL, new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory()));
9383    if (json.has("_type"))
9384      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9385    if (json.has("state"))
9386      res.setStateElement(parseEnumeration(json.get("state").getAsString(), DeviceMetric.DeviceMetricCalibrationState.NULL, new DeviceMetric.DeviceMetricCalibrationStateEnumFactory()));
9387    if (json.has("_state"))
9388      parseElementProperties(json.getAsJsonObject("_state"), res.getStateElement());
9389    if (json.has("time"))
9390      res.setTimeElement(parseInstant(json.get("time").getAsString()));
9391    if (json.has("_time"))
9392      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
9393  }
9394
9395  protected DeviceRequest parseDeviceRequest(JsonObject json) throws IOException, FHIRFormatError {
9396    DeviceRequest res = new DeviceRequest();
9397    parseDeviceRequestProperties(json, res);
9398    return res;
9399  }
9400
9401  protected void parseDeviceRequestProperties(JsonObject json, DeviceRequest res) throws IOException, FHIRFormatError {
9402    parseDomainResourceProperties(json, res);
9403    if (json.has("identifier")) {
9404      JsonArray array = json.getAsJsonArray("identifier");
9405      for (int i = 0; i < array.size(); i++) {
9406        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9407      }
9408    };
9409    if (json.has("instantiatesCanonical")) {
9410      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
9411      for (int i = 0; i < array.size(); i++) {
9412        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
9413      }
9414    };
9415    if (json.has("_instantiatesCanonical")) {
9416      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
9417      for (int i = 0; i < array.size(); i++) {
9418        if (i == res.getInstantiatesCanonical().size())
9419          res.getInstantiatesCanonical().add(parseCanonical(null));
9420        if (array.get(i) instanceof JsonObject) 
9421          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
9422      }
9423    };
9424    if (json.has("instantiatesUri")) {
9425      JsonArray array = json.getAsJsonArray("instantiatesUri");
9426      for (int i = 0; i < array.size(); i++) {
9427        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
9428      }
9429    };
9430    if (json.has("_instantiatesUri")) {
9431      JsonArray array = json.getAsJsonArray("_instantiatesUri");
9432      for (int i = 0; i < array.size(); i++) {
9433        if (i == res.getInstantiatesUri().size())
9434          res.getInstantiatesUri().add(parseUri(null));
9435        if (array.get(i) instanceof JsonObject) 
9436          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
9437      }
9438    };
9439    if (json.has("basedOn")) {
9440      JsonArray array = json.getAsJsonArray("basedOn");
9441      for (int i = 0; i < array.size(); i++) {
9442        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
9443      }
9444    };
9445    if (json.has("priorRequest")) {
9446      JsonArray array = json.getAsJsonArray("priorRequest");
9447      for (int i = 0; i < array.size(); i++) {
9448        res.getPriorRequest().add(parseReference(array.get(i).getAsJsonObject()));
9449      }
9450    };
9451    if (json.has("groupIdentifier"))
9452      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
9453    if (json.has("status"))
9454      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceRequest.DeviceRequestStatus.NULL, new DeviceRequest.DeviceRequestStatusEnumFactory()));
9455    if (json.has("_status"))
9456      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9457    if (json.has("intent"))
9458      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), DeviceRequest.RequestIntent.NULL, new DeviceRequest.RequestIntentEnumFactory()));
9459    if (json.has("_intent"))
9460      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
9461    if (json.has("priority"))
9462      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), DeviceRequest.RequestPriority.NULL, new DeviceRequest.RequestPriorityEnumFactory()));
9463    if (json.has("_priority"))
9464      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
9465    Type code = parseType("code", json);
9466    if (code != null)
9467      res.setCode(code);
9468    if (json.has("parameter")) {
9469      JsonArray array = json.getAsJsonArray("parameter");
9470      for (int i = 0; i < array.size(); i++) {
9471        res.getParameter().add(parseDeviceRequestDeviceRequestParameterComponent(array.get(i).getAsJsonObject(), res));
9472      }
9473    };
9474    if (json.has("subject"))
9475      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9476    if (json.has("encounter"))
9477      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
9478    Type occurrence = parseType("occurrence", json);
9479    if (occurrence != null)
9480      res.setOccurrence(occurrence);
9481    if (json.has("authoredOn"))
9482      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
9483    if (json.has("_authoredOn"))
9484      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
9485    if (json.has("requester"))
9486      res.setRequester(parseReference(json.getAsJsonObject("requester")));
9487    if (json.has("performerType"))
9488      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
9489    if (json.has("performer"))
9490      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
9491    if (json.has("reasonCode")) {
9492      JsonArray array = json.getAsJsonArray("reasonCode");
9493      for (int i = 0; i < array.size(); i++) {
9494        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9495      }
9496    };
9497    if (json.has("reasonReference")) {
9498      JsonArray array = json.getAsJsonArray("reasonReference");
9499      for (int i = 0; i < array.size(); i++) {
9500        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
9501      }
9502    };
9503    if (json.has("insurance")) {
9504      JsonArray array = json.getAsJsonArray("insurance");
9505      for (int i = 0; i < array.size(); i++) {
9506        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
9507      }
9508    };
9509    if (json.has("supportingInfo")) {
9510      JsonArray array = json.getAsJsonArray("supportingInfo");
9511      for (int i = 0; i < array.size(); i++) {
9512        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
9513      }
9514    };
9515    if (json.has("note")) {
9516      JsonArray array = json.getAsJsonArray("note");
9517      for (int i = 0; i < array.size(); i++) {
9518        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9519      }
9520    };
9521    if (json.has("relevantHistory")) {
9522      JsonArray array = json.getAsJsonArray("relevantHistory");
9523      for (int i = 0; i < array.size(); i++) {
9524        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
9525      }
9526    };
9527  }
9528
9529  protected DeviceRequest.DeviceRequestParameterComponent parseDeviceRequestDeviceRequestParameterComponent(JsonObject json, DeviceRequest owner) throws IOException, FHIRFormatError {
9530    DeviceRequest.DeviceRequestParameterComponent res = new DeviceRequest.DeviceRequestParameterComponent();
9531    parseDeviceRequestDeviceRequestParameterComponentProperties(json, owner, res);
9532    return res;
9533  }
9534
9535  protected void parseDeviceRequestDeviceRequestParameterComponentProperties(JsonObject json, DeviceRequest owner, DeviceRequest.DeviceRequestParameterComponent res) throws IOException, FHIRFormatError {
9536    parseBackboneElementProperties(json, res);
9537    if (json.has("code"))
9538      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
9539    Type value = parseType("value", json);
9540    if (value != null)
9541      res.setValue(value);
9542  }
9543
9544  protected DeviceUseStatement parseDeviceUseStatement(JsonObject json) throws IOException, FHIRFormatError {
9545    DeviceUseStatement res = new DeviceUseStatement();
9546    parseDeviceUseStatementProperties(json, res);
9547    return res;
9548  }
9549
9550  protected void parseDeviceUseStatementProperties(JsonObject json, DeviceUseStatement res) throws IOException, FHIRFormatError {
9551    parseDomainResourceProperties(json, res);
9552    if (json.has("identifier")) {
9553      JsonArray array = json.getAsJsonArray("identifier");
9554      for (int i = 0; i < array.size(); i++) {
9555        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9556      }
9557    };
9558    if (json.has("basedOn")) {
9559      JsonArray array = json.getAsJsonArray("basedOn");
9560      for (int i = 0; i < array.size(); i++) {
9561        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
9562      }
9563    };
9564    if (json.has("status"))
9565      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceUseStatement.DeviceUseStatementStatus.NULL, new DeviceUseStatement.DeviceUseStatementStatusEnumFactory()));
9566    if (json.has("_status"))
9567      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9568    if (json.has("subject"))
9569      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9570    if (json.has("derivedFrom")) {
9571      JsonArray array = json.getAsJsonArray("derivedFrom");
9572      for (int i = 0; i < array.size(); i++) {
9573        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
9574      }
9575    };
9576    Type timing = parseType("timing", json);
9577    if (timing != null)
9578      res.setTiming(timing);
9579    if (json.has("recordedOn"))
9580      res.setRecordedOnElement(parseDateTime(json.get("recordedOn").getAsString()));
9581    if (json.has("_recordedOn"))
9582      parseElementProperties(json.getAsJsonObject("_recordedOn"), res.getRecordedOnElement());
9583    if (json.has("source"))
9584      res.setSource(parseReference(json.getAsJsonObject("source")));
9585    if (json.has("device"))
9586      res.setDevice(parseReference(json.getAsJsonObject("device")));
9587    if (json.has("reasonCode")) {
9588      JsonArray array = json.getAsJsonArray("reasonCode");
9589      for (int i = 0; i < array.size(); i++) {
9590        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9591      }
9592    };
9593    if (json.has("reasonReference")) {
9594      JsonArray array = json.getAsJsonArray("reasonReference");
9595      for (int i = 0; i < array.size(); i++) {
9596        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
9597      }
9598    };
9599    if (json.has("bodySite"))
9600      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
9601    if (json.has("note")) {
9602      JsonArray array = json.getAsJsonArray("note");
9603      for (int i = 0; i < array.size(); i++) {
9604        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9605      }
9606    };
9607  }
9608
9609  protected DiagnosticReport parseDiagnosticReport(JsonObject json) throws IOException, FHIRFormatError {
9610    DiagnosticReport res = new DiagnosticReport();
9611    parseDiagnosticReportProperties(json, res);
9612    return res;
9613  }
9614
9615  protected void parseDiagnosticReportProperties(JsonObject json, DiagnosticReport res) throws IOException, FHIRFormatError {
9616    parseDomainResourceProperties(json, res);
9617    if (json.has("identifier")) {
9618      JsonArray array = json.getAsJsonArray("identifier");
9619      for (int i = 0; i < array.size(); i++) {
9620        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9621      }
9622    };
9623    if (json.has("basedOn")) {
9624      JsonArray array = json.getAsJsonArray("basedOn");
9625      for (int i = 0; i < array.size(); i++) {
9626        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
9627      }
9628    };
9629    if (json.has("status"))
9630      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticReport.DiagnosticReportStatus.NULL, new DiagnosticReport.DiagnosticReportStatusEnumFactory()));
9631    if (json.has("_status"))
9632      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9633    if (json.has("category")) {
9634      JsonArray array = json.getAsJsonArray("category");
9635      for (int i = 0; i < array.size(); i++) {
9636        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9637      }
9638    };
9639    if (json.has("code"))
9640      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
9641    if (json.has("subject"))
9642      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9643    if (json.has("encounter"))
9644      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
9645    Type effective = parseType("effective", json);
9646    if (effective != null)
9647      res.setEffective(effective);
9648    if (json.has("issued"))
9649      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
9650    if (json.has("_issued"))
9651      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
9652    if (json.has("performer")) {
9653      JsonArray array = json.getAsJsonArray("performer");
9654      for (int i = 0; i < array.size(); i++) {
9655        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
9656      }
9657    };
9658    if (json.has("resultsInterpreter")) {
9659      JsonArray array = json.getAsJsonArray("resultsInterpreter");
9660      for (int i = 0; i < array.size(); i++) {
9661        res.getResultsInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
9662      }
9663    };
9664    if (json.has("specimen")) {
9665      JsonArray array = json.getAsJsonArray("specimen");
9666      for (int i = 0; i < array.size(); i++) {
9667        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
9668      }
9669    };
9670    if (json.has("result")) {
9671      JsonArray array = json.getAsJsonArray("result");
9672      for (int i = 0; i < array.size(); i++) {
9673        res.getResult().add(parseReference(array.get(i).getAsJsonObject()));
9674      }
9675    };
9676    if (json.has("imagingStudy")) {
9677      JsonArray array = json.getAsJsonArray("imagingStudy");
9678      for (int i = 0; i < array.size(); i++) {
9679        res.getImagingStudy().add(parseReference(array.get(i).getAsJsonObject()));
9680      }
9681    };
9682    if (json.has("media")) {
9683      JsonArray array = json.getAsJsonArray("media");
9684      for (int i = 0; i < array.size(); i++) {
9685        res.getMedia().add(parseDiagnosticReportDiagnosticReportMediaComponent(array.get(i).getAsJsonObject(), res));
9686      }
9687    };
9688    if (json.has("conclusion"))
9689      res.setConclusionElement(parseString(json.get("conclusion").getAsString()));
9690    if (json.has("_conclusion"))
9691      parseElementProperties(json.getAsJsonObject("_conclusion"), res.getConclusionElement());
9692    if (json.has("conclusionCode")) {
9693      JsonArray array = json.getAsJsonArray("conclusionCode");
9694      for (int i = 0; i < array.size(); i++) {
9695        res.getConclusionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9696      }
9697    };
9698    if (json.has("presentedForm")) {
9699      JsonArray array = json.getAsJsonArray("presentedForm");
9700      for (int i = 0; i < array.size(); i++) {
9701        res.getPresentedForm().add(parseAttachment(array.get(i).getAsJsonObject()));
9702      }
9703    };
9704  }
9705
9706  protected DiagnosticReport.DiagnosticReportMediaComponent parseDiagnosticReportDiagnosticReportMediaComponent(JsonObject json, DiagnosticReport owner) throws IOException, FHIRFormatError {
9707    DiagnosticReport.DiagnosticReportMediaComponent res = new DiagnosticReport.DiagnosticReportMediaComponent();
9708    parseDiagnosticReportDiagnosticReportMediaComponentProperties(json, owner, res);
9709    return res;
9710  }
9711
9712  protected void parseDiagnosticReportDiagnosticReportMediaComponentProperties(JsonObject json, DiagnosticReport owner, DiagnosticReport.DiagnosticReportMediaComponent res) throws IOException, FHIRFormatError {
9713    parseBackboneElementProperties(json, res);
9714    if (json.has("comment"))
9715      res.setCommentElement(parseString(json.get("comment").getAsString()));
9716    if (json.has("_comment"))
9717      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
9718    if (json.has("link"))
9719      res.setLink(parseReference(json.getAsJsonObject("link")));
9720  }
9721
9722  protected DocumentManifest parseDocumentManifest(JsonObject json) throws IOException, FHIRFormatError {
9723    DocumentManifest res = new DocumentManifest();
9724    parseDocumentManifestProperties(json, res);
9725    return res;
9726  }
9727
9728  protected void parseDocumentManifestProperties(JsonObject json, DocumentManifest res) throws IOException, FHIRFormatError {
9729    parseDomainResourceProperties(json, res);
9730    if (json.has("masterIdentifier"))
9731      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
9732    if (json.has("identifier")) {
9733      JsonArray array = json.getAsJsonArray("identifier");
9734      for (int i = 0; i < array.size(); i++) {
9735        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9736      }
9737    };
9738    if (json.has("status"))
9739      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
9740    if (json.has("_status"))
9741      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9742    if (json.has("type"))
9743      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9744    if (json.has("subject"))
9745      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9746    if (json.has("created"))
9747      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
9748    if (json.has("_created"))
9749      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
9750    if (json.has("author")) {
9751      JsonArray array = json.getAsJsonArray("author");
9752      for (int i = 0; i < array.size(); i++) {
9753        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
9754      }
9755    };
9756    if (json.has("recipient")) {
9757      JsonArray array = json.getAsJsonArray("recipient");
9758      for (int i = 0; i < array.size(); i++) {
9759        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
9760      }
9761    };
9762    if (json.has("source"))
9763      res.setSourceElement(parseUri(json.get("source").getAsString()));
9764    if (json.has("_source"))
9765      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
9766    if (json.has("description"))
9767      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9768    if (json.has("_description"))
9769      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9770    if (json.has("content")) {
9771      JsonArray array = json.getAsJsonArray("content");
9772      for (int i = 0; i < array.size(); i++) {
9773        res.getContent().add(parseReference(array.get(i).getAsJsonObject()));
9774      }
9775    };
9776    if (json.has("related")) {
9777      JsonArray array = json.getAsJsonArray("related");
9778      for (int i = 0; i < array.size(); i++) {
9779        res.getRelated().add(parseDocumentManifestDocumentManifestRelatedComponent(array.get(i).getAsJsonObject(), res));
9780      }
9781    };
9782  }
9783
9784  protected DocumentManifest.DocumentManifestRelatedComponent parseDocumentManifestDocumentManifestRelatedComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
9785    DocumentManifest.DocumentManifestRelatedComponent res = new DocumentManifest.DocumentManifestRelatedComponent();
9786    parseDocumentManifestDocumentManifestRelatedComponentProperties(json, owner, res);
9787    return res;
9788  }
9789
9790  protected void parseDocumentManifestDocumentManifestRelatedComponentProperties(JsonObject json, DocumentManifest owner, DocumentManifest.DocumentManifestRelatedComponent res) throws IOException, FHIRFormatError {
9791    parseBackboneElementProperties(json, res);
9792    if (json.has("identifier"))
9793      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
9794    if (json.has("ref"))
9795      res.setRef(parseReference(json.getAsJsonObject("ref")));
9796  }
9797
9798  protected DocumentReference parseDocumentReference(JsonObject json) throws IOException, FHIRFormatError {
9799    DocumentReference res = new DocumentReference();
9800    parseDocumentReferenceProperties(json, res);
9801    return res;
9802  }
9803
9804  protected void parseDocumentReferenceProperties(JsonObject json, DocumentReference res) throws IOException, FHIRFormatError {
9805    parseDomainResourceProperties(json, res);
9806    if (json.has("masterIdentifier"))
9807      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
9808    if (json.has("identifier")) {
9809      JsonArray array = json.getAsJsonArray("identifier");
9810      for (int i = 0; i < array.size(); i++) {
9811        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9812      }
9813    };
9814    if (json.has("status"))
9815      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
9816    if (json.has("_status"))
9817      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9818    if (json.has("docStatus"))
9819      res.setDocStatusElement(parseEnumeration(json.get("docStatus").getAsString(), DocumentReference.ReferredDocumentStatus.NULL, new DocumentReference.ReferredDocumentStatusEnumFactory()));
9820    if (json.has("_docStatus"))
9821      parseElementProperties(json.getAsJsonObject("_docStatus"), res.getDocStatusElement());
9822    if (json.has("type"))
9823      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9824    if (json.has("category")) {
9825      JsonArray array = json.getAsJsonArray("category");
9826      for (int i = 0; i < array.size(); i++) {
9827        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9828      }
9829    };
9830    if (json.has("subject"))
9831      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9832    if (json.has("date"))
9833      res.setDateElement(parseInstant(json.get("date").getAsString()));
9834    if (json.has("_date"))
9835      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9836    if (json.has("author")) {
9837      JsonArray array = json.getAsJsonArray("author");
9838      for (int i = 0; i < array.size(); i++) {
9839        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
9840      }
9841    };
9842    if (json.has("authenticator"))
9843      res.setAuthenticator(parseReference(json.getAsJsonObject("authenticator")));
9844    if (json.has("custodian"))
9845      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
9846    if (json.has("relatesTo")) {
9847      JsonArray array = json.getAsJsonArray("relatesTo");
9848      for (int i = 0; i < array.size(); i++) {
9849        res.getRelatesTo().add(parseDocumentReferenceDocumentReferenceRelatesToComponent(array.get(i).getAsJsonObject(), res));
9850      }
9851    };
9852    if (json.has("description"))
9853      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9854    if (json.has("_description"))
9855      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9856    if (json.has("securityLabel")) {
9857      JsonArray array = json.getAsJsonArray("securityLabel");
9858      for (int i = 0; i < array.size(); i++) {
9859        res.getSecurityLabel().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9860      }
9861    };
9862    if (json.has("content")) {
9863      JsonArray array = json.getAsJsonArray("content");
9864      for (int i = 0; i < array.size(); i++) {
9865        res.getContent().add(parseDocumentReferenceDocumentReferenceContentComponent(array.get(i).getAsJsonObject(), res));
9866      }
9867    };
9868    if (json.has("context"))
9869      res.setContext(parseDocumentReferenceDocumentReferenceContextComponent(json.getAsJsonObject("context"), res));
9870  }
9871
9872  protected DocumentReference.DocumentReferenceRelatesToComponent parseDocumentReferenceDocumentReferenceRelatesToComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
9873    DocumentReference.DocumentReferenceRelatesToComponent res = new DocumentReference.DocumentReferenceRelatesToComponent();
9874    parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(json, owner, res);
9875    return res;
9876  }
9877
9878  protected void parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceRelatesToComponent res) throws IOException, FHIRFormatError {
9879    parseBackboneElementProperties(json, res);
9880    if (json.has("code"))
9881      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), DocumentReference.DocumentRelationshipType.NULL, new DocumentReference.DocumentRelationshipTypeEnumFactory()));
9882    if (json.has("_code"))
9883      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
9884    if (json.has("target"))
9885      res.setTarget(parseReference(json.getAsJsonObject("target")));
9886  }
9887
9888  protected DocumentReference.DocumentReferenceContentComponent parseDocumentReferenceDocumentReferenceContentComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
9889    DocumentReference.DocumentReferenceContentComponent res = new DocumentReference.DocumentReferenceContentComponent();
9890    parseDocumentReferenceDocumentReferenceContentComponentProperties(json, owner, res);
9891    return res;
9892  }
9893
9894  protected void parseDocumentReferenceDocumentReferenceContentComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContentComponent res) throws IOException, FHIRFormatError {
9895    parseBackboneElementProperties(json, res);
9896    if (json.has("attachment"))
9897      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
9898    if (json.has("format"))
9899      res.setFormat(parseCoding(json.getAsJsonObject("format")));
9900  }
9901
9902  protected DocumentReference.DocumentReferenceContextComponent parseDocumentReferenceDocumentReferenceContextComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
9903    DocumentReference.DocumentReferenceContextComponent res = new DocumentReference.DocumentReferenceContextComponent();
9904    parseDocumentReferenceDocumentReferenceContextComponentProperties(json, owner, res);
9905    return res;
9906  }
9907
9908  protected void parseDocumentReferenceDocumentReferenceContextComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContextComponent res) throws IOException, FHIRFormatError {
9909    parseBackboneElementProperties(json, res);
9910    if (json.has("encounter")) {
9911      JsonArray array = json.getAsJsonArray("encounter");
9912      for (int i = 0; i < array.size(); i++) {
9913        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
9914      }
9915    };
9916    if (json.has("event")) {
9917      JsonArray array = json.getAsJsonArray("event");
9918      for (int i = 0; i < array.size(); i++) {
9919        res.getEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9920      }
9921    };
9922    if (json.has("period"))
9923      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
9924    if (json.has("facilityType"))
9925      res.setFacilityType(parseCodeableConcept(json.getAsJsonObject("facilityType")));
9926    if (json.has("practiceSetting"))
9927      res.setPracticeSetting(parseCodeableConcept(json.getAsJsonObject("practiceSetting")));
9928    if (json.has("sourcePatientInfo"))
9929      res.setSourcePatientInfo(parseReference(json.getAsJsonObject("sourcePatientInfo")));
9930    if (json.has("related")) {
9931      JsonArray array = json.getAsJsonArray("related");
9932      for (int i = 0; i < array.size(); i++) {
9933        res.getRelated().add(parseReference(array.get(i).getAsJsonObject()));
9934      }
9935    };
9936  }
9937
9938  protected EffectEvidenceSynthesis parseEffectEvidenceSynthesis(JsonObject json) throws IOException, FHIRFormatError {
9939    EffectEvidenceSynthesis res = new EffectEvidenceSynthesis();
9940    parseEffectEvidenceSynthesisProperties(json, res);
9941    return res;
9942  }
9943
9944  protected void parseEffectEvidenceSynthesisProperties(JsonObject json, EffectEvidenceSynthesis res) throws IOException, FHIRFormatError {
9945    parseDomainResourceProperties(json, res);
9946    if (json.has("url"))
9947      res.setUrlElement(parseUri(json.get("url").getAsString()));
9948    if (json.has("_url"))
9949      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
9950    if (json.has("identifier")) {
9951      JsonArray array = json.getAsJsonArray("identifier");
9952      for (int i = 0; i < array.size(); i++) {
9953        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9954      }
9955    };
9956    if (json.has("version"))
9957      res.setVersionElement(parseString(json.get("version").getAsString()));
9958    if (json.has("_version"))
9959      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9960    if (json.has("name"))
9961      res.setNameElement(parseString(json.get("name").getAsString()));
9962    if (json.has("_name"))
9963      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9964    if (json.has("title"))
9965      res.setTitleElement(parseString(json.get("title").getAsString()));
9966    if (json.has("_title"))
9967      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
9968    if (json.has("status"))
9969      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
9970    if (json.has("_status"))
9971      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9972    if (json.has("date"))
9973      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9974    if (json.has("_date"))
9975      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9976    if (json.has("publisher"))
9977      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
9978    if (json.has("_publisher"))
9979      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
9980    if (json.has("contact")) {
9981      JsonArray array = json.getAsJsonArray("contact");
9982      for (int i = 0; i < array.size(); i++) {
9983        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
9984      }
9985    };
9986    if (json.has("description"))
9987      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
9988    if (json.has("_description"))
9989      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9990    if (json.has("note")) {
9991      JsonArray array = json.getAsJsonArray("note");
9992      for (int i = 0; i < array.size(); i++) {
9993        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9994      }
9995    };
9996    if (json.has("useContext")) {
9997      JsonArray array = json.getAsJsonArray("useContext");
9998      for (int i = 0; i < array.size(); i++) {
9999        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
10000      }
10001    };
10002    if (json.has("jurisdiction")) {
10003      JsonArray array = json.getAsJsonArray("jurisdiction");
10004      for (int i = 0; i < array.size(); i++) {
10005        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10006      }
10007    };
10008    if (json.has("copyright"))
10009      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
10010    if (json.has("_copyright"))
10011      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
10012    if (json.has("approvalDate"))
10013      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
10014    if (json.has("_approvalDate"))
10015      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
10016    if (json.has("lastReviewDate"))
10017      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
10018    if (json.has("_lastReviewDate"))
10019      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
10020    if (json.has("effectivePeriod"))
10021      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
10022    if (json.has("topic")) {
10023      JsonArray array = json.getAsJsonArray("topic");
10024      for (int i = 0; i < array.size(); i++) {
10025        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10026      }
10027    };
10028    if (json.has("author")) {
10029      JsonArray array = json.getAsJsonArray("author");
10030      for (int i = 0; i < array.size(); i++) {
10031        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10032      }
10033    };
10034    if (json.has("editor")) {
10035      JsonArray array = json.getAsJsonArray("editor");
10036      for (int i = 0; i < array.size(); i++) {
10037        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10038      }
10039    };
10040    if (json.has("reviewer")) {
10041      JsonArray array = json.getAsJsonArray("reviewer");
10042      for (int i = 0; i < array.size(); i++) {
10043        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
10044      }
10045    };
10046    if (json.has("endorser")) {
10047      JsonArray array = json.getAsJsonArray("endorser");
10048      for (int i = 0; i < array.size(); i++) {
10049        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
10050      }
10051    };
10052    if (json.has("relatedArtifact")) {
10053      JsonArray array = json.getAsJsonArray("relatedArtifact");
10054      for (int i = 0; i < array.size(); i++) {
10055        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
10056      }
10057    };
10058    if (json.has("synthesisType"))
10059      res.setSynthesisType(parseCodeableConcept(json.getAsJsonObject("synthesisType")));
10060    if (json.has("studyType"))
10061      res.setStudyType(parseCodeableConcept(json.getAsJsonObject("studyType")));
10062    if (json.has("population"))
10063      res.setPopulation(parseReference(json.getAsJsonObject("population")));
10064    if (json.has("exposure"))
10065      res.setExposure(parseReference(json.getAsJsonObject("exposure")));
10066    if (json.has("exposureAlternative"))
10067      res.setExposureAlternative(parseReference(json.getAsJsonObject("exposureAlternative")));
10068    if (json.has("outcome"))
10069      res.setOutcome(parseReference(json.getAsJsonObject("outcome")));
10070    if (json.has("sampleSize"))
10071      res.setSampleSize(parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent(json.getAsJsonObject("sampleSize"), res));
10072    if (json.has("resultsByExposure")) {
10073      JsonArray array = json.getAsJsonArray("resultsByExposure");
10074      for (int i = 0; i < array.size(); i++) {
10075        res.getResultsByExposure().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(array.get(i).getAsJsonObject(), res));
10076      }
10077    };
10078    if (json.has("effectEstimate")) {
10079      JsonArray array = json.getAsJsonArray("effectEstimate");
10080      for (int i = 0; i < array.size(); i++) {
10081        res.getEffectEstimate().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(array.get(i).getAsJsonObject(), res));
10082      }
10083    };
10084    if (json.has("certainty")) {
10085      JsonArray array = json.getAsJsonArray("certainty");
10086      for (int i = 0; i < array.size(); i++) {
10087        res.getCertainty().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(array.get(i).getAsJsonObject(), res));
10088      }
10089    };
10090  }
10091
10092  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10093    EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent();
10094    parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentProperties(json, owner, res);
10095    return res;
10096  }
10097
10098  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent res) throws IOException, FHIRFormatError {
10099    parseBackboneElementProperties(json, res);
10100    if (json.has("description"))
10101      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10102    if (json.has("_description"))
10103      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10104    if (json.has("numberOfStudies"))
10105      res.setNumberOfStudiesElement(parseInteger(json.get("numberOfStudies").getAsLong()));
10106    if (json.has("_numberOfStudies"))
10107      parseElementProperties(json.getAsJsonObject("_numberOfStudies"), res.getNumberOfStudiesElement());
10108    if (json.has("numberOfParticipants"))
10109      res.setNumberOfParticipantsElement(parseInteger(json.get("numberOfParticipants").getAsLong()));
10110    if (json.has("_numberOfParticipants"))
10111      parseElementProperties(json.getAsJsonObject("_numberOfParticipants"), res.getNumberOfParticipantsElement());
10112  }
10113
10114  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10115    EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent();
10116    parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentProperties(json, owner, res);
10117    return res;
10118  }
10119
10120  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent res) throws IOException, FHIRFormatError {
10121    parseBackboneElementProperties(json, res);
10122    if (json.has("description"))
10123      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10124    if (json.has("_description"))
10125      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10126    if (json.has("exposureState"))
10127      res.setExposureStateElement(parseEnumeration(json.get("exposureState").getAsString(), EffectEvidenceSynthesis.ExposureState.NULL, new EffectEvidenceSynthesis.ExposureStateEnumFactory()));
10128    if (json.has("_exposureState"))
10129      parseElementProperties(json.getAsJsonObject("_exposureState"), res.getExposureStateElement());
10130    if (json.has("variantState"))
10131      res.setVariantState(parseCodeableConcept(json.getAsJsonObject("variantState")));
10132    if (json.has("riskEvidenceSynthesis"))
10133      res.setRiskEvidenceSynthesis(parseReference(json.getAsJsonObject("riskEvidenceSynthesis")));
10134  }
10135
10136  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10137    EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent();
10138    parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentProperties(json, owner, res);
10139    return res;
10140  }
10141
10142  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent res) throws IOException, FHIRFormatError {
10143    parseBackboneElementProperties(json, res);
10144    if (json.has("description"))
10145      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10146    if (json.has("_description"))
10147      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10148    if (json.has("type"))
10149      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10150    if (json.has("variantState"))
10151      res.setVariantState(parseCodeableConcept(json.getAsJsonObject("variantState")));
10152    if (json.has("value"))
10153      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
10154    if (json.has("_value"))
10155      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
10156    if (json.has("unitOfMeasure"))
10157      res.setUnitOfMeasure(parseCodeableConcept(json.getAsJsonObject("unitOfMeasure")));
10158    if (json.has("precisionEstimate")) {
10159      JsonArray array = json.getAsJsonArray("precisionEstimate");
10160      for (int i = 0; i < array.size(); i++) {
10161        res.getPrecisionEstimate().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(array.get(i).getAsJsonObject(), owner));
10162      }
10163    };
10164  }
10165
10166  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10167    EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent();
10168    parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentProperties(json, owner, res);
10169    return res;
10170  }
10171
10172  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent res) throws IOException, FHIRFormatError {
10173    parseBackboneElementProperties(json, res);
10174    if (json.has("type"))
10175      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10176    if (json.has("level"))
10177      res.setLevelElement(parseDecimal(json.get("level").getAsBigDecimal()));
10178    if (json.has("_level"))
10179      parseElementProperties(json.getAsJsonObject("_level"), res.getLevelElement());
10180    if (json.has("from"))
10181      res.setFromElement(parseDecimal(json.get("from").getAsBigDecimal()));
10182    if (json.has("_from"))
10183      parseElementProperties(json.getAsJsonObject("_from"), res.getFromElement());
10184    if (json.has("to"))
10185      res.setToElement(parseDecimal(json.get("to").getAsBigDecimal()));
10186    if (json.has("_to"))
10187      parseElementProperties(json.getAsJsonObject("_to"), res.getToElement());
10188  }
10189
10190  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10191    EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent();
10192    parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentProperties(json, owner, res);
10193    return res;
10194  }
10195
10196  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent res) throws IOException, FHIRFormatError {
10197    parseBackboneElementProperties(json, res);
10198    if (json.has("rating")) {
10199      JsonArray array = json.getAsJsonArray("rating");
10200      for (int i = 0; i < array.size(); i++) {
10201        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10202      }
10203    };
10204    if (json.has("note")) {
10205      JsonArray array = json.getAsJsonArray("note");
10206      for (int i = 0; i < array.size(); i++) {
10207        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10208      }
10209    };
10210    if (json.has("certaintySubcomponent")) {
10211      JsonArray array = json.getAsJsonArray("certaintySubcomponent");
10212      for (int i = 0; i < array.size(); i++) {
10213        res.getCertaintySubcomponent().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(array.get(i).getAsJsonObject(), owner));
10214      }
10215    };
10216  }
10217
10218  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10219    EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent();
10220    parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentProperties(json, owner, res);
10221    return res;
10222  }
10223
10224  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent res) throws IOException, FHIRFormatError {
10225    parseBackboneElementProperties(json, res);
10226    if (json.has("type"))
10227      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10228    if (json.has("rating")) {
10229      JsonArray array = json.getAsJsonArray("rating");
10230      for (int i = 0; i < array.size(); i++) {
10231        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10232      }
10233    };
10234    if (json.has("note")) {
10235      JsonArray array = json.getAsJsonArray("note");
10236      for (int i = 0; i < array.size(); i++) {
10237        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10238      }
10239    };
10240  }
10241
10242  protected Encounter parseEncounter(JsonObject json) throws IOException, FHIRFormatError {
10243    Encounter res = new Encounter();
10244    parseEncounterProperties(json, res);
10245    return res;
10246  }
10247
10248  protected void parseEncounterProperties(JsonObject json, Encounter res) throws IOException, FHIRFormatError {
10249    parseDomainResourceProperties(json, res);
10250    if (json.has("identifier")) {
10251      JsonArray array = json.getAsJsonArray("identifier");
10252      for (int i = 0; i < array.size(); i++) {
10253        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10254      }
10255    };
10256    if (json.has("status"))
10257      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
10258    if (json.has("_status"))
10259      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10260    if (json.has("statusHistory")) {
10261      JsonArray array = json.getAsJsonArray("statusHistory");
10262      for (int i = 0; i < array.size(); i++) {
10263        res.getStatusHistory().add(parseEncounterStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
10264      }
10265    };
10266    if (json.has("class"))
10267      res.setClass_(parseCoding(json.getAsJsonObject("class")));
10268    if (json.has("classHistory")) {
10269      JsonArray array = json.getAsJsonArray("classHistory");
10270      for (int i = 0; i < array.size(); i++) {
10271        res.getClassHistory().add(parseEncounterClassHistoryComponent(array.get(i).getAsJsonObject(), res));
10272      }
10273    };
10274    if (json.has("type")) {
10275      JsonArray array = json.getAsJsonArray("type");
10276      for (int i = 0; i < array.size(); i++) {
10277        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10278      }
10279    };
10280    if (json.has("serviceType"))
10281      res.setServiceType(parseCodeableConcept(json.getAsJsonObject("serviceType")));
10282    if (json.has("priority"))
10283      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
10284    if (json.has("subject"))
10285      res.setSubject(parseReference(json.getAsJsonObject("subject")));
10286    if (json.has("episodeOfCare")) {
10287      JsonArray array = json.getAsJsonArray("episodeOfCare");
10288      for (int i = 0; i < array.size(); i++) {
10289        res.getEpisodeOfCare().add(parseReference(array.get(i).getAsJsonObject()));
10290      }
10291    };
10292    if (json.has("basedOn")) {
10293      JsonArray array = json.getAsJsonArray("basedOn");
10294      for (int i = 0; i < array.size(); i++) {
10295        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
10296      }
10297    };
10298    if (json.has("participant")) {
10299      JsonArray array = json.getAsJsonArray("participant");
10300      for (int i = 0; i < array.size(); i++) {
10301        res.getParticipant().add(parseEncounterEncounterParticipantComponent(array.get(i).getAsJsonObject(), res));
10302      }
10303    };
10304    if (json.has("appointment")) {
10305      JsonArray array = json.getAsJsonArray("appointment");
10306      for (int i = 0; i < array.size(); i++) {
10307        res.getAppointment().add(parseReference(array.get(i).getAsJsonObject()));
10308      }
10309    };
10310    if (json.has("period"))
10311      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10312    if (json.has("length"))
10313      res.setLength(parseDuration(json.getAsJsonObject("length")));
10314    if (json.has("reasonCode")) {
10315      JsonArray array = json.getAsJsonArray("reasonCode");
10316      for (int i = 0; i < array.size(); i++) {
10317        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10318      }
10319    };
10320    if (json.has("reasonReference")) {
10321      JsonArray array = json.getAsJsonArray("reasonReference");
10322      for (int i = 0; i < array.size(); i++) {
10323        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
10324      }
10325    };
10326    if (json.has("diagnosis")) {
10327      JsonArray array = json.getAsJsonArray("diagnosis");
10328      for (int i = 0; i < array.size(); i++) {
10329        res.getDiagnosis().add(parseEncounterDiagnosisComponent(array.get(i).getAsJsonObject(), res));
10330      }
10331    };
10332    if (json.has("account")) {
10333      JsonArray array = json.getAsJsonArray("account");
10334      for (int i = 0; i < array.size(); i++) {
10335        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
10336      }
10337    };
10338    if (json.has("hospitalization"))
10339      res.setHospitalization(parseEncounterEncounterHospitalizationComponent(json.getAsJsonObject("hospitalization"), res));
10340    if (json.has("location")) {
10341      JsonArray array = json.getAsJsonArray("location");
10342      for (int i = 0; i < array.size(); i++) {
10343        res.getLocation().add(parseEncounterEncounterLocationComponent(array.get(i).getAsJsonObject(), res));
10344      }
10345    };
10346    if (json.has("serviceProvider"))
10347      res.setServiceProvider(parseReference(json.getAsJsonObject("serviceProvider")));
10348    if (json.has("partOf"))
10349      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
10350  }
10351
10352  protected Encounter.StatusHistoryComponent parseEncounterStatusHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10353    Encounter.StatusHistoryComponent res = new Encounter.StatusHistoryComponent();
10354    parseEncounterStatusHistoryComponentProperties(json, owner, res);
10355    return res;
10356  }
10357
10358  protected void parseEncounterStatusHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.StatusHistoryComponent res) throws IOException, FHIRFormatError {
10359    parseBackboneElementProperties(json, res);
10360    if (json.has("status"))
10361      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
10362    if (json.has("_status"))
10363      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10364    if (json.has("period"))
10365      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10366  }
10367
10368  protected Encounter.ClassHistoryComponent parseEncounterClassHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10369    Encounter.ClassHistoryComponent res = new Encounter.ClassHistoryComponent();
10370    parseEncounterClassHistoryComponentProperties(json, owner, res);
10371    return res;
10372  }
10373
10374  protected void parseEncounterClassHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.ClassHistoryComponent res) throws IOException, FHIRFormatError {
10375    parseBackboneElementProperties(json, res);
10376    if (json.has("class"))
10377      res.setClass_(parseCoding(json.getAsJsonObject("class")));
10378    if (json.has("period"))
10379      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10380  }
10381
10382  protected Encounter.EncounterParticipantComponent parseEncounterEncounterParticipantComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10383    Encounter.EncounterParticipantComponent res = new Encounter.EncounterParticipantComponent();
10384    parseEncounterEncounterParticipantComponentProperties(json, owner, res);
10385    return res;
10386  }
10387
10388  protected void parseEncounterEncounterParticipantComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterParticipantComponent res) throws IOException, FHIRFormatError {
10389    parseBackboneElementProperties(json, res);
10390    if (json.has("type")) {
10391      JsonArray array = json.getAsJsonArray("type");
10392      for (int i = 0; i < array.size(); i++) {
10393        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10394      }
10395    };
10396    if (json.has("period"))
10397      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10398    if (json.has("individual"))
10399      res.setIndividual(parseReference(json.getAsJsonObject("individual")));
10400  }
10401
10402  protected Encounter.DiagnosisComponent parseEncounterDiagnosisComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10403    Encounter.DiagnosisComponent res = new Encounter.DiagnosisComponent();
10404    parseEncounterDiagnosisComponentProperties(json, owner, res);
10405    return res;
10406  }
10407
10408  protected void parseEncounterDiagnosisComponentProperties(JsonObject json, Encounter owner, Encounter.DiagnosisComponent res) throws IOException, FHIRFormatError {
10409    parseBackboneElementProperties(json, res);
10410    if (json.has("condition"))
10411      res.setCondition(parseReference(json.getAsJsonObject("condition")));
10412    if (json.has("use"))
10413      res.setUse(parseCodeableConcept(json.getAsJsonObject("use")));
10414    if (json.has("rank"))
10415      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
10416    if (json.has("_rank"))
10417      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
10418  }
10419
10420  protected Encounter.EncounterHospitalizationComponent parseEncounterEncounterHospitalizationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10421    Encounter.EncounterHospitalizationComponent res = new Encounter.EncounterHospitalizationComponent();
10422    parseEncounterEncounterHospitalizationComponentProperties(json, owner, res);
10423    return res;
10424  }
10425
10426  protected void parseEncounterEncounterHospitalizationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterHospitalizationComponent res) throws IOException, FHIRFormatError {
10427    parseBackboneElementProperties(json, res);
10428    if (json.has("preAdmissionIdentifier"))
10429      res.setPreAdmissionIdentifier(parseIdentifier(json.getAsJsonObject("preAdmissionIdentifier")));
10430    if (json.has("origin"))
10431      res.setOrigin(parseReference(json.getAsJsonObject("origin")));
10432    if (json.has("admitSource"))
10433      res.setAdmitSource(parseCodeableConcept(json.getAsJsonObject("admitSource")));
10434    if (json.has("reAdmission"))
10435      res.setReAdmission(parseCodeableConcept(json.getAsJsonObject("reAdmission")));
10436    if (json.has("dietPreference")) {
10437      JsonArray array = json.getAsJsonArray("dietPreference");
10438      for (int i = 0; i < array.size(); i++) {
10439        res.getDietPreference().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10440      }
10441    };
10442    if (json.has("specialCourtesy")) {
10443      JsonArray array = json.getAsJsonArray("specialCourtesy");
10444      for (int i = 0; i < array.size(); i++) {
10445        res.getSpecialCourtesy().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10446      }
10447    };
10448    if (json.has("specialArrangement")) {
10449      JsonArray array = json.getAsJsonArray("specialArrangement");
10450      for (int i = 0; i < array.size(); i++) {
10451        res.getSpecialArrangement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10452      }
10453    };
10454    if (json.has("destination"))
10455      res.setDestination(parseReference(json.getAsJsonObject("destination")));
10456    if (json.has("dischargeDisposition"))
10457      res.setDischargeDisposition(parseCodeableConcept(json.getAsJsonObject("dischargeDisposition")));
10458  }
10459
10460  protected Encounter.EncounterLocationComponent parseEncounterEncounterLocationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10461    Encounter.EncounterLocationComponent res = new Encounter.EncounterLocationComponent();
10462    parseEncounterEncounterLocationComponentProperties(json, owner, res);
10463    return res;
10464  }
10465
10466  protected void parseEncounterEncounterLocationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterLocationComponent res) throws IOException, FHIRFormatError {
10467    parseBackboneElementProperties(json, res);
10468    if (json.has("location"))
10469      res.setLocation(parseReference(json.getAsJsonObject("location")));
10470    if (json.has("status"))
10471      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterLocationStatus.NULL, new Encounter.EncounterLocationStatusEnumFactory()));
10472    if (json.has("_status"))
10473      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10474    if (json.has("physicalType"))
10475      res.setPhysicalType(parseCodeableConcept(json.getAsJsonObject("physicalType")));
10476    if (json.has("period"))
10477      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10478  }
10479
10480  protected Endpoint parseEndpoint(JsonObject json) throws IOException, FHIRFormatError {
10481    Endpoint res = new Endpoint();
10482    parseEndpointProperties(json, res);
10483    return res;
10484  }
10485
10486  protected void parseEndpointProperties(JsonObject json, Endpoint res) throws IOException, FHIRFormatError {
10487    parseDomainResourceProperties(json, res);
10488    if (json.has("identifier")) {
10489      JsonArray array = json.getAsJsonArray("identifier");
10490      for (int i = 0; i < array.size(); i++) {
10491        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10492      }
10493    };
10494    if (json.has("status"))
10495      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Endpoint.EndpointStatus.NULL, new Endpoint.EndpointStatusEnumFactory()));
10496    if (json.has("_status"))
10497      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10498    if (json.has("connectionType"))
10499      res.setConnectionType(parseCoding(json.getAsJsonObject("connectionType")));
10500    if (json.has("name"))
10501      res.setNameElement(parseString(json.get("name").getAsString()));
10502    if (json.has("_name"))
10503      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10504    if (json.has("managingOrganization"))
10505      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
10506    if (json.has("contact")) {
10507      JsonArray array = json.getAsJsonArray("contact");
10508      for (int i = 0; i < array.size(); i++) {
10509        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
10510      }
10511    };
10512    if (json.has("period"))
10513      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10514    if (json.has("payloadType")) {
10515      JsonArray array = json.getAsJsonArray("payloadType");
10516      for (int i = 0; i < array.size(); i++) {
10517        res.getPayloadType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10518      }
10519    };
10520    if (json.has("payloadMimeType")) {
10521      JsonArray array = json.getAsJsonArray("payloadMimeType");
10522      for (int i = 0; i < array.size(); i++) {
10523        res.getPayloadMimeType().add(parseCode(array.get(i).getAsString()));
10524      }
10525    };
10526    if (json.has("_payloadMimeType")) {
10527      JsonArray array = json.getAsJsonArray("_payloadMimeType");
10528      for (int i = 0; i < array.size(); i++) {
10529        if (i == res.getPayloadMimeType().size())
10530          res.getPayloadMimeType().add(parseCode(null));
10531        if (array.get(i) instanceof JsonObject) 
10532          parseElementProperties(array.get(i).getAsJsonObject(), res.getPayloadMimeType().get(i));
10533      }
10534    };
10535    if (json.has("address"))
10536      res.setAddressElement(parseUrl(json.get("address").getAsString()));
10537    if (json.has("_address"))
10538      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
10539    if (json.has("header")) {
10540      JsonArray array = json.getAsJsonArray("header");
10541      for (int i = 0; i < array.size(); i++) {
10542        res.getHeader().add(parseString(array.get(i).getAsString()));
10543      }
10544    };
10545    if (json.has("_header")) {
10546      JsonArray array = json.getAsJsonArray("_header");
10547      for (int i = 0; i < array.size(); i++) {
10548        if (i == res.getHeader().size())
10549          res.getHeader().add(parseString(null));
10550        if (array.get(i) instanceof JsonObject) 
10551          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
10552      }
10553    };
10554  }
10555
10556  protected EnrollmentRequest parseEnrollmentRequest(JsonObject json) throws IOException, FHIRFormatError {
10557    EnrollmentRequest res = new EnrollmentRequest();
10558    parseEnrollmentRequestProperties(json, res);
10559    return res;
10560  }
10561
10562  protected void parseEnrollmentRequestProperties(JsonObject json, EnrollmentRequest res) throws IOException, FHIRFormatError {
10563    parseDomainResourceProperties(json, res);
10564    if (json.has("identifier")) {
10565      JsonArray array = json.getAsJsonArray("identifier");
10566      for (int i = 0; i < array.size(); i++) {
10567        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10568      }
10569    };
10570    if (json.has("status"))
10571      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentRequest.EnrollmentRequestStatus.NULL, new EnrollmentRequest.EnrollmentRequestStatusEnumFactory()));
10572    if (json.has("_status"))
10573      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10574    if (json.has("created"))
10575      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
10576    if (json.has("_created"))
10577      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
10578    if (json.has("insurer"))
10579      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
10580    if (json.has("provider"))
10581      res.setProvider(parseReference(json.getAsJsonObject("provider")));
10582    if (json.has("candidate"))
10583      res.setCandidate(parseReference(json.getAsJsonObject("candidate")));
10584    if (json.has("coverage"))
10585      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
10586  }
10587
10588  protected EnrollmentResponse parseEnrollmentResponse(JsonObject json) throws IOException, FHIRFormatError {
10589    EnrollmentResponse res = new EnrollmentResponse();
10590    parseEnrollmentResponseProperties(json, res);
10591    return res;
10592  }
10593
10594  protected void parseEnrollmentResponseProperties(JsonObject json, EnrollmentResponse res) throws IOException, FHIRFormatError {
10595    parseDomainResourceProperties(json, res);
10596    if (json.has("identifier")) {
10597      JsonArray array = json.getAsJsonArray("identifier");
10598      for (int i = 0; i < array.size(); i++) {
10599        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10600      }
10601    };
10602    if (json.has("status"))
10603      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentResponse.EnrollmentResponseStatus.NULL, new EnrollmentResponse.EnrollmentResponseStatusEnumFactory()));
10604    if (json.has("_status"))
10605      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10606    if (json.has("request"))
10607      res.setRequest(parseReference(json.getAsJsonObject("request")));
10608    if (json.has("outcome"))
10609      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
10610    if (json.has("_outcome"))
10611      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
10612    if (json.has("disposition"))
10613      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
10614    if (json.has("_disposition"))
10615      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
10616    if (json.has("created"))
10617      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
10618    if (json.has("_created"))
10619      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
10620    if (json.has("organization"))
10621      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
10622    if (json.has("requestProvider"))
10623      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
10624  }
10625
10626  protected EpisodeOfCare parseEpisodeOfCare(JsonObject json) throws IOException, FHIRFormatError {
10627    EpisodeOfCare res = new EpisodeOfCare();
10628    parseEpisodeOfCareProperties(json, res);
10629    return res;
10630  }
10631
10632  protected void parseEpisodeOfCareProperties(JsonObject json, EpisodeOfCare res) throws IOException, FHIRFormatError {
10633    parseDomainResourceProperties(json, res);
10634    if (json.has("identifier")) {
10635      JsonArray array = json.getAsJsonArray("identifier");
10636      for (int i = 0; i < array.size(); i++) {
10637        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10638      }
10639    };
10640    if (json.has("status"))
10641      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
10642    if (json.has("_status"))
10643      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10644    if (json.has("statusHistory")) {
10645      JsonArray array = json.getAsJsonArray("statusHistory");
10646      for (int i = 0; i < array.size(); i++) {
10647        res.getStatusHistory().add(parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
10648      }
10649    };
10650    if (json.has("type")) {
10651      JsonArray array = json.getAsJsonArray("type");
10652      for (int i = 0; i < array.size(); i++) {
10653        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10654      }
10655    };
10656    if (json.has("diagnosis")) {
10657      JsonArray array = json.getAsJsonArray("diagnosis");
10658      for (int i = 0; i < array.size(); i++) {
10659        res.getDiagnosis().add(parseEpisodeOfCareDiagnosisComponent(array.get(i).getAsJsonObject(), res));
10660      }
10661    };
10662    if (json.has("patient"))
10663      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10664    if (json.has("managingOrganization"))
10665      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
10666    if (json.has("period"))
10667      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10668    if (json.has("referralRequest")) {
10669      JsonArray array = json.getAsJsonArray("referralRequest");
10670      for (int i = 0; i < array.size(); i++) {
10671        res.getReferralRequest().add(parseReference(array.get(i).getAsJsonObject()));
10672      }
10673    };
10674    if (json.has("careManager"))
10675      res.setCareManager(parseReference(json.getAsJsonObject("careManager")));
10676    if (json.has("team")) {
10677      JsonArray array = json.getAsJsonArray("team");
10678      for (int i = 0; i < array.size(); i++) {
10679        res.getTeam().add(parseReference(array.get(i).getAsJsonObject()));
10680      }
10681    };
10682    if (json.has("account")) {
10683      JsonArray array = json.getAsJsonArray("account");
10684      for (int i = 0; i < array.size(); i++) {
10685        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
10686      }
10687    };
10688  }
10689
10690  protected EpisodeOfCare.EpisodeOfCareStatusHistoryComponent parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
10691    EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res = new EpisodeOfCare.EpisodeOfCareStatusHistoryComponent();
10692    parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(json, owner, res);
10693    return res;
10694  }
10695
10696  protected void parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res) throws IOException, FHIRFormatError {
10697    parseBackboneElementProperties(json, res);
10698    if (json.has("status"))
10699      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
10700    if (json.has("_status"))
10701      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10702    if (json.has("period"))
10703      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10704  }
10705
10706  protected EpisodeOfCare.DiagnosisComponent parseEpisodeOfCareDiagnosisComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
10707    EpisodeOfCare.DiagnosisComponent res = new EpisodeOfCare.DiagnosisComponent();
10708    parseEpisodeOfCareDiagnosisComponentProperties(json, owner, res);
10709    return res;
10710  }
10711
10712  protected void parseEpisodeOfCareDiagnosisComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.DiagnosisComponent res) throws IOException, FHIRFormatError {
10713    parseBackboneElementProperties(json, res);
10714    if (json.has("condition"))
10715      res.setCondition(parseReference(json.getAsJsonObject("condition")));
10716    if (json.has("role"))
10717      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
10718    if (json.has("rank"))
10719      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
10720    if (json.has("_rank"))
10721      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
10722  }
10723
10724  protected EventDefinition parseEventDefinition(JsonObject json) throws IOException, FHIRFormatError {
10725    EventDefinition res = new EventDefinition();
10726    parseEventDefinitionProperties(json, res);
10727    return res;
10728  }
10729
10730  protected void parseEventDefinitionProperties(JsonObject json, EventDefinition res) throws IOException, FHIRFormatError {
10731    parseDomainResourceProperties(json, res);
10732    if (json.has("url"))
10733      res.setUrlElement(parseUri(json.get("url").getAsString()));
10734    if (json.has("_url"))
10735      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
10736    if (json.has("identifier")) {
10737      JsonArray array = json.getAsJsonArray("identifier");
10738      for (int i = 0; i < array.size(); i++) {
10739        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10740      }
10741    };
10742    if (json.has("version"))
10743      res.setVersionElement(parseString(json.get("version").getAsString()));
10744    if (json.has("_version"))
10745      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10746    if (json.has("name"))
10747      res.setNameElement(parseString(json.get("name").getAsString()));
10748    if (json.has("_name"))
10749      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10750    if (json.has("title"))
10751      res.setTitleElement(parseString(json.get("title").getAsString()));
10752    if (json.has("_title"))
10753      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
10754    if (json.has("subtitle"))
10755      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
10756    if (json.has("_subtitle"))
10757      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
10758    if (json.has("status"))
10759      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
10760    if (json.has("_status"))
10761      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10762    if (json.has("experimental"))
10763      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
10764    if (json.has("_experimental"))
10765      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
10766    Type subject = parseType("subject", json);
10767    if (subject != null)
10768      res.setSubject(subject);
10769    if (json.has("date"))
10770      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10771    if (json.has("_date"))
10772      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10773    if (json.has("publisher"))
10774      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
10775    if (json.has("_publisher"))
10776      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
10777    if (json.has("contact")) {
10778      JsonArray array = json.getAsJsonArray("contact");
10779      for (int i = 0; i < array.size(); i++) {
10780        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
10781      }
10782    };
10783    if (json.has("description"))
10784      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
10785    if (json.has("_description"))
10786      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10787    if (json.has("useContext")) {
10788      JsonArray array = json.getAsJsonArray("useContext");
10789      for (int i = 0; i < array.size(); i++) {
10790        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
10791      }
10792    };
10793    if (json.has("jurisdiction")) {
10794      JsonArray array = json.getAsJsonArray("jurisdiction");
10795      for (int i = 0; i < array.size(); i++) {
10796        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10797      }
10798    };
10799    if (json.has("purpose"))
10800      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
10801    if (json.has("_purpose"))
10802      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
10803    if (json.has("usage"))
10804      res.setUsageElement(parseString(json.get("usage").getAsString()));
10805    if (json.has("_usage"))
10806      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
10807    if (json.has("copyright"))
10808      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
10809    if (json.has("_copyright"))
10810      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
10811    if (json.has("approvalDate"))
10812      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
10813    if (json.has("_approvalDate"))
10814      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
10815    if (json.has("lastReviewDate"))
10816      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
10817    if (json.has("_lastReviewDate"))
10818      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
10819    if (json.has("effectivePeriod"))
10820      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
10821    if (json.has("topic")) {
10822      JsonArray array = json.getAsJsonArray("topic");
10823      for (int i = 0; i < array.size(); i++) {
10824        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10825      }
10826    };
10827    if (json.has("author")) {
10828      JsonArray array = json.getAsJsonArray("author");
10829      for (int i = 0; i < array.size(); i++) {
10830        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10831      }
10832    };
10833    if (json.has("editor")) {
10834      JsonArray array = json.getAsJsonArray("editor");
10835      for (int i = 0; i < array.size(); i++) {
10836        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10837      }
10838    };
10839    if (json.has("reviewer")) {
10840      JsonArray array = json.getAsJsonArray("reviewer");
10841      for (int i = 0; i < array.size(); i++) {
10842        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
10843      }
10844    };
10845    if (json.has("endorser")) {
10846      JsonArray array = json.getAsJsonArray("endorser");
10847      for (int i = 0; i < array.size(); i++) {
10848        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
10849      }
10850    };
10851    if (json.has("relatedArtifact")) {
10852      JsonArray array = json.getAsJsonArray("relatedArtifact");
10853      for (int i = 0; i < array.size(); i++) {
10854        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
10855      }
10856    };
10857    if (json.has("trigger")) {
10858      JsonArray array = json.getAsJsonArray("trigger");
10859      for (int i = 0; i < array.size(); i++) {
10860        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
10861      }
10862    };
10863  }
10864
10865  protected Evidence parseEvidence(JsonObject json) throws IOException, FHIRFormatError {
10866    Evidence res = new Evidence();
10867    parseEvidenceProperties(json, res);
10868    return res;
10869  }
10870
10871  protected void parseEvidenceProperties(JsonObject json, Evidence res) throws IOException, FHIRFormatError {
10872    parseDomainResourceProperties(json, res);
10873    if (json.has("url"))
10874      res.setUrlElement(parseUri(json.get("url").getAsString()));
10875    if (json.has("_url"))
10876      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
10877    if (json.has("identifier")) {
10878      JsonArray array = json.getAsJsonArray("identifier");
10879      for (int i = 0; i < array.size(); i++) {
10880        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10881      }
10882    };
10883    if (json.has("version"))
10884      res.setVersionElement(parseString(json.get("version").getAsString()));
10885    if (json.has("_version"))
10886      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10887    if (json.has("name"))
10888      res.setNameElement(parseString(json.get("name").getAsString()));
10889    if (json.has("_name"))
10890      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10891    if (json.has("title"))
10892      res.setTitleElement(parseString(json.get("title").getAsString()));
10893    if (json.has("_title"))
10894      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
10895    if (json.has("shortTitle"))
10896      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
10897    if (json.has("_shortTitle"))
10898      parseElementProperties(json.getAsJsonObject("_shortTitle"), res.getShortTitleElement());
10899    if (json.has("subtitle"))
10900      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
10901    if (json.has("_subtitle"))
10902      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
10903    if (json.has("status"))
10904      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
10905    if (json.has("_status"))
10906      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10907    if (json.has("date"))
10908      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10909    if (json.has("_date"))
10910      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10911    if (json.has("publisher"))
10912      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
10913    if (json.has("_publisher"))
10914      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
10915    if (json.has("contact")) {
10916      JsonArray array = json.getAsJsonArray("contact");
10917      for (int i = 0; i < array.size(); i++) {
10918        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
10919      }
10920    };
10921    if (json.has("description"))
10922      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
10923    if (json.has("_description"))
10924      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10925    if (json.has("note")) {
10926      JsonArray array = json.getAsJsonArray("note");
10927      for (int i = 0; i < array.size(); i++) {
10928        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10929      }
10930    };
10931    if (json.has("useContext")) {
10932      JsonArray array = json.getAsJsonArray("useContext");
10933      for (int i = 0; i < array.size(); i++) {
10934        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
10935      }
10936    };
10937    if (json.has("jurisdiction")) {
10938      JsonArray array = json.getAsJsonArray("jurisdiction");
10939      for (int i = 0; i < array.size(); i++) {
10940        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10941      }
10942    };
10943    if (json.has("copyright"))
10944      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
10945    if (json.has("_copyright"))
10946      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
10947    if (json.has("approvalDate"))
10948      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
10949    if (json.has("_approvalDate"))
10950      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
10951    if (json.has("lastReviewDate"))
10952      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
10953    if (json.has("_lastReviewDate"))
10954      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
10955    if (json.has("effectivePeriod"))
10956      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
10957    if (json.has("topic")) {
10958      JsonArray array = json.getAsJsonArray("topic");
10959      for (int i = 0; i < array.size(); i++) {
10960        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10961      }
10962    };
10963    if (json.has("author")) {
10964      JsonArray array = json.getAsJsonArray("author");
10965      for (int i = 0; i < array.size(); i++) {
10966        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10967      }
10968    };
10969    if (json.has("editor")) {
10970      JsonArray array = json.getAsJsonArray("editor");
10971      for (int i = 0; i < array.size(); i++) {
10972        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10973      }
10974    };
10975    if (json.has("reviewer")) {
10976      JsonArray array = json.getAsJsonArray("reviewer");
10977      for (int i = 0; i < array.size(); i++) {
10978        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
10979      }
10980    };
10981    if (json.has("endorser")) {
10982      JsonArray array = json.getAsJsonArray("endorser");
10983      for (int i = 0; i < array.size(); i++) {
10984        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
10985      }
10986    };
10987    if (json.has("relatedArtifact")) {
10988      JsonArray array = json.getAsJsonArray("relatedArtifact");
10989      for (int i = 0; i < array.size(); i++) {
10990        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
10991      }
10992    };
10993    if (json.has("exposureBackground"))
10994      res.setExposureBackground(parseReference(json.getAsJsonObject("exposureBackground")));
10995    if (json.has("exposureVariant")) {
10996      JsonArray array = json.getAsJsonArray("exposureVariant");
10997      for (int i = 0; i < array.size(); i++) {
10998        res.getExposureVariant().add(parseReference(array.get(i).getAsJsonObject()));
10999      }
11000    };
11001    if (json.has("outcome")) {
11002      JsonArray array = json.getAsJsonArray("outcome");
11003      for (int i = 0; i < array.size(); i++) {
11004        res.getOutcome().add(parseReference(array.get(i).getAsJsonObject()));
11005      }
11006    };
11007  }
11008
11009  protected EvidenceVariable parseEvidenceVariable(JsonObject json) throws IOException, FHIRFormatError {
11010    EvidenceVariable res = new EvidenceVariable();
11011    parseEvidenceVariableProperties(json, res);
11012    return res;
11013  }
11014
11015  protected void parseEvidenceVariableProperties(JsonObject json, EvidenceVariable res) throws IOException, FHIRFormatError {
11016    parseDomainResourceProperties(json, res);
11017    if (json.has("url"))
11018      res.setUrlElement(parseUri(json.get("url").getAsString()));
11019    if (json.has("_url"))
11020      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
11021    if (json.has("identifier")) {
11022      JsonArray array = json.getAsJsonArray("identifier");
11023      for (int i = 0; i < array.size(); i++) {
11024        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11025      }
11026    };
11027    if (json.has("version"))
11028      res.setVersionElement(parseString(json.get("version").getAsString()));
11029    if (json.has("_version"))
11030      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
11031    if (json.has("name"))
11032      res.setNameElement(parseString(json.get("name").getAsString()));
11033    if (json.has("_name"))
11034      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11035    if (json.has("title"))
11036      res.setTitleElement(parseString(json.get("title").getAsString()));
11037    if (json.has("_title"))
11038      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
11039    if (json.has("shortTitle"))
11040      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
11041    if (json.has("_shortTitle"))
11042      parseElementProperties(json.getAsJsonObject("_shortTitle"), res.getShortTitleElement());
11043    if (json.has("subtitle"))
11044      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
11045    if (json.has("_subtitle"))
11046      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
11047    if (json.has("status"))
11048      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11049    if (json.has("_status"))
11050      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11051    if (json.has("date"))
11052      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11053    if (json.has("_date"))
11054      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11055    if (json.has("publisher"))
11056      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11057    if (json.has("_publisher"))
11058      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
11059    if (json.has("contact")) {
11060      JsonArray array = json.getAsJsonArray("contact");
11061      for (int i = 0; i < array.size(); i++) {
11062        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
11063      }
11064    };
11065    if (json.has("description"))
11066      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11067    if (json.has("_description"))
11068      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11069    if (json.has("note")) {
11070      JsonArray array = json.getAsJsonArray("note");
11071      for (int i = 0; i < array.size(); i++) {
11072        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11073      }
11074    };
11075    if (json.has("useContext")) {
11076      JsonArray array = json.getAsJsonArray("useContext");
11077      for (int i = 0; i < array.size(); i++) {
11078        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11079      }
11080    };
11081    if (json.has("jurisdiction")) {
11082      JsonArray array = json.getAsJsonArray("jurisdiction");
11083      for (int i = 0; i < array.size(); i++) {
11084        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11085      }
11086    };
11087    if (json.has("copyright"))
11088      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
11089    if (json.has("_copyright"))
11090      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
11091    if (json.has("approvalDate"))
11092      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
11093    if (json.has("_approvalDate"))
11094      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
11095    if (json.has("lastReviewDate"))
11096      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
11097    if (json.has("_lastReviewDate"))
11098      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
11099    if (json.has("effectivePeriod"))
11100      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
11101    if (json.has("topic")) {
11102      JsonArray array = json.getAsJsonArray("topic");
11103      for (int i = 0; i < array.size(); i++) {
11104        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11105      }
11106    };
11107    if (json.has("author")) {
11108      JsonArray array = json.getAsJsonArray("author");
11109      for (int i = 0; i < array.size(); i++) {
11110        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
11111      }
11112    };
11113    if (json.has("editor")) {
11114      JsonArray array = json.getAsJsonArray("editor");
11115      for (int i = 0; i < array.size(); i++) {
11116        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
11117      }
11118    };
11119    if (json.has("reviewer")) {
11120      JsonArray array = json.getAsJsonArray("reviewer");
11121      for (int i = 0; i < array.size(); i++) {
11122        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
11123      }
11124    };
11125    if (json.has("endorser")) {
11126      JsonArray array = json.getAsJsonArray("endorser");
11127      for (int i = 0; i < array.size(); i++) {
11128        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
11129      }
11130    };
11131    if (json.has("relatedArtifact")) {
11132      JsonArray array = json.getAsJsonArray("relatedArtifact");
11133      for (int i = 0; i < array.size(); i++) {
11134        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
11135      }
11136    };
11137    if (json.has("type"))
11138      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), EvidenceVariable.EvidenceVariableType.NULL, new EvidenceVariable.EvidenceVariableTypeEnumFactory()));
11139    if (json.has("_type"))
11140      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
11141    if (json.has("characteristic")) {
11142      JsonArray array = json.getAsJsonArray("characteristic");
11143      for (int i = 0; i < array.size(); i++) {
11144        res.getCharacteristic().add(parseEvidenceVariableEvidenceVariableCharacteristicComponent(array.get(i).getAsJsonObject(), res));
11145      }
11146    };
11147  }
11148
11149  protected EvidenceVariable.EvidenceVariableCharacteristicComponent parseEvidenceVariableEvidenceVariableCharacteristicComponent(JsonObject json, EvidenceVariable owner) throws IOException, FHIRFormatError {
11150    EvidenceVariable.EvidenceVariableCharacteristicComponent res = new EvidenceVariable.EvidenceVariableCharacteristicComponent();
11151    parseEvidenceVariableEvidenceVariableCharacteristicComponentProperties(json, owner, res);
11152    return res;
11153  }
11154
11155  protected void parseEvidenceVariableEvidenceVariableCharacteristicComponentProperties(JsonObject json, EvidenceVariable owner, EvidenceVariable.EvidenceVariableCharacteristicComponent res) throws IOException, FHIRFormatError {
11156    parseBackboneElementProperties(json, res);
11157    if (json.has("description"))
11158      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11159    if (json.has("_description"))
11160      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11161    Type definition = parseType("definition", json);
11162    if (definition != null)
11163      res.setDefinition(definition);
11164    if (json.has("usageContext")) {
11165      JsonArray array = json.getAsJsonArray("usageContext");
11166      for (int i = 0; i < array.size(); i++) {
11167        res.getUsageContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11168      }
11169    };
11170    if (json.has("exclude"))
11171      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
11172    if (json.has("_exclude"))
11173      parseElementProperties(json.getAsJsonObject("_exclude"), res.getExcludeElement());
11174    Type participantEffective = parseType("participantEffective", json);
11175    if (participantEffective != null)
11176      res.setParticipantEffective(participantEffective);
11177    if (json.has("timeFromStart"))
11178      res.setTimeFromStart(parseDuration(json.getAsJsonObject("timeFromStart")));
11179    if (json.has("groupMeasure"))
11180      res.setGroupMeasureElement(parseEnumeration(json.get("groupMeasure").getAsString(), EvidenceVariable.GroupMeasure.NULL, new EvidenceVariable.GroupMeasureEnumFactory()));
11181    if (json.has("_groupMeasure"))
11182      parseElementProperties(json.getAsJsonObject("_groupMeasure"), res.getGroupMeasureElement());
11183  }
11184
11185  protected ExampleScenario parseExampleScenario(JsonObject json) throws IOException, FHIRFormatError {
11186    ExampleScenario res = new ExampleScenario();
11187    parseExampleScenarioProperties(json, res);
11188    return res;
11189  }
11190
11191  protected void parseExampleScenarioProperties(JsonObject json, ExampleScenario res) throws IOException, FHIRFormatError {
11192    parseDomainResourceProperties(json, res);
11193    if (json.has("url"))
11194      res.setUrlElement(parseUri(json.get("url").getAsString()));
11195    if (json.has("_url"))
11196      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
11197    if (json.has("identifier")) {
11198      JsonArray array = json.getAsJsonArray("identifier");
11199      for (int i = 0; i < array.size(); i++) {
11200        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11201      }
11202    };
11203    if (json.has("version"))
11204      res.setVersionElement(parseString(json.get("version").getAsString()));
11205    if (json.has("_version"))
11206      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
11207    if (json.has("name"))
11208      res.setNameElement(parseString(json.get("name").getAsString()));
11209    if (json.has("_name"))
11210      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11211    if (json.has("status"))
11212      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11213    if (json.has("_status"))
11214      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11215    if (json.has("experimental"))
11216      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
11217    if (json.has("_experimental"))
11218      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
11219    if (json.has("date"))
11220      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11221    if (json.has("_date"))
11222      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11223    if (json.has("publisher"))
11224      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11225    if (json.has("_publisher"))
11226      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
11227    if (json.has("contact")) {
11228      JsonArray array = json.getAsJsonArray("contact");
11229      for (int i = 0; i < array.size(); i++) {
11230        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
11231      }
11232    };
11233    if (json.has("useContext")) {
11234      JsonArray array = json.getAsJsonArray("useContext");
11235      for (int i = 0; i < array.size(); i++) {
11236        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11237      }
11238    };
11239    if (json.has("jurisdiction")) {
11240      JsonArray array = json.getAsJsonArray("jurisdiction");
11241      for (int i = 0; i < array.size(); i++) {
11242        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11243      }
11244    };
11245    if (json.has("copyright"))
11246      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
11247    if (json.has("_copyright"))
11248      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
11249    if (json.has("purpose"))
11250      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
11251    if (json.has("_purpose"))
11252      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
11253    if (json.has("actor")) {
11254      JsonArray array = json.getAsJsonArray("actor");
11255      for (int i = 0; i < array.size(); i++) {
11256        res.getActor().add(parseExampleScenarioExampleScenarioActorComponent(array.get(i).getAsJsonObject(), res));
11257      }
11258    };
11259    if (json.has("instance")) {
11260      JsonArray array = json.getAsJsonArray("instance");
11261      for (int i = 0; i < array.size(); i++) {
11262        res.getInstance().add(parseExampleScenarioExampleScenarioInstanceComponent(array.get(i).getAsJsonObject(), res));
11263      }
11264    };
11265    if (json.has("process")) {
11266      JsonArray array = json.getAsJsonArray("process");
11267      for (int i = 0; i < array.size(); i++) {
11268        res.getProcess().add(parseExampleScenarioExampleScenarioProcessComponent(array.get(i).getAsJsonObject(), res));
11269      }
11270    };
11271    if (json.has("workflow")) {
11272      JsonArray array = json.getAsJsonArray("workflow");
11273      for (int i = 0; i < array.size(); i++) {
11274        res.getWorkflow().add(parseCanonical(array.get(i).getAsString()));
11275      }
11276    };
11277    if (json.has("_workflow")) {
11278      JsonArray array = json.getAsJsonArray("_workflow");
11279      for (int i = 0; i < array.size(); i++) {
11280        if (i == res.getWorkflow().size())
11281          res.getWorkflow().add(parseCanonical(null));
11282        if (array.get(i) instanceof JsonObject) 
11283          parseElementProperties(array.get(i).getAsJsonObject(), res.getWorkflow().get(i));
11284      }
11285    };
11286  }
11287
11288  protected ExampleScenario.ExampleScenarioActorComponent parseExampleScenarioExampleScenarioActorComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11289    ExampleScenario.ExampleScenarioActorComponent res = new ExampleScenario.ExampleScenarioActorComponent();
11290    parseExampleScenarioExampleScenarioActorComponentProperties(json, owner, res);
11291    return res;
11292  }
11293
11294  protected void parseExampleScenarioExampleScenarioActorComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioActorComponent res) throws IOException, FHIRFormatError {
11295    parseBackboneElementProperties(json, res);
11296    if (json.has("actorId"))
11297      res.setActorIdElement(parseString(json.get("actorId").getAsString()));
11298    if (json.has("_actorId"))
11299      parseElementProperties(json.getAsJsonObject("_actorId"), res.getActorIdElement());
11300    if (json.has("type"))
11301      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ExampleScenario.ExampleScenarioActorType.NULL, new ExampleScenario.ExampleScenarioActorTypeEnumFactory()));
11302    if (json.has("_type"))
11303      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
11304    if (json.has("name"))
11305      res.setNameElement(parseString(json.get("name").getAsString()));
11306    if (json.has("_name"))
11307      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11308    if (json.has("description"))
11309      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11310    if (json.has("_description"))
11311      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11312  }
11313
11314  protected ExampleScenario.ExampleScenarioInstanceComponent parseExampleScenarioExampleScenarioInstanceComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11315    ExampleScenario.ExampleScenarioInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceComponent();
11316    parseExampleScenarioExampleScenarioInstanceComponentProperties(json, owner, res);
11317    return res;
11318  }
11319
11320  protected void parseExampleScenarioExampleScenarioInstanceComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceComponent res) throws IOException, FHIRFormatError {
11321    parseBackboneElementProperties(json, res);
11322    if (json.has("resourceId"))
11323      res.setResourceIdElement(parseString(json.get("resourceId").getAsString()));
11324    if (json.has("_resourceId"))
11325      parseElementProperties(json.getAsJsonObject("_resourceId"), res.getResourceIdElement());
11326    if (json.has("resourceType"))
11327      res.setResourceTypeElement(parseEnumeration(json.get("resourceType").getAsString(), ExampleScenario.FHIRResourceType.NULL, new ExampleScenario.FHIRResourceTypeEnumFactory()));
11328    if (json.has("_resourceType"))
11329      parseElementProperties(json.getAsJsonObject("_resourceType"), res.getResourceTypeElement());
11330    if (json.has("name"))
11331      res.setNameElement(parseString(json.get("name").getAsString()));
11332    if (json.has("_name"))
11333      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11334    if (json.has("description"))
11335      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11336    if (json.has("_description"))
11337      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11338    if (json.has("version")) {
11339      JsonArray array = json.getAsJsonArray("version");
11340      for (int i = 0; i < array.size(); i++) {
11341        res.getVersion().add(parseExampleScenarioExampleScenarioInstanceVersionComponent(array.get(i).getAsJsonObject(), owner));
11342      }
11343    };
11344    if (json.has("containedInstance")) {
11345      JsonArray array = json.getAsJsonArray("containedInstance");
11346      for (int i = 0; i < array.size(); i++) {
11347        res.getContainedInstance().add(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(array.get(i).getAsJsonObject(), owner));
11348      }
11349    };
11350  }
11351
11352  protected ExampleScenario.ExampleScenarioInstanceVersionComponent parseExampleScenarioExampleScenarioInstanceVersionComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11353    ExampleScenario.ExampleScenarioInstanceVersionComponent res = new ExampleScenario.ExampleScenarioInstanceVersionComponent();
11354    parseExampleScenarioExampleScenarioInstanceVersionComponentProperties(json, owner, res);
11355    return res;
11356  }
11357
11358  protected void parseExampleScenarioExampleScenarioInstanceVersionComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceVersionComponent res) throws IOException, FHIRFormatError {
11359    parseBackboneElementProperties(json, res);
11360    if (json.has("versionId"))
11361      res.setVersionIdElement(parseString(json.get("versionId").getAsString()));
11362    if (json.has("_versionId"))
11363      parseElementProperties(json.getAsJsonObject("_versionId"), res.getVersionIdElement());
11364    if (json.has("description"))
11365      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11366    if (json.has("_description"))
11367      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11368  }
11369
11370  protected ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11371    ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent();
11372    parseExampleScenarioExampleScenarioInstanceContainedInstanceComponentProperties(json, owner, res);
11373    return res;
11374  }
11375
11376  protected void parseExampleScenarioExampleScenarioInstanceContainedInstanceComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res) throws IOException, FHIRFormatError {
11377    parseBackboneElementProperties(json, res);
11378    if (json.has("resourceId"))
11379      res.setResourceIdElement(parseString(json.get("resourceId").getAsString()));
11380    if (json.has("_resourceId"))
11381      parseElementProperties(json.getAsJsonObject("_resourceId"), res.getResourceIdElement());
11382    if (json.has("versionId"))
11383      res.setVersionIdElement(parseString(json.get("versionId").getAsString()));
11384    if (json.has("_versionId"))
11385      parseElementProperties(json.getAsJsonObject("_versionId"), res.getVersionIdElement());
11386  }
11387
11388  protected ExampleScenario.ExampleScenarioProcessComponent parseExampleScenarioExampleScenarioProcessComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11389    ExampleScenario.ExampleScenarioProcessComponent res = new ExampleScenario.ExampleScenarioProcessComponent();
11390    parseExampleScenarioExampleScenarioProcessComponentProperties(json, owner, res);
11391    return res;
11392  }
11393
11394  protected void parseExampleScenarioExampleScenarioProcessComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessComponent res) throws IOException, FHIRFormatError {
11395    parseBackboneElementProperties(json, res);
11396    if (json.has("title"))
11397      res.setTitleElement(parseString(json.get("title").getAsString()));
11398    if (json.has("_title"))
11399      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
11400    if (json.has("description"))
11401      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11402    if (json.has("_description"))
11403      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11404    if (json.has("preConditions"))
11405      res.setPreConditionsElement(parseMarkdown(json.get("preConditions").getAsString()));
11406    if (json.has("_preConditions"))
11407      parseElementProperties(json.getAsJsonObject("_preConditions"), res.getPreConditionsElement());
11408    if (json.has("postConditions"))
11409      res.setPostConditionsElement(parseMarkdown(json.get("postConditions").getAsString()));
11410    if (json.has("_postConditions"))
11411      parseElementProperties(json.getAsJsonObject("_postConditions"), res.getPostConditionsElement());
11412    if (json.has("step")) {
11413      JsonArray array = json.getAsJsonArray("step");
11414      for (int i = 0; i < array.size(); i++) {
11415        res.getStep().add(parseExampleScenarioExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject(), owner));
11416      }
11417    };
11418  }
11419
11420  protected ExampleScenario.ExampleScenarioProcessStepComponent parseExampleScenarioExampleScenarioProcessStepComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11421    ExampleScenario.ExampleScenarioProcessStepComponent res = new ExampleScenario.ExampleScenarioProcessStepComponent();
11422    parseExampleScenarioExampleScenarioProcessStepComponentProperties(json, owner, res);
11423    return res;
11424  }
11425
11426  protected void parseExampleScenarioExampleScenarioProcessStepComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepComponent res) throws IOException, FHIRFormatError {
11427    parseBackboneElementProperties(json, res);
11428    if (json.has("process")) {
11429      JsonArray array = json.getAsJsonArray("process");
11430      for (int i = 0; i < array.size(); i++) {
11431        res.getProcess().add(parseExampleScenarioExampleScenarioProcessComponent(array.get(i).getAsJsonObject(), owner));
11432      }
11433    };
11434    if (json.has("pause"))
11435      res.setPauseElement(parseBoolean(json.get("pause").getAsBoolean()));
11436    if (json.has("_pause"))
11437      parseElementProperties(json.getAsJsonObject("_pause"), res.getPauseElement());
11438    if (json.has("operation"))
11439      res.setOperation(parseExampleScenarioExampleScenarioProcessStepOperationComponent(json.getAsJsonObject("operation"), owner));
11440    if (json.has("alternative")) {
11441      JsonArray array = json.getAsJsonArray("alternative");
11442      for (int i = 0; i < array.size(); i++) {
11443        res.getAlternative().add(parseExampleScenarioExampleScenarioProcessStepAlternativeComponent(array.get(i).getAsJsonObject(), owner));
11444      }
11445    };
11446  }
11447
11448  protected ExampleScenario.ExampleScenarioProcessStepOperationComponent parseExampleScenarioExampleScenarioProcessStepOperationComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11449    ExampleScenario.ExampleScenarioProcessStepOperationComponent res = new ExampleScenario.ExampleScenarioProcessStepOperationComponent();
11450    parseExampleScenarioExampleScenarioProcessStepOperationComponentProperties(json, owner, res);
11451    return res;
11452  }
11453
11454  protected void parseExampleScenarioExampleScenarioProcessStepOperationComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepOperationComponent res) throws IOException, FHIRFormatError {
11455    parseBackboneElementProperties(json, res);
11456    if (json.has("number"))
11457      res.setNumberElement(parseString(json.get("number").getAsString()));
11458    if (json.has("_number"))
11459      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
11460    if (json.has("type"))
11461      res.setTypeElement(parseString(json.get("type").getAsString()));
11462    if (json.has("_type"))
11463      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
11464    if (json.has("name"))
11465      res.setNameElement(parseString(json.get("name").getAsString()));
11466    if (json.has("_name"))
11467      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11468    if (json.has("initiator"))
11469      res.setInitiatorElement(parseString(json.get("initiator").getAsString()));
11470    if (json.has("_initiator"))
11471      parseElementProperties(json.getAsJsonObject("_initiator"), res.getInitiatorElement());
11472    if (json.has("receiver"))
11473      res.setReceiverElement(parseString(json.get("receiver").getAsString()));
11474    if (json.has("_receiver"))
11475      parseElementProperties(json.getAsJsonObject("_receiver"), res.getReceiverElement());
11476    if (json.has("description"))
11477      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11478    if (json.has("_description"))
11479      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11480    if (json.has("initiatorActive"))
11481      res.setInitiatorActiveElement(parseBoolean(json.get("initiatorActive").getAsBoolean()));
11482    if (json.has("_initiatorActive"))
11483      parseElementProperties(json.getAsJsonObject("_initiatorActive"), res.getInitiatorActiveElement());
11484    if (json.has("receiverActive"))
11485      res.setReceiverActiveElement(parseBoolean(json.get("receiverActive").getAsBoolean()));
11486    if (json.has("_receiverActive"))
11487      parseElementProperties(json.getAsJsonObject("_receiverActive"), res.getReceiverActiveElement());
11488    if (json.has("request"))
11489      res.setRequest(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(json.getAsJsonObject("request"), owner));
11490    if (json.has("response"))
11491      res.setResponse(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(json.getAsJsonObject("response"), owner));
11492  }
11493
11494  protected ExampleScenario.ExampleScenarioProcessStepAlternativeComponent parseExampleScenarioExampleScenarioProcessStepAlternativeComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11495    ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res = new ExampleScenario.ExampleScenarioProcessStepAlternativeComponent();
11496    parseExampleScenarioExampleScenarioProcessStepAlternativeComponentProperties(json, owner, res);
11497    return res;
11498  }
11499
11500  protected void parseExampleScenarioExampleScenarioProcessStepAlternativeComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res) throws IOException, FHIRFormatError {
11501    parseBackboneElementProperties(json, res);
11502    if (json.has("title"))
11503      res.setTitleElement(parseString(json.get("title").getAsString()));
11504    if (json.has("_title"))
11505      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
11506    if (json.has("description"))
11507      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11508    if (json.has("_description"))
11509      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11510    if (json.has("step")) {
11511      JsonArray array = json.getAsJsonArray("step");
11512      for (int i = 0; i < array.size(); i++) {
11513        res.getStep().add(parseExampleScenarioExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject(), owner));
11514      }
11515    };
11516  }
11517
11518  protected ExplanationOfBenefit parseExplanationOfBenefit(JsonObject json) throws IOException, FHIRFormatError {
11519    ExplanationOfBenefit res = new ExplanationOfBenefit();
11520    parseExplanationOfBenefitProperties(json, res);
11521    return res;
11522  }
11523
11524  protected void parseExplanationOfBenefitProperties(JsonObject json, ExplanationOfBenefit res) throws IOException, FHIRFormatError {
11525    parseDomainResourceProperties(json, res);
11526    if (json.has("identifier")) {
11527      JsonArray array = json.getAsJsonArray("identifier");
11528      for (int i = 0; i < array.size(); i++) {
11529        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11530      }
11531    };
11532    if (json.has("status"))
11533      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ExplanationOfBenefit.ExplanationOfBenefitStatus.NULL, new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory()));
11534    if (json.has("_status"))
11535      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11536    if (json.has("type"))
11537      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
11538    if (json.has("subType"))
11539      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
11540    if (json.has("use"))
11541      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ExplanationOfBenefit.Use.NULL, new ExplanationOfBenefit.UseEnumFactory()));
11542    if (json.has("_use"))
11543      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
11544    if (json.has("patient"))
11545      res.setPatient(parseReference(json.getAsJsonObject("patient")));
11546    if (json.has("billablePeriod"))
11547      res.setBillablePeriod(parsePeriod(json.getAsJsonObject("billablePeriod")));
11548    if (json.has("created"))
11549      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
11550    if (json.has("_created"))
11551      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
11552    if (json.has("enterer"))
11553      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
11554    if (json.has("insurer"))
11555      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
11556    if (json.has("provider"))
11557      res.setProvider(parseReference(json.getAsJsonObject("provider")));
11558    if (json.has("priority"))
11559      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
11560    if (json.has("fundsReserveRequested"))
11561      res.setFundsReserveRequested(parseCodeableConcept(json.getAsJsonObject("fundsReserveRequested")));
11562    if (json.has("fundsReserve"))
11563      res.setFundsReserve(parseCodeableConcept(json.getAsJsonObject("fundsReserve")));
11564    if (json.has("related")) {
11565      JsonArray array = json.getAsJsonArray("related");
11566      for (int i = 0; i < array.size(); i++) {
11567        res.getRelated().add(parseExplanationOfBenefitRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
11568      }
11569    };
11570    if (json.has("prescription"))
11571      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
11572    if (json.has("originalPrescription"))
11573      res.setOriginalPrescription(parseReference(json.getAsJsonObject("originalPrescription")));
11574    if (json.has("payee"))
11575      res.setPayee(parseExplanationOfBenefitPayeeComponent(json.getAsJsonObject("payee"), res));
11576    if (json.has("referral"))
11577      res.setReferral(parseReference(json.getAsJsonObject("referral")));
11578    if (json.has("facility"))
11579      res.setFacility(parseReference(json.getAsJsonObject("facility")));
11580    if (json.has("claim"))
11581      res.setClaim(parseReference(json.getAsJsonObject("claim")));
11582    if (json.has("claimResponse"))
11583      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
11584    if (json.has("outcome"))
11585      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), ExplanationOfBenefit.RemittanceOutcome.NULL, new ExplanationOfBenefit.RemittanceOutcomeEnumFactory()));
11586    if (json.has("_outcome"))
11587      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
11588    if (json.has("disposition"))
11589      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
11590    if (json.has("_disposition"))
11591      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
11592    if (json.has("preAuthRef")) {
11593      JsonArray array = json.getAsJsonArray("preAuthRef");
11594      for (int i = 0; i < array.size(); i++) {
11595        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
11596      }
11597    };
11598    if (json.has("_preAuthRef")) {
11599      JsonArray array = json.getAsJsonArray("_preAuthRef");
11600      for (int i = 0; i < array.size(); i++) {
11601        if (i == res.getPreAuthRef().size())
11602          res.getPreAuthRef().add(parseString(null));
11603        if (array.get(i) instanceof JsonObject) 
11604          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
11605      }
11606    };
11607    if (json.has("preAuthRefPeriod")) {
11608      JsonArray array = json.getAsJsonArray("preAuthRefPeriod");
11609      for (int i = 0; i < array.size(); i++) {
11610        res.getPreAuthRefPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
11611      }
11612    };
11613    if (json.has("careTeam")) {
11614      JsonArray array = json.getAsJsonArray("careTeam");
11615      for (int i = 0; i < array.size(); i++) {
11616        res.getCareTeam().add(parseExplanationOfBenefitCareTeamComponent(array.get(i).getAsJsonObject(), res));
11617      }
11618    };
11619    if (json.has("supportingInfo")) {
11620      JsonArray array = json.getAsJsonArray("supportingInfo");
11621      for (int i = 0; i < array.size(); i++) {
11622        res.getSupportingInfo().add(parseExplanationOfBenefitSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
11623      }
11624    };
11625    if (json.has("diagnosis")) {
11626      JsonArray array = json.getAsJsonArray("diagnosis");
11627      for (int i = 0; i < array.size(); i++) {
11628        res.getDiagnosis().add(parseExplanationOfBenefitDiagnosisComponent(array.get(i).getAsJsonObject(), res));
11629      }
11630    };
11631    if (json.has("procedure")) {
11632      JsonArray array = json.getAsJsonArray("procedure");
11633      for (int i = 0; i < array.size(); i++) {
11634        res.getProcedure().add(parseExplanationOfBenefitProcedureComponent(array.get(i).getAsJsonObject(), res));
11635      }
11636    };
11637    if (json.has("precedence"))
11638      res.setPrecedenceElement(parsePositiveInt(json.get("precedence").getAsString()));
11639    if (json.has("_precedence"))
11640      parseElementProperties(json.getAsJsonObject("_precedence"), res.getPrecedenceElement());
11641    if (json.has("insurance")) {
11642      JsonArray array = json.getAsJsonArray("insurance");
11643      for (int i = 0; i < array.size(); i++) {
11644        res.getInsurance().add(parseExplanationOfBenefitInsuranceComponent(array.get(i).getAsJsonObject(), res));
11645      }
11646    };
11647    if (json.has("accident"))
11648      res.setAccident(parseExplanationOfBenefitAccidentComponent(json.getAsJsonObject("accident"), res));
11649    if (json.has("item")) {
11650      JsonArray array = json.getAsJsonArray("item");
11651      for (int i = 0; i < array.size(); i++) {
11652        res.getItem().add(parseExplanationOfBenefitItemComponent(array.get(i).getAsJsonObject(), res));
11653      }
11654    };
11655    if (json.has("addItem")) {
11656      JsonArray array = json.getAsJsonArray("addItem");
11657      for (int i = 0; i < array.size(); i++) {
11658        res.getAddItem().add(parseExplanationOfBenefitAddedItemComponent(array.get(i).getAsJsonObject(), res));
11659      }
11660    };
11661    if (json.has("adjudication")) {
11662      JsonArray array = json.getAsJsonArray("adjudication");
11663      for (int i = 0; i < array.size(); i++) {
11664        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), res));
11665      }
11666    };
11667    if (json.has("total")) {
11668      JsonArray array = json.getAsJsonArray("total");
11669      for (int i = 0; i < array.size(); i++) {
11670        res.getTotal().add(parseExplanationOfBenefitTotalComponent(array.get(i).getAsJsonObject(), res));
11671      }
11672    };
11673    if (json.has("payment"))
11674      res.setPayment(parseExplanationOfBenefitPaymentComponent(json.getAsJsonObject("payment"), res));
11675    if (json.has("formCode"))
11676      res.setFormCode(parseCodeableConcept(json.getAsJsonObject("formCode")));
11677    if (json.has("form"))
11678      res.setForm(parseAttachment(json.getAsJsonObject("form")));
11679    if (json.has("processNote")) {
11680      JsonArray array = json.getAsJsonArray("processNote");
11681      for (int i = 0; i < array.size(); i++) {
11682        res.getProcessNote().add(parseExplanationOfBenefitNoteComponent(array.get(i).getAsJsonObject(), res));
11683      }
11684    };
11685    if (json.has("benefitPeriod"))
11686      res.setBenefitPeriod(parsePeriod(json.getAsJsonObject("benefitPeriod")));
11687    if (json.has("benefitBalance")) {
11688      JsonArray array = json.getAsJsonArray("benefitBalance");
11689      for (int i = 0; i < array.size(); i++) {
11690        res.getBenefitBalance().add(parseExplanationOfBenefitBenefitBalanceComponent(array.get(i).getAsJsonObject(), res));
11691      }
11692    };
11693  }
11694
11695  protected ExplanationOfBenefit.RelatedClaimComponent parseExplanationOfBenefitRelatedClaimComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11696    ExplanationOfBenefit.RelatedClaimComponent res = new ExplanationOfBenefit.RelatedClaimComponent();
11697    parseExplanationOfBenefitRelatedClaimComponentProperties(json, owner, res);
11698    return res;
11699  }
11700
11701  protected void parseExplanationOfBenefitRelatedClaimComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.RelatedClaimComponent res) throws IOException, FHIRFormatError {
11702    parseBackboneElementProperties(json, res);
11703    if (json.has("claim"))
11704      res.setClaim(parseReference(json.getAsJsonObject("claim")));
11705    if (json.has("relationship"))
11706      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
11707    if (json.has("reference"))
11708      res.setReference(parseIdentifier(json.getAsJsonObject("reference")));
11709  }
11710
11711  protected ExplanationOfBenefit.PayeeComponent parseExplanationOfBenefitPayeeComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11712    ExplanationOfBenefit.PayeeComponent res = new ExplanationOfBenefit.PayeeComponent();
11713    parseExplanationOfBenefitPayeeComponentProperties(json, owner, res);
11714    return res;
11715  }
11716
11717  protected void parseExplanationOfBenefitPayeeComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.PayeeComponent res) throws IOException, FHIRFormatError {
11718    parseBackboneElementProperties(json, res);
11719    if (json.has("type"))
11720      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
11721    if (json.has("party"))
11722      res.setParty(parseReference(json.getAsJsonObject("party")));
11723  }
11724
11725  protected ExplanationOfBenefit.CareTeamComponent parseExplanationOfBenefitCareTeamComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11726    ExplanationOfBenefit.CareTeamComponent res = new ExplanationOfBenefit.CareTeamComponent();
11727    parseExplanationOfBenefitCareTeamComponentProperties(json, owner, res);
11728    return res;
11729  }
11730
11731  protected void parseExplanationOfBenefitCareTeamComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.CareTeamComponent res) throws IOException, FHIRFormatError {
11732    parseBackboneElementProperties(json, res);
11733    if (json.has("sequence"))
11734      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11735    if (json.has("_sequence"))
11736      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
11737    if (json.has("provider"))
11738      res.setProvider(parseReference(json.getAsJsonObject("provider")));
11739    if (json.has("responsible"))
11740      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
11741    if (json.has("_responsible"))
11742      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
11743    if (json.has("role"))
11744      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
11745    if (json.has("qualification"))
11746      res.setQualification(parseCodeableConcept(json.getAsJsonObject("qualification")));
11747  }
11748
11749  protected ExplanationOfBenefit.SupportingInformationComponent parseExplanationOfBenefitSupportingInformationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11750    ExplanationOfBenefit.SupportingInformationComponent res = new ExplanationOfBenefit.SupportingInformationComponent();
11751    parseExplanationOfBenefitSupportingInformationComponentProperties(json, owner, res);
11752    return res;
11753  }
11754
11755  protected void parseExplanationOfBenefitSupportingInformationComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.SupportingInformationComponent res) throws IOException, FHIRFormatError {
11756    parseBackboneElementProperties(json, res);
11757    if (json.has("sequence"))
11758      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11759    if (json.has("_sequence"))
11760      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
11761    if (json.has("category"))
11762      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
11763    if (json.has("code"))
11764      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
11765    Type timing = parseType("timing", json);
11766    if (timing != null)
11767      res.setTiming(timing);
11768    Type value = parseType("value", json);
11769    if (value != null)
11770      res.setValue(value);
11771    if (json.has("reason"))
11772      res.setReason(parseCoding(json.getAsJsonObject("reason")));
11773  }
11774
11775  protected ExplanationOfBenefit.DiagnosisComponent parseExplanationOfBenefitDiagnosisComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11776    ExplanationOfBenefit.DiagnosisComponent res = new ExplanationOfBenefit.DiagnosisComponent();
11777    parseExplanationOfBenefitDiagnosisComponentProperties(json, owner, res);
11778    return res;
11779  }
11780
11781  protected void parseExplanationOfBenefitDiagnosisComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.DiagnosisComponent res) throws IOException, FHIRFormatError {
11782    parseBackboneElementProperties(json, res);
11783    if (json.has("sequence"))
11784      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11785    if (json.has("_sequence"))
11786      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
11787    Type diagnosis = parseType("diagnosis", json);
11788    if (diagnosis != null)
11789      res.setDiagnosis(diagnosis);
11790    if (json.has("type")) {
11791      JsonArray array = json.getAsJsonArray("type");
11792      for (int i = 0; i < array.size(); i++) {
11793        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11794      }
11795    };
11796    if (json.has("onAdmission"))
11797      res.setOnAdmission(parseCodeableConcept(json.getAsJsonObject("onAdmission")));
11798    if (json.has("packageCode"))
11799      res.setPackageCode(parseCodeableConcept(json.getAsJsonObject("packageCode")));
11800  }
11801
11802  protected ExplanationOfBenefit.ProcedureComponent parseExplanationOfBenefitProcedureComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11803    ExplanationOfBenefit.ProcedureComponent res = new ExplanationOfBenefit.ProcedureComponent();
11804    parseExplanationOfBenefitProcedureComponentProperties(json, owner, res);
11805    return res;
11806  }
11807
11808  protected void parseExplanationOfBenefitProcedureComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.ProcedureComponent res) throws IOException, FHIRFormatError {
11809    parseBackboneElementProperties(json, res);
11810    if (json.has("sequence"))
11811      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11812    if (json.has("_sequence"))
11813      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
11814    if (json.has("type")) {
11815      JsonArray array = json.getAsJsonArray("type");
11816      for (int i = 0; i < array.size(); i++) {
11817        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11818      }
11819    };
11820    if (json.has("date"))
11821      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11822    if (json.has("_date"))
11823      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11824    Type procedure = parseType("procedure", json);
11825    if (procedure != null)
11826      res.setProcedure(procedure);
11827    if (json.has("udi")) {
11828      JsonArray array = json.getAsJsonArray("udi");
11829      for (int i = 0; i < array.size(); i++) {
11830        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
11831      }
11832    };
11833  }
11834
11835  protected ExplanationOfBenefit.InsuranceComponent parseExplanationOfBenefitInsuranceComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11836    ExplanationOfBenefit.InsuranceComponent res = new ExplanationOfBenefit.InsuranceComponent();
11837    parseExplanationOfBenefitInsuranceComponentProperties(json, owner, res);
11838    return res;
11839  }
11840
11841  protected void parseExplanationOfBenefitInsuranceComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.InsuranceComponent res) throws IOException, FHIRFormatError {
11842    parseBackboneElementProperties(json, res);
11843    if (json.has("focal"))
11844      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
11845    if (json.has("_focal"))
11846      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
11847    if (json.has("coverage"))
11848      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
11849    if (json.has("preAuthRef")) {
11850      JsonArray array = json.getAsJsonArray("preAuthRef");
11851      for (int i = 0; i < array.size(); i++) {
11852        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
11853      }
11854    };
11855    if (json.has("_preAuthRef")) {
11856      JsonArray array = json.getAsJsonArray("_preAuthRef");
11857      for (int i = 0; i < array.size(); i++) {
11858        if (i == res.getPreAuthRef().size())
11859          res.getPreAuthRef().add(parseString(null));
11860        if (array.get(i) instanceof JsonObject) 
11861          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
11862      }
11863    };
11864  }
11865
11866  protected ExplanationOfBenefit.AccidentComponent parseExplanationOfBenefitAccidentComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11867    ExplanationOfBenefit.AccidentComponent res = new ExplanationOfBenefit.AccidentComponent();
11868    parseExplanationOfBenefitAccidentComponentProperties(json, owner, res);
11869    return res;
11870  }
11871
11872  protected void parseExplanationOfBenefitAccidentComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AccidentComponent res) throws IOException, FHIRFormatError {
11873    parseBackboneElementProperties(json, res);
11874    if (json.has("date"))
11875      res.setDateElement(parseDate(json.get("date").getAsString()));
11876    if (json.has("_date"))
11877      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11878    if (json.has("type"))
11879      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
11880    Type location = parseType("location", json);
11881    if (location != null)
11882      res.setLocation(location);
11883  }
11884
11885  protected ExplanationOfBenefit.ItemComponent parseExplanationOfBenefitItemComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11886    ExplanationOfBenefit.ItemComponent res = new ExplanationOfBenefit.ItemComponent();
11887    parseExplanationOfBenefitItemComponentProperties(json, owner, res);
11888    return res;
11889  }
11890
11891  protected void parseExplanationOfBenefitItemComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.ItemComponent res) throws IOException, FHIRFormatError {
11892    parseBackboneElementProperties(json, res);
11893    if (json.has("sequence"))
11894      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11895    if (json.has("_sequence"))
11896      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
11897    if (json.has("careTeamSequence")) {
11898      JsonArray array = json.getAsJsonArray("careTeamSequence");
11899      for (int i = 0; i < array.size(); i++) {
11900        res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
11901      }
11902    };
11903    if (json.has("_careTeamSequence")) {
11904      JsonArray array = json.getAsJsonArray("_careTeamSequence");
11905      for (int i = 0; i < array.size(); i++) {
11906        if (i == res.getCareTeamSequence().size())
11907          res.getCareTeamSequence().add(parsePositiveInt(null));
11908        if (array.get(i) instanceof JsonObject) 
11909          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
11910      }
11911    };
11912    if (json.has("diagnosisSequence")) {
11913      JsonArray array = json.getAsJsonArray("diagnosisSequence");
11914      for (int i = 0; i < array.size(); i++) {
11915        res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
11916      }
11917    };
11918    if (json.has("_diagnosisSequence")) {
11919      JsonArray array = json.getAsJsonArray("_diagnosisSequence");
11920      for (int i = 0; i < array.size(); i++) {
11921        if (i == res.getDiagnosisSequence().size())
11922          res.getDiagnosisSequence().add(parsePositiveInt(null));
11923        if (array.get(i) instanceof JsonObject) 
11924          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
11925      }
11926    };
11927    if (json.has("procedureSequence")) {
11928      JsonArray array = json.getAsJsonArray("procedureSequence");
11929      for (int i = 0; i < array.size(); i++) {
11930        res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
11931      }
11932    };
11933    if (json.has("_procedureSequence")) {
11934      JsonArray array = json.getAsJsonArray("_procedureSequence");
11935      for (int i = 0; i < array.size(); i++) {
11936        if (i == res.getProcedureSequence().size())
11937          res.getProcedureSequence().add(parsePositiveInt(null));
11938        if (array.get(i) instanceof JsonObject) 
11939          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
11940      }
11941    };
11942    if (json.has("informationSequence")) {
11943      JsonArray array = json.getAsJsonArray("informationSequence");
11944      for (int i = 0; i < array.size(); i++) {
11945        res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
11946      }
11947    };
11948    if (json.has("_informationSequence")) {
11949      JsonArray array = json.getAsJsonArray("_informationSequence");
11950      for (int i = 0; i < array.size(); i++) {
11951        if (i == res.getInformationSequence().size())
11952          res.getInformationSequence().add(parsePositiveInt(null));
11953        if (array.get(i) instanceof JsonObject) 
11954          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
11955      }
11956    };
11957    if (json.has("revenue"))
11958      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
11959    if (json.has("category"))
11960      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
11961    if (json.has("productOrService"))
11962      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
11963    if (json.has("modifier")) {
11964      JsonArray array = json.getAsJsonArray("modifier");
11965      for (int i = 0; i < array.size(); i++) {
11966        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11967      }
11968    };
11969    if (json.has("programCode")) {
11970      JsonArray array = json.getAsJsonArray("programCode");
11971      for (int i = 0; i < array.size(); i++) {
11972        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11973      }
11974    };
11975    Type serviced = parseType("serviced", json);
11976    if (serviced != null)
11977      res.setServiced(serviced);
11978    Type location = parseType("location", json);
11979    if (location != null)
11980      res.setLocation(location);
11981    if (json.has("quantity"))
11982      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
11983    if (json.has("unitPrice"))
11984      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
11985    if (json.has("factor"))
11986      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
11987    if (json.has("_factor"))
11988      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
11989    if (json.has("net"))
11990      res.setNet(parseMoney(json.getAsJsonObject("net")));
11991    if (json.has("udi")) {
11992      JsonArray array = json.getAsJsonArray("udi");
11993      for (int i = 0; i < array.size(); i++) {
11994        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
11995      }
11996    };
11997    if (json.has("bodySite"))
11998      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
11999    if (json.has("subSite")) {
12000      JsonArray array = json.getAsJsonArray("subSite");
12001      for (int i = 0; i < array.size(); i++) {
12002        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12003      }
12004    };
12005    if (json.has("encounter")) {
12006      JsonArray array = json.getAsJsonArray("encounter");
12007      for (int i = 0; i < array.size(); i++) {
12008        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
12009      }
12010    };
12011    if (json.has("noteNumber")) {
12012      JsonArray array = json.getAsJsonArray("noteNumber");
12013      for (int i = 0; i < array.size(); i++) {
12014        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12015      }
12016    };
12017    if (json.has("_noteNumber")) {
12018      JsonArray array = json.getAsJsonArray("_noteNumber");
12019      for (int i = 0; i < array.size(); i++) {
12020        if (i == res.getNoteNumber().size())
12021          res.getNoteNumber().add(parsePositiveInt(null));
12022        if (array.get(i) instanceof JsonObject) 
12023          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12024      }
12025    };
12026    if (json.has("adjudication")) {
12027      JsonArray array = json.getAsJsonArray("adjudication");
12028      for (int i = 0; i < array.size(); i++) {
12029        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12030      }
12031    };
12032    if (json.has("detail")) {
12033      JsonArray array = json.getAsJsonArray("detail");
12034      for (int i = 0; i < array.size(); i++) {
12035        res.getDetail().add(parseExplanationOfBenefitDetailComponent(array.get(i).getAsJsonObject(), owner));
12036      }
12037    };
12038  }
12039
12040  protected ExplanationOfBenefit.AdjudicationComponent parseExplanationOfBenefitAdjudicationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12041    ExplanationOfBenefit.AdjudicationComponent res = new ExplanationOfBenefit.AdjudicationComponent();
12042    parseExplanationOfBenefitAdjudicationComponentProperties(json, owner, res);
12043    return res;
12044  }
12045
12046  protected void parseExplanationOfBenefitAdjudicationComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AdjudicationComponent res) throws IOException, FHIRFormatError {
12047    parseBackboneElementProperties(json, res);
12048    if (json.has("category"))
12049      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
12050    if (json.has("reason"))
12051      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
12052    if (json.has("amount"))
12053      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
12054    if (json.has("value"))
12055      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
12056    if (json.has("_value"))
12057      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
12058  }
12059
12060  protected ExplanationOfBenefit.DetailComponent parseExplanationOfBenefitDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12061    ExplanationOfBenefit.DetailComponent res = new ExplanationOfBenefit.DetailComponent();
12062    parseExplanationOfBenefitDetailComponentProperties(json, owner, res);
12063    return res;
12064  }
12065
12066  protected void parseExplanationOfBenefitDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.DetailComponent res) throws IOException, FHIRFormatError {
12067    parseBackboneElementProperties(json, res);
12068    if (json.has("sequence"))
12069      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
12070    if (json.has("_sequence"))
12071      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
12072    if (json.has("revenue"))
12073      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
12074    if (json.has("category"))
12075      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
12076    if (json.has("productOrService"))
12077      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
12078    if (json.has("modifier")) {
12079      JsonArray array = json.getAsJsonArray("modifier");
12080      for (int i = 0; i < array.size(); i++) {
12081        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12082      }
12083    };
12084    if (json.has("programCode")) {
12085      JsonArray array = json.getAsJsonArray("programCode");
12086      for (int i = 0; i < array.size(); i++) {
12087        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12088      }
12089    };
12090    if (json.has("quantity"))
12091      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
12092    if (json.has("unitPrice"))
12093      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
12094    if (json.has("factor"))
12095      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12096    if (json.has("_factor"))
12097      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
12098    if (json.has("net"))
12099      res.setNet(parseMoney(json.getAsJsonObject("net")));
12100    if (json.has("udi")) {
12101      JsonArray array = json.getAsJsonArray("udi");
12102      for (int i = 0; i < array.size(); i++) {
12103        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
12104      }
12105    };
12106    if (json.has("noteNumber")) {
12107      JsonArray array = json.getAsJsonArray("noteNumber");
12108      for (int i = 0; i < array.size(); i++) {
12109        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12110      }
12111    };
12112    if (json.has("_noteNumber")) {
12113      JsonArray array = json.getAsJsonArray("_noteNumber");
12114      for (int i = 0; i < array.size(); i++) {
12115        if (i == res.getNoteNumber().size())
12116          res.getNoteNumber().add(parsePositiveInt(null));
12117        if (array.get(i) instanceof JsonObject) 
12118          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12119      }
12120    };
12121    if (json.has("adjudication")) {
12122      JsonArray array = json.getAsJsonArray("adjudication");
12123      for (int i = 0; i < array.size(); i++) {
12124        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12125      }
12126    };
12127    if (json.has("subDetail")) {
12128      JsonArray array = json.getAsJsonArray("subDetail");
12129      for (int i = 0; i < array.size(); i++) {
12130        res.getSubDetail().add(parseExplanationOfBenefitSubDetailComponent(array.get(i).getAsJsonObject(), owner));
12131      }
12132    };
12133  }
12134
12135  protected ExplanationOfBenefit.SubDetailComponent parseExplanationOfBenefitSubDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12136    ExplanationOfBenefit.SubDetailComponent res = new ExplanationOfBenefit.SubDetailComponent();
12137    parseExplanationOfBenefitSubDetailComponentProperties(json, owner, res);
12138    return res;
12139  }
12140
12141  protected void parseExplanationOfBenefitSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.SubDetailComponent res) throws IOException, FHIRFormatError {
12142    parseBackboneElementProperties(json, res);
12143    if (json.has("sequence"))
12144      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
12145    if (json.has("_sequence"))
12146      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
12147    if (json.has("revenue"))
12148      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
12149    if (json.has("category"))
12150      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
12151    if (json.has("productOrService"))
12152      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
12153    if (json.has("modifier")) {
12154      JsonArray array = json.getAsJsonArray("modifier");
12155      for (int i = 0; i < array.size(); i++) {
12156        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12157      }
12158    };
12159    if (json.has("programCode")) {
12160      JsonArray array = json.getAsJsonArray("programCode");
12161      for (int i = 0; i < array.size(); i++) {
12162        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12163      }
12164    };
12165    if (json.has("quantity"))
12166      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
12167    if (json.has("unitPrice"))
12168      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
12169    if (json.has("factor"))
12170      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12171    if (json.has("_factor"))
12172      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
12173    if (json.has("net"))
12174      res.setNet(parseMoney(json.getAsJsonObject("net")));
12175    if (json.has("udi")) {
12176      JsonArray array = json.getAsJsonArray("udi");
12177      for (int i = 0; i < array.size(); i++) {
12178        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
12179      }
12180    };
12181    if (json.has("noteNumber")) {
12182      JsonArray array = json.getAsJsonArray("noteNumber");
12183      for (int i = 0; i < array.size(); i++) {
12184        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12185      }
12186    };
12187    if (json.has("_noteNumber")) {
12188      JsonArray array = json.getAsJsonArray("_noteNumber");
12189      for (int i = 0; i < array.size(); i++) {
12190        if (i == res.getNoteNumber().size())
12191          res.getNoteNumber().add(parsePositiveInt(null));
12192        if (array.get(i) instanceof JsonObject) 
12193          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12194      }
12195    };
12196    if (json.has("adjudication")) {
12197      JsonArray array = json.getAsJsonArray("adjudication");
12198      for (int i = 0; i < array.size(); i++) {
12199        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12200      }
12201    };
12202  }
12203
12204  protected ExplanationOfBenefit.AddedItemComponent parseExplanationOfBenefitAddedItemComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12205    ExplanationOfBenefit.AddedItemComponent res = new ExplanationOfBenefit.AddedItemComponent();
12206    parseExplanationOfBenefitAddedItemComponentProperties(json, owner, res);
12207    return res;
12208  }
12209
12210  protected void parseExplanationOfBenefitAddedItemComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemComponent res) throws IOException, FHIRFormatError {
12211    parseBackboneElementProperties(json, res);
12212    if (json.has("itemSequence")) {
12213      JsonArray array = json.getAsJsonArray("itemSequence");
12214      for (int i = 0; i < array.size(); i++) {
12215        res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
12216      }
12217    };
12218    if (json.has("_itemSequence")) {
12219      JsonArray array = json.getAsJsonArray("_itemSequence");
12220      for (int i = 0; i < array.size(); i++) {
12221        if (i == res.getItemSequence().size())
12222          res.getItemSequence().add(parsePositiveInt(null));
12223        if (array.get(i) instanceof JsonObject) 
12224          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
12225      }
12226    };
12227    if (json.has("detailSequence")) {
12228      JsonArray array = json.getAsJsonArray("detailSequence");
12229      for (int i = 0; i < array.size(); i++) {
12230        res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
12231      }
12232    };
12233    if (json.has("_detailSequence")) {
12234      JsonArray array = json.getAsJsonArray("_detailSequence");
12235      for (int i = 0; i < array.size(); i++) {
12236        if (i == res.getDetailSequence().size())
12237          res.getDetailSequence().add(parsePositiveInt(null));
12238        if (array.get(i) instanceof JsonObject) 
12239          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
12240      }
12241    };
12242    if (json.has("subDetailSequence")) {
12243      JsonArray array = json.getAsJsonArray("subDetailSequence");
12244      for (int i = 0; i < array.size(); i++) {
12245        res.getSubDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
12246      }
12247    };
12248    if (json.has("_subDetailSequence")) {
12249      JsonArray array = json.getAsJsonArray("_subDetailSequence");
12250      for (int i = 0; i < array.size(); i++) {
12251        if (i == res.getSubDetailSequence().size())
12252          res.getSubDetailSequence().add(parsePositiveInt(null));
12253        if (array.get(i) instanceof JsonObject) 
12254          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubDetailSequence().get(i));
12255      }
12256    };
12257    if (json.has("provider")) {
12258      JsonArray array = json.getAsJsonArray("provider");
12259      for (int i = 0; i < array.size(); i++) {
12260        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
12261      }
12262    };
12263    if (json.has("productOrService"))
12264      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
12265    if (json.has("modifier")) {
12266      JsonArray array = json.getAsJsonArray("modifier");
12267      for (int i = 0; i < array.size(); i++) {
12268        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12269      }
12270    };
12271    if (json.has("programCode")) {
12272      JsonArray array = json.getAsJsonArray("programCode");
12273      for (int i = 0; i < array.size(); i++) {
12274        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12275      }
12276    };
12277    Type serviced = parseType("serviced", json);
12278    if (serviced != null)
12279      res.setServiced(serviced);
12280    Type location = parseType("location", json);
12281    if (location != null)
12282      res.setLocation(location);
12283    if (json.has("quantity"))
12284      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
12285    if (json.has("unitPrice"))
12286      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
12287    if (json.has("factor"))
12288      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12289    if (json.has("_factor"))
12290      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
12291    if (json.has("net"))
12292      res.setNet(parseMoney(json.getAsJsonObject("net")));
12293    if (json.has("bodySite"))
12294      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
12295    if (json.has("subSite")) {
12296      JsonArray array = json.getAsJsonArray("subSite");
12297      for (int i = 0; i < array.size(); i++) {
12298        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12299      }
12300    };
12301    if (json.has("noteNumber")) {
12302      JsonArray array = json.getAsJsonArray("noteNumber");
12303      for (int i = 0; i < array.size(); i++) {
12304        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12305      }
12306    };
12307    if (json.has("_noteNumber")) {
12308      JsonArray array = json.getAsJsonArray("_noteNumber");
12309      for (int i = 0; i < array.size(); i++) {
12310        if (i == res.getNoteNumber().size())
12311          res.getNoteNumber().add(parsePositiveInt(null));
12312        if (array.get(i) instanceof JsonObject) 
12313          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12314      }
12315    };
12316    if (json.has("adjudication")) {
12317      JsonArray array = json.getAsJsonArray("adjudication");
12318      for (int i = 0; i < array.size(); i++) {
12319        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12320      }
12321    };
12322    if (json.has("detail")) {
12323      JsonArray array = json.getAsJsonArray("detail");
12324      for (int i = 0; i < array.size(); i++) {
12325        res.getDetail().add(parseExplanationOfBenefitAddedItemDetailComponent(array.get(i).getAsJsonObject(), owner));
12326      }
12327    };
12328  }
12329
12330  protected ExplanationOfBenefit.AddedItemDetailComponent parseExplanationOfBenefitAddedItemDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12331    ExplanationOfBenefit.AddedItemDetailComponent res = new ExplanationOfBenefit.AddedItemDetailComponent();
12332    parseExplanationOfBenefitAddedItemDetailComponentProperties(json, owner, res);
12333    return res;
12334  }
12335
12336  protected void parseExplanationOfBenefitAddedItemDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemDetailComponent res) throws IOException, FHIRFormatError {
12337    parseBackboneElementProperties(json, res);
12338    if (json.has("productOrService"))
12339      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
12340    if (json.has("modifier")) {
12341      JsonArray array = json.getAsJsonArray("modifier");
12342      for (int i = 0; i < array.size(); i++) {
12343        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12344      }
12345    };
12346    if (json.has("quantity"))
12347      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
12348    if (json.has("unitPrice"))
12349      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
12350    if (json.has("factor"))
12351      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12352    if (json.has("_factor"))
12353      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
12354    if (json.has("net"))
12355      res.setNet(parseMoney(json.getAsJsonObject("net")));
12356    if (json.has("noteNumber")) {
12357      JsonArray array = json.getAsJsonArray("noteNumber");
12358      for (int i = 0; i < array.size(); i++) {
12359        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12360      }
12361    };
12362    if (json.has("_noteNumber")) {
12363      JsonArray array = json.getAsJsonArray("_noteNumber");
12364      for (int i = 0; i < array.size(); i++) {
12365        if (i == res.getNoteNumber().size())
12366          res.getNoteNumber().add(parsePositiveInt(null));
12367        if (array.get(i) instanceof JsonObject) 
12368          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12369      }
12370    };
12371    if (json.has("adjudication")) {
12372      JsonArray array = json.getAsJsonArray("adjudication");
12373      for (int i = 0; i < array.size(); i++) {
12374        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12375      }
12376    };
12377    if (json.has("subDetail")) {
12378      JsonArray array = json.getAsJsonArray("subDetail");
12379      for (int i = 0; i < array.size(); i++) {
12380        res.getSubDetail().add(parseExplanationOfBenefitAddedItemDetailSubDetailComponent(array.get(i).getAsJsonObject(), owner));
12381      }
12382    };
12383  }
12384
12385  protected ExplanationOfBenefit.AddedItemDetailSubDetailComponent parseExplanationOfBenefitAddedItemDetailSubDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12386    ExplanationOfBenefit.AddedItemDetailSubDetailComponent res = new ExplanationOfBenefit.AddedItemDetailSubDetailComponent();
12387    parseExplanationOfBenefitAddedItemDetailSubDetailComponentProperties(json, owner, res);
12388    return res;
12389  }
12390
12391  protected void parseExplanationOfBenefitAddedItemDetailSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemDetailSubDetailComponent res) throws IOException, FHIRFormatError {
12392    parseBackboneElementProperties(json, res);
12393    if (json.has("productOrService"))
12394      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
12395    if (json.has("modifier")) {
12396      JsonArray array = json.getAsJsonArray("modifier");
12397      for (int i = 0; i < array.size(); i++) {
12398        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12399      }
12400    };
12401    if (json.has("quantity"))
12402      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
12403    if (json.has("unitPrice"))
12404      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
12405    if (json.has("factor"))
12406      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12407    if (json.has("_factor"))
12408      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
12409    if (json.has("net"))
12410      res.setNet(parseMoney(json.getAsJsonObject("net")));
12411    if (json.has("noteNumber")) {
12412      JsonArray array = json.getAsJsonArray("noteNumber");
12413      for (int i = 0; i < array.size(); i++) {
12414        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12415      }
12416    };
12417    if (json.has("_noteNumber")) {
12418      JsonArray array = json.getAsJsonArray("_noteNumber");
12419      for (int i = 0; i < array.size(); i++) {
12420        if (i == res.getNoteNumber().size())
12421          res.getNoteNumber().add(parsePositiveInt(null));
12422        if (array.get(i) instanceof JsonObject) 
12423          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12424      }
12425    };
12426    if (json.has("adjudication")) {
12427      JsonArray array = json.getAsJsonArray("adjudication");
12428      for (int i = 0; i < array.size(); i++) {
12429        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12430      }
12431    };
12432  }
12433
12434  protected ExplanationOfBenefit.TotalComponent parseExplanationOfBenefitTotalComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12435    ExplanationOfBenefit.TotalComponent res = new ExplanationOfBenefit.TotalComponent();
12436    parseExplanationOfBenefitTotalComponentProperties(json, owner, res);
12437    return res;
12438  }
12439
12440  protected void parseExplanationOfBenefitTotalComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.TotalComponent res) throws IOException, FHIRFormatError {
12441    parseBackboneElementProperties(json, res);
12442    if (json.has("category"))
12443      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
12444    if (json.has("amount"))
12445      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
12446  }
12447
12448  protected ExplanationOfBenefit.PaymentComponent parseExplanationOfBenefitPaymentComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12449    ExplanationOfBenefit.PaymentComponent res = new ExplanationOfBenefit.PaymentComponent();
12450    parseExplanationOfBenefitPaymentComponentProperties(json, owner, res);
12451    return res;
12452  }
12453
12454  protected void parseExplanationOfBenefitPaymentComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.PaymentComponent res) throws IOException, FHIRFormatError {
12455    parseBackboneElementProperties(json, res);
12456    if (json.has("type"))
12457      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
12458    if (json.has("adjustment"))
12459      res.setAdjustment(parseMoney(json.getAsJsonObject("adjustment")));
12460    if (json.has("adjustmentReason"))
12461      res.setAdjustmentReason(parseCodeableConcept(json.getAsJsonObject("adjustmentReason")));
12462    if (json.has("date"))
12463      res.setDateElement(parseDate(json.get("date").getAsString()));
12464    if (json.has("_date"))
12465      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12466    if (json.has("amount"))
12467      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
12468    if (json.has("identifier"))
12469      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
12470  }
12471
12472  protected ExplanationOfBenefit.NoteComponent parseExplanationOfBenefitNoteComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12473    ExplanationOfBenefit.NoteComponent res = new ExplanationOfBenefit.NoteComponent();
12474    parseExplanationOfBenefitNoteComponentProperties(json, owner, res);
12475    return res;
12476  }
12477
12478  protected void parseExplanationOfBenefitNoteComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.NoteComponent res) throws IOException, FHIRFormatError {
12479    parseBackboneElementProperties(json, res);
12480    if (json.has("number"))
12481      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
12482    if (json.has("_number"))
12483      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
12484    if (json.has("type"))
12485      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
12486    if (json.has("_type"))
12487      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
12488    if (json.has("text"))
12489      res.setTextElement(parseString(json.get("text").getAsString()));
12490    if (json.has("_text"))
12491      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
12492    if (json.has("language"))
12493      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
12494  }
12495
12496  protected ExplanationOfBenefit.BenefitBalanceComponent parseExplanationOfBenefitBenefitBalanceComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12497    ExplanationOfBenefit.BenefitBalanceComponent res = new ExplanationOfBenefit.BenefitBalanceComponent();
12498    parseExplanationOfBenefitBenefitBalanceComponentProperties(json, owner, res);
12499    return res;
12500  }
12501
12502  protected void parseExplanationOfBenefitBenefitBalanceComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitBalanceComponent res) throws IOException, FHIRFormatError {
12503    parseBackboneElementProperties(json, res);
12504    if (json.has("category"))
12505      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
12506    if (json.has("excluded"))
12507      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
12508    if (json.has("_excluded"))
12509      parseElementProperties(json.getAsJsonObject("_excluded"), res.getExcludedElement());
12510    if (json.has("name"))
12511      res.setNameElement(parseString(json.get("name").getAsString()));
12512    if (json.has("_name"))
12513      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12514    if (json.has("description"))
12515      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12516    if (json.has("_description"))
12517      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12518    if (json.has("network"))
12519      res.setNetwork(parseCodeableConcept(json.getAsJsonObject("network")));
12520    if (json.has("unit"))
12521      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
12522    if (json.has("term"))
12523      res.setTerm(parseCodeableConcept(json.getAsJsonObject("term")));
12524    if (json.has("financial")) {
12525      JsonArray array = json.getAsJsonArray("financial");
12526      for (int i = 0; i < array.size(); i++) {
12527        res.getFinancial().add(parseExplanationOfBenefitBenefitComponent(array.get(i).getAsJsonObject(), owner));
12528      }
12529    };
12530  }
12531
12532  protected ExplanationOfBenefit.BenefitComponent parseExplanationOfBenefitBenefitComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12533    ExplanationOfBenefit.BenefitComponent res = new ExplanationOfBenefit.BenefitComponent();
12534    parseExplanationOfBenefitBenefitComponentProperties(json, owner, res);
12535    return res;
12536  }
12537
12538  protected void parseExplanationOfBenefitBenefitComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitComponent res) throws IOException, FHIRFormatError {
12539    parseBackboneElementProperties(json, res);
12540    if (json.has("type"))
12541      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
12542    Type allowed = parseType("allowed", json);
12543    if (allowed != null)
12544      res.setAllowed(allowed);
12545    Type used = parseType("used", json);
12546    if (used != null)
12547      res.setUsed(used);
12548  }
12549
12550  protected FamilyMemberHistory parseFamilyMemberHistory(JsonObject json) throws IOException, FHIRFormatError {
12551    FamilyMemberHistory res = new FamilyMemberHistory();
12552    parseFamilyMemberHistoryProperties(json, res);
12553    return res;
12554  }
12555
12556  protected void parseFamilyMemberHistoryProperties(JsonObject json, FamilyMemberHistory res) throws IOException, FHIRFormatError {
12557    parseDomainResourceProperties(json, res);
12558    if (json.has("identifier")) {
12559      JsonArray array = json.getAsJsonArray("identifier");
12560      for (int i = 0; i < array.size(); i++) {
12561        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12562      }
12563    };
12564    if (json.has("instantiatesCanonical")) {
12565      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
12566      for (int i = 0; i < array.size(); i++) {
12567        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
12568      }
12569    };
12570    if (json.has("_instantiatesCanonical")) {
12571      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
12572      for (int i = 0; i < array.size(); i++) {
12573        if (i == res.getInstantiatesCanonical().size())
12574          res.getInstantiatesCanonical().add(parseCanonical(null));
12575        if (array.get(i) instanceof JsonObject) 
12576          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
12577      }
12578    };
12579    if (json.has("instantiatesUri")) {
12580      JsonArray array = json.getAsJsonArray("instantiatesUri");
12581      for (int i = 0; i < array.size(); i++) {
12582        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
12583      }
12584    };
12585    if (json.has("_instantiatesUri")) {
12586      JsonArray array = json.getAsJsonArray("_instantiatesUri");
12587      for (int i = 0; i < array.size(); i++) {
12588        if (i == res.getInstantiatesUri().size())
12589          res.getInstantiatesUri().add(parseUri(null));
12590        if (array.get(i) instanceof JsonObject) 
12591          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
12592      }
12593    };
12594    if (json.has("status"))
12595      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), FamilyMemberHistory.FamilyHistoryStatus.NULL, new FamilyMemberHistory.FamilyHistoryStatusEnumFactory()));
12596    if (json.has("_status"))
12597      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12598    if (json.has("dataAbsentReason"))
12599      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
12600    if (json.has("patient"))
12601      res.setPatient(parseReference(json.getAsJsonObject("patient")));
12602    if (json.has("date"))
12603      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12604    if (json.has("_date"))
12605      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12606    if (json.has("name"))
12607      res.setNameElement(parseString(json.get("name").getAsString()));
12608    if (json.has("_name"))
12609      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12610    if (json.has("relationship"))
12611      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
12612    if (json.has("sex"))
12613      res.setSex(parseCodeableConcept(json.getAsJsonObject("sex")));
12614    Type born = parseType("born", json);
12615    if (born != null)
12616      res.setBorn(born);
12617    Type age = parseType("age", json);
12618    if (age != null)
12619      res.setAge(age);
12620    if (json.has("estimatedAge"))
12621      res.setEstimatedAgeElement(parseBoolean(json.get("estimatedAge").getAsBoolean()));
12622    if (json.has("_estimatedAge"))
12623      parseElementProperties(json.getAsJsonObject("_estimatedAge"), res.getEstimatedAgeElement());
12624    Type deceased = parseType("deceased", json);
12625    if (deceased != null)
12626      res.setDeceased(deceased);
12627    if (json.has("reasonCode")) {
12628      JsonArray array = json.getAsJsonArray("reasonCode");
12629      for (int i = 0; i < array.size(); i++) {
12630        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12631      }
12632    };
12633    if (json.has("reasonReference")) {
12634      JsonArray array = json.getAsJsonArray("reasonReference");
12635      for (int i = 0; i < array.size(); i++) {
12636        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
12637      }
12638    };
12639    if (json.has("note")) {
12640      JsonArray array = json.getAsJsonArray("note");
12641      for (int i = 0; i < array.size(); i++) {
12642        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12643      }
12644    };
12645    if (json.has("condition")) {
12646      JsonArray array = json.getAsJsonArray("condition");
12647      for (int i = 0; i < array.size(); i++) {
12648        res.getCondition().add(parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(array.get(i).getAsJsonObject(), res));
12649      }
12650    };
12651  }
12652
12653  protected FamilyMemberHistory.FamilyMemberHistoryConditionComponent parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(JsonObject json, FamilyMemberHistory owner) throws IOException, FHIRFormatError {
12654    FamilyMemberHistory.FamilyMemberHistoryConditionComponent res = new FamilyMemberHistory.FamilyMemberHistoryConditionComponent();
12655    parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(json, owner, res);
12656    return res;
12657  }
12658
12659  protected void parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(JsonObject json, FamilyMemberHistory owner, FamilyMemberHistory.FamilyMemberHistoryConditionComponent res) throws IOException, FHIRFormatError {
12660    parseBackboneElementProperties(json, res);
12661    if (json.has("code"))
12662      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
12663    if (json.has("outcome"))
12664      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
12665    if (json.has("contributedToDeath"))
12666      res.setContributedToDeathElement(parseBoolean(json.get("contributedToDeath").getAsBoolean()));
12667    if (json.has("_contributedToDeath"))
12668      parseElementProperties(json.getAsJsonObject("_contributedToDeath"), res.getContributedToDeathElement());
12669    Type onset = parseType("onset", json);
12670    if (onset != null)
12671      res.setOnset(onset);
12672    if (json.has("note")) {
12673      JsonArray array = json.getAsJsonArray("note");
12674      for (int i = 0; i < array.size(); i++) {
12675        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12676      }
12677    };
12678  }
12679
12680  protected Flag parseFlag(JsonObject json) throws IOException, FHIRFormatError {
12681    Flag res = new Flag();
12682    parseFlagProperties(json, res);
12683    return res;
12684  }
12685
12686  protected void parseFlagProperties(JsonObject json, Flag res) throws IOException, FHIRFormatError {
12687    parseDomainResourceProperties(json, res);
12688    if (json.has("identifier")) {
12689      JsonArray array = json.getAsJsonArray("identifier");
12690      for (int i = 0; i < array.size(); i++) {
12691        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12692      }
12693    };
12694    if (json.has("status"))
12695      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Flag.FlagStatus.NULL, new Flag.FlagStatusEnumFactory()));
12696    if (json.has("_status"))
12697      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12698    if (json.has("category")) {
12699      JsonArray array = json.getAsJsonArray("category");
12700      for (int i = 0; i < array.size(); i++) {
12701        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12702      }
12703    };
12704    if (json.has("code"))
12705      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
12706    if (json.has("subject"))
12707      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12708    if (json.has("period"))
12709      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
12710    if (json.has("encounter"))
12711      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
12712    if (json.has("author"))
12713      res.setAuthor(parseReference(json.getAsJsonObject("author")));
12714  }
12715
12716  protected Goal parseGoal(JsonObject json) throws IOException, FHIRFormatError {
12717    Goal res = new Goal();
12718    parseGoalProperties(json, res);
12719    return res;
12720  }
12721
12722  protected void parseGoalProperties(JsonObject json, Goal res) throws IOException, FHIRFormatError {
12723    parseDomainResourceProperties(json, res);
12724    if (json.has("identifier")) {
12725      JsonArray array = json.getAsJsonArray("identifier");
12726      for (int i = 0; i < array.size(); i++) {
12727        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12728      }
12729    };
12730    if (json.has("lifecycleStatus"))
12731      res.setLifecycleStatusElement(parseEnumeration(json.get("lifecycleStatus").getAsString(), Goal.GoalLifecycleStatus.NULL, new Goal.GoalLifecycleStatusEnumFactory()));
12732    if (json.has("_lifecycleStatus"))
12733      parseElementProperties(json.getAsJsonObject("_lifecycleStatus"), res.getLifecycleStatusElement());
12734    if (json.has("achievementStatus"))
12735      res.setAchievementStatus(parseCodeableConcept(json.getAsJsonObject("achievementStatus")));
12736    if (json.has("category")) {
12737      JsonArray array = json.getAsJsonArray("category");
12738      for (int i = 0; i < array.size(); i++) {
12739        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12740      }
12741    };
12742    if (json.has("priority"))
12743      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
12744    if (json.has("description"))
12745      res.setDescription(parseCodeableConcept(json.getAsJsonObject("description")));
12746    if (json.has("subject"))
12747      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12748    Type start = parseType("start", json);
12749    if (start != null)
12750      res.setStart(start);
12751    if (json.has("target")) {
12752      JsonArray array = json.getAsJsonArray("target");
12753      for (int i = 0; i < array.size(); i++) {
12754        res.getTarget().add(parseGoalGoalTargetComponent(array.get(i).getAsJsonObject(), res));
12755      }
12756    };
12757    if (json.has("statusDate"))
12758      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
12759    if (json.has("_statusDate"))
12760      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
12761    if (json.has("statusReason"))
12762      res.setStatusReasonElement(parseString(json.get("statusReason").getAsString()));
12763    if (json.has("_statusReason"))
12764      parseElementProperties(json.getAsJsonObject("_statusReason"), res.getStatusReasonElement());
12765    if (json.has("expressedBy"))
12766      res.setExpressedBy(parseReference(json.getAsJsonObject("expressedBy")));
12767    if (json.has("addresses")) {
12768      JsonArray array = json.getAsJsonArray("addresses");
12769      for (int i = 0; i < array.size(); i++) {
12770        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
12771      }
12772    };
12773    if (json.has("note")) {
12774      JsonArray array = json.getAsJsonArray("note");
12775      for (int i = 0; i < array.size(); i++) {
12776        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12777      }
12778    };
12779    if (json.has("outcomeCode")) {
12780      JsonArray array = json.getAsJsonArray("outcomeCode");
12781      for (int i = 0; i < array.size(); i++) {
12782        res.getOutcomeCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12783      }
12784    };
12785    if (json.has("outcomeReference")) {
12786      JsonArray array = json.getAsJsonArray("outcomeReference");
12787      for (int i = 0; i < array.size(); i++) {
12788        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
12789      }
12790    };
12791  }
12792
12793  protected Goal.GoalTargetComponent parseGoalGoalTargetComponent(JsonObject json, Goal owner) throws IOException, FHIRFormatError {
12794    Goal.GoalTargetComponent res = new Goal.GoalTargetComponent();
12795    parseGoalGoalTargetComponentProperties(json, owner, res);
12796    return res;
12797  }
12798
12799  protected void parseGoalGoalTargetComponentProperties(JsonObject json, Goal owner, Goal.GoalTargetComponent res) throws IOException, FHIRFormatError {
12800    parseBackboneElementProperties(json, res);
12801    if (json.has("measure"))
12802      res.setMeasure(parseCodeableConcept(json.getAsJsonObject("measure")));
12803    Type detail = parseType("detail", json);
12804    if (detail != null)
12805      res.setDetail(detail);
12806    Type due = parseType("due", json);
12807    if (due != null)
12808      res.setDue(due);
12809  }
12810
12811  protected GraphDefinition parseGraphDefinition(JsonObject json) throws IOException, FHIRFormatError {
12812    GraphDefinition res = new GraphDefinition();
12813    parseGraphDefinitionProperties(json, res);
12814    return res;
12815  }
12816
12817  protected void parseGraphDefinitionProperties(JsonObject json, GraphDefinition res) throws IOException, FHIRFormatError {
12818    parseDomainResourceProperties(json, res);
12819    if (json.has("url"))
12820      res.setUrlElement(parseUri(json.get("url").getAsString()));
12821    if (json.has("_url"))
12822      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
12823    if (json.has("version"))
12824      res.setVersionElement(parseString(json.get("version").getAsString()));
12825    if (json.has("_version"))
12826      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
12827    if (json.has("name"))
12828      res.setNameElement(parseString(json.get("name").getAsString()));
12829    if (json.has("_name"))
12830      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12831    if (json.has("status"))
12832      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
12833    if (json.has("_status"))
12834      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12835    if (json.has("experimental"))
12836      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
12837    if (json.has("_experimental"))
12838      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
12839    if (json.has("date"))
12840      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12841    if (json.has("_date"))
12842      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12843    if (json.has("publisher"))
12844      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12845    if (json.has("_publisher"))
12846      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
12847    if (json.has("contact")) {
12848      JsonArray array = json.getAsJsonArray("contact");
12849      for (int i = 0; i < array.size(); i++) {
12850        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12851      }
12852    };
12853    if (json.has("description"))
12854      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12855    if (json.has("_description"))
12856      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12857    if (json.has("useContext")) {
12858      JsonArray array = json.getAsJsonArray("useContext");
12859      for (int i = 0; i < array.size(); i++) {
12860        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12861      }
12862    };
12863    if (json.has("jurisdiction")) {
12864      JsonArray array = json.getAsJsonArray("jurisdiction");
12865      for (int i = 0; i < array.size(); i++) {
12866        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12867      }
12868    };
12869    if (json.has("purpose"))
12870      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
12871    if (json.has("_purpose"))
12872      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
12873    if (json.has("start"))
12874      res.setStartElement(parseCode(json.get("start").getAsString()));
12875    if (json.has("_start"))
12876      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
12877    if (json.has("profile"))
12878      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
12879    if (json.has("_profile"))
12880      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
12881    if (json.has("link")) {
12882      JsonArray array = json.getAsJsonArray("link");
12883      for (int i = 0; i < array.size(); i++) {
12884        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), res));
12885      }
12886    };
12887  }
12888
12889  protected GraphDefinition.GraphDefinitionLinkComponent parseGraphDefinitionGraphDefinitionLinkComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
12890    GraphDefinition.GraphDefinitionLinkComponent res = new GraphDefinition.GraphDefinitionLinkComponent();
12891    parseGraphDefinitionGraphDefinitionLinkComponentProperties(json, owner, res);
12892    return res;
12893  }
12894
12895  protected void parseGraphDefinitionGraphDefinitionLinkComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkComponent res) throws IOException, FHIRFormatError {
12896    parseBackboneElementProperties(json, res);
12897    if (json.has("path"))
12898      res.setPathElement(parseString(json.get("path").getAsString()));
12899    if (json.has("_path"))
12900      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
12901    if (json.has("sliceName"))
12902      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
12903    if (json.has("_sliceName"))
12904      parseElementProperties(json.getAsJsonObject("_sliceName"), res.getSliceNameElement());
12905    if (json.has("min"))
12906      res.setMinElement(parseInteger(json.get("min").getAsLong()));
12907    if (json.has("_min"))
12908      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
12909    if (json.has("max"))
12910      res.setMaxElement(parseString(json.get("max").getAsString()));
12911    if (json.has("_max"))
12912      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
12913    if (json.has("description"))
12914      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12915    if (json.has("_description"))
12916      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12917    if (json.has("target")) {
12918      JsonArray array = json.getAsJsonArray("target");
12919      for (int i = 0; i < array.size(); i++) {
12920        res.getTarget().add(parseGraphDefinitionGraphDefinitionLinkTargetComponent(array.get(i).getAsJsonObject(), owner));
12921      }
12922    };
12923  }
12924
12925  protected GraphDefinition.GraphDefinitionLinkTargetComponent parseGraphDefinitionGraphDefinitionLinkTargetComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
12926    GraphDefinition.GraphDefinitionLinkTargetComponent res = new GraphDefinition.GraphDefinitionLinkTargetComponent();
12927    parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(json, owner, res);
12928    return res;
12929  }
12930
12931  protected void parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetComponent res) throws IOException, FHIRFormatError {
12932    parseBackboneElementProperties(json, res);
12933    if (json.has("type"))
12934      res.setTypeElement(parseCode(json.get("type").getAsString()));
12935    if (json.has("_type"))
12936      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
12937    if (json.has("params"))
12938      res.setParamsElement(parseString(json.get("params").getAsString()));
12939    if (json.has("_params"))
12940      parseElementProperties(json.getAsJsonObject("_params"), res.getParamsElement());
12941    if (json.has("profile"))
12942      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
12943    if (json.has("_profile"))
12944      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
12945    if (json.has("compartment")) {
12946      JsonArray array = json.getAsJsonArray("compartment");
12947      for (int i = 0; i < array.size(); i++) {
12948        res.getCompartment().add(parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(array.get(i).getAsJsonObject(), owner));
12949      }
12950    };
12951    if (json.has("link")) {
12952      JsonArray array = json.getAsJsonArray("link");
12953      for (int i = 0; i < array.size(); i++) {
12954        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), owner));
12955      }
12956    };
12957  }
12958
12959  protected GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
12960    GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res = new GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent();
12961    parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(json, owner, res);
12962    return res;
12963  }
12964
12965  protected void parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res) throws IOException, FHIRFormatError {
12966    parseBackboneElementProperties(json, res);
12967    if (json.has("use"))
12968      res.setUseElement(parseEnumeration(json.get("use").getAsString(), GraphDefinition.GraphCompartmentUse.NULL, new GraphDefinition.GraphCompartmentUseEnumFactory()));
12969    if (json.has("_use"))
12970      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
12971    if (json.has("code"))
12972      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), GraphDefinition.CompartmentCode.NULL, new GraphDefinition.CompartmentCodeEnumFactory()));
12973    if (json.has("_code"))
12974      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
12975    if (json.has("rule"))
12976      res.setRuleElement(parseEnumeration(json.get("rule").getAsString(), GraphDefinition.GraphCompartmentRule.NULL, new GraphDefinition.GraphCompartmentRuleEnumFactory()));
12977    if (json.has("_rule"))
12978      parseElementProperties(json.getAsJsonObject("_rule"), res.getRuleElement());
12979    if (json.has("expression"))
12980      res.setExpressionElement(parseString(json.get("expression").getAsString()));
12981    if (json.has("_expression"))
12982      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
12983    if (json.has("description"))
12984      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12985    if (json.has("_description"))
12986      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12987  }
12988
12989  protected Group parseGroup(JsonObject json) throws IOException, FHIRFormatError {
12990    Group res = new Group();
12991    parseGroupProperties(json, res);
12992    return res;
12993  }
12994
12995  protected void parseGroupProperties(JsonObject json, Group res) throws IOException, FHIRFormatError {
12996    parseDomainResourceProperties(json, res);
12997    if (json.has("identifier")) {
12998      JsonArray array = json.getAsJsonArray("identifier");
12999      for (int i = 0; i < array.size(); i++) {
13000        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13001      }
13002    };
13003    if (json.has("active"))
13004      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
13005    if (json.has("_active"))
13006      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
13007    if (json.has("type"))
13008      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Group.GroupType.NULL, new Group.GroupTypeEnumFactory()));
13009    if (json.has("_type"))
13010      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
13011    if (json.has("actual"))
13012      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
13013    if (json.has("_actual"))
13014      parseElementProperties(json.getAsJsonObject("_actual"), res.getActualElement());
13015    if (json.has("code"))
13016      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13017    if (json.has("name"))
13018      res.setNameElement(parseString(json.get("name").getAsString()));
13019    if (json.has("_name"))
13020      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13021    if (json.has("quantity"))
13022      res.setQuantityElement(parseUnsignedInt(json.get("quantity").getAsString()));
13023    if (json.has("_quantity"))
13024      parseElementProperties(json.getAsJsonObject("_quantity"), res.getQuantityElement());
13025    if (json.has("managingEntity"))
13026      res.setManagingEntity(parseReference(json.getAsJsonObject("managingEntity")));
13027    if (json.has("characteristic")) {
13028      JsonArray array = json.getAsJsonArray("characteristic");
13029      for (int i = 0; i < array.size(); i++) {
13030        res.getCharacteristic().add(parseGroupGroupCharacteristicComponent(array.get(i).getAsJsonObject(), res));
13031      }
13032    };
13033    if (json.has("member")) {
13034      JsonArray array = json.getAsJsonArray("member");
13035      for (int i = 0; i < array.size(); i++) {
13036        res.getMember().add(parseGroupGroupMemberComponent(array.get(i).getAsJsonObject(), res));
13037      }
13038    };
13039  }
13040
13041  protected Group.GroupCharacteristicComponent parseGroupGroupCharacteristicComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
13042    Group.GroupCharacteristicComponent res = new Group.GroupCharacteristicComponent();
13043    parseGroupGroupCharacteristicComponentProperties(json, owner, res);
13044    return res;
13045  }
13046
13047  protected void parseGroupGroupCharacteristicComponentProperties(JsonObject json, Group owner, Group.GroupCharacteristicComponent res) throws IOException, FHIRFormatError {
13048    parseBackboneElementProperties(json, res);
13049    if (json.has("code"))
13050      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13051    Type value = parseType("value", json);
13052    if (value != null)
13053      res.setValue(value);
13054    if (json.has("exclude"))
13055      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
13056    if (json.has("_exclude"))
13057      parseElementProperties(json.getAsJsonObject("_exclude"), res.getExcludeElement());
13058    if (json.has("period"))
13059      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
13060  }
13061
13062  protected Group.GroupMemberComponent parseGroupGroupMemberComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
13063    Group.GroupMemberComponent res = new Group.GroupMemberComponent();
13064    parseGroupGroupMemberComponentProperties(json, owner, res);
13065    return res;
13066  }
13067
13068  protected void parseGroupGroupMemberComponentProperties(JsonObject json, Group owner, Group.GroupMemberComponent res) throws IOException, FHIRFormatError {
13069    parseBackboneElementProperties(json, res);
13070    if (json.has("entity"))
13071      res.setEntity(parseReference(json.getAsJsonObject("entity")));
13072    if (json.has("period"))
13073      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
13074    if (json.has("inactive"))
13075      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
13076    if (json.has("_inactive"))
13077      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
13078  }
13079
13080  protected GuidanceResponse parseGuidanceResponse(JsonObject json) throws IOException, FHIRFormatError {
13081    GuidanceResponse res = new GuidanceResponse();
13082    parseGuidanceResponseProperties(json, res);
13083    return res;
13084  }
13085
13086  protected void parseGuidanceResponseProperties(JsonObject json, GuidanceResponse res) throws IOException, FHIRFormatError {
13087    parseDomainResourceProperties(json, res);
13088    if (json.has("requestIdentifier"))
13089      res.setRequestIdentifier(parseIdentifier(json.getAsJsonObject("requestIdentifier")));
13090    if (json.has("identifier")) {
13091      JsonArray array = json.getAsJsonArray("identifier");
13092      for (int i = 0; i < array.size(); i++) {
13093        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13094      }
13095    };
13096    Type module = parseType("module", json);
13097    if (module != null)
13098      res.setModule(module);
13099    if (json.has("status"))
13100      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), GuidanceResponse.GuidanceResponseStatus.NULL, new GuidanceResponse.GuidanceResponseStatusEnumFactory()));
13101    if (json.has("_status"))
13102      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13103    if (json.has("subject"))
13104      res.setSubject(parseReference(json.getAsJsonObject("subject")));
13105    if (json.has("encounter"))
13106      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
13107    if (json.has("occurrenceDateTime"))
13108      res.setOccurrenceDateTimeElement(parseDateTime(json.get("occurrenceDateTime").getAsString()));
13109    if (json.has("_occurrenceDateTime"))
13110      parseElementProperties(json.getAsJsonObject("_occurrenceDateTime"), res.getOccurrenceDateTimeElement());
13111    if (json.has("performer"))
13112      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
13113    if (json.has("reasonCode")) {
13114      JsonArray array = json.getAsJsonArray("reasonCode");
13115      for (int i = 0; i < array.size(); i++) {
13116        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13117      }
13118    };
13119    if (json.has("reasonReference")) {
13120      JsonArray array = json.getAsJsonArray("reasonReference");
13121      for (int i = 0; i < array.size(); i++) {
13122        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
13123      }
13124    };
13125    if (json.has("note")) {
13126      JsonArray array = json.getAsJsonArray("note");
13127      for (int i = 0; i < array.size(); i++) {
13128        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13129      }
13130    };
13131    if (json.has("evaluationMessage")) {
13132      JsonArray array = json.getAsJsonArray("evaluationMessage");
13133      for (int i = 0; i < array.size(); i++) {
13134        res.getEvaluationMessage().add(parseReference(array.get(i).getAsJsonObject()));
13135      }
13136    };
13137    if (json.has("outputParameters"))
13138      res.setOutputParameters(parseReference(json.getAsJsonObject("outputParameters")));
13139    if (json.has("result"))
13140      res.setResult(parseReference(json.getAsJsonObject("result")));
13141    if (json.has("dataRequirement")) {
13142      JsonArray array = json.getAsJsonArray("dataRequirement");
13143      for (int i = 0; i < array.size(); i++) {
13144        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
13145      }
13146    };
13147  }
13148
13149  protected HealthcareService parseHealthcareService(JsonObject json) throws IOException, FHIRFormatError {
13150    HealthcareService res = new HealthcareService();
13151    parseHealthcareServiceProperties(json, res);
13152    return res;
13153  }
13154
13155  protected void parseHealthcareServiceProperties(JsonObject json, HealthcareService res) throws IOException, FHIRFormatError {
13156    parseDomainResourceProperties(json, res);
13157    if (json.has("identifier")) {
13158      JsonArray array = json.getAsJsonArray("identifier");
13159      for (int i = 0; i < array.size(); i++) {
13160        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13161      }
13162    };
13163    if (json.has("active"))
13164      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
13165    if (json.has("_active"))
13166      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
13167    if (json.has("providedBy"))
13168      res.setProvidedBy(parseReference(json.getAsJsonObject("providedBy")));
13169    if (json.has("category")) {
13170      JsonArray array = json.getAsJsonArray("category");
13171      for (int i = 0; i < array.size(); i++) {
13172        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13173      }
13174    };
13175    if (json.has("type")) {
13176      JsonArray array = json.getAsJsonArray("type");
13177      for (int i = 0; i < array.size(); i++) {
13178        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13179      }
13180    };
13181    if (json.has("specialty")) {
13182      JsonArray array = json.getAsJsonArray("specialty");
13183      for (int i = 0; i < array.size(); i++) {
13184        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13185      }
13186    };
13187    if (json.has("location")) {
13188      JsonArray array = json.getAsJsonArray("location");
13189      for (int i = 0; i < array.size(); i++) {
13190        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
13191      }
13192    };
13193    if (json.has("name"))
13194      res.setNameElement(parseString(json.get("name").getAsString()));
13195    if (json.has("_name"))
13196      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13197    if (json.has("comment"))
13198      res.setCommentElement(parseString(json.get("comment").getAsString()));
13199    if (json.has("_comment"))
13200      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
13201    if (json.has("extraDetails"))
13202      res.setExtraDetailsElement(parseMarkdown(json.get("extraDetails").getAsString()));
13203    if (json.has("_extraDetails"))
13204      parseElementProperties(json.getAsJsonObject("_extraDetails"), res.getExtraDetailsElement());
13205    if (json.has("photo"))
13206      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
13207    if (json.has("telecom")) {
13208      JsonArray array = json.getAsJsonArray("telecom");
13209      for (int i = 0; i < array.size(); i++) {
13210        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
13211      }
13212    };
13213    if (json.has("coverageArea")) {
13214      JsonArray array = json.getAsJsonArray("coverageArea");
13215      for (int i = 0; i < array.size(); i++) {
13216        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
13217      }
13218    };
13219    if (json.has("serviceProvisionCode")) {
13220      JsonArray array = json.getAsJsonArray("serviceProvisionCode");
13221      for (int i = 0; i < array.size(); i++) {
13222        res.getServiceProvisionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13223      }
13224    };
13225    if (json.has("eligibility")) {
13226      JsonArray array = json.getAsJsonArray("eligibility");
13227      for (int i = 0; i < array.size(); i++) {
13228        res.getEligibility().add(parseHealthcareServiceHealthcareServiceEligibilityComponent(array.get(i).getAsJsonObject(), res));
13229      }
13230    };
13231    if (json.has("program")) {
13232      JsonArray array = json.getAsJsonArray("program");
13233      for (int i = 0; i < array.size(); i++) {
13234        res.getProgram().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13235      }
13236    };
13237    if (json.has("characteristic")) {
13238      JsonArray array = json.getAsJsonArray("characteristic");
13239      for (int i = 0; i < array.size(); i++) {
13240        res.getCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13241      }
13242    };
13243    if (json.has("communication")) {
13244      JsonArray array = json.getAsJsonArray("communication");
13245      for (int i = 0; i < array.size(); i++) {
13246        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13247      }
13248    };
13249    if (json.has("referralMethod")) {
13250      JsonArray array = json.getAsJsonArray("referralMethod");
13251      for (int i = 0; i < array.size(); i++) {
13252        res.getReferralMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13253      }
13254    };
13255    if (json.has("appointmentRequired"))
13256      res.setAppointmentRequiredElement(parseBoolean(json.get("appointmentRequired").getAsBoolean()));
13257    if (json.has("_appointmentRequired"))
13258      parseElementProperties(json.getAsJsonObject("_appointmentRequired"), res.getAppointmentRequiredElement());
13259    if (json.has("availableTime")) {
13260      JsonArray array = json.getAsJsonArray("availableTime");
13261      for (int i = 0; i < array.size(); i++) {
13262        res.getAvailableTime().add(parseHealthcareServiceHealthcareServiceAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
13263      }
13264    };
13265    if (json.has("notAvailable")) {
13266      JsonArray array = json.getAsJsonArray("notAvailable");
13267      for (int i = 0; i < array.size(); i++) {
13268        res.getNotAvailable().add(parseHealthcareServiceHealthcareServiceNotAvailableComponent(array.get(i).getAsJsonObject(), res));
13269      }
13270    };
13271    if (json.has("availabilityExceptions"))
13272      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
13273    if (json.has("_availabilityExceptions"))
13274      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
13275    if (json.has("endpoint")) {
13276      JsonArray array = json.getAsJsonArray("endpoint");
13277      for (int i = 0; i < array.size(); i++) {
13278        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
13279      }
13280    };
13281  }
13282
13283  protected HealthcareService.HealthcareServiceEligibilityComponent parseHealthcareServiceHealthcareServiceEligibilityComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
13284    HealthcareService.HealthcareServiceEligibilityComponent res = new HealthcareService.HealthcareServiceEligibilityComponent();
13285    parseHealthcareServiceHealthcareServiceEligibilityComponentProperties(json, owner, res);
13286    return res;
13287  }
13288
13289  protected void parseHealthcareServiceHealthcareServiceEligibilityComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceEligibilityComponent res) throws IOException, FHIRFormatError {
13290    parseBackboneElementProperties(json, res);
13291    if (json.has("code"))
13292      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13293    if (json.has("comment"))
13294      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
13295    if (json.has("_comment"))
13296      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
13297  }
13298
13299  protected HealthcareService.HealthcareServiceAvailableTimeComponent parseHealthcareServiceHealthcareServiceAvailableTimeComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
13300    HealthcareService.HealthcareServiceAvailableTimeComponent res = new HealthcareService.HealthcareServiceAvailableTimeComponent();
13301    parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(json, owner, res);
13302    return res;
13303  }
13304
13305  protected void parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceAvailableTimeComponent res) throws IOException, FHIRFormatError {
13306    parseBackboneElementProperties(json, res);
13307    if (json.has("daysOfWeek")) {
13308      JsonArray array = json.getAsJsonArray("daysOfWeek");
13309      for (int i = 0; i < array.size(); i++) {
13310        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
13311      }
13312    };
13313    if (json.has("_daysOfWeek")) {
13314      JsonArray array = json.getAsJsonArray("_daysOfWeek");
13315      for (int i = 0; i < array.size(); i++) {
13316        if (i == res.getDaysOfWeek().size())
13317          res.getDaysOfWeek().add(parseEnumeration(null, HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
13318        if (array.get(i) instanceof JsonObject) 
13319          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
13320      }
13321    };
13322    if (json.has("allDay"))
13323      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
13324    if (json.has("_allDay"))
13325      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
13326    if (json.has("availableStartTime"))
13327      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
13328    if (json.has("_availableStartTime"))
13329      parseElementProperties(json.getAsJsonObject("_availableStartTime"), res.getAvailableStartTimeElement());
13330    if (json.has("availableEndTime"))
13331      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
13332    if (json.has("_availableEndTime"))
13333      parseElementProperties(json.getAsJsonObject("_availableEndTime"), res.getAvailableEndTimeElement());
13334  }
13335
13336  protected HealthcareService.HealthcareServiceNotAvailableComponent parseHealthcareServiceHealthcareServiceNotAvailableComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
13337    HealthcareService.HealthcareServiceNotAvailableComponent res = new HealthcareService.HealthcareServiceNotAvailableComponent();
13338    parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(json, owner, res);
13339    return res;
13340  }
13341
13342  protected void parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceNotAvailableComponent res) throws IOException, FHIRFormatError {
13343    parseBackboneElementProperties(json, res);
13344    if (json.has("description"))
13345      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13346    if (json.has("_description"))
13347      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13348    if (json.has("during"))
13349      res.setDuring(parsePeriod(json.getAsJsonObject("during")));
13350  }
13351
13352  protected ImagingStudy parseImagingStudy(JsonObject json) throws IOException, FHIRFormatError {
13353    ImagingStudy res = new ImagingStudy();
13354    parseImagingStudyProperties(json, res);
13355    return res;
13356  }
13357
13358  protected void parseImagingStudyProperties(JsonObject json, ImagingStudy res) throws IOException, FHIRFormatError {
13359    parseDomainResourceProperties(json, res);
13360    if (json.has("identifier")) {
13361      JsonArray array = json.getAsJsonArray("identifier");
13362      for (int i = 0; i < array.size(); i++) {
13363        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13364      }
13365    };
13366    if (json.has("status"))
13367      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImagingStudy.ImagingStudyStatus.NULL, new ImagingStudy.ImagingStudyStatusEnumFactory()));
13368    if (json.has("_status"))
13369      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13370    if (json.has("modality")) {
13371      JsonArray array = json.getAsJsonArray("modality");
13372      for (int i = 0; i < array.size(); i++) {
13373        res.getModality().add(parseCoding(array.get(i).getAsJsonObject()));
13374      }
13375    };
13376    if (json.has("subject"))
13377      res.setSubject(parseReference(json.getAsJsonObject("subject")));
13378    if (json.has("encounter"))
13379      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
13380    if (json.has("started"))
13381      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
13382    if (json.has("_started"))
13383      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
13384    if (json.has("basedOn")) {
13385      JsonArray array = json.getAsJsonArray("basedOn");
13386      for (int i = 0; i < array.size(); i++) {
13387        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
13388      }
13389    };
13390    if (json.has("referrer"))
13391      res.setReferrer(parseReference(json.getAsJsonObject("referrer")));
13392    if (json.has("interpreter")) {
13393      JsonArray array = json.getAsJsonArray("interpreter");
13394      for (int i = 0; i < array.size(); i++) {
13395        res.getInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
13396      }
13397    };
13398    if (json.has("endpoint")) {
13399      JsonArray array = json.getAsJsonArray("endpoint");
13400      for (int i = 0; i < array.size(); i++) {
13401        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
13402      }
13403    };
13404    if (json.has("numberOfSeries"))
13405      res.setNumberOfSeriesElement(parseUnsignedInt(json.get("numberOfSeries").getAsString()));
13406    if (json.has("_numberOfSeries"))
13407      parseElementProperties(json.getAsJsonObject("_numberOfSeries"), res.getNumberOfSeriesElement());
13408    if (json.has("numberOfInstances"))
13409      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
13410    if (json.has("_numberOfInstances"))
13411      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
13412    if (json.has("procedureReference"))
13413      res.setProcedureReference(parseReference(json.getAsJsonObject("procedureReference")));
13414    if (json.has("procedureCode")) {
13415      JsonArray array = json.getAsJsonArray("procedureCode");
13416      for (int i = 0; i < array.size(); i++) {
13417        res.getProcedureCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13418      }
13419    };
13420    if (json.has("location"))
13421      res.setLocation(parseReference(json.getAsJsonObject("location")));
13422    if (json.has("reasonCode")) {
13423      JsonArray array = json.getAsJsonArray("reasonCode");
13424      for (int i = 0; i < array.size(); i++) {
13425        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13426      }
13427    };
13428    if (json.has("reasonReference")) {
13429      JsonArray array = json.getAsJsonArray("reasonReference");
13430      for (int i = 0; i < array.size(); i++) {
13431        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
13432      }
13433    };
13434    if (json.has("note")) {
13435      JsonArray array = json.getAsJsonArray("note");
13436      for (int i = 0; i < array.size(); i++) {
13437        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13438      }
13439    };
13440    if (json.has("description"))
13441      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13442    if (json.has("_description"))
13443      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13444    if (json.has("series")) {
13445      JsonArray array = json.getAsJsonArray("series");
13446      for (int i = 0; i < array.size(); i++) {
13447        res.getSeries().add(parseImagingStudyImagingStudySeriesComponent(array.get(i).getAsJsonObject(), res));
13448      }
13449    };
13450  }
13451
13452  protected ImagingStudy.ImagingStudySeriesComponent parseImagingStudyImagingStudySeriesComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
13453    ImagingStudy.ImagingStudySeriesComponent res = new ImagingStudy.ImagingStudySeriesComponent();
13454    parseImagingStudyImagingStudySeriesComponentProperties(json, owner, res);
13455    return res;
13456  }
13457
13458  protected void parseImagingStudyImagingStudySeriesComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesComponent res) throws IOException, FHIRFormatError {
13459    parseBackboneElementProperties(json, res);
13460    if (json.has("uid"))
13461      res.setUidElement(parseId(json.get("uid").getAsString()));
13462    if (json.has("_uid"))
13463      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
13464    if (json.has("number"))
13465      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
13466    if (json.has("_number"))
13467      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
13468    if (json.has("modality"))
13469      res.setModality(parseCoding(json.getAsJsonObject("modality")));
13470    if (json.has("description"))
13471      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13472    if (json.has("_description"))
13473      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13474    if (json.has("numberOfInstances"))
13475      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
13476    if (json.has("_numberOfInstances"))
13477      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
13478    if (json.has("endpoint")) {
13479      JsonArray array = json.getAsJsonArray("endpoint");
13480      for (int i = 0; i < array.size(); i++) {
13481        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
13482      }
13483    };
13484    if (json.has("bodySite"))
13485      res.setBodySite(parseCoding(json.getAsJsonObject("bodySite")));
13486    if (json.has("laterality"))
13487      res.setLaterality(parseCoding(json.getAsJsonObject("laterality")));
13488    if (json.has("specimen")) {
13489      JsonArray array = json.getAsJsonArray("specimen");
13490      for (int i = 0; i < array.size(); i++) {
13491        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
13492      }
13493    };
13494    if (json.has("started"))
13495      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
13496    if (json.has("_started"))
13497      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
13498    if (json.has("performer")) {
13499      JsonArray array = json.getAsJsonArray("performer");
13500      for (int i = 0; i < array.size(); i++) {
13501        res.getPerformer().add(parseImagingStudyImagingStudySeriesPerformerComponent(array.get(i).getAsJsonObject(), owner));
13502      }
13503    };
13504    if (json.has("instance")) {
13505      JsonArray array = json.getAsJsonArray("instance");
13506      for (int i = 0; i < array.size(); i++) {
13507        res.getInstance().add(parseImagingStudyImagingStudySeriesInstanceComponent(array.get(i).getAsJsonObject(), owner));
13508      }
13509    };
13510  }
13511
13512  protected ImagingStudy.ImagingStudySeriesPerformerComponent parseImagingStudyImagingStudySeriesPerformerComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
13513    ImagingStudy.ImagingStudySeriesPerformerComponent res = new ImagingStudy.ImagingStudySeriesPerformerComponent();
13514    parseImagingStudyImagingStudySeriesPerformerComponentProperties(json, owner, res);
13515    return res;
13516  }
13517
13518  protected void parseImagingStudyImagingStudySeriesPerformerComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesPerformerComponent res) throws IOException, FHIRFormatError {
13519    parseBackboneElementProperties(json, res);
13520    if (json.has("function"))
13521      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
13522    if (json.has("actor"))
13523      res.setActor(parseReference(json.getAsJsonObject("actor")));
13524  }
13525
13526  protected ImagingStudy.ImagingStudySeriesInstanceComponent parseImagingStudyImagingStudySeriesInstanceComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
13527    ImagingStudy.ImagingStudySeriesInstanceComponent res = new ImagingStudy.ImagingStudySeriesInstanceComponent();
13528    parseImagingStudyImagingStudySeriesInstanceComponentProperties(json, owner, res);
13529    return res;
13530  }
13531
13532  protected void parseImagingStudyImagingStudySeriesInstanceComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesInstanceComponent res) throws IOException, FHIRFormatError {
13533    parseBackboneElementProperties(json, res);
13534    if (json.has("uid"))
13535      res.setUidElement(parseId(json.get("uid").getAsString()));
13536    if (json.has("_uid"))
13537      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
13538    if (json.has("sopClass"))
13539      res.setSopClass(parseCoding(json.getAsJsonObject("sopClass")));
13540    if (json.has("number"))
13541      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
13542    if (json.has("_number"))
13543      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
13544    if (json.has("title"))
13545      res.setTitleElement(parseString(json.get("title").getAsString()));
13546    if (json.has("_title"))
13547      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
13548  }
13549
13550  protected Immunization parseImmunization(JsonObject json) throws IOException, FHIRFormatError {
13551    Immunization res = new Immunization();
13552    parseImmunizationProperties(json, res);
13553    return res;
13554  }
13555
13556  protected void parseImmunizationProperties(JsonObject json, Immunization res) throws IOException, FHIRFormatError {
13557    parseDomainResourceProperties(json, res);
13558    if (json.has("identifier")) {
13559      JsonArray array = json.getAsJsonArray("identifier");
13560      for (int i = 0; i < array.size(); i++) {
13561        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13562      }
13563    };
13564    if (json.has("status"))
13565      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Immunization.ImmunizationStatus.NULL, new Immunization.ImmunizationStatusEnumFactory()));
13566    if (json.has("_status"))
13567      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13568    if (json.has("statusReason"))
13569      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
13570    if (json.has("vaccineCode"))
13571      res.setVaccineCode(parseCodeableConcept(json.getAsJsonObject("vaccineCode")));
13572    if (json.has("patient"))
13573      res.setPatient(parseReference(json.getAsJsonObject("patient")));
13574    if (json.has("encounter"))
13575      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
13576    Type occurrence = parseType("occurrence", json);
13577    if (occurrence != null)
13578      res.setOccurrence(occurrence);
13579    if (json.has("recorded"))
13580      res.setRecordedElement(parseDateTime(json.get("recorded").getAsString()));
13581    if (json.has("_recorded"))
13582      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
13583    if (json.has("primarySource"))
13584      res.setPrimarySourceElement(parseBoolean(json.get("primarySource").getAsBoolean()));
13585    if (json.has("_primarySource"))
13586      parseElementProperties(json.getAsJsonObject("_primarySource"), res.getPrimarySourceElement());
13587    if (json.has("reportOrigin"))
13588      res.setReportOrigin(parseCodeableConcept(json.getAsJsonObject("reportOrigin")));
13589    if (json.has("location"))
13590      res.setLocation(parseReference(json.getAsJsonObject("location")));
13591    if (json.has("manufacturer"))
13592      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
13593    if (json.has("lotNumber"))
13594      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
13595    if (json.has("_lotNumber"))
13596      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
13597    if (json.has("expirationDate"))
13598      res.setExpirationDateElement(parseDate(json.get("expirationDate").getAsString()));
13599    if (json.has("_expirationDate"))
13600      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
13601    if (json.has("site"))
13602      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
13603    if (json.has("route"))
13604      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
13605    if (json.has("doseQuantity"))
13606      res.setDoseQuantity(parseQuantity(json.getAsJsonObject("doseQuantity")));
13607    if (json.has("performer")) {
13608      JsonArray array = json.getAsJsonArray("performer");
13609      for (int i = 0; i < array.size(); i++) {
13610        res.getPerformer().add(parseImmunizationImmunizationPerformerComponent(array.get(i).getAsJsonObject(), res));
13611      }
13612    };
13613    if (json.has("note")) {
13614      JsonArray array = json.getAsJsonArray("note");
13615      for (int i = 0; i < array.size(); i++) {
13616        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13617      }
13618    };
13619    if (json.has("reasonCode")) {
13620      JsonArray array = json.getAsJsonArray("reasonCode");
13621      for (int i = 0; i < array.size(); i++) {
13622        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13623      }
13624    };
13625    if (json.has("reasonReference")) {
13626      JsonArray array = json.getAsJsonArray("reasonReference");
13627      for (int i = 0; i < array.size(); i++) {
13628        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
13629      }
13630    };
13631    if (json.has("isSubpotent"))
13632      res.setIsSubpotentElement(parseBoolean(json.get("isSubpotent").getAsBoolean()));
13633    if (json.has("_isSubpotent"))
13634      parseElementProperties(json.getAsJsonObject("_isSubpotent"), res.getIsSubpotentElement());
13635    if (json.has("subpotentReason")) {
13636      JsonArray array = json.getAsJsonArray("subpotentReason");
13637      for (int i = 0; i < array.size(); i++) {
13638        res.getSubpotentReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13639      }
13640    };
13641    if (json.has("education")) {
13642      JsonArray array = json.getAsJsonArray("education");
13643      for (int i = 0; i < array.size(); i++) {
13644        res.getEducation().add(parseImmunizationImmunizationEducationComponent(array.get(i).getAsJsonObject(), res));
13645      }
13646    };
13647    if (json.has("programEligibility")) {
13648      JsonArray array = json.getAsJsonArray("programEligibility");
13649      for (int i = 0; i < array.size(); i++) {
13650        res.getProgramEligibility().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13651      }
13652    };
13653    if (json.has("fundingSource"))
13654      res.setFundingSource(parseCodeableConcept(json.getAsJsonObject("fundingSource")));
13655    if (json.has("reaction")) {
13656      JsonArray array = json.getAsJsonArray("reaction");
13657      for (int i = 0; i < array.size(); i++) {
13658        res.getReaction().add(parseImmunizationImmunizationReactionComponent(array.get(i).getAsJsonObject(), res));
13659      }
13660    };
13661    if (json.has("protocolApplied")) {
13662      JsonArray array = json.getAsJsonArray("protocolApplied");
13663      for (int i = 0; i < array.size(); i++) {
13664        res.getProtocolApplied().add(parseImmunizationImmunizationProtocolAppliedComponent(array.get(i).getAsJsonObject(), res));
13665      }
13666    };
13667  }
13668
13669  protected Immunization.ImmunizationPerformerComponent parseImmunizationImmunizationPerformerComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
13670    Immunization.ImmunizationPerformerComponent res = new Immunization.ImmunizationPerformerComponent();
13671    parseImmunizationImmunizationPerformerComponentProperties(json, owner, res);
13672    return res;
13673  }
13674
13675  protected void parseImmunizationImmunizationPerformerComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationPerformerComponent res) throws IOException, FHIRFormatError {
13676    parseBackboneElementProperties(json, res);
13677    if (json.has("function"))
13678      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
13679    if (json.has("actor"))
13680      res.setActor(parseReference(json.getAsJsonObject("actor")));
13681  }
13682
13683  protected Immunization.ImmunizationEducationComponent parseImmunizationImmunizationEducationComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
13684    Immunization.ImmunizationEducationComponent res = new Immunization.ImmunizationEducationComponent();
13685    parseImmunizationImmunizationEducationComponentProperties(json, owner, res);
13686    return res;
13687  }
13688
13689  protected void parseImmunizationImmunizationEducationComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationEducationComponent res) throws IOException, FHIRFormatError {
13690    parseBackboneElementProperties(json, res);
13691    if (json.has("documentType"))
13692      res.setDocumentTypeElement(parseString(json.get("documentType").getAsString()));
13693    if (json.has("_documentType"))
13694      parseElementProperties(json.getAsJsonObject("_documentType"), res.getDocumentTypeElement());
13695    if (json.has("reference"))
13696      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
13697    if (json.has("_reference"))
13698      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
13699    if (json.has("publicationDate"))
13700      res.setPublicationDateElement(parseDateTime(json.get("publicationDate").getAsString()));
13701    if (json.has("_publicationDate"))
13702      parseElementProperties(json.getAsJsonObject("_publicationDate"), res.getPublicationDateElement());
13703    if (json.has("presentationDate"))
13704      res.setPresentationDateElement(parseDateTime(json.get("presentationDate").getAsString()));
13705    if (json.has("_presentationDate"))
13706      parseElementProperties(json.getAsJsonObject("_presentationDate"), res.getPresentationDateElement());
13707  }
13708
13709  protected Immunization.ImmunizationReactionComponent parseImmunizationImmunizationReactionComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
13710    Immunization.ImmunizationReactionComponent res = new Immunization.ImmunizationReactionComponent();
13711    parseImmunizationImmunizationReactionComponentProperties(json, owner, res);
13712    return res;
13713  }
13714
13715  protected void parseImmunizationImmunizationReactionComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationReactionComponent res) throws IOException, FHIRFormatError {
13716    parseBackboneElementProperties(json, res);
13717    if (json.has("date"))
13718      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13719    if (json.has("_date"))
13720      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13721    if (json.has("detail"))
13722      res.setDetail(parseReference(json.getAsJsonObject("detail")));
13723    if (json.has("reported"))
13724      res.setReportedElement(parseBoolean(json.get("reported").getAsBoolean()));
13725    if (json.has("_reported"))
13726      parseElementProperties(json.getAsJsonObject("_reported"), res.getReportedElement());
13727  }
13728
13729  protected Immunization.ImmunizationProtocolAppliedComponent parseImmunizationImmunizationProtocolAppliedComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
13730    Immunization.ImmunizationProtocolAppliedComponent res = new Immunization.ImmunizationProtocolAppliedComponent();
13731    parseImmunizationImmunizationProtocolAppliedComponentProperties(json, owner, res);
13732    return res;
13733  }
13734
13735  protected void parseImmunizationImmunizationProtocolAppliedComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationProtocolAppliedComponent res) throws IOException, FHIRFormatError {
13736    parseBackboneElementProperties(json, res);
13737    if (json.has("series"))
13738      res.setSeriesElement(parseString(json.get("series").getAsString()));
13739    if (json.has("_series"))
13740      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
13741    if (json.has("authority"))
13742      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
13743    if (json.has("targetDisease")) {
13744      JsonArray array = json.getAsJsonArray("targetDisease");
13745      for (int i = 0; i < array.size(); i++) {
13746        res.getTargetDisease().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13747      }
13748    };
13749    Type doseNumber = parseType("doseNumber", json);
13750    if (doseNumber != null)
13751      res.setDoseNumber(doseNumber);
13752    Type seriesDoses = parseType("seriesDoses", json);
13753    if (seriesDoses != null)
13754      res.setSeriesDoses(seriesDoses);
13755  }
13756
13757  protected ImmunizationEvaluation parseImmunizationEvaluation(JsonObject json) throws IOException, FHIRFormatError {
13758    ImmunizationEvaluation res = new ImmunizationEvaluation();
13759    parseImmunizationEvaluationProperties(json, res);
13760    return res;
13761  }
13762
13763  protected void parseImmunizationEvaluationProperties(JsonObject json, ImmunizationEvaluation res) throws IOException, FHIRFormatError {
13764    parseDomainResourceProperties(json, res);
13765    if (json.has("identifier")) {
13766      JsonArray array = json.getAsJsonArray("identifier");
13767      for (int i = 0; i < array.size(); i++) {
13768        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13769      }
13770    };
13771    if (json.has("status"))
13772      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImmunizationEvaluation.ImmunizationEvaluationStatus.NULL, new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory()));
13773    if (json.has("_status"))
13774      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13775    if (json.has("patient"))
13776      res.setPatient(parseReference(json.getAsJsonObject("patient")));
13777    if (json.has("date"))
13778      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13779    if (json.has("_date"))
13780      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13781    if (json.has("authority"))
13782      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
13783    if (json.has("targetDisease"))
13784      res.setTargetDisease(parseCodeableConcept(json.getAsJsonObject("targetDisease")));
13785    if (json.has("immunizationEvent"))
13786      res.setImmunizationEvent(parseReference(json.getAsJsonObject("immunizationEvent")));
13787    if (json.has("doseStatus"))
13788      res.setDoseStatus(parseCodeableConcept(json.getAsJsonObject("doseStatus")));
13789    if (json.has("doseStatusReason")) {
13790      JsonArray array = json.getAsJsonArray("doseStatusReason");
13791      for (int i = 0; i < array.size(); i++) {
13792        res.getDoseStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13793      }
13794    };
13795    if (json.has("description"))
13796      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13797    if (json.has("_description"))
13798      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13799    if (json.has("series"))
13800      res.setSeriesElement(parseString(json.get("series").getAsString()));
13801    if (json.has("_series"))
13802      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
13803    Type doseNumber = parseType("doseNumber", json);
13804    if (doseNumber != null)
13805      res.setDoseNumber(doseNumber);
13806    Type seriesDoses = parseType("seriesDoses", json);
13807    if (seriesDoses != null)
13808      res.setSeriesDoses(seriesDoses);
13809  }
13810
13811  protected ImmunizationRecommendation parseImmunizationRecommendation(JsonObject json) throws IOException, FHIRFormatError {
13812    ImmunizationRecommendation res = new ImmunizationRecommendation();
13813    parseImmunizationRecommendationProperties(json, res);
13814    return res;
13815  }
13816
13817  protected void parseImmunizationRecommendationProperties(JsonObject json, ImmunizationRecommendation res) throws IOException, FHIRFormatError {
13818    parseDomainResourceProperties(json, res);
13819    if (json.has("identifier")) {
13820      JsonArray array = json.getAsJsonArray("identifier");
13821      for (int i = 0; i < array.size(); i++) {
13822        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13823      }
13824    };
13825    if (json.has("patient"))
13826      res.setPatient(parseReference(json.getAsJsonObject("patient")));
13827    if (json.has("date"))
13828      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13829    if (json.has("_date"))
13830      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13831    if (json.has("authority"))
13832      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
13833    if (json.has("recommendation")) {
13834      JsonArray array = json.getAsJsonArray("recommendation");
13835      for (int i = 0; i < array.size(); i++) {
13836        res.getRecommendation().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(array.get(i).getAsJsonObject(), res));
13837      }
13838    };
13839  }
13840
13841  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
13842    ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent();
13843    parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(json, owner, res);
13844    return res;
13845  }
13846
13847  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res) throws IOException, FHIRFormatError {
13848    parseBackboneElementProperties(json, res);
13849    if (json.has("vaccineCode")) {
13850      JsonArray array = json.getAsJsonArray("vaccineCode");
13851      for (int i = 0; i < array.size(); i++) {
13852        res.getVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13853      }
13854    };
13855    if (json.has("targetDisease"))
13856      res.setTargetDisease(parseCodeableConcept(json.getAsJsonObject("targetDisease")));
13857    if (json.has("contraindicatedVaccineCode")) {
13858      JsonArray array = json.getAsJsonArray("contraindicatedVaccineCode");
13859      for (int i = 0; i < array.size(); i++) {
13860        res.getContraindicatedVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13861      }
13862    };
13863    if (json.has("forecastStatus"))
13864      res.setForecastStatus(parseCodeableConcept(json.getAsJsonObject("forecastStatus")));
13865    if (json.has("forecastReason")) {
13866      JsonArray array = json.getAsJsonArray("forecastReason");
13867      for (int i = 0; i < array.size(); i++) {
13868        res.getForecastReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13869      }
13870    };
13871    if (json.has("dateCriterion")) {
13872      JsonArray array = json.getAsJsonArray("dateCriterion");
13873      for (int i = 0; i < array.size(); i++) {
13874        res.getDateCriterion().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(array.get(i).getAsJsonObject(), owner));
13875      }
13876    };
13877    if (json.has("description"))
13878      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13879    if (json.has("_description"))
13880      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13881    if (json.has("series"))
13882      res.setSeriesElement(parseString(json.get("series").getAsString()));
13883    if (json.has("_series"))
13884      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
13885    Type doseNumber = parseType("doseNumber", json);
13886    if (doseNumber != null)
13887      res.setDoseNumber(doseNumber);
13888    Type seriesDoses = parseType("seriesDoses", json);
13889    if (seriesDoses != null)
13890      res.setSeriesDoses(seriesDoses);
13891    if (json.has("supportingImmunization")) {
13892      JsonArray array = json.getAsJsonArray("supportingImmunization");
13893      for (int i = 0; i < array.size(); i++) {
13894        res.getSupportingImmunization().add(parseReference(array.get(i).getAsJsonObject()));
13895      }
13896    };
13897    if (json.has("supportingPatientInformation")) {
13898      JsonArray array = json.getAsJsonArray("supportingPatientInformation");
13899      for (int i = 0; i < array.size(); i++) {
13900        res.getSupportingPatientInformation().add(parseReference(array.get(i).getAsJsonObject()));
13901      }
13902    };
13903  }
13904
13905  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
13906    ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent();
13907    parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(json, owner, res);
13908    return res;
13909  }
13910
13911  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res) throws IOException, FHIRFormatError {
13912    parseBackboneElementProperties(json, res);
13913    if (json.has("code"))
13914      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13915    if (json.has("value"))
13916      res.setValueElement(parseDateTime(json.get("value").getAsString()));
13917    if (json.has("_value"))
13918      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
13919  }
13920
13921  protected ImplementationGuide parseImplementationGuide(JsonObject json) throws IOException, FHIRFormatError {
13922    ImplementationGuide res = new ImplementationGuide();
13923    parseImplementationGuideProperties(json, res);
13924    return res;
13925  }
13926
13927  protected void parseImplementationGuideProperties(JsonObject json, ImplementationGuide res) throws IOException, FHIRFormatError {
13928    parseDomainResourceProperties(json, res);
13929    if (json.has("url"))
13930      res.setUrlElement(parseUri(json.get("url").getAsString()));
13931    if (json.has("_url"))
13932      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
13933    if (json.has("version"))
13934      res.setVersionElement(parseString(json.get("version").getAsString()));
13935    if (json.has("_version"))
13936      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
13937    if (json.has("name"))
13938      res.setNameElement(parseString(json.get("name").getAsString()));
13939    if (json.has("_name"))
13940      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13941    if (json.has("title"))
13942      res.setTitleElement(parseString(json.get("title").getAsString()));
13943    if (json.has("_title"))
13944      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
13945    if (json.has("status"))
13946      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
13947    if (json.has("_status"))
13948      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13949    if (json.has("experimental"))
13950      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
13951    if (json.has("_experimental"))
13952      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
13953    if (json.has("date"))
13954      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13955    if (json.has("_date"))
13956      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13957    if (json.has("publisher"))
13958      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
13959    if (json.has("_publisher"))
13960      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
13961    if (json.has("contact")) {
13962      JsonArray array = json.getAsJsonArray("contact");
13963      for (int i = 0; i < array.size(); i++) {
13964        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
13965      }
13966    };
13967    if (json.has("description"))
13968      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
13969    if (json.has("_description"))
13970      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13971    if (json.has("useContext")) {
13972      JsonArray array = json.getAsJsonArray("useContext");
13973      for (int i = 0; i < array.size(); i++) {
13974        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
13975      }
13976    };
13977    if (json.has("jurisdiction")) {
13978      JsonArray array = json.getAsJsonArray("jurisdiction");
13979      for (int i = 0; i < array.size(); i++) {
13980        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13981      }
13982    };
13983    if (json.has("copyright"))
13984      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
13985    if (json.has("_copyright"))
13986      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
13987    if (json.has("packageId"))
13988      res.setPackageIdElement(parseId(json.get("packageId").getAsString()));
13989    if (json.has("_packageId"))
13990      parseElementProperties(json.getAsJsonObject("_packageId"), res.getPackageIdElement());
13991    if (json.has("license"))
13992      res.setLicenseElement(parseEnumeration(json.get("license").getAsString(), ImplementationGuide.SPDXLicense.NULL, new ImplementationGuide.SPDXLicenseEnumFactory()));
13993    if (json.has("_license"))
13994      parseElementProperties(json.getAsJsonObject("_license"), res.getLicenseElement());
13995    if (json.has("fhirVersion")) {
13996      JsonArray array = json.getAsJsonArray("fhirVersion");
13997      for (int i = 0; i < array.size(); i++) {
13998        res.getFhirVersion().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
13999      }
14000    };
14001    if (json.has("_fhirVersion")) {
14002      JsonArray array = json.getAsJsonArray("_fhirVersion");
14003      for (int i = 0; i < array.size(); i++) {
14004        if (i == res.getFhirVersion().size())
14005          res.getFhirVersion().add(parseEnumeration(null, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
14006        if (array.get(i) instanceof JsonObject) 
14007          parseElementProperties(array.get(i).getAsJsonObject(), res.getFhirVersion().get(i));
14008      }
14009    };
14010    if (json.has("dependsOn")) {
14011      JsonArray array = json.getAsJsonArray("dependsOn");
14012      for (int i = 0; i < array.size(); i++) {
14013        res.getDependsOn().add(parseImplementationGuideImplementationGuideDependsOnComponent(array.get(i).getAsJsonObject(), res));
14014      }
14015    };
14016    if (json.has("global")) {
14017      JsonArray array = json.getAsJsonArray("global");
14018      for (int i = 0; i < array.size(); i++) {
14019        res.getGlobal().add(parseImplementationGuideImplementationGuideGlobalComponent(array.get(i).getAsJsonObject(), res));
14020      }
14021    };
14022    if (json.has("definition"))
14023      res.setDefinition(parseImplementationGuideImplementationGuideDefinitionComponent(json.getAsJsonObject("definition"), res));
14024    if (json.has("manifest"))
14025      res.setManifest(parseImplementationGuideImplementationGuideManifestComponent(json.getAsJsonObject("manifest"), res));
14026  }
14027
14028  protected ImplementationGuide.ImplementationGuideDependsOnComponent parseImplementationGuideImplementationGuideDependsOnComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14029    ImplementationGuide.ImplementationGuideDependsOnComponent res = new ImplementationGuide.ImplementationGuideDependsOnComponent();
14030    parseImplementationGuideImplementationGuideDependsOnComponentProperties(json, owner, res);
14031    return res;
14032  }
14033
14034  protected void parseImplementationGuideImplementationGuideDependsOnComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDependsOnComponent res) throws IOException, FHIRFormatError {
14035    parseBackboneElementProperties(json, res);
14036    if (json.has("uri"))
14037      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
14038    if (json.has("_uri"))
14039      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
14040    if (json.has("packageId"))
14041      res.setPackageIdElement(parseId(json.get("packageId").getAsString()));
14042    if (json.has("_packageId"))
14043      parseElementProperties(json.getAsJsonObject("_packageId"), res.getPackageIdElement());
14044    if (json.has("version"))
14045      res.setVersionElement(parseString(json.get("version").getAsString()));
14046    if (json.has("_version"))
14047      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
14048  }
14049
14050  protected ImplementationGuide.ImplementationGuideGlobalComponent parseImplementationGuideImplementationGuideGlobalComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14051    ImplementationGuide.ImplementationGuideGlobalComponent res = new ImplementationGuide.ImplementationGuideGlobalComponent();
14052    parseImplementationGuideImplementationGuideGlobalComponentProperties(json, owner, res);
14053    return res;
14054  }
14055
14056  protected void parseImplementationGuideImplementationGuideGlobalComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideGlobalComponent res) throws IOException, FHIRFormatError {
14057    parseBackboneElementProperties(json, res);
14058    if (json.has("type"))
14059      res.setTypeElement(parseCode(json.get("type").getAsString()));
14060    if (json.has("_type"))
14061      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
14062    if (json.has("profile"))
14063      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
14064    if (json.has("_profile"))
14065      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
14066  }
14067
14068  protected ImplementationGuide.ImplementationGuideDefinitionComponent parseImplementationGuideImplementationGuideDefinitionComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14069    ImplementationGuide.ImplementationGuideDefinitionComponent res = new ImplementationGuide.ImplementationGuideDefinitionComponent();
14070    parseImplementationGuideImplementationGuideDefinitionComponentProperties(json, owner, res);
14071    return res;
14072  }
14073
14074  protected void parseImplementationGuideImplementationGuideDefinitionComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionComponent res) throws IOException, FHIRFormatError {
14075    parseBackboneElementProperties(json, res);
14076    if (json.has("grouping")) {
14077      JsonArray array = json.getAsJsonArray("grouping");
14078      for (int i = 0; i < array.size(); i++) {
14079        res.getGrouping().add(parseImplementationGuideImplementationGuideDefinitionGroupingComponent(array.get(i).getAsJsonObject(), owner));
14080      }
14081    };
14082    if (json.has("resource")) {
14083      JsonArray array = json.getAsJsonArray("resource");
14084      for (int i = 0; i < array.size(); i++) {
14085        res.getResource().add(parseImplementationGuideImplementationGuideDefinitionResourceComponent(array.get(i).getAsJsonObject(), owner));
14086      }
14087    };
14088    if (json.has("page"))
14089      res.setPage(parseImplementationGuideImplementationGuideDefinitionPageComponent(json.getAsJsonObject("page"), owner));
14090    if (json.has("parameter")) {
14091      JsonArray array = json.getAsJsonArray("parameter");
14092      for (int i = 0; i < array.size(); i++) {
14093        res.getParameter().add(parseImplementationGuideImplementationGuideDefinitionParameterComponent(array.get(i).getAsJsonObject(), owner));
14094      }
14095    };
14096    if (json.has("template")) {
14097      JsonArray array = json.getAsJsonArray("template");
14098      for (int i = 0; i < array.size(); i++) {
14099        res.getTemplate().add(parseImplementationGuideImplementationGuideDefinitionTemplateComponent(array.get(i).getAsJsonObject(), owner));
14100      }
14101    };
14102  }
14103
14104  protected ImplementationGuide.ImplementationGuideDefinitionGroupingComponent parseImplementationGuideImplementationGuideDefinitionGroupingComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14105    ImplementationGuide.ImplementationGuideDefinitionGroupingComponent res = new ImplementationGuide.ImplementationGuideDefinitionGroupingComponent();
14106    parseImplementationGuideImplementationGuideDefinitionGroupingComponentProperties(json, owner, res);
14107    return res;
14108  }
14109
14110  protected void parseImplementationGuideImplementationGuideDefinitionGroupingComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionGroupingComponent res) throws IOException, FHIRFormatError {
14111    parseBackboneElementProperties(json, res);
14112    if (json.has("name"))
14113      res.setNameElement(parseString(json.get("name").getAsString()));
14114    if (json.has("_name"))
14115      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14116    if (json.has("description"))
14117      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14118    if (json.has("_description"))
14119      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14120  }
14121
14122  protected ImplementationGuide.ImplementationGuideDefinitionResourceComponent parseImplementationGuideImplementationGuideDefinitionResourceComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14123    ImplementationGuide.ImplementationGuideDefinitionResourceComponent res = new ImplementationGuide.ImplementationGuideDefinitionResourceComponent();
14124    parseImplementationGuideImplementationGuideDefinitionResourceComponentProperties(json, owner, res);
14125    return res;
14126  }
14127
14128  protected void parseImplementationGuideImplementationGuideDefinitionResourceComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionResourceComponent res) throws IOException, FHIRFormatError {
14129    parseBackboneElementProperties(json, res);
14130    if (json.has("reference"))
14131      res.setReference(parseReference(json.getAsJsonObject("reference")));
14132    if (json.has("fhirVersion")) {
14133      JsonArray array = json.getAsJsonArray("fhirVersion");
14134      for (int i = 0; i < array.size(); i++) {
14135        res.getFhirVersion().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
14136      }
14137    };
14138    if (json.has("_fhirVersion")) {
14139      JsonArray array = json.getAsJsonArray("_fhirVersion");
14140      for (int i = 0; i < array.size(); i++) {
14141        if (i == res.getFhirVersion().size())
14142          res.getFhirVersion().add(parseEnumeration(null, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
14143        if (array.get(i) instanceof JsonObject) 
14144          parseElementProperties(array.get(i).getAsJsonObject(), res.getFhirVersion().get(i));
14145      }
14146    };
14147    if (json.has("name"))
14148      res.setNameElement(parseString(json.get("name").getAsString()));
14149    if (json.has("_name"))
14150      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14151    if (json.has("description"))
14152      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14153    if (json.has("_description"))
14154      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14155    Type example = parseType("example", json);
14156    if (example != null)
14157      res.setExample(example);
14158    if (json.has("groupingId"))
14159      res.setGroupingIdElement(parseId(json.get("groupingId").getAsString()));
14160    if (json.has("_groupingId"))
14161      parseElementProperties(json.getAsJsonObject("_groupingId"), res.getGroupingIdElement());
14162  }
14163
14164  protected ImplementationGuide.ImplementationGuideDefinitionPageComponent parseImplementationGuideImplementationGuideDefinitionPageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14165    ImplementationGuide.ImplementationGuideDefinitionPageComponent res = new ImplementationGuide.ImplementationGuideDefinitionPageComponent();
14166    parseImplementationGuideImplementationGuideDefinitionPageComponentProperties(json, owner, res);
14167    return res;
14168  }
14169
14170  protected void parseImplementationGuideImplementationGuideDefinitionPageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionPageComponent res) throws IOException, FHIRFormatError {
14171    parseBackboneElementProperties(json, res);
14172    Type name = parseType("name", json);
14173    if (name != null)
14174      res.setName(name);
14175    if (json.has("title"))
14176      res.setTitleElement(parseString(json.get("title").getAsString()));
14177    if (json.has("_title"))
14178      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
14179    if (json.has("generation"))
14180      res.setGenerationElement(parseEnumeration(json.get("generation").getAsString(), ImplementationGuide.GuidePageGeneration.NULL, new ImplementationGuide.GuidePageGenerationEnumFactory()));
14181    if (json.has("_generation"))
14182      parseElementProperties(json.getAsJsonObject("_generation"), res.getGenerationElement());
14183    if (json.has("page")) {
14184      JsonArray array = json.getAsJsonArray("page");
14185      for (int i = 0; i < array.size(); i++) {
14186        res.getPage().add(parseImplementationGuideImplementationGuideDefinitionPageComponent(array.get(i).getAsJsonObject(), owner));
14187      }
14188    };
14189  }
14190
14191  protected ImplementationGuide.ImplementationGuideDefinitionParameterComponent parseImplementationGuideImplementationGuideDefinitionParameterComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14192    ImplementationGuide.ImplementationGuideDefinitionParameterComponent res = new ImplementationGuide.ImplementationGuideDefinitionParameterComponent();
14193    parseImplementationGuideImplementationGuideDefinitionParameterComponentProperties(json, owner, res);
14194    return res;
14195  }
14196
14197  protected void parseImplementationGuideImplementationGuideDefinitionParameterComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionParameterComponent res) throws IOException, FHIRFormatError {
14198    parseBackboneElementProperties(json, res);
14199    if (json.has("code"))
14200      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), ImplementationGuide.GuideParameterCode.NULL, new ImplementationGuide.GuideParameterCodeEnumFactory()));
14201    if (json.has("_code"))
14202      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
14203    if (json.has("value"))
14204      res.setValueElement(parseString(json.get("value").getAsString()));
14205    if (json.has("_value"))
14206      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
14207  }
14208
14209  protected ImplementationGuide.ImplementationGuideDefinitionTemplateComponent parseImplementationGuideImplementationGuideDefinitionTemplateComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14210    ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res = new ImplementationGuide.ImplementationGuideDefinitionTemplateComponent();
14211    parseImplementationGuideImplementationGuideDefinitionTemplateComponentProperties(json, owner, res);
14212    return res;
14213  }
14214
14215  protected void parseImplementationGuideImplementationGuideDefinitionTemplateComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res) throws IOException, FHIRFormatError {
14216    parseBackboneElementProperties(json, res);
14217    if (json.has("code"))
14218      res.setCodeElement(parseCode(json.get("code").getAsString()));
14219    if (json.has("_code"))
14220      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
14221    if (json.has("source"))
14222      res.setSourceElement(parseString(json.get("source").getAsString()));
14223    if (json.has("_source"))
14224      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
14225    if (json.has("scope"))
14226      res.setScopeElement(parseString(json.get("scope").getAsString()));
14227    if (json.has("_scope"))
14228      parseElementProperties(json.getAsJsonObject("_scope"), res.getScopeElement());
14229  }
14230
14231  protected ImplementationGuide.ImplementationGuideManifestComponent parseImplementationGuideImplementationGuideManifestComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14232    ImplementationGuide.ImplementationGuideManifestComponent res = new ImplementationGuide.ImplementationGuideManifestComponent();
14233    parseImplementationGuideImplementationGuideManifestComponentProperties(json, owner, res);
14234    return res;
14235  }
14236
14237  protected void parseImplementationGuideImplementationGuideManifestComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideManifestComponent res) throws IOException, FHIRFormatError {
14238    parseBackboneElementProperties(json, res);
14239    if (json.has("rendering"))
14240      res.setRenderingElement(parseUrl(json.get("rendering").getAsString()));
14241    if (json.has("_rendering"))
14242      parseElementProperties(json.getAsJsonObject("_rendering"), res.getRenderingElement());
14243    if (json.has("resource")) {
14244      JsonArray array = json.getAsJsonArray("resource");
14245      for (int i = 0; i < array.size(); i++) {
14246        res.getResource().add(parseImplementationGuideManifestResourceComponent(array.get(i).getAsJsonObject(), owner));
14247      }
14248    };
14249    if (json.has("page")) {
14250      JsonArray array = json.getAsJsonArray("page");
14251      for (int i = 0; i < array.size(); i++) {
14252        res.getPage().add(parseImplementationGuideManifestPageComponent(array.get(i).getAsJsonObject(), owner));
14253      }
14254    };
14255    if (json.has("image")) {
14256      JsonArray array = json.getAsJsonArray("image");
14257      for (int i = 0; i < array.size(); i++) {
14258        res.getImage().add(parseString(array.get(i).getAsString()));
14259      }
14260    };
14261    if (json.has("_image")) {
14262      JsonArray array = json.getAsJsonArray("_image");
14263      for (int i = 0; i < array.size(); i++) {
14264        if (i == res.getImage().size())
14265          res.getImage().add(parseString(null));
14266        if (array.get(i) instanceof JsonObject) 
14267          parseElementProperties(array.get(i).getAsJsonObject(), res.getImage().get(i));
14268      }
14269    };
14270    if (json.has("other")) {
14271      JsonArray array = json.getAsJsonArray("other");
14272      for (int i = 0; i < array.size(); i++) {
14273        res.getOther().add(parseString(array.get(i).getAsString()));
14274      }
14275    };
14276    if (json.has("_other")) {
14277      JsonArray array = json.getAsJsonArray("_other");
14278      for (int i = 0; i < array.size(); i++) {
14279        if (i == res.getOther().size())
14280          res.getOther().add(parseString(null));
14281        if (array.get(i) instanceof JsonObject) 
14282          parseElementProperties(array.get(i).getAsJsonObject(), res.getOther().get(i));
14283      }
14284    };
14285  }
14286
14287  protected ImplementationGuide.ManifestResourceComponent parseImplementationGuideManifestResourceComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14288    ImplementationGuide.ManifestResourceComponent res = new ImplementationGuide.ManifestResourceComponent();
14289    parseImplementationGuideManifestResourceComponentProperties(json, owner, res);
14290    return res;
14291  }
14292
14293  protected void parseImplementationGuideManifestResourceComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ManifestResourceComponent res) throws IOException, FHIRFormatError {
14294    parseBackboneElementProperties(json, res);
14295    if (json.has("reference"))
14296      res.setReference(parseReference(json.getAsJsonObject("reference")));
14297    Type example = parseType("example", json);
14298    if (example != null)
14299      res.setExample(example);
14300    if (json.has("relativePath"))
14301      res.setRelativePathElement(parseUrl(json.get("relativePath").getAsString()));
14302    if (json.has("_relativePath"))
14303      parseElementProperties(json.getAsJsonObject("_relativePath"), res.getRelativePathElement());
14304  }
14305
14306  protected ImplementationGuide.ManifestPageComponent parseImplementationGuideManifestPageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14307    ImplementationGuide.ManifestPageComponent res = new ImplementationGuide.ManifestPageComponent();
14308    parseImplementationGuideManifestPageComponentProperties(json, owner, res);
14309    return res;
14310  }
14311
14312  protected void parseImplementationGuideManifestPageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ManifestPageComponent res) throws IOException, FHIRFormatError {
14313    parseBackboneElementProperties(json, res);
14314    if (json.has("name"))
14315      res.setNameElement(parseString(json.get("name").getAsString()));
14316    if (json.has("_name"))
14317      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14318    if (json.has("title"))
14319      res.setTitleElement(parseString(json.get("title").getAsString()));
14320    if (json.has("_title"))
14321      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
14322    if (json.has("anchor")) {
14323      JsonArray array = json.getAsJsonArray("anchor");
14324      for (int i = 0; i < array.size(); i++) {
14325        res.getAnchor().add(parseString(array.get(i).getAsString()));
14326      }
14327    };
14328    if (json.has("_anchor")) {
14329      JsonArray array = json.getAsJsonArray("_anchor");
14330      for (int i = 0; i < array.size(); i++) {
14331        if (i == res.getAnchor().size())
14332          res.getAnchor().add(parseString(null));
14333        if (array.get(i) instanceof JsonObject) 
14334          parseElementProperties(array.get(i).getAsJsonObject(), res.getAnchor().get(i));
14335      }
14336    };
14337  }
14338
14339  protected InsurancePlan parseInsurancePlan(JsonObject json) throws IOException, FHIRFormatError {
14340    InsurancePlan res = new InsurancePlan();
14341    parseInsurancePlanProperties(json, res);
14342    return res;
14343  }
14344
14345  protected void parseInsurancePlanProperties(JsonObject json, InsurancePlan res) throws IOException, FHIRFormatError {
14346    parseDomainResourceProperties(json, res);
14347    if (json.has("identifier")) {
14348      JsonArray array = json.getAsJsonArray("identifier");
14349      for (int i = 0; i < array.size(); i++) {
14350        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14351      }
14352    };
14353    if (json.has("status"))
14354      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
14355    if (json.has("_status"))
14356      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14357    if (json.has("type")) {
14358      JsonArray array = json.getAsJsonArray("type");
14359      for (int i = 0; i < array.size(); i++) {
14360        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14361      }
14362    };
14363    if (json.has("name"))
14364      res.setNameElement(parseString(json.get("name").getAsString()));
14365    if (json.has("_name"))
14366      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14367    if (json.has("alias")) {
14368      JsonArray array = json.getAsJsonArray("alias");
14369      for (int i = 0; i < array.size(); i++) {
14370        res.getAlias().add(parseString(array.get(i).getAsString()));
14371      }
14372    };
14373    if (json.has("_alias")) {
14374      JsonArray array = json.getAsJsonArray("_alias");
14375      for (int i = 0; i < array.size(); i++) {
14376        if (i == res.getAlias().size())
14377          res.getAlias().add(parseString(null));
14378        if (array.get(i) instanceof JsonObject) 
14379          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
14380      }
14381    };
14382    if (json.has("period"))
14383      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
14384    if (json.has("ownedBy"))
14385      res.setOwnedBy(parseReference(json.getAsJsonObject("ownedBy")));
14386    if (json.has("administeredBy"))
14387      res.setAdministeredBy(parseReference(json.getAsJsonObject("administeredBy")));
14388    if (json.has("coverageArea")) {
14389      JsonArray array = json.getAsJsonArray("coverageArea");
14390      for (int i = 0; i < array.size(); i++) {
14391        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
14392      }
14393    };
14394    if (json.has("contact")) {
14395      JsonArray array = json.getAsJsonArray("contact");
14396      for (int i = 0; i < array.size(); i++) {
14397        res.getContact().add(parseInsurancePlanInsurancePlanContactComponent(array.get(i).getAsJsonObject(), res));
14398      }
14399    };
14400    if (json.has("endpoint")) {
14401      JsonArray array = json.getAsJsonArray("endpoint");
14402      for (int i = 0; i < array.size(); i++) {
14403        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
14404      }
14405    };
14406    if (json.has("network")) {
14407      JsonArray array = json.getAsJsonArray("network");
14408      for (int i = 0; i < array.size(); i++) {
14409        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
14410      }
14411    };
14412    if (json.has("coverage")) {
14413      JsonArray array = json.getAsJsonArray("coverage");
14414      for (int i = 0; i < array.size(); i++) {
14415        res.getCoverage().add(parseInsurancePlanInsurancePlanCoverageComponent(array.get(i).getAsJsonObject(), res));
14416      }
14417    };
14418    if (json.has("plan")) {
14419      JsonArray array = json.getAsJsonArray("plan");
14420      for (int i = 0; i < array.size(); i++) {
14421        res.getPlan().add(parseInsurancePlanInsurancePlanPlanComponent(array.get(i).getAsJsonObject(), res));
14422      }
14423    };
14424  }
14425
14426  protected InsurancePlan.InsurancePlanContactComponent parseInsurancePlanInsurancePlanContactComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14427    InsurancePlan.InsurancePlanContactComponent res = new InsurancePlan.InsurancePlanContactComponent();
14428    parseInsurancePlanInsurancePlanContactComponentProperties(json, owner, res);
14429    return res;
14430  }
14431
14432  protected void parseInsurancePlanInsurancePlanContactComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanContactComponent res) throws IOException, FHIRFormatError {
14433    parseBackboneElementProperties(json, res);
14434    if (json.has("purpose"))
14435      res.setPurpose(parseCodeableConcept(json.getAsJsonObject("purpose")));
14436    if (json.has("name"))
14437      res.setName(parseHumanName(json.getAsJsonObject("name")));
14438    if (json.has("telecom")) {
14439      JsonArray array = json.getAsJsonArray("telecom");
14440      for (int i = 0; i < array.size(); i++) {
14441        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
14442      }
14443    };
14444    if (json.has("address"))
14445      res.setAddress(parseAddress(json.getAsJsonObject("address")));
14446  }
14447
14448  protected InsurancePlan.InsurancePlanCoverageComponent parseInsurancePlanInsurancePlanCoverageComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14449    InsurancePlan.InsurancePlanCoverageComponent res = new InsurancePlan.InsurancePlanCoverageComponent();
14450    parseInsurancePlanInsurancePlanCoverageComponentProperties(json, owner, res);
14451    return res;
14452  }
14453
14454  protected void parseInsurancePlanInsurancePlanCoverageComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanCoverageComponent res) throws IOException, FHIRFormatError {
14455    parseBackboneElementProperties(json, res);
14456    if (json.has("type"))
14457      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14458    if (json.has("network")) {
14459      JsonArray array = json.getAsJsonArray("network");
14460      for (int i = 0; i < array.size(); i++) {
14461        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
14462      }
14463    };
14464    if (json.has("benefit")) {
14465      JsonArray array = json.getAsJsonArray("benefit");
14466      for (int i = 0; i < array.size(); i++) {
14467        res.getBenefit().add(parseInsurancePlanCoverageBenefitComponent(array.get(i).getAsJsonObject(), owner));
14468      }
14469    };
14470  }
14471
14472  protected InsurancePlan.CoverageBenefitComponent parseInsurancePlanCoverageBenefitComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14473    InsurancePlan.CoverageBenefitComponent res = new InsurancePlan.CoverageBenefitComponent();
14474    parseInsurancePlanCoverageBenefitComponentProperties(json, owner, res);
14475    return res;
14476  }
14477
14478  protected void parseInsurancePlanCoverageBenefitComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.CoverageBenefitComponent res) throws IOException, FHIRFormatError {
14479    parseBackboneElementProperties(json, res);
14480    if (json.has("type"))
14481      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14482    if (json.has("requirement"))
14483      res.setRequirementElement(parseString(json.get("requirement").getAsString()));
14484    if (json.has("_requirement"))
14485      parseElementProperties(json.getAsJsonObject("_requirement"), res.getRequirementElement());
14486    if (json.has("limit")) {
14487      JsonArray array = json.getAsJsonArray("limit");
14488      for (int i = 0; i < array.size(); i++) {
14489        res.getLimit().add(parseInsurancePlanCoverageBenefitLimitComponent(array.get(i).getAsJsonObject(), owner));
14490      }
14491    };
14492  }
14493
14494  protected InsurancePlan.CoverageBenefitLimitComponent parseInsurancePlanCoverageBenefitLimitComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14495    InsurancePlan.CoverageBenefitLimitComponent res = new InsurancePlan.CoverageBenefitLimitComponent();
14496    parseInsurancePlanCoverageBenefitLimitComponentProperties(json, owner, res);
14497    return res;
14498  }
14499
14500  protected void parseInsurancePlanCoverageBenefitLimitComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.CoverageBenefitLimitComponent res) throws IOException, FHIRFormatError {
14501    parseBackboneElementProperties(json, res);
14502    if (json.has("value"))
14503      res.setValue(parseQuantity(json.getAsJsonObject("value")));
14504    if (json.has("code"))
14505      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14506  }
14507
14508  protected InsurancePlan.InsurancePlanPlanComponent parseInsurancePlanInsurancePlanPlanComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14509    InsurancePlan.InsurancePlanPlanComponent res = new InsurancePlan.InsurancePlanPlanComponent();
14510    parseInsurancePlanInsurancePlanPlanComponentProperties(json, owner, res);
14511    return res;
14512  }
14513
14514  protected void parseInsurancePlanInsurancePlanPlanComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanPlanComponent res) throws IOException, FHIRFormatError {
14515    parseBackboneElementProperties(json, res);
14516    if (json.has("identifier")) {
14517      JsonArray array = json.getAsJsonArray("identifier");
14518      for (int i = 0; i < array.size(); i++) {
14519        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14520      }
14521    };
14522    if (json.has("type"))
14523      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14524    if (json.has("coverageArea")) {
14525      JsonArray array = json.getAsJsonArray("coverageArea");
14526      for (int i = 0; i < array.size(); i++) {
14527        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
14528      }
14529    };
14530    if (json.has("network")) {
14531      JsonArray array = json.getAsJsonArray("network");
14532      for (int i = 0; i < array.size(); i++) {
14533        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
14534      }
14535    };
14536    if (json.has("generalCost")) {
14537      JsonArray array = json.getAsJsonArray("generalCost");
14538      for (int i = 0; i < array.size(); i++) {
14539        res.getGeneralCost().add(parseInsurancePlanInsurancePlanPlanGeneralCostComponent(array.get(i).getAsJsonObject(), owner));
14540      }
14541    };
14542    if (json.has("specificCost")) {
14543      JsonArray array = json.getAsJsonArray("specificCost");
14544      for (int i = 0; i < array.size(); i++) {
14545        res.getSpecificCost().add(parseInsurancePlanInsurancePlanPlanSpecificCostComponent(array.get(i).getAsJsonObject(), owner));
14546      }
14547    };
14548  }
14549
14550  protected InsurancePlan.InsurancePlanPlanGeneralCostComponent parseInsurancePlanInsurancePlanPlanGeneralCostComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14551    InsurancePlan.InsurancePlanPlanGeneralCostComponent res = new InsurancePlan.InsurancePlanPlanGeneralCostComponent();
14552    parseInsurancePlanInsurancePlanPlanGeneralCostComponentProperties(json, owner, res);
14553    return res;
14554  }
14555
14556  protected void parseInsurancePlanInsurancePlanPlanGeneralCostComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanPlanGeneralCostComponent res) throws IOException, FHIRFormatError {
14557    parseBackboneElementProperties(json, res);
14558    if (json.has("type"))
14559      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14560    if (json.has("groupSize"))
14561      res.setGroupSizeElement(parsePositiveInt(json.get("groupSize").getAsString()));
14562    if (json.has("_groupSize"))
14563      parseElementProperties(json.getAsJsonObject("_groupSize"), res.getGroupSizeElement());
14564    if (json.has("cost"))
14565      res.setCost(parseMoney(json.getAsJsonObject("cost")));
14566    if (json.has("comment"))
14567      res.setCommentElement(parseString(json.get("comment").getAsString()));
14568    if (json.has("_comment"))
14569      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
14570  }
14571
14572  protected InsurancePlan.InsurancePlanPlanSpecificCostComponent parseInsurancePlanInsurancePlanPlanSpecificCostComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14573    InsurancePlan.InsurancePlanPlanSpecificCostComponent res = new InsurancePlan.InsurancePlanPlanSpecificCostComponent();
14574    parseInsurancePlanInsurancePlanPlanSpecificCostComponentProperties(json, owner, res);
14575    return res;
14576  }
14577
14578  protected void parseInsurancePlanInsurancePlanPlanSpecificCostComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanPlanSpecificCostComponent res) throws IOException, FHIRFormatError {
14579    parseBackboneElementProperties(json, res);
14580    if (json.has("category"))
14581      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
14582    if (json.has("benefit")) {
14583      JsonArray array = json.getAsJsonArray("benefit");
14584      for (int i = 0; i < array.size(); i++) {
14585        res.getBenefit().add(parseInsurancePlanPlanBenefitComponent(array.get(i).getAsJsonObject(), owner));
14586      }
14587    };
14588  }
14589
14590  protected InsurancePlan.PlanBenefitComponent parseInsurancePlanPlanBenefitComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14591    InsurancePlan.PlanBenefitComponent res = new InsurancePlan.PlanBenefitComponent();
14592    parseInsurancePlanPlanBenefitComponentProperties(json, owner, res);
14593    return res;
14594  }
14595
14596  protected void parseInsurancePlanPlanBenefitComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.PlanBenefitComponent res) throws IOException, FHIRFormatError {
14597    parseBackboneElementProperties(json, res);
14598    if (json.has("type"))
14599      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14600    if (json.has("cost")) {
14601      JsonArray array = json.getAsJsonArray("cost");
14602      for (int i = 0; i < array.size(); i++) {
14603        res.getCost().add(parseInsurancePlanPlanBenefitCostComponent(array.get(i).getAsJsonObject(), owner));
14604      }
14605    };
14606  }
14607
14608  protected InsurancePlan.PlanBenefitCostComponent parseInsurancePlanPlanBenefitCostComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14609    InsurancePlan.PlanBenefitCostComponent res = new InsurancePlan.PlanBenefitCostComponent();
14610    parseInsurancePlanPlanBenefitCostComponentProperties(json, owner, res);
14611    return res;
14612  }
14613
14614  protected void parseInsurancePlanPlanBenefitCostComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.PlanBenefitCostComponent res) throws IOException, FHIRFormatError {
14615    parseBackboneElementProperties(json, res);
14616    if (json.has("type"))
14617      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14618    if (json.has("applicability"))
14619      res.setApplicability(parseCodeableConcept(json.getAsJsonObject("applicability")));
14620    if (json.has("qualifiers")) {
14621      JsonArray array = json.getAsJsonArray("qualifiers");
14622      for (int i = 0; i < array.size(); i++) {
14623        res.getQualifiers().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14624      }
14625    };
14626    if (json.has("value"))
14627      res.setValue(parseQuantity(json.getAsJsonObject("value")));
14628  }
14629
14630  protected Invoice parseInvoice(JsonObject json) throws IOException, FHIRFormatError {
14631    Invoice res = new Invoice();
14632    parseInvoiceProperties(json, res);
14633    return res;
14634  }
14635
14636  protected void parseInvoiceProperties(JsonObject json, Invoice res) throws IOException, FHIRFormatError {
14637    parseDomainResourceProperties(json, res);
14638    if (json.has("identifier")) {
14639      JsonArray array = json.getAsJsonArray("identifier");
14640      for (int i = 0; i < array.size(); i++) {
14641        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14642      }
14643    };
14644    if (json.has("status"))
14645      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Invoice.InvoiceStatus.NULL, new Invoice.InvoiceStatusEnumFactory()));
14646    if (json.has("_status"))
14647      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14648    if (json.has("cancelledReason"))
14649      res.setCancelledReasonElement(parseString(json.get("cancelledReason").getAsString()));
14650    if (json.has("_cancelledReason"))
14651      parseElementProperties(json.getAsJsonObject("_cancelledReason"), res.getCancelledReasonElement());
14652    if (json.has("type"))
14653      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14654    if (json.has("subject"))
14655      res.setSubject(parseReference(json.getAsJsonObject("subject")));
14656    if (json.has("recipient"))
14657      res.setRecipient(parseReference(json.getAsJsonObject("recipient")));
14658    if (json.has("date"))
14659      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14660    if (json.has("_date"))
14661      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14662    if (json.has("participant")) {
14663      JsonArray array = json.getAsJsonArray("participant");
14664      for (int i = 0; i < array.size(); i++) {
14665        res.getParticipant().add(parseInvoiceInvoiceParticipantComponent(array.get(i).getAsJsonObject(), res));
14666      }
14667    };
14668    if (json.has("issuer"))
14669      res.setIssuer(parseReference(json.getAsJsonObject("issuer")));
14670    if (json.has("account"))
14671      res.setAccount(parseReference(json.getAsJsonObject("account")));
14672    if (json.has("lineItem")) {
14673      JsonArray array = json.getAsJsonArray("lineItem");
14674      for (int i = 0; i < array.size(); i++) {
14675        res.getLineItem().add(parseInvoiceInvoiceLineItemComponent(array.get(i).getAsJsonObject(), res));
14676      }
14677    };
14678    if (json.has("totalPriceComponent")) {
14679      JsonArray array = json.getAsJsonArray("totalPriceComponent");
14680      for (int i = 0; i < array.size(); i++) {
14681        res.getTotalPriceComponent().add(parseInvoiceInvoiceLineItemPriceComponentComponent(array.get(i).getAsJsonObject(), res));
14682      }
14683    };
14684    if (json.has("totalNet"))
14685      res.setTotalNet(parseMoney(json.getAsJsonObject("totalNet")));
14686    if (json.has("totalGross"))
14687      res.setTotalGross(parseMoney(json.getAsJsonObject("totalGross")));
14688    if (json.has("paymentTerms"))
14689      res.setPaymentTermsElement(parseMarkdown(json.get("paymentTerms").getAsString()));
14690    if (json.has("_paymentTerms"))
14691      parseElementProperties(json.getAsJsonObject("_paymentTerms"), res.getPaymentTermsElement());
14692    if (json.has("note")) {
14693      JsonArray array = json.getAsJsonArray("note");
14694      for (int i = 0; i < array.size(); i++) {
14695        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14696      }
14697    };
14698  }
14699
14700  protected Invoice.InvoiceParticipantComponent parseInvoiceInvoiceParticipantComponent(JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
14701    Invoice.InvoiceParticipantComponent res = new Invoice.InvoiceParticipantComponent();
14702    parseInvoiceInvoiceParticipantComponentProperties(json, owner, res);
14703    return res;
14704  }
14705
14706  protected void parseInvoiceInvoiceParticipantComponentProperties(JsonObject json, Invoice owner, Invoice.InvoiceParticipantComponent res) throws IOException, FHIRFormatError {
14707    parseBackboneElementProperties(json, res);
14708    if (json.has("role"))
14709      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
14710    if (json.has("actor"))
14711      res.setActor(parseReference(json.getAsJsonObject("actor")));
14712  }
14713
14714  protected Invoice.InvoiceLineItemComponent parseInvoiceInvoiceLineItemComponent(JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
14715    Invoice.InvoiceLineItemComponent res = new Invoice.InvoiceLineItemComponent();
14716    parseInvoiceInvoiceLineItemComponentProperties(json, owner, res);
14717    return res;
14718  }
14719
14720  protected void parseInvoiceInvoiceLineItemComponentProperties(JsonObject json, Invoice owner, Invoice.InvoiceLineItemComponent res) throws IOException, FHIRFormatError {
14721    parseBackboneElementProperties(json, res);
14722    if (json.has("sequence"))
14723      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
14724    if (json.has("_sequence"))
14725      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
14726    Type chargeItem = parseType("chargeItem", json);
14727    if (chargeItem != null)
14728      res.setChargeItem(chargeItem);
14729    if (json.has("priceComponent")) {
14730      JsonArray array = json.getAsJsonArray("priceComponent");
14731      for (int i = 0; i < array.size(); i++) {
14732        res.getPriceComponent().add(parseInvoiceInvoiceLineItemPriceComponentComponent(array.get(i).getAsJsonObject(), owner));
14733      }
14734    };
14735  }
14736
14737  protected Invoice.InvoiceLineItemPriceComponentComponent parseInvoiceInvoiceLineItemPriceComponentComponent(JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
14738    Invoice.InvoiceLineItemPriceComponentComponent res = new Invoice.InvoiceLineItemPriceComponentComponent();
14739    parseInvoiceInvoiceLineItemPriceComponentComponentProperties(json, owner, res);
14740    return res;
14741  }
14742
14743  protected void parseInvoiceInvoiceLineItemPriceComponentComponentProperties(JsonObject json, Invoice owner, Invoice.InvoiceLineItemPriceComponentComponent res) throws IOException, FHIRFormatError {
14744    parseBackboneElementProperties(json, res);
14745    if (json.has("type"))
14746      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Invoice.InvoicePriceComponentType.NULL, new Invoice.InvoicePriceComponentTypeEnumFactory()));
14747    if (json.has("_type"))
14748      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
14749    if (json.has("code"))
14750      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14751    if (json.has("factor"))
14752      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
14753    if (json.has("_factor"))
14754      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
14755    if (json.has("amount"))
14756      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
14757  }
14758
14759  protected Library parseLibrary(JsonObject json) throws IOException, FHIRFormatError {
14760    Library res = new Library();
14761    parseLibraryProperties(json, res);
14762    return res;
14763  }
14764
14765  protected void parseLibraryProperties(JsonObject json, Library res) throws IOException, FHIRFormatError {
14766    parseDomainResourceProperties(json, res);
14767    if (json.has("url"))
14768      res.setUrlElement(parseUri(json.get("url").getAsString()));
14769    if (json.has("_url"))
14770      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
14771    if (json.has("identifier")) {
14772      JsonArray array = json.getAsJsonArray("identifier");
14773      for (int i = 0; i < array.size(); i++) {
14774        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14775      }
14776    };
14777    if (json.has("version"))
14778      res.setVersionElement(parseString(json.get("version").getAsString()));
14779    if (json.has("_version"))
14780      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
14781    if (json.has("name"))
14782      res.setNameElement(parseString(json.get("name").getAsString()));
14783    if (json.has("_name"))
14784      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14785    if (json.has("title"))
14786      res.setTitleElement(parseString(json.get("title").getAsString()));
14787    if (json.has("_title"))
14788      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
14789    if (json.has("subtitle"))
14790      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
14791    if (json.has("_subtitle"))
14792      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
14793    if (json.has("status"))
14794      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
14795    if (json.has("_status"))
14796      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14797    if (json.has("experimental"))
14798      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
14799    if (json.has("_experimental"))
14800      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
14801    if (json.has("type"))
14802      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14803    Type subject = parseType("subject", json);
14804    if (subject != null)
14805      res.setSubject(subject);
14806    if (json.has("date"))
14807      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14808    if (json.has("_date"))
14809      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14810    if (json.has("publisher"))
14811      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
14812    if (json.has("_publisher"))
14813      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
14814    if (json.has("contact")) {
14815      JsonArray array = json.getAsJsonArray("contact");
14816      for (int i = 0; i < array.size(); i++) {
14817        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
14818      }
14819    };
14820    if (json.has("description"))
14821      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
14822    if (json.has("_description"))
14823      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14824    if (json.has("useContext")) {
14825      JsonArray array = json.getAsJsonArray("useContext");
14826      for (int i = 0; i < array.size(); i++) {
14827        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
14828      }
14829    };
14830    if (json.has("jurisdiction")) {
14831      JsonArray array = json.getAsJsonArray("jurisdiction");
14832      for (int i = 0; i < array.size(); i++) {
14833        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14834      }
14835    };
14836    if (json.has("purpose"))
14837      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
14838    if (json.has("_purpose"))
14839      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
14840    if (json.has("usage"))
14841      res.setUsageElement(parseString(json.get("usage").getAsString()));
14842    if (json.has("_usage"))
14843      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
14844    if (json.has("copyright"))
14845      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
14846    if (json.has("_copyright"))
14847      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
14848    if (json.has("approvalDate"))
14849      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
14850    if (json.has("_approvalDate"))
14851      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
14852    if (json.has("lastReviewDate"))
14853      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
14854    if (json.has("_lastReviewDate"))
14855      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
14856    if (json.has("effectivePeriod"))
14857      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
14858    if (json.has("topic")) {
14859      JsonArray array = json.getAsJsonArray("topic");
14860      for (int i = 0; i < array.size(); i++) {
14861        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14862      }
14863    };
14864    if (json.has("author")) {
14865      JsonArray array = json.getAsJsonArray("author");
14866      for (int i = 0; i < array.size(); i++) {
14867        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
14868      }
14869    };
14870    if (json.has("editor")) {
14871      JsonArray array = json.getAsJsonArray("editor");
14872      for (int i = 0; i < array.size(); i++) {
14873        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
14874      }
14875    };
14876    if (json.has("reviewer")) {
14877      JsonArray array = json.getAsJsonArray("reviewer");
14878      for (int i = 0; i < array.size(); i++) {
14879        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
14880      }
14881    };
14882    if (json.has("endorser")) {
14883      JsonArray array = json.getAsJsonArray("endorser");
14884      for (int i = 0; i < array.size(); i++) {
14885        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
14886      }
14887    };
14888    if (json.has("relatedArtifact")) {
14889      JsonArray array = json.getAsJsonArray("relatedArtifact");
14890      for (int i = 0; i < array.size(); i++) {
14891        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
14892      }
14893    };
14894    if (json.has("parameter")) {
14895      JsonArray array = json.getAsJsonArray("parameter");
14896      for (int i = 0; i < array.size(); i++) {
14897        res.getParameter().add(parseParameterDefinition(array.get(i).getAsJsonObject()));
14898      }
14899    };
14900    if (json.has("dataRequirement")) {
14901      JsonArray array = json.getAsJsonArray("dataRequirement");
14902      for (int i = 0; i < array.size(); i++) {
14903        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
14904      }
14905    };
14906    if (json.has("content")) {
14907      JsonArray array = json.getAsJsonArray("content");
14908      for (int i = 0; i < array.size(); i++) {
14909        res.getContent().add(parseAttachment(array.get(i).getAsJsonObject()));
14910      }
14911    };
14912  }
14913
14914  protected Linkage parseLinkage(JsonObject json) throws IOException, FHIRFormatError {
14915    Linkage res = new Linkage();
14916    parseLinkageProperties(json, res);
14917    return res;
14918  }
14919
14920  protected void parseLinkageProperties(JsonObject json, Linkage res) throws IOException, FHIRFormatError {
14921    parseDomainResourceProperties(json, res);
14922    if (json.has("active"))
14923      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
14924    if (json.has("_active"))
14925      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
14926    if (json.has("author"))
14927      res.setAuthor(parseReference(json.getAsJsonObject("author")));
14928    if (json.has("item")) {
14929      JsonArray array = json.getAsJsonArray("item");
14930      for (int i = 0; i < array.size(); i++) {
14931        res.getItem().add(parseLinkageLinkageItemComponent(array.get(i).getAsJsonObject(), res));
14932      }
14933    };
14934  }
14935
14936  protected Linkage.LinkageItemComponent parseLinkageLinkageItemComponent(JsonObject json, Linkage owner) throws IOException, FHIRFormatError {
14937    Linkage.LinkageItemComponent res = new Linkage.LinkageItemComponent();
14938    parseLinkageLinkageItemComponentProperties(json, owner, res);
14939    return res;
14940  }
14941
14942  protected void parseLinkageLinkageItemComponentProperties(JsonObject json, Linkage owner, Linkage.LinkageItemComponent res) throws IOException, FHIRFormatError {
14943    parseBackboneElementProperties(json, res);
14944    if (json.has("type"))
14945      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Linkage.LinkageType.NULL, new Linkage.LinkageTypeEnumFactory()));
14946    if (json.has("_type"))
14947      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
14948    if (json.has("resource"))
14949      res.setResource(parseReference(json.getAsJsonObject("resource")));
14950  }
14951
14952  protected ListResource parseListResource(JsonObject json) throws IOException, FHIRFormatError {
14953    ListResource res = new ListResource();
14954    parseListResourceProperties(json, res);
14955    return res;
14956  }
14957
14958  protected void parseListResourceProperties(JsonObject json, ListResource res) throws IOException, FHIRFormatError {
14959    parseDomainResourceProperties(json, res);
14960    if (json.has("identifier")) {
14961      JsonArray array = json.getAsJsonArray("identifier");
14962      for (int i = 0; i < array.size(); i++) {
14963        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14964      }
14965    };
14966    if (json.has("status"))
14967      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ListResource.ListStatus.NULL, new ListResource.ListStatusEnumFactory()));
14968    if (json.has("_status"))
14969      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14970    if (json.has("mode"))
14971      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ListResource.ListMode.NULL, new ListResource.ListModeEnumFactory()));
14972    if (json.has("_mode"))
14973      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
14974    if (json.has("title"))
14975      res.setTitleElement(parseString(json.get("title").getAsString()));
14976    if (json.has("_title"))
14977      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
14978    if (json.has("code"))
14979      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14980    if (json.has("subject"))
14981      res.setSubject(parseReference(json.getAsJsonObject("subject")));
14982    if (json.has("encounter"))
14983      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
14984    if (json.has("date"))
14985      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14986    if (json.has("_date"))
14987      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14988    if (json.has("source"))
14989      res.setSource(parseReference(json.getAsJsonObject("source")));
14990    if (json.has("orderedBy"))
14991      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
14992    if (json.has("note")) {
14993      JsonArray array = json.getAsJsonArray("note");
14994      for (int i = 0; i < array.size(); i++) {
14995        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14996      }
14997    };
14998    if (json.has("entry")) {
14999      JsonArray array = json.getAsJsonArray("entry");
15000      for (int i = 0; i < array.size(); i++) {
15001        res.getEntry().add(parseListResourceListEntryComponent(array.get(i).getAsJsonObject(), res));
15002      }
15003    };
15004    if (json.has("emptyReason"))
15005      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
15006  }
15007
15008  protected ListResource.ListEntryComponent parseListResourceListEntryComponent(JsonObject json, ListResource owner) throws IOException, FHIRFormatError {
15009    ListResource.ListEntryComponent res = new ListResource.ListEntryComponent();
15010    parseListResourceListEntryComponentProperties(json, owner, res);
15011    return res;
15012  }
15013
15014  protected void parseListResourceListEntryComponentProperties(JsonObject json, ListResource owner, ListResource.ListEntryComponent res) throws IOException, FHIRFormatError {
15015    parseBackboneElementProperties(json, res);
15016    if (json.has("flag"))
15017      res.setFlag(parseCodeableConcept(json.getAsJsonObject("flag")));
15018    if (json.has("deleted"))
15019      res.setDeletedElement(parseBoolean(json.get("deleted").getAsBoolean()));
15020    if (json.has("_deleted"))
15021      parseElementProperties(json.getAsJsonObject("_deleted"), res.getDeletedElement());
15022    if (json.has("date"))
15023      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15024    if (json.has("_date"))
15025      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
15026    if (json.has("item"))
15027      res.setItem(parseReference(json.getAsJsonObject("item")));
15028  }
15029
15030  protected Location parseLocation(JsonObject json) throws IOException, FHIRFormatError {
15031    Location res = new Location();
15032    parseLocationProperties(json, res);
15033    return res;
15034  }
15035
15036  protected void parseLocationProperties(JsonObject json, Location res) throws IOException, FHIRFormatError {
15037    parseDomainResourceProperties(json, res);
15038    if (json.has("identifier")) {
15039      JsonArray array = json.getAsJsonArray("identifier");
15040      for (int i = 0; i < array.size(); i++) {
15041        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15042      }
15043    };
15044    if (json.has("status"))
15045      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Location.LocationStatus.NULL, new Location.LocationStatusEnumFactory()));
15046    if (json.has("_status"))
15047      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15048    if (json.has("operationalStatus"))
15049      res.setOperationalStatus(parseCoding(json.getAsJsonObject("operationalStatus")));
15050    if (json.has("name"))
15051      res.setNameElement(parseString(json.get("name").getAsString()));
15052    if (json.has("_name"))
15053      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15054    if (json.has("alias")) {
15055      JsonArray array = json.getAsJsonArray("alias");
15056      for (int i = 0; i < array.size(); i++) {
15057        res.getAlias().add(parseString(array.get(i).getAsString()));
15058      }
15059    };
15060    if (json.has("_alias")) {
15061      JsonArray array = json.getAsJsonArray("_alias");
15062      for (int i = 0; i < array.size(); i++) {
15063        if (i == res.getAlias().size())
15064          res.getAlias().add(parseString(null));
15065        if (array.get(i) instanceof JsonObject) 
15066          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
15067      }
15068    };
15069    if (json.has("description"))
15070      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15071    if (json.has("_description"))
15072      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15073    if (json.has("mode"))
15074      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Location.LocationMode.NULL, new Location.LocationModeEnumFactory()));
15075    if (json.has("_mode"))
15076      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
15077    if (json.has("type")) {
15078      JsonArray array = json.getAsJsonArray("type");
15079      for (int i = 0; i < array.size(); i++) {
15080        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15081      }
15082    };
15083    if (json.has("telecom")) {
15084      JsonArray array = json.getAsJsonArray("telecom");
15085      for (int i = 0; i < array.size(); i++) {
15086        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
15087      }
15088    };
15089    if (json.has("address"))
15090      res.setAddress(parseAddress(json.getAsJsonObject("address")));
15091    if (json.has("physicalType"))
15092      res.setPhysicalType(parseCodeableConcept(json.getAsJsonObject("physicalType")));
15093    if (json.has("position"))
15094      res.setPosition(parseLocationLocationPositionComponent(json.getAsJsonObject("position"), res));
15095    if (json.has("managingOrganization"))
15096      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
15097    if (json.has("partOf"))
15098      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
15099    if (json.has("hoursOfOperation")) {
15100      JsonArray array = json.getAsJsonArray("hoursOfOperation");
15101      for (int i = 0; i < array.size(); i++) {
15102        res.getHoursOfOperation().add(parseLocationLocationHoursOfOperationComponent(array.get(i).getAsJsonObject(), res));
15103      }
15104    };
15105    if (json.has("availabilityExceptions"))
15106      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
15107    if (json.has("_availabilityExceptions"))
15108      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
15109    if (json.has("endpoint")) {
15110      JsonArray array = json.getAsJsonArray("endpoint");
15111      for (int i = 0; i < array.size(); i++) {
15112        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
15113      }
15114    };
15115  }
15116
15117  protected Location.LocationPositionComponent parseLocationLocationPositionComponent(JsonObject json, Location owner) throws IOException, FHIRFormatError {
15118    Location.LocationPositionComponent res = new Location.LocationPositionComponent();
15119    parseLocationLocationPositionComponentProperties(json, owner, res);
15120    return res;
15121  }
15122
15123  protected void parseLocationLocationPositionComponentProperties(JsonObject json, Location owner, Location.LocationPositionComponent res) throws IOException, FHIRFormatError {
15124    parseBackboneElementProperties(json, res);
15125    if (json.has("longitude"))
15126      res.setLongitudeElement(parseDecimal(json.get("longitude").getAsBigDecimal()));
15127    if (json.has("_longitude"))
15128      parseElementProperties(json.getAsJsonObject("_longitude"), res.getLongitudeElement());
15129    if (json.has("latitude"))
15130      res.setLatitudeElement(parseDecimal(json.get("latitude").getAsBigDecimal()));
15131    if (json.has("_latitude"))
15132      parseElementProperties(json.getAsJsonObject("_latitude"), res.getLatitudeElement());
15133    if (json.has("altitude"))
15134      res.setAltitudeElement(parseDecimal(json.get("altitude").getAsBigDecimal()));
15135    if (json.has("_altitude"))
15136      parseElementProperties(json.getAsJsonObject("_altitude"), res.getAltitudeElement());
15137  }
15138
15139  protected Location.LocationHoursOfOperationComponent parseLocationLocationHoursOfOperationComponent(JsonObject json, Location owner) throws IOException, FHIRFormatError {
15140    Location.LocationHoursOfOperationComponent res = new Location.LocationHoursOfOperationComponent();
15141    parseLocationLocationHoursOfOperationComponentProperties(json, owner, res);
15142    return res;
15143  }
15144
15145  protected void parseLocationLocationHoursOfOperationComponentProperties(JsonObject json, Location owner, Location.LocationHoursOfOperationComponent res) throws IOException, FHIRFormatError {
15146    parseBackboneElementProperties(json, res);
15147    if (json.has("daysOfWeek")) {
15148      JsonArray array = json.getAsJsonArray("daysOfWeek");
15149      for (int i = 0; i < array.size(); i++) {
15150        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), Location.DaysOfWeek.NULL, new Location.DaysOfWeekEnumFactory()));
15151      }
15152    };
15153    if (json.has("_daysOfWeek")) {
15154      JsonArray array = json.getAsJsonArray("_daysOfWeek");
15155      for (int i = 0; i < array.size(); i++) {
15156        if (i == res.getDaysOfWeek().size())
15157          res.getDaysOfWeek().add(parseEnumeration(null, Location.DaysOfWeek.NULL, new Location.DaysOfWeekEnumFactory()));
15158        if (array.get(i) instanceof JsonObject) 
15159          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
15160      }
15161    };
15162    if (json.has("allDay"))
15163      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
15164    if (json.has("_allDay"))
15165      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
15166    if (json.has("openingTime"))
15167      res.setOpeningTimeElement(parseTime(json.get("openingTime").getAsString()));
15168    if (json.has("_openingTime"))
15169      parseElementProperties(json.getAsJsonObject("_openingTime"), res.getOpeningTimeElement());
15170    if (json.has("closingTime"))
15171      res.setClosingTimeElement(parseTime(json.get("closingTime").getAsString()));
15172    if (json.has("_closingTime"))
15173      parseElementProperties(json.getAsJsonObject("_closingTime"), res.getClosingTimeElement());
15174  }
15175
15176  protected Measure parseMeasure(JsonObject json) throws IOException, FHIRFormatError {
15177    Measure res = new Measure();
15178    parseMeasureProperties(json, res);
15179    return res;
15180  }
15181
15182  protected void parseMeasureProperties(JsonObject json, Measure res) throws IOException, FHIRFormatError {
15183    parseDomainResourceProperties(json, res);
15184    if (json.has("url"))
15185      res.setUrlElement(parseUri(json.get("url").getAsString()));
15186    if (json.has("_url"))
15187      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
15188    if (json.has("identifier")) {
15189      JsonArray array = json.getAsJsonArray("identifier");
15190      for (int i = 0; i < array.size(); i++) {
15191        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15192      }
15193    };
15194    if (json.has("version"))
15195      res.setVersionElement(parseString(json.get("version").getAsString()));
15196    if (json.has("_version"))
15197      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
15198    if (json.has("name"))
15199      res.setNameElement(parseString(json.get("name").getAsString()));
15200    if (json.has("_name"))
15201      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15202    if (json.has("title"))
15203      res.setTitleElement(parseString(json.get("title").getAsString()));
15204    if (json.has("_title"))
15205      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
15206    if (json.has("subtitle"))
15207      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
15208    if (json.has("_subtitle"))
15209      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
15210    if (json.has("status"))
15211      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
15212    if (json.has("_status"))
15213      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15214    if (json.has("experimental"))
15215      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
15216    if (json.has("_experimental"))
15217      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
15218    Type subject = parseType("subject", json);
15219    if (subject != null)
15220      res.setSubject(subject);
15221    if (json.has("date"))
15222      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15223    if (json.has("_date"))
15224      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
15225    if (json.has("publisher"))
15226      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
15227    if (json.has("_publisher"))
15228      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
15229    if (json.has("contact")) {
15230      JsonArray array = json.getAsJsonArray("contact");
15231      for (int i = 0; i < array.size(); i++) {
15232        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
15233      }
15234    };
15235    if (json.has("description"))
15236      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15237    if (json.has("_description"))
15238      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15239    if (json.has("useContext")) {
15240      JsonArray array = json.getAsJsonArray("useContext");
15241      for (int i = 0; i < array.size(); i++) {
15242        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
15243      }
15244    };
15245    if (json.has("jurisdiction")) {
15246      JsonArray array = json.getAsJsonArray("jurisdiction");
15247      for (int i = 0; i < array.size(); i++) {
15248        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15249      }
15250    };
15251    if (json.has("purpose"))
15252      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
15253    if (json.has("_purpose"))
15254      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
15255    if (json.has("usage"))
15256      res.setUsageElement(parseString(json.get("usage").getAsString()));
15257    if (json.has("_usage"))
15258      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
15259    if (json.has("copyright"))
15260      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
15261    if (json.has("_copyright"))
15262      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
15263    if (json.has("approvalDate"))
15264      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
15265    if (json.has("_approvalDate"))
15266      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
15267    if (json.has("lastReviewDate"))
15268      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
15269    if (json.has("_lastReviewDate"))
15270      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
15271    if (json.has("effectivePeriod"))
15272      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
15273    if (json.has("topic")) {
15274      JsonArray array = json.getAsJsonArray("topic");
15275      for (int i = 0; i < array.size(); i++) {
15276        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15277      }
15278    };
15279    if (json.has("author")) {
15280      JsonArray array = json.getAsJsonArray("author");
15281      for (int i = 0; i < array.size(); i++) {
15282        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
15283      }
15284    };
15285    if (json.has("editor")) {
15286      JsonArray array = json.getAsJsonArray("editor");
15287      for (int i = 0; i < array.size(); i++) {
15288        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
15289      }
15290    };
15291    if (json.has("reviewer")) {
15292      JsonArray array = json.getAsJsonArray("reviewer");
15293      for (int i = 0; i < array.size(); i++) {
15294        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
15295      }
15296    };
15297    if (json.has("endorser")) {
15298      JsonArray array = json.getAsJsonArray("endorser");
15299      for (int i = 0; i < array.size(); i++) {
15300        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
15301      }
15302    };
15303    if (json.has("relatedArtifact")) {
15304      JsonArray array = json.getAsJsonArray("relatedArtifact");
15305      for (int i = 0; i < array.size(); i++) {
15306        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
15307      }
15308    };
15309    if (json.has("library")) {
15310      JsonArray array = json.getAsJsonArray("library");
15311      for (int i = 0; i < array.size(); i++) {
15312        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
15313      }
15314    };
15315    if (json.has("_library")) {
15316      JsonArray array = json.getAsJsonArray("_library");
15317      for (int i = 0; i < array.size(); i++) {
15318        if (i == res.getLibrary().size())
15319          res.getLibrary().add(parseCanonical(null));
15320        if (array.get(i) instanceof JsonObject) 
15321          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
15322      }
15323    };
15324    if (json.has("disclaimer"))
15325      res.setDisclaimerElement(parseMarkdown(json.get("disclaimer").getAsString()));
15326    if (json.has("_disclaimer"))
15327      parseElementProperties(json.getAsJsonObject("_disclaimer"), res.getDisclaimerElement());
15328    if (json.has("scoring"))
15329      res.setScoring(parseCodeableConcept(json.getAsJsonObject("scoring")));
15330    if (json.has("compositeScoring"))
15331      res.setCompositeScoring(parseCodeableConcept(json.getAsJsonObject("compositeScoring")));
15332    if (json.has("type")) {
15333      JsonArray array = json.getAsJsonArray("type");
15334      for (int i = 0; i < array.size(); i++) {
15335        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15336      }
15337    };
15338    if (json.has("riskAdjustment"))
15339      res.setRiskAdjustmentElement(parseString(json.get("riskAdjustment").getAsString()));
15340    if (json.has("_riskAdjustment"))
15341      parseElementProperties(json.getAsJsonObject("_riskAdjustment"), res.getRiskAdjustmentElement());
15342    if (json.has("rateAggregation"))
15343      res.setRateAggregationElement(parseString(json.get("rateAggregation").getAsString()));
15344    if (json.has("_rateAggregation"))
15345      parseElementProperties(json.getAsJsonObject("_rateAggregation"), res.getRateAggregationElement());
15346    if (json.has("rationale"))
15347      res.setRationaleElement(parseMarkdown(json.get("rationale").getAsString()));
15348    if (json.has("_rationale"))
15349      parseElementProperties(json.getAsJsonObject("_rationale"), res.getRationaleElement());
15350    if (json.has("clinicalRecommendationStatement"))
15351      res.setClinicalRecommendationStatementElement(parseMarkdown(json.get("clinicalRecommendationStatement").getAsString()));
15352    if (json.has("_clinicalRecommendationStatement"))
15353      parseElementProperties(json.getAsJsonObject("_clinicalRecommendationStatement"), res.getClinicalRecommendationStatementElement());
15354    if (json.has("improvementNotation"))
15355      res.setImprovementNotation(parseCodeableConcept(json.getAsJsonObject("improvementNotation")));
15356    if (json.has("definition")) {
15357      JsonArray array = json.getAsJsonArray("definition");
15358      for (int i = 0; i < array.size(); i++) {
15359        res.getDefinition().add(parseMarkdown(array.get(i).getAsString()));
15360      }
15361    };
15362    if (json.has("_definition")) {
15363      JsonArray array = json.getAsJsonArray("_definition");
15364      for (int i = 0; i < array.size(); i++) {
15365        if (i == res.getDefinition().size())
15366          res.getDefinition().add(parseMarkdown(null));
15367        if (array.get(i) instanceof JsonObject) 
15368          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
15369      }
15370    };
15371    if (json.has("guidance"))
15372      res.setGuidanceElement(parseMarkdown(json.get("guidance").getAsString()));
15373    if (json.has("_guidance"))
15374      parseElementProperties(json.getAsJsonObject("_guidance"), res.getGuidanceElement());
15375    if (json.has("group")) {
15376      JsonArray array = json.getAsJsonArray("group");
15377      for (int i = 0; i < array.size(); i++) {
15378        res.getGroup().add(parseMeasureMeasureGroupComponent(array.get(i).getAsJsonObject(), res));
15379      }
15380    };
15381    if (json.has("supplementalData")) {
15382      JsonArray array = json.getAsJsonArray("supplementalData");
15383      for (int i = 0; i < array.size(); i++) {
15384        res.getSupplementalData().add(parseMeasureMeasureSupplementalDataComponent(array.get(i).getAsJsonObject(), res));
15385      }
15386    };
15387  }
15388
15389  protected Measure.MeasureGroupComponent parseMeasureMeasureGroupComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
15390    Measure.MeasureGroupComponent res = new Measure.MeasureGroupComponent();
15391    parseMeasureMeasureGroupComponentProperties(json, owner, res);
15392    return res;
15393  }
15394
15395  protected void parseMeasureMeasureGroupComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupComponent res) throws IOException, FHIRFormatError {
15396    parseBackboneElementProperties(json, res);
15397    if (json.has("code"))
15398      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15399    if (json.has("description"))
15400      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15401    if (json.has("_description"))
15402      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15403    if (json.has("population")) {
15404      JsonArray array = json.getAsJsonArray("population");
15405      for (int i = 0; i < array.size(); i++) {
15406        res.getPopulation().add(parseMeasureMeasureGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
15407      }
15408    };
15409    if (json.has("stratifier")) {
15410      JsonArray array = json.getAsJsonArray("stratifier");
15411      for (int i = 0; i < array.size(); i++) {
15412        res.getStratifier().add(parseMeasureMeasureGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
15413      }
15414    };
15415  }
15416
15417  protected Measure.MeasureGroupPopulationComponent parseMeasureMeasureGroupPopulationComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
15418    Measure.MeasureGroupPopulationComponent res = new Measure.MeasureGroupPopulationComponent();
15419    parseMeasureMeasureGroupPopulationComponentProperties(json, owner, res);
15420    return res;
15421  }
15422
15423  protected void parseMeasureMeasureGroupPopulationComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupPopulationComponent res) throws IOException, FHIRFormatError {
15424    parseBackboneElementProperties(json, res);
15425    if (json.has("code"))
15426      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15427    if (json.has("description"))
15428      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15429    if (json.has("_description"))
15430      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15431    if (json.has("criteria"))
15432      res.setCriteria(parseExpression(json.getAsJsonObject("criteria")));
15433  }
15434
15435  protected Measure.MeasureGroupStratifierComponent parseMeasureMeasureGroupStratifierComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
15436    Measure.MeasureGroupStratifierComponent res = new Measure.MeasureGroupStratifierComponent();
15437    parseMeasureMeasureGroupStratifierComponentProperties(json, owner, res);
15438    return res;
15439  }
15440
15441  protected void parseMeasureMeasureGroupStratifierComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupStratifierComponent res) throws IOException, FHIRFormatError {
15442    parseBackboneElementProperties(json, res);
15443    if (json.has("code"))
15444      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15445    if (json.has("description"))
15446      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15447    if (json.has("_description"))
15448      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15449    if (json.has("criteria"))
15450      res.setCriteria(parseExpression(json.getAsJsonObject("criteria")));
15451    if (json.has("component")) {
15452      JsonArray array = json.getAsJsonArray("component");
15453      for (int i = 0; i < array.size(); i++) {
15454        res.getComponent().add(parseMeasureMeasureGroupStratifierComponentComponent(array.get(i).getAsJsonObject(), owner));
15455      }
15456    };
15457  }
15458
15459  protected Measure.MeasureGroupStratifierComponentComponent parseMeasureMeasureGroupStratifierComponentComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
15460    Measure.MeasureGroupStratifierComponentComponent res = new Measure.MeasureGroupStratifierComponentComponent();
15461    parseMeasureMeasureGroupStratifierComponentComponentProperties(json, owner, res);
15462    return res;
15463  }
15464
15465  protected void parseMeasureMeasureGroupStratifierComponentComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupStratifierComponentComponent res) throws IOException, FHIRFormatError {
15466    parseBackboneElementProperties(json, res);
15467    if (json.has("code"))
15468      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15469    if (json.has("description"))
15470      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15471    if (json.has("_description"))
15472      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15473    if (json.has("criteria"))
15474      res.setCriteria(parseExpression(json.getAsJsonObject("criteria")));
15475  }
15476
15477  protected Measure.MeasureSupplementalDataComponent parseMeasureMeasureSupplementalDataComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
15478    Measure.MeasureSupplementalDataComponent res = new Measure.MeasureSupplementalDataComponent();
15479    parseMeasureMeasureSupplementalDataComponentProperties(json, owner, res);
15480    return res;
15481  }
15482
15483  protected void parseMeasureMeasureSupplementalDataComponentProperties(JsonObject json, Measure owner, Measure.MeasureSupplementalDataComponent res) throws IOException, FHIRFormatError {
15484    parseBackboneElementProperties(json, res);
15485    if (json.has("code"))
15486      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15487    if (json.has("usage")) {
15488      JsonArray array = json.getAsJsonArray("usage");
15489      for (int i = 0; i < array.size(); i++) {
15490        res.getUsage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15491      }
15492    };
15493    if (json.has("description"))
15494      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15495    if (json.has("_description"))
15496      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15497    if (json.has("criteria"))
15498      res.setCriteria(parseExpression(json.getAsJsonObject("criteria")));
15499  }
15500
15501  protected MeasureReport parseMeasureReport(JsonObject json) throws IOException, FHIRFormatError {
15502    MeasureReport res = new MeasureReport();
15503    parseMeasureReportProperties(json, res);
15504    return res;
15505  }
15506
15507  protected void parseMeasureReportProperties(JsonObject json, MeasureReport res) throws IOException, FHIRFormatError {
15508    parseDomainResourceProperties(json, res);
15509    if (json.has("identifier")) {
15510      JsonArray array = json.getAsJsonArray("identifier");
15511      for (int i = 0; i < array.size(); i++) {
15512        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15513      }
15514    };
15515    if (json.has("status"))
15516      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MeasureReport.MeasureReportStatus.NULL, new MeasureReport.MeasureReportStatusEnumFactory()));
15517    if (json.has("_status"))
15518      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15519    if (json.has("type"))
15520      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MeasureReport.MeasureReportType.NULL, new MeasureReport.MeasureReportTypeEnumFactory()));
15521    if (json.has("_type"))
15522      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
15523    if (json.has("measure"))
15524      res.setMeasureElement(parseCanonical(json.get("measure").getAsString()));
15525    if (json.has("_measure"))
15526      parseElementProperties(json.getAsJsonObject("_measure"), res.getMeasureElement());
15527    if (json.has("subject"))
15528      res.setSubject(parseReference(json.getAsJsonObject("subject")));
15529    if (json.has("date"))
15530      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15531    if (json.has("_date"))
15532      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
15533    if (json.has("reporter"))
15534      res.setReporter(parseReference(json.getAsJsonObject("reporter")));
15535    if (json.has("period"))
15536      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
15537    if (json.has("improvementNotation"))
15538      res.setImprovementNotation(parseCodeableConcept(json.getAsJsonObject("improvementNotation")));
15539    if (json.has("group")) {
15540      JsonArray array = json.getAsJsonArray("group");
15541      for (int i = 0; i < array.size(); i++) {
15542        res.getGroup().add(parseMeasureReportMeasureReportGroupComponent(array.get(i).getAsJsonObject(), res));
15543      }
15544    };
15545    if (json.has("evaluatedResource")) {
15546      JsonArray array = json.getAsJsonArray("evaluatedResource");
15547      for (int i = 0; i < array.size(); i++) {
15548        res.getEvaluatedResource().add(parseReference(array.get(i).getAsJsonObject()));
15549      }
15550    };
15551  }
15552
15553  protected MeasureReport.MeasureReportGroupComponent parseMeasureReportMeasureReportGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
15554    MeasureReport.MeasureReportGroupComponent res = new MeasureReport.MeasureReportGroupComponent();
15555    parseMeasureReportMeasureReportGroupComponentProperties(json, owner, res);
15556    return res;
15557  }
15558
15559  protected void parseMeasureReportMeasureReportGroupComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupComponent res) throws IOException, FHIRFormatError {
15560    parseBackboneElementProperties(json, res);
15561    if (json.has("code"))
15562      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15563    if (json.has("population")) {
15564      JsonArray array = json.getAsJsonArray("population");
15565      for (int i = 0; i < array.size(); i++) {
15566        res.getPopulation().add(parseMeasureReportMeasureReportGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
15567      }
15568    };
15569    if (json.has("measureScore"))
15570      res.setMeasureScore(parseQuantity(json.getAsJsonObject("measureScore")));
15571    if (json.has("stratifier")) {
15572      JsonArray array = json.getAsJsonArray("stratifier");
15573      for (int i = 0; i < array.size(); i++) {
15574        res.getStratifier().add(parseMeasureReportMeasureReportGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
15575      }
15576    };
15577  }
15578
15579  protected MeasureReport.MeasureReportGroupPopulationComponent parseMeasureReportMeasureReportGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
15580    MeasureReport.MeasureReportGroupPopulationComponent res = new MeasureReport.MeasureReportGroupPopulationComponent();
15581    parseMeasureReportMeasureReportGroupPopulationComponentProperties(json, owner, res);
15582    return res;
15583  }
15584
15585  protected void parseMeasureReportMeasureReportGroupPopulationComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupPopulationComponent res) throws IOException, FHIRFormatError {
15586    parseBackboneElementProperties(json, res);
15587    if (json.has("code"))
15588      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15589    if (json.has("count"))
15590      res.setCountElement(parseInteger(json.get("count").getAsLong()));
15591    if (json.has("_count"))
15592      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
15593    if (json.has("subjectResults"))
15594      res.setSubjectResults(parseReference(json.getAsJsonObject("subjectResults")));
15595  }
15596
15597  protected MeasureReport.MeasureReportGroupStratifierComponent parseMeasureReportMeasureReportGroupStratifierComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
15598    MeasureReport.MeasureReportGroupStratifierComponent res = new MeasureReport.MeasureReportGroupStratifierComponent();
15599    parseMeasureReportMeasureReportGroupStratifierComponentProperties(json, owner, res);
15600    return res;
15601  }
15602
15603  protected void parseMeasureReportMeasureReportGroupStratifierComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupStratifierComponent res) throws IOException, FHIRFormatError {
15604    parseBackboneElementProperties(json, res);
15605    if (json.has("code")) {
15606      JsonArray array = json.getAsJsonArray("code");
15607      for (int i = 0; i < array.size(); i++) {
15608        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15609      }
15610    };
15611    if (json.has("stratum")) {
15612      JsonArray array = json.getAsJsonArray("stratum");
15613      for (int i = 0; i < array.size(); i++) {
15614        res.getStratum().add(parseMeasureReportStratifierGroupComponent(array.get(i).getAsJsonObject(), owner));
15615      }
15616    };
15617  }
15618
15619  protected MeasureReport.StratifierGroupComponent parseMeasureReportStratifierGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
15620    MeasureReport.StratifierGroupComponent res = new MeasureReport.StratifierGroupComponent();
15621    parseMeasureReportStratifierGroupComponentProperties(json, owner, res);
15622    return res;
15623  }
15624
15625  protected void parseMeasureReportStratifierGroupComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupComponent res) throws IOException, FHIRFormatError {
15626    parseBackboneElementProperties(json, res);
15627    if (json.has("value"))
15628      res.setValue(parseCodeableConcept(json.getAsJsonObject("value")));
15629    if (json.has("component")) {
15630      JsonArray array = json.getAsJsonArray("component");
15631      for (int i = 0; i < array.size(); i++) {
15632        res.getComponent().add(parseMeasureReportStratifierGroupComponentComponent(array.get(i).getAsJsonObject(), owner));
15633      }
15634    };
15635    if (json.has("population")) {
15636      JsonArray array = json.getAsJsonArray("population");
15637      for (int i = 0; i < array.size(); i++) {
15638        res.getPopulation().add(parseMeasureReportStratifierGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
15639      }
15640    };
15641    if (json.has("measureScore"))
15642      res.setMeasureScore(parseQuantity(json.getAsJsonObject("measureScore")));
15643  }
15644
15645  protected MeasureReport.StratifierGroupComponentComponent parseMeasureReportStratifierGroupComponentComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
15646    MeasureReport.StratifierGroupComponentComponent res = new MeasureReport.StratifierGroupComponentComponent();
15647    parseMeasureReportStratifierGroupComponentComponentProperties(json, owner, res);
15648    return res;
15649  }
15650
15651  protected void parseMeasureReportStratifierGroupComponentComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupComponentComponent res) throws IOException, FHIRFormatError {
15652    parseBackboneElementProperties(json, res);
15653    if (json.has("code"))
15654      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15655    if (json.has("value"))
15656      res.setValue(parseCodeableConcept(json.getAsJsonObject("value")));
15657  }
15658
15659  protected MeasureReport.StratifierGroupPopulationComponent parseMeasureReportStratifierGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
15660    MeasureReport.StratifierGroupPopulationComponent res = new MeasureReport.StratifierGroupPopulationComponent();
15661    parseMeasureReportStratifierGroupPopulationComponentProperties(json, owner, res);
15662    return res;
15663  }
15664
15665  protected void parseMeasureReportStratifierGroupPopulationComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupPopulationComponent res) throws IOException, FHIRFormatError {
15666    parseBackboneElementProperties(json, res);
15667    if (json.has("code"))
15668      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15669    if (json.has("count"))
15670      res.setCountElement(parseInteger(json.get("count").getAsLong()));
15671    if (json.has("_count"))
15672      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
15673    if (json.has("subjectResults"))
15674      res.setSubjectResults(parseReference(json.getAsJsonObject("subjectResults")));
15675  }
15676
15677  protected Media parseMedia(JsonObject json) throws IOException, FHIRFormatError {
15678    Media res = new Media();
15679    parseMediaProperties(json, res);
15680    return res;
15681  }
15682
15683  protected void parseMediaProperties(JsonObject json, Media res) throws IOException, FHIRFormatError {
15684    parseDomainResourceProperties(json, res);
15685    if (json.has("identifier")) {
15686      JsonArray array = json.getAsJsonArray("identifier");
15687      for (int i = 0; i < array.size(); i++) {
15688        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15689      }
15690    };
15691    if (json.has("basedOn")) {
15692      JsonArray array = json.getAsJsonArray("basedOn");
15693      for (int i = 0; i < array.size(); i++) {
15694        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
15695      }
15696    };
15697    if (json.has("partOf")) {
15698      JsonArray array = json.getAsJsonArray("partOf");
15699      for (int i = 0; i < array.size(); i++) {
15700        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
15701      }
15702    };
15703    if (json.has("status"))
15704      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Media.MediaStatus.NULL, new Media.MediaStatusEnumFactory()));
15705    if (json.has("_status"))
15706      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15707    if (json.has("type"))
15708      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15709    if (json.has("modality"))
15710      res.setModality(parseCodeableConcept(json.getAsJsonObject("modality")));
15711    if (json.has("view"))
15712      res.setView(parseCodeableConcept(json.getAsJsonObject("view")));
15713    if (json.has("subject"))
15714      res.setSubject(parseReference(json.getAsJsonObject("subject")));
15715    if (json.has("encounter"))
15716      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
15717    Type created = parseType("created", json);
15718    if (created != null)
15719      res.setCreated(created);
15720    if (json.has("issued"))
15721      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
15722    if (json.has("_issued"))
15723      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
15724    if (json.has("operator"))
15725      res.setOperator(parseReference(json.getAsJsonObject("operator")));
15726    if (json.has("reasonCode")) {
15727      JsonArray array = json.getAsJsonArray("reasonCode");
15728      for (int i = 0; i < array.size(); i++) {
15729        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15730      }
15731    };
15732    if (json.has("bodySite"))
15733      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
15734    if (json.has("deviceName"))
15735      res.setDeviceNameElement(parseString(json.get("deviceName").getAsString()));
15736    if (json.has("_deviceName"))
15737      parseElementProperties(json.getAsJsonObject("_deviceName"), res.getDeviceNameElement());
15738    if (json.has("device"))
15739      res.setDevice(parseReference(json.getAsJsonObject("device")));
15740    if (json.has("height"))
15741      res.setHeightElement(parsePositiveInt(json.get("height").getAsString()));
15742    if (json.has("_height"))
15743      parseElementProperties(json.getAsJsonObject("_height"), res.getHeightElement());
15744    if (json.has("width"))
15745      res.setWidthElement(parsePositiveInt(json.get("width").getAsString()));
15746    if (json.has("_width"))
15747      parseElementProperties(json.getAsJsonObject("_width"), res.getWidthElement());
15748    if (json.has("frames"))
15749      res.setFramesElement(parsePositiveInt(json.get("frames").getAsString()));
15750    if (json.has("_frames"))
15751      parseElementProperties(json.getAsJsonObject("_frames"), res.getFramesElement());
15752    if (json.has("duration"))
15753      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
15754    if (json.has("_duration"))
15755      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
15756    if (json.has("content"))
15757      res.setContent(parseAttachment(json.getAsJsonObject("content")));
15758    if (json.has("note")) {
15759      JsonArray array = json.getAsJsonArray("note");
15760      for (int i = 0; i < array.size(); i++) {
15761        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15762      }
15763    };
15764  }
15765
15766  protected Medication parseMedication(JsonObject json) throws IOException, FHIRFormatError {
15767    Medication res = new Medication();
15768    parseMedicationProperties(json, res);
15769    return res;
15770  }
15771
15772  protected void parseMedicationProperties(JsonObject json, Medication res) throws IOException, FHIRFormatError {
15773    parseDomainResourceProperties(json, res);
15774    if (json.has("identifier")) {
15775      JsonArray array = json.getAsJsonArray("identifier");
15776      for (int i = 0; i < array.size(); i++) {
15777        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15778      }
15779    };
15780    if (json.has("code"))
15781      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15782    if (json.has("status"))
15783      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Medication.MedicationStatus.NULL, new Medication.MedicationStatusEnumFactory()));
15784    if (json.has("_status"))
15785      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15786    if (json.has("manufacturer"))
15787      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
15788    if (json.has("form"))
15789      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
15790    if (json.has("amount"))
15791      res.setAmount(parseRatio(json.getAsJsonObject("amount")));
15792    if (json.has("ingredient")) {
15793      JsonArray array = json.getAsJsonArray("ingredient");
15794      for (int i = 0; i < array.size(); i++) {
15795        res.getIngredient().add(parseMedicationMedicationIngredientComponent(array.get(i).getAsJsonObject(), res));
15796      }
15797    };
15798    if (json.has("batch"))
15799      res.setBatch(parseMedicationMedicationBatchComponent(json.getAsJsonObject("batch"), res));
15800  }
15801
15802  protected Medication.MedicationIngredientComponent parseMedicationMedicationIngredientComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
15803    Medication.MedicationIngredientComponent res = new Medication.MedicationIngredientComponent();
15804    parseMedicationMedicationIngredientComponentProperties(json, owner, res);
15805    return res;
15806  }
15807
15808  protected void parseMedicationMedicationIngredientComponentProperties(JsonObject json, Medication owner, Medication.MedicationIngredientComponent res) throws IOException, FHIRFormatError {
15809    parseBackboneElementProperties(json, res);
15810    Type item = parseType("item", json);
15811    if (item != null)
15812      res.setItem(item);
15813    if (json.has("isActive"))
15814      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
15815    if (json.has("_isActive"))
15816      parseElementProperties(json.getAsJsonObject("_isActive"), res.getIsActiveElement());
15817    if (json.has("strength"))
15818      res.setStrength(parseRatio(json.getAsJsonObject("strength")));
15819  }
15820
15821  protected Medication.MedicationBatchComponent parseMedicationMedicationBatchComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
15822    Medication.MedicationBatchComponent res = new Medication.MedicationBatchComponent();
15823    parseMedicationMedicationBatchComponentProperties(json, owner, res);
15824    return res;
15825  }
15826
15827  protected void parseMedicationMedicationBatchComponentProperties(JsonObject json, Medication owner, Medication.MedicationBatchComponent res) throws IOException, FHIRFormatError {
15828    parseBackboneElementProperties(json, res);
15829    if (json.has("lotNumber"))
15830      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
15831    if (json.has("_lotNumber"))
15832      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
15833    if (json.has("expirationDate"))
15834      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
15835    if (json.has("_expirationDate"))
15836      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
15837  }
15838
15839  protected MedicationAdministration parseMedicationAdministration(JsonObject json) throws IOException, FHIRFormatError {
15840    MedicationAdministration res = new MedicationAdministration();
15841    parseMedicationAdministrationProperties(json, res);
15842    return res;
15843  }
15844
15845  protected void parseMedicationAdministrationProperties(JsonObject json, MedicationAdministration res) throws IOException, FHIRFormatError {
15846    parseDomainResourceProperties(json, res);
15847    if (json.has("identifier")) {
15848      JsonArray array = json.getAsJsonArray("identifier");
15849      for (int i = 0; i < array.size(); i++) {
15850        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15851      }
15852    };
15853    if (json.has("instantiates")) {
15854      JsonArray array = json.getAsJsonArray("instantiates");
15855      for (int i = 0; i < array.size(); i++) {
15856        res.getInstantiates().add(parseUri(array.get(i).getAsString()));
15857      }
15858    };
15859    if (json.has("_instantiates")) {
15860      JsonArray array = json.getAsJsonArray("_instantiates");
15861      for (int i = 0; i < array.size(); i++) {
15862        if (i == res.getInstantiates().size())
15863          res.getInstantiates().add(parseUri(null));
15864        if (array.get(i) instanceof JsonObject) 
15865          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
15866      }
15867    };
15868    if (json.has("partOf")) {
15869      JsonArray array = json.getAsJsonArray("partOf");
15870      for (int i = 0; i < array.size(); i++) {
15871        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
15872      }
15873    };
15874    if (json.has("status"))
15875      res.setStatusElement(parseCode(json.get("status").getAsString()));
15876    if (json.has("_status"))
15877      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15878    if (json.has("statusReason")) {
15879      JsonArray array = json.getAsJsonArray("statusReason");
15880      for (int i = 0; i < array.size(); i++) {
15881        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15882      }
15883    };
15884    if (json.has("category"))
15885      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
15886    Type medication = parseType("medication", json);
15887    if (medication != null)
15888      res.setMedication(medication);
15889    if (json.has("subject"))
15890      res.setSubject(parseReference(json.getAsJsonObject("subject")));
15891    if (json.has("context"))
15892      res.setContext(parseReference(json.getAsJsonObject("context")));
15893    if (json.has("supportingInformation")) {
15894      JsonArray array = json.getAsJsonArray("supportingInformation");
15895      for (int i = 0; i < array.size(); i++) {
15896        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
15897      }
15898    };
15899    Type effective = parseType("effective", json);
15900    if (effective != null)
15901      res.setEffective(effective);
15902    if (json.has("performer")) {
15903      JsonArray array = json.getAsJsonArray("performer");
15904      for (int i = 0; i < array.size(); i++) {
15905        res.getPerformer().add(parseMedicationAdministrationMedicationAdministrationPerformerComponent(array.get(i).getAsJsonObject(), res));
15906      }
15907    };
15908    if (json.has("reasonCode")) {
15909      JsonArray array = json.getAsJsonArray("reasonCode");
15910      for (int i = 0; i < array.size(); i++) {
15911        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15912      }
15913    };
15914    if (json.has("reasonReference")) {
15915      JsonArray array = json.getAsJsonArray("reasonReference");
15916      for (int i = 0; i < array.size(); i++) {
15917        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
15918      }
15919    };
15920    if (json.has("request"))
15921      res.setRequest(parseReference(json.getAsJsonObject("request")));
15922    if (json.has("device")) {
15923      JsonArray array = json.getAsJsonArray("device");
15924      for (int i = 0; i < array.size(); i++) {
15925        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
15926      }
15927    };
15928    if (json.has("note")) {
15929      JsonArray array = json.getAsJsonArray("note");
15930      for (int i = 0; i < array.size(); i++) {
15931        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15932      }
15933    };
15934    if (json.has("dosage"))
15935      res.setDosage(parseMedicationAdministrationMedicationAdministrationDosageComponent(json.getAsJsonObject("dosage"), res));
15936    if (json.has("eventHistory")) {
15937      JsonArray array = json.getAsJsonArray("eventHistory");
15938      for (int i = 0; i < array.size(); i++) {
15939        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
15940      }
15941    };
15942  }
15943
15944  protected MedicationAdministration.MedicationAdministrationPerformerComponent parseMedicationAdministrationMedicationAdministrationPerformerComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
15945    MedicationAdministration.MedicationAdministrationPerformerComponent res = new MedicationAdministration.MedicationAdministrationPerformerComponent();
15946    parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(json, owner, res);
15947    return res;
15948  }
15949
15950  protected void parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(JsonObject json, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationPerformerComponent res) throws IOException, FHIRFormatError {
15951    parseBackboneElementProperties(json, res);
15952    if (json.has("function"))
15953      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
15954    if (json.has("actor"))
15955      res.setActor(parseReference(json.getAsJsonObject("actor")));
15956  }
15957
15958  protected MedicationAdministration.MedicationAdministrationDosageComponent parseMedicationAdministrationMedicationAdministrationDosageComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
15959    MedicationAdministration.MedicationAdministrationDosageComponent res = new MedicationAdministration.MedicationAdministrationDosageComponent();
15960    parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(json, owner, res);
15961    return res;
15962  }
15963
15964  protected void parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(JsonObject json, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationDosageComponent res) throws IOException, FHIRFormatError {
15965    parseBackboneElementProperties(json, res);
15966    if (json.has("text"))
15967      res.setTextElement(parseString(json.get("text").getAsString()));
15968    if (json.has("_text"))
15969      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
15970    if (json.has("site"))
15971      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
15972    if (json.has("route"))
15973      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
15974    if (json.has("method"))
15975      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
15976    if (json.has("dose"))
15977      res.setDose(parseQuantity(json.getAsJsonObject("dose")));
15978    Type rate = parseType("rate", json);
15979    if (rate != null)
15980      res.setRate(rate);
15981  }
15982
15983  protected MedicationDispense parseMedicationDispense(JsonObject json) throws IOException, FHIRFormatError {
15984    MedicationDispense res = new MedicationDispense();
15985    parseMedicationDispenseProperties(json, res);
15986    return res;
15987  }
15988
15989  protected void parseMedicationDispenseProperties(JsonObject json, MedicationDispense res) throws IOException, FHIRFormatError {
15990    parseDomainResourceProperties(json, res);
15991    if (json.has("identifier")) {
15992      JsonArray array = json.getAsJsonArray("identifier");
15993      for (int i = 0; i < array.size(); i++) {
15994        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15995      }
15996    };
15997    if (json.has("partOf")) {
15998      JsonArray array = json.getAsJsonArray("partOf");
15999      for (int i = 0; i < array.size(); i++) {
16000        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
16001      }
16002    };
16003    if (json.has("status"))
16004      res.setStatusElement(parseCode(json.get("status").getAsString()));
16005    if (json.has("_status"))
16006      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16007    Type statusReason = parseType("statusReason", json);
16008    if (statusReason != null)
16009      res.setStatusReason(statusReason);
16010    if (json.has("category"))
16011      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
16012    Type medication = parseType("medication", json);
16013    if (medication != null)
16014      res.setMedication(medication);
16015    if (json.has("subject"))
16016      res.setSubject(parseReference(json.getAsJsonObject("subject")));
16017    if (json.has("context"))
16018      res.setContext(parseReference(json.getAsJsonObject("context")));
16019    if (json.has("supportingInformation")) {
16020      JsonArray array = json.getAsJsonArray("supportingInformation");
16021      for (int i = 0; i < array.size(); i++) {
16022        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
16023      }
16024    };
16025    if (json.has("performer")) {
16026      JsonArray array = json.getAsJsonArray("performer");
16027      for (int i = 0; i < array.size(); i++) {
16028        res.getPerformer().add(parseMedicationDispenseMedicationDispensePerformerComponent(array.get(i).getAsJsonObject(), res));
16029      }
16030    };
16031    if (json.has("location"))
16032      res.setLocation(parseReference(json.getAsJsonObject("location")));
16033    if (json.has("authorizingPrescription")) {
16034      JsonArray array = json.getAsJsonArray("authorizingPrescription");
16035      for (int i = 0; i < array.size(); i++) {
16036        res.getAuthorizingPrescription().add(parseReference(array.get(i).getAsJsonObject()));
16037      }
16038    };
16039    if (json.has("type"))
16040      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16041    if (json.has("quantity"))
16042      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
16043    if (json.has("daysSupply"))
16044      res.setDaysSupply(parseQuantity(json.getAsJsonObject("daysSupply")));
16045    if (json.has("whenPrepared"))
16046      res.setWhenPreparedElement(parseDateTime(json.get("whenPrepared").getAsString()));
16047    if (json.has("_whenPrepared"))
16048      parseElementProperties(json.getAsJsonObject("_whenPrepared"), res.getWhenPreparedElement());
16049    if (json.has("whenHandedOver"))
16050      res.setWhenHandedOverElement(parseDateTime(json.get("whenHandedOver").getAsString()));
16051    if (json.has("_whenHandedOver"))
16052      parseElementProperties(json.getAsJsonObject("_whenHandedOver"), res.getWhenHandedOverElement());
16053    if (json.has("destination"))
16054      res.setDestination(parseReference(json.getAsJsonObject("destination")));
16055    if (json.has("receiver")) {
16056      JsonArray array = json.getAsJsonArray("receiver");
16057      for (int i = 0; i < array.size(); i++) {
16058        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
16059      }
16060    };
16061    if (json.has("note")) {
16062      JsonArray array = json.getAsJsonArray("note");
16063      for (int i = 0; i < array.size(); i++) {
16064        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16065      }
16066    };
16067    if (json.has("dosageInstruction")) {
16068      JsonArray array = json.getAsJsonArray("dosageInstruction");
16069      for (int i = 0; i < array.size(); i++) {
16070        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
16071      }
16072    };
16073    if (json.has("substitution"))
16074      res.setSubstitution(parseMedicationDispenseMedicationDispenseSubstitutionComponent(json.getAsJsonObject("substitution"), res));
16075    if (json.has("detectedIssue")) {
16076      JsonArray array = json.getAsJsonArray("detectedIssue");
16077      for (int i = 0; i < array.size(); i++) {
16078        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
16079      }
16080    };
16081    if (json.has("eventHistory")) {
16082      JsonArray array = json.getAsJsonArray("eventHistory");
16083      for (int i = 0; i < array.size(); i++) {
16084        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
16085      }
16086    };
16087  }
16088
16089  protected MedicationDispense.MedicationDispensePerformerComponent parseMedicationDispenseMedicationDispensePerformerComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
16090    MedicationDispense.MedicationDispensePerformerComponent res = new MedicationDispense.MedicationDispensePerformerComponent();
16091    parseMedicationDispenseMedicationDispensePerformerComponentProperties(json, owner, res);
16092    return res;
16093  }
16094
16095  protected void parseMedicationDispenseMedicationDispensePerformerComponentProperties(JsonObject json, MedicationDispense owner, MedicationDispense.MedicationDispensePerformerComponent res) throws IOException, FHIRFormatError {
16096    parseBackboneElementProperties(json, res);
16097    if (json.has("function"))
16098      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
16099    if (json.has("actor"))
16100      res.setActor(parseReference(json.getAsJsonObject("actor")));
16101  }
16102
16103  protected MedicationDispense.MedicationDispenseSubstitutionComponent parseMedicationDispenseMedicationDispenseSubstitutionComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
16104    MedicationDispense.MedicationDispenseSubstitutionComponent res = new MedicationDispense.MedicationDispenseSubstitutionComponent();
16105    parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(json, owner, res);
16106    return res;
16107  }
16108
16109  protected void parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(JsonObject json, MedicationDispense owner, MedicationDispense.MedicationDispenseSubstitutionComponent res) throws IOException, FHIRFormatError {
16110    parseBackboneElementProperties(json, res);
16111    if (json.has("wasSubstituted"))
16112      res.setWasSubstitutedElement(parseBoolean(json.get("wasSubstituted").getAsBoolean()));
16113    if (json.has("_wasSubstituted"))
16114      parseElementProperties(json.getAsJsonObject("_wasSubstituted"), res.getWasSubstitutedElement());
16115    if (json.has("type"))
16116      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16117    if (json.has("reason")) {
16118      JsonArray array = json.getAsJsonArray("reason");
16119      for (int i = 0; i < array.size(); i++) {
16120        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16121      }
16122    };
16123    if (json.has("responsibleParty")) {
16124      JsonArray array = json.getAsJsonArray("responsibleParty");
16125      for (int i = 0; i < array.size(); i++) {
16126        res.getResponsibleParty().add(parseReference(array.get(i).getAsJsonObject()));
16127      }
16128    };
16129  }
16130
16131  protected MedicationKnowledge parseMedicationKnowledge(JsonObject json) throws IOException, FHIRFormatError {
16132    MedicationKnowledge res = new MedicationKnowledge();
16133    parseMedicationKnowledgeProperties(json, res);
16134    return res;
16135  }
16136
16137  protected void parseMedicationKnowledgeProperties(JsonObject json, MedicationKnowledge res) throws IOException, FHIRFormatError {
16138    parseDomainResourceProperties(json, res);
16139    if (json.has("code"))
16140      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16141    if (json.has("status"))
16142      res.setStatusElement(parseCode(json.get("status").getAsString()));
16143    if (json.has("_status"))
16144      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16145    if (json.has("manufacturer"))
16146      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
16147    if (json.has("doseForm"))
16148      res.setDoseForm(parseCodeableConcept(json.getAsJsonObject("doseForm")));
16149    if (json.has("amount"))
16150      res.setAmount(parseQuantity(json.getAsJsonObject("amount")));
16151    if (json.has("synonym")) {
16152      JsonArray array = json.getAsJsonArray("synonym");
16153      for (int i = 0; i < array.size(); i++) {
16154        res.getSynonym().add(parseString(array.get(i).getAsString()));
16155      }
16156    };
16157    if (json.has("_synonym")) {
16158      JsonArray array = json.getAsJsonArray("_synonym");
16159      for (int i = 0; i < array.size(); i++) {
16160        if (i == res.getSynonym().size())
16161          res.getSynonym().add(parseString(null));
16162        if (array.get(i) instanceof JsonObject) 
16163          parseElementProperties(array.get(i).getAsJsonObject(), res.getSynonym().get(i));
16164      }
16165    };
16166    if (json.has("relatedMedicationKnowledge")) {
16167      JsonArray array = json.getAsJsonArray("relatedMedicationKnowledge");
16168      for (int i = 0; i < array.size(); i++) {
16169        res.getRelatedMedicationKnowledge().add(parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(array.get(i).getAsJsonObject(), res));
16170      }
16171    };
16172    if (json.has("associatedMedication")) {
16173      JsonArray array = json.getAsJsonArray("associatedMedication");
16174      for (int i = 0; i < array.size(); i++) {
16175        res.getAssociatedMedication().add(parseReference(array.get(i).getAsJsonObject()));
16176      }
16177    };
16178    if (json.has("productType")) {
16179      JsonArray array = json.getAsJsonArray("productType");
16180      for (int i = 0; i < array.size(); i++) {
16181        res.getProductType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16182      }
16183    };
16184    if (json.has("monograph")) {
16185      JsonArray array = json.getAsJsonArray("monograph");
16186      for (int i = 0; i < array.size(); i++) {
16187        res.getMonograph().add(parseMedicationKnowledgeMedicationKnowledgeMonographComponent(array.get(i).getAsJsonObject(), res));
16188      }
16189    };
16190    if (json.has("ingredient")) {
16191      JsonArray array = json.getAsJsonArray("ingredient");
16192      for (int i = 0; i < array.size(); i++) {
16193        res.getIngredient().add(parseMedicationKnowledgeMedicationKnowledgeIngredientComponent(array.get(i).getAsJsonObject(), res));
16194      }
16195    };
16196    if (json.has("preparationInstruction"))
16197      res.setPreparationInstructionElement(parseMarkdown(json.get("preparationInstruction").getAsString()));
16198    if (json.has("_preparationInstruction"))
16199      parseElementProperties(json.getAsJsonObject("_preparationInstruction"), res.getPreparationInstructionElement());
16200    if (json.has("intendedRoute")) {
16201      JsonArray array = json.getAsJsonArray("intendedRoute");
16202      for (int i = 0; i < array.size(); i++) {
16203        res.getIntendedRoute().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16204      }
16205    };
16206    if (json.has("cost")) {
16207      JsonArray array = json.getAsJsonArray("cost");
16208      for (int i = 0; i < array.size(); i++) {
16209        res.getCost().add(parseMedicationKnowledgeMedicationKnowledgeCostComponent(array.get(i).getAsJsonObject(), res));
16210      }
16211    };
16212    if (json.has("monitoringProgram")) {
16213      JsonArray array = json.getAsJsonArray("monitoringProgram");
16214      for (int i = 0; i < array.size(); i++) {
16215        res.getMonitoringProgram().add(parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(array.get(i).getAsJsonObject(), res));
16216      }
16217    };
16218    if (json.has("administrationGuidelines")) {
16219      JsonArray array = json.getAsJsonArray("administrationGuidelines");
16220      for (int i = 0; i < array.size(); i++) {
16221        res.getAdministrationGuidelines().add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(array.get(i).getAsJsonObject(), res));
16222      }
16223    };
16224    if (json.has("medicineClassification")) {
16225      JsonArray array = json.getAsJsonArray("medicineClassification");
16226      for (int i = 0; i < array.size(); i++) {
16227        res.getMedicineClassification().add(parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(array.get(i).getAsJsonObject(), res));
16228      }
16229    };
16230    if (json.has("packaging"))
16231      res.setPackaging(parseMedicationKnowledgeMedicationKnowledgePackagingComponent(json.getAsJsonObject("packaging"), res));
16232    if (json.has("drugCharacteristic")) {
16233      JsonArray array = json.getAsJsonArray("drugCharacteristic");
16234      for (int i = 0; i < array.size(); i++) {
16235        res.getDrugCharacteristic().add(parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(array.get(i).getAsJsonObject(), res));
16236      }
16237    };
16238    if (json.has("contraindication")) {
16239      JsonArray array = json.getAsJsonArray("contraindication");
16240      for (int i = 0; i < array.size(); i++) {
16241        res.getContraindication().add(parseReference(array.get(i).getAsJsonObject()));
16242      }
16243    };
16244    if (json.has("regulatory")) {
16245      JsonArray array = json.getAsJsonArray("regulatory");
16246      for (int i = 0; i < array.size(); i++) {
16247        res.getRegulatory().add(parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(array.get(i).getAsJsonObject(), res));
16248      }
16249    };
16250    if (json.has("kinetics")) {
16251      JsonArray array = json.getAsJsonArray("kinetics");
16252      for (int i = 0; i < array.size(); i++) {
16253        res.getKinetics().add(parseMedicationKnowledgeMedicationKnowledgeKineticsComponent(array.get(i).getAsJsonObject(), res));
16254      }
16255    };
16256  }
16257
16258  protected MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16259    MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent res = new MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent();
16260    parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(json, owner, res);
16261    return res;
16262  }
16263
16264  protected void parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent res) throws IOException, FHIRFormatError {
16265    parseBackboneElementProperties(json, res);
16266    if (json.has("type"))
16267      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16268    if (json.has("reference")) {
16269      JsonArray array = json.getAsJsonArray("reference");
16270      for (int i = 0; i < array.size(); i++) {
16271        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
16272      }
16273    };
16274  }
16275
16276  protected MedicationKnowledge.MedicationKnowledgeMonographComponent parseMedicationKnowledgeMedicationKnowledgeMonographComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16277    MedicationKnowledge.MedicationKnowledgeMonographComponent res = new MedicationKnowledge.MedicationKnowledgeMonographComponent();
16278    parseMedicationKnowledgeMedicationKnowledgeMonographComponentProperties(json, owner, res);
16279    return res;
16280  }
16281
16282  protected void parseMedicationKnowledgeMedicationKnowledgeMonographComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMonographComponent res) throws IOException, FHIRFormatError {
16283    parseBackboneElementProperties(json, res);
16284    if (json.has("type"))
16285      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16286    if (json.has("source"))
16287      res.setSource(parseReference(json.getAsJsonObject("source")));
16288  }
16289
16290  protected MedicationKnowledge.MedicationKnowledgeIngredientComponent parseMedicationKnowledgeMedicationKnowledgeIngredientComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16291    MedicationKnowledge.MedicationKnowledgeIngredientComponent res = new MedicationKnowledge.MedicationKnowledgeIngredientComponent();
16292    parseMedicationKnowledgeMedicationKnowledgeIngredientComponentProperties(json, owner, res);
16293    return res;
16294  }
16295
16296  protected void parseMedicationKnowledgeMedicationKnowledgeIngredientComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeIngredientComponent res) throws IOException, FHIRFormatError {
16297    parseBackboneElementProperties(json, res);
16298    Type item = parseType("item", json);
16299    if (item != null)
16300      res.setItem(item);
16301    if (json.has("isActive"))
16302      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
16303    if (json.has("_isActive"))
16304      parseElementProperties(json.getAsJsonObject("_isActive"), res.getIsActiveElement());
16305    if (json.has("strength"))
16306      res.setStrength(parseRatio(json.getAsJsonObject("strength")));
16307  }
16308
16309  protected MedicationKnowledge.MedicationKnowledgeCostComponent parseMedicationKnowledgeMedicationKnowledgeCostComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16310    MedicationKnowledge.MedicationKnowledgeCostComponent res = new MedicationKnowledge.MedicationKnowledgeCostComponent();
16311    parseMedicationKnowledgeMedicationKnowledgeCostComponentProperties(json, owner, res);
16312    return res;
16313  }
16314
16315  protected void parseMedicationKnowledgeMedicationKnowledgeCostComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeCostComponent res) throws IOException, FHIRFormatError {
16316    parseBackboneElementProperties(json, res);
16317    if (json.has("type"))
16318      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16319    if (json.has("source"))
16320      res.setSourceElement(parseString(json.get("source").getAsString()));
16321    if (json.has("_source"))
16322      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
16323    if (json.has("cost"))
16324      res.setCost(parseMoney(json.getAsJsonObject("cost")));
16325  }
16326
16327  protected MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16328    MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res = new MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent();
16329    parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentProperties(json, owner, res);
16330    return res;
16331  }
16332
16333  protected void parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res) throws IOException, FHIRFormatError {
16334    parseBackboneElementProperties(json, res);
16335    if (json.has("type"))
16336      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16337    if (json.has("name"))
16338      res.setNameElement(parseString(json.get("name").getAsString()));
16339    if (json.has("_name"))
16340      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
16341  }
16342
16343  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16344    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent();
16345    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentProperties(json, owner, res);
16346    return res;
16347  }
16348
16349  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent res) throws IOException, FHIRFormatError {
16350    parseBackboneElementProperties(json, res);
16351    if (json.has("dosage")) {
16352      JsonArray array = json.getAsJsonArray("dosage");
16353      for (int i = 0; i < array.size(); i++) {
16354        res.getDosage().add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(array.get(i).getAsJsonObject(), owner));
16355      }
16356    };
16357    Type indication = parseType("indication", json);
16358    if (indication != null)
16359      res.setIndication(indication);
16360    if (json.has("patientCharacteristics")) {
16361      JsonArray array = json.getAsJsonArray("patientCharacteristics");
16362      for (int i = 0; i < array.size(); i++) {
16363        res.getPatientCharacteristics().add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(array.get(i).getAsJsonObject(), owner));
16364      }
16365    };
16366  }
16367
16368  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16369    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent();
16370    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentProperties(json, owner, res);
16371    return res;
16372  }
16373
16374  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent res) throws IOException, FHIRFormatError {
16375    parseBackboneElementProperties(json, res);
16376    if (json.has("type"))
16377      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16378    if (json.has("dosage")) {
16379      JsonArray array = json.getAsJsonArray("dosage");
16380      for (int i = 0; i < array.size(); i++) {
16381        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
16382      }
16383    };
16384  }
16385
16386  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16387    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent();
16388    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentProperties(json, owner, res);
16389    return res;
16390  }
16391
16392  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent res) throws IOException, FHIRFormatError {
16393    parseBackboneElementProperties(json, res);
16394    Type characteristic = parseType("characteristic", json);
16395    if (characteristic != null)
16396      res.setCharacteristic(characteristic);
16397    if (json.has("value")) {
16398      JsonArray array = json.getAsJsonArray("value");
16399      for (int i = 0; i < array.size(); i++) {
16400        res.getValue().add(parseString(array.get(i).getAsString()));
16401      }
16402    };
16403    if (json.has("_value")) {
16404      JsonArray array = json.getAsJsonArray("_value");
16405      for (int i = 0; i < array.size(); i++) {
16406        if (i == res.getValue().size())
16407          res.getValue().add(parseString(null));
16408        if (array.get(i) instanceof JsonObject) 
16409          parseElementProperties(array.get(i).getAsJsonObject(), res.getValue().get(i));
16410      }
16411    };
16412  }
16413
16414  protected MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16415    MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res = new MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent();
16416    parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentProperties(json, owner, res);
16417    return res;
16418  }
16419
16420  protected void parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res) throws IOException, FHIRFormatError {
16421    parseBackboneElementProperties(json, res);
16422    if (json.has("type"))
16423      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16424    if (json.has("classification")) {
16425      JsonArray array = json.getAsJsonArray("classification");
16426      for (int i = 0; i < array.size(); i++) {
16427        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16428      }
16429    };
16430  }
16431
16432  protected MedicationKnowledge.MedicationKnowledgePackagingComponent parseMedicationKnowledgeMedicationKnowledgePackagingComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16433    MedicationKnowledge.MedicationKnowledgePackagingComponent res = new MedicationKnowledge.MedicationKnowledgePackagingComponent();
16434    parseMedicationKnowledgeMedicationKnowledgePackagingComponentProperties(json, owner, res);
16435    return res;
16436  }
16437
16438  protected void parseMedicationKnowledgeMedicationKnowledgePackagingComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgePackagingComponent res) throws IOException, FHIRFormatError {
16439    parseBackboneElementProperties(json, res);
16440    if (json.has("type"))
16441      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16442    if (json.has("quantity"))
16443      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
16444  }
16445
16446  protected MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16447    MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent res = new MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent();
16448    parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentProperties(json, owner, res);
16449    return res;
16450  }
16451
16452  protected void parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent res) throws IOException, FHIRFormatError {
16453    parseBackboneElementProperties(json, res);
16454    if (json.has("type"))
16455      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16456    Type value = parseType("value", json);
16457    if (value != null)
16458      res.setValue(value);
16459  }
16460
16461  protected MedicationKnowledge.MedicationKnowledgeRegulatoryComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16462    MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryComponent();
16463    parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponentProperties(json, owner, res);
16464    return res;
16465  }
16466
16467  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res) throws IOException, FHIRFormatError {
16468    parseBackboneElementProperties(json, res);
16469    if (json.has("regulatoryAuthority"))
16470      res.setRegulatoryAuthority(parseReference(json.getAsJsonObject("regulatoryAuthority")));
16471    if (json.has("substitution")) {
16472      JsonArray array = json.getAsJsonArray("substitution");
16473      for (int i = 0; i < array.size(); i++) {
16474        res.getSubstitution().add(parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(array.get(i).getAsJsonObject(), owner));
16475      }
16476    };
16477    if (json.has("schedule")) {
16478      JsonArray array = json.getAsJsonArray("schedule");
16479      for (int i = 0; i < array.size(); i++) {
16480        res.getSchedule().add(parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(array.get(i).getAsJsonObject(), owner));
16481      }
16482    };
16483    if (json.has("maxDispense"))
16484      res.setMaxDispense(parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(json.getAsJsonObject("maxDispense"), owner));
16485  }
16486
16487  protected MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16488    MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent();
16489    parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentProperties(json, owner, res);
16490    return res;
16491  }
16492
16493  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent res) throws IOException, FHIRFormatError {
16494    parseBackboneElementProperties(json, res);
16495    if (json.has("type"))
16496      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16497    if (json.has("allowed"))
16498      res.setAllowedElement(parseBoolean(json.get("allowed").getAsBoolean()));
16499    if (json.has("_allowed"))
16500      parseElementProperties(json.getAsJsonObject("_allowed"), res.getAllowedElement());
16501  }
16502
16503  protected MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16504    MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent();
16505    parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentProperties(json, owner, res);
16506    return res;
16507  }
16508
16509  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent res) throws IOException, FHIRFormatError {
16510    parseBackboneElementProperties(json, res);
16511    if (json.has("schedule"))
16512      res.setSchedule(parseCodeableConcept(json.getAsJsonObject("schedule")));
16513  }
16514
16515  protected MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16516    MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent();
16517    parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(json, owner, res);
16518    return res;
16519  }
16520
16521  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res) throws IOException, FHIRFormatError {
16522    parseBackboneElementProperties(json, res);
16523    if (json.has("quantity"))
16524      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
16525    if (json.has("period"))
16526      res.setPeriod(parseDuration(json.getAsJsonObject("period")));
16527  }
16528
16529  protected MedicationKnowledge.MedicationKnowledgeKineticsComponent parseMedicationKnowledgeMedicationKnowledgeKineticsComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16530    MedicationKnowledge.MedicationKnowledgeKineticsComponent res = new MedicationKnowledge.MedicationKnowledgeKineticsComponent();
16531    parseMedicationKnowledgeMedicationKnowledgeKineticsComponentProperties(json, owner, res);
16532    return res;
16533  }
16534
16535  protected void parseMedicationKnowledgeMedicationKnowledgeKineticsComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeKineticsComponent res) throws IOException, FHIRFormatError {
16536    parseBackboneElementProperties(json, res);
16537    if (json.has("areaUnderCurve")) {
16538      JsonArray array = json.getAsJsonArray("areaUnderCurve");
16539      for (int i = 0; i < array.size(); i++) {
16540        res.getAreaUnderCurve().add(parseQuantity(array.get(i).getAsJsonObject()));
16541      }
16542    };
16543    if (json.has("lethalDose50")) {
16544      JsonArray array = json.getAsJsonArray("lethalDose50");
16545      for (int i = 0; i < array.size(); i++) {
16546        res.getLethalDose50().add(parseQuantity(array.get(i).getAsJsonObject()));
16547      }
16548    };
16549    if (json.has("halfLifePeriod"))
16550      res.setHalfLifePeriod(parseDuration(json.getAsJsonObject("halfLifePeriod")));
16551  }
16552
16553  protected MedicationRequest parseMedicationRequest(JsonObject json) throws IOException, FHIRFormatError {
16554    MedicationRequest res = new MedicationRequest();
16555    parseMedicationRequestProperties(json, res);
16556    return res;
16557  }
16558
16559  protected void parseMedicationRequestProperties(JsonObject json, MedicationRequest res) throws IOException, FHIRFormatError {
16560    parseDomainResourceProperties(json, res);
16561    if (json.has("identifier")) {
16562      JsonArray array = json.getAsJsonArray("identifier");
16563      for (int i = 0; i < array.size(); i++) {
16564        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16565      }
16566    };
16567    if (json.has("status"))
16568      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationRequest.MedicationRequestStatus.NULL, new MedicationRequest.MedicationRequestStatusEnumFactory()));
16569    if (json.has("_status"))
16570      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16571    if (json.has("statusReason"))
16572      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
16573    if (json.has("intent"))
16574      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), MedicationRequest.MedicationRequestIntent.NULL, new MedicationRequest.MedicationRequestIntentEnumFactory()));
16575    if (json.has("_intent"))
16576      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
16577    if (json.has("category")) {
16578      JsonArray array = json.getAsJsonArray("category");
16579      for (int i = 0; i < array.size(); i++) {
16580        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16581      }
16582    };
16583    if (json.has("priority"))
16584      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), MedicationRequest.MedicationRequestPriority.NULL, new MedicationRequest.MedicationRequestPriorityEnumFactory()));
16585    if (json.has("_priority"))
16586      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
16587    if (json.has("doNotPerform"))
16588      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
16589    if (json.has("_doNotPerform"))
16590      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
16591    Type reported = parseType("reported", json);
16592    if (reported != null)
16593      res.setReported(reported);
16594    Type medication = parseType("medication", json);
16595    if (medication != null)
16596      res.setMedication(medication);
16597    if (json.has("subject"))
16598      res.setSubject(parseReference(json.getAsJsonObject("subject")));
16599    if (json.has("encounter"))
16600      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
16601    if (json.has("supportingInformation")) {
16602      JsonArray array = json.getAsJsonArray("supportingInformation");
16603      for (int i = 0; i < array.size(); i++) {
16604        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
16605      }
16606    };
16607    if (json.has("authoredOn"))
16608      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
16609    if (json.has("_authoredOn"))
16610      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
16611    if (json.has("requester"))
16612      res.setRequester(parseReference(json.getAsJsonObject("requester")));
16613    if (json.has("performer"))
16614      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
16615    if (json.has("performerType"))
16616      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
16617    if (json.has("recorder"))
16618      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
16619    if (json.has("reasonCode")) {
16620      JsonArray array = json.getAsJsonArray("reasonCode");
16621      for (int i = 0; i < array.size(); i++) {
16622        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16623      }
16624    };
16625    if (json.has("reasonReference")) {
16626      JsonArray array = json.getAsJsonArray("reasonReference");
16627      for (int i = 0; i < array.size(); i++) {
16628        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
16629      }
16630    };
16631    if (json.has("instantiatesCanonical")) {
16632      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
16633      for (int i = 0; i < array.size(); i++) {
16634        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
16635      }
16636    };
16637    if (json.has("_instantiatesCanonical")) {
16638      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
16639      for (int i = 0; i < array.size(); i++) {
16640        if (i == res.getInstantiatesCanonical().size())
16641          res.getInstantiatesCanonical().add(parseCanonical(null));
16642        if (array.get(i) instanceof JsonObject) 
16643          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
16644      }
16645    };
16646    if (json.has("instantiatesUri")) {
16647      JsonArray array = json.getAsJsonArray("instantiatesUri");
16648      for (int i = 0; i < array.size(); i++) {
16649        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
16650      }
16651    };
16652    if (json.has("_instantiatesUri")) {
16653      JsonArray array = json.getAsJsonArray("_instantiatesUri");
16654      for (int i = 0; i < array.size(); i++) {
16655        if (i == res.getInstantiatesUri().size())
16656          res.getInstantiatesUri().add(parseUri(null));
16657        if (array.get(i) instanceof JsonObject) 
16658          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
16659      }
16660    };
16661    if (json.has("basedOn")) {
16662      JsonArray array = json.getAsJsonArray("basedOn");
16663      for (int i = 0; i < array.size(); i++) {
16664        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
16665      }
16666    };
16667    if (json.has("groupIdentifier"))
16668      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
16669    if (json.has("courseOfTherapyType"))
16670      res.setCourseOfTherapyType(parseCodeableConcept(json.getAsJsonObject("courseOfTherapyType")));
16671    if (json.has("insurance")) {
16672      JsonArray array = json.getAsJsonArray("insurance");
16673      for (int i = 0; i < array.size(); i++) {
16674        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
16675      }
16676    };
16677    if (json.has("note")) {
16678      JsonArray array = json.getAsJsonArray("note");
16679      for (int i = 0; i < array.size(); i++) {
16680        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16681      }
16682    };
16683    if (json.has("dosageInstruction")) {
16684      JsonArray array = json.getAsJsonArray("dosageInstruction");
16685      for (int i = 0; i < array.size(); i++) {
16686        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
16687      }
16688    };
16689    if (json.has("dispenseRequest"))
16690      res.setDispenseRequest(parseMedicationRequestMedicationRequestDispenseRequestComponent(json.getAsJsonObject("dispenseRequest"), res));
16691    if (json.has("substitution"))
16692      res.setSubstitution(parseMedicationRequestMedicationRequestSubstitutionComponent(json.getAsJsonObject("substitution"), res));
16693    if (json.has("priorPrescription"))
16694      res.setPriorPrescription(parseReference(json.getAsJsonObject("priorPrescription")));
16695    if (json.has("detectedIssue")) {
16696      JsonArray array = json.getAsJsonArray("detectedIssue");
16697      for (int i = 0; i < array.size(); i++) {
16698        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
16699      }
16700    };
16701    if (json.has("eventHistory")) {
16702      JsonArray array = json.getAsJsonArray("eventHistory");
16703      for (int i = 0; i < array.size(); i++) {
16704        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
16705      }
16706    };
16707  }
16708
16709  protected MedicationRequest.MedicationRequestDispenseRequestComponent parseMedicationRequestMedicationRequestDispenseRequestComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
16710    MedicationRequest.MedicationRequestDispenseRequestComponent res = new MedicationRequest.MedicationRequestDispenseRequestComponent();
16711    parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(json, owner, res);
16712    return res;
16713  }
16714
16715  protected void parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestDispenseRequestComponent res) throws IOException, FHIRFormatError {
16716    parseBackboneElementProperties(json, res);
16717    if (json.has("initialFill"))
16718      res.setInitialFill(parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(json.getAsJsonObject("initialFill"), owner));
16719    if (json.has("dispenseInterval"))
16720      res.setDispenseInterval(parseDuration(json.getAsJsonObject("dispenseInterval")));
16721    if (json.has("validityPeriod"))
16722      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
16723    if (json.has("numberOfRepeatsAllowed"))
16724      res.setNumberOfRepeatsAllowedElement(parseUnsignedInt(json.get("numberOfRepeatsAllowed").getAsString()));
16725    if (json.has("_numberOfRepeatsAllowed"))
16726      parseElementProperties(json.getAsJsonObject("_numberOfRepeatsAllowed"), res.getNumberOfRepeatsAllowedElement());
16727    if (json.has("quantity"))
16728      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
16729    if (json.has("expectedSupplyDuration"))
16730      res.setExpectedSupplyDuration(parseDuration(json.getAsJsonObject("expectedSupplyDuration")));
16731    if (json.has("performer"))
16732      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
16733  }
16734
16735  protected MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
16736    MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent res = new MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent();
16737    parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponentProperties(json, owner, res);
16738    return res;
16739  }
16740
16741  protected void parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent res) throws IOException, FHIRFormatError {
16742    parseBackboneElementProperties(json, res);
16743    if (json.has("quantity"))
16744      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
16745    if (json.has("duration"))
16746      res.setDuration(parseDuration(json.getAsJsonObject("duration")));
16747  }
16748
16749  protected MedicationRequest.MedicationRequestSubstitutionComponent parseMedicationRequestMedicationRequestSubstitutionComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
16750    MedicationRequest.MedicationRequestSubstitutionComponent res = new MedicationRequest.MedicationRequestSubstitutionComponent();
16751    parseMedicationRequestMedicationRequestSubstitutionComponentProperties(json, owner, res);
16752    return res;
16753  }
16754
16755  protected void parseMedicationRequestMedicationRequestSubstitutionComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestSubstitutionComponent res) throws IOException, FHIRFormatError {
16756    parseBackboneElementProperties(json, res);
16757    Type allowed = parseType("allowed", json);
16758    if (allowed != null)
16759      res.setAllowed(allowed);
16760    if (json.has("reason"))
16761      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
16762  }
16763
16764  protected MedicationStatement parseMedicationStatement(JsonObject json) throws IOException, FHIRFormatError {
16765    MedicationStatement res = new MedicationStatement();
16766    parseMedicationStatementProperties(json, res);
16767    return res;
16768  }
16769
16770  protected void parseMedicationStatementProperties(JsonObject json, MedicationStatement res) throws IOException, FHIRFormatError {
16771    parseDomainResourceProperties(json, res);
16772    if (json.has("identifier")) {
16773      JsonArray array = json.getAsJsonArray("identifier");
16774      for (int i = 0; i < array.size(); i++) {
16775        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16776      }
16777    };
16778    if (json.has("basedOn")) {
16779      JsonArray array = json.getAsJsonArray("basedOn");
16780      for (int i = 0; i < array.size(); i++) {
16781        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
16782      }
16783    };
16784    if (json.has("partOf")) {
16785      JsonArray array = json.getAsJsonArray("partOf");
16786      for (int i = 0; i < array.size(); i++) {
16787        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
16788      }
16789    };
16790    if (json.has("status"))
16791      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationStatement.MedicationStatementStatus.NULL, new MedicationStatement.MedicationStatementStatusEnumFactory()));
16792    if (json.has("_status"))
16793      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16794    if (json.has("statusReason")) {
16795      JsonArray array = json.getAsJsonArray("statusReason");
16796      for (int i = 0; i < array.size(); i++) {
16797        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16798      }
16799    };
16800    if (json.has("category"))
16801      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
16802    Type medication = parseType("medication", json);
16803    if (medication != null)
16804      res.setMedication(medication);
16805    if (json.has("subject"))
16806      res.setSubject(parseReference(json.getAsJsonObject("subject")));
16807    if (json.has("context"))
16808      res.setContext(parseReference(json.getAsJsonObject("context")));
16809    Type effective = parseType("effective", json);
16810    if (effective != null)
16811      res.setEffective(effective);
16812    if (json.has("dateAsserted"))
16813      res.setDateAssertedElement(parseDateTime(json.get("dateAsserted").getAsString()));
16814    if (json.has("_dateAsserted"))
16815      parseElementProperties(json.getAsJsonObject("_dateAsserted"), res.getDateAssertedElement());
16816    if (json.has("informationSource"))
16817      res.setInformationSource(parseReference(json.getAsJsonObject("informationSource")));
16818    if (json.has("derivedFrom")) {
16819      JsonArray array = json.getAsJsonArray("derivedFrom");
16820      for (int i = 0; i < array.size(); i++) {
16821        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
16822      }
16823    };
16824    if (json.has("reasonCode")) {
16825      JsonArray array = json.getAsJsonArray("reasonCode");
16826      for (int i = 0; i < array.size(); i++) {
16827        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16828      }
16829    };
16830    if (json.has("reasonReference")) {
16831      JsonArray array = json.getAsJsonArray("reasonReference");
16832      for (int i = 0; i < array.size(); i++) {
16833        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
16834      }
16835    };
16836    if (json.has("note")) {
16837      JsonArray array = json.getAsJsonArray("note");
16838      for (int i = 0; i < array.size(); i++) {
16839        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16840      }
16841    };
16842    if (json.has("dosage")) {
16843      JsonArray array = json.getAsJsonArray("dosage");
16844      for (int i = 0; i < array.size(); i++) {
16845        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
16846      }
16847    };
16848  }
16849
16850  protected MedicinalProduct parseMedicinalProduct(JsonObject json) throws IOException, FHIRFormatError {
16851    MedicinalProduct res = new MedicinalProduct();
16852    parseMedicinalProductProperties(json, res);
16853    return res;
16854  }
16855
16856  protected void parseMedicinalProductProperties(JsonObject json, MedicinalProduct res) throws IOException, FHIRFormatError {
16857    parseDomainResourceProperties(json, res);
16858    if (json.has("identifier")) {
16859      JsonArray array = json.getAsJsonArray("identifier");
16860      for (int i = 0; i < array.size(); i++) {
16861        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16862      }
16863    };
16864    if (json.has("type"))
16865      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16866    if (json.has("domain"))
16867      res.setDomain(parseCoding(json.getAsJsonObject("domain")));
16868    if (json.has("combinedPharmaceuticalDoseForm"))
16869      res.setCombinedPharmaceuticalDoseForm(parseCodeableConcept(json.getAsJsonObject("combinedPharmaceuticalDoseForm")));
16870    if (json.has("legalStatusOfSupply"))
16871      res.setLegalStatusOfSupply(parseCodeableConcept(json.getAsJsonObject("legalStatusOfSupply")));
16872    if (json.has("additionalMonitoringIndicator"))
16873      res.setAdditionalMonitoringIndicator(parseCodeableConcept(json.getAsJsonObject("additionalMonitoringIndicator")));
16874    if (json.has("specialMeasures")) {
16875      JsonArray array = json.getAsJsonArray("specialMeasures");
16876      for (int i = 0; i < array.size(); i++) {
16877        res.getSpecialMeasures().add(parseString(array.get(i).getAsString()));
16878      }
16879    };
16880    if (json.has("_specialMeasures")) {
16881      JsonArray array = json.getAsJsonArray("_specialMeasures");
16882      for (int i = 0; i < array.size(); i++) {
16883        if (i == res.getSpecialMeasures().size())
16884          res.getSpecialMeasures().add(parseString(null));
16885        if (array.get(i) instanceof JsonObject) 
16886          parseElementProperties(array.get(i).getAsJsonObject(), res.getSpecialMeasures().get(i));
16887      }
16888    };
16889    if (json.has("paediatricUseIndicator"))
16890      res.setPaediatricUseIndicator(parseCodeableConcept(json.getAsJsonObject("paediatricUseIndicator")));
16891    if (json.has("productClassification")) {
16892      JsonArray array = json.getAsJsonArray("productClassification");
16893      for (int i = 0; i < array.size(); i++) {
16894        res.getProductClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16895      }
16896    };
16897    if (json.has("marketingStatus")) {
16898      JsonArray array = json.getAsJsonArray("marketingStatus");
16899      for (int i = 0; i < array.size(); i++) {
16900        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
16901      }
16902    };
16903    if (json.has("pharmaceuticalProduct")) {
16904      JsonArray array = json.getAsJsonArray("pharmaceuticalProduct");
16905      for (int i = 0; i < array.size(); i++) {
16906        res.getPharmaceuticalProduct().add(parseReference(array.get(i).getAsJsonObject()));
16907      }
16908    };
16909    if (json.has("packagedMedicinalProduct")) {
16910      JsonArray array = json.getAsJsonArray("packagedMedicinalProduct");
16911      for (int i = 0; i < array.size(); i++) {
16912        res.getPackagedMedicinalProduct().add(parseReference(array.get(i).getAsJsonObject()));
16913      }
16914    };
16915    if (json.has("attachedDocument")) {
16916      JsonArray array = json.getAsJsonArray("attachedDocument");
16917      for (int i = 0; i < array.size(); i++) {
16918        res.getAttachedDocument().add(parseReference(array.get(i).getAsJsonObject()));
16919      }
16920    };
16921    if (json.has("masterFile")) {
16922      JsonArray array = json.getAsJsonArray("masterFile");
16923      for (int i = 0; i < array.size(); i++) {
16924        res.getMasterFile().add(parseReference(array.get(i).getAsJsonObject()));
16925      }
16926    };
16927    if (json.has("contact")) {
16928      JsonArray array = json.getAsJsonArray("contact");
16929      for (int i = 0; i < array.size(); i++) {
16930        res.getContact().add(parseReference(array.get(i).getAsJsonObject()));
16931      }
16932    };
16933    if (json.has("clinicalTrial")) {
16934      JsonArray array = json.getAsJsonArray("clinicalTrial");
16935      for (int i = 0; i < array.size(); i++) {
16936        res.getClinicalTrial().add(parseReference(array.get(i).getAsJsonObject()));
16937      }
16938    };
16939    if (json.has("name")) {
16940      JsonArray array = json.getAsJsonArray("name");
16941      for (int i = 0; i < array.size(); i++) {
16942        res.getName().add(parseMedicinalProductMedicinalProductNameComponent(array.get(i).getAsJsonObject(), res));
16943      }
16944    };
16945    if (json.has("crossReference")) {
16946      JsonArray array = json.getAsJsonArray("crossReference");
16947      for (int i = 0; i < array.size(); i++) {
16948        res.getCrossReference().add(parseIdentifier(array.get(i).getAsJsonObject()));
16949      }
16950    };
16951    if (json.has("manufacturingBusinessOperation")) {
16952      JsonArray array = json.getAsJsonArray("manufacturingBusinessOperation");
16953      for (int i = 0; i < array.size(); i++) {
16954        res.getManufacturingBusinessOperation().add(parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(array.get(i).getAsJsonObject(), res));
16955      }
16956    };
16957    if (json.has("specialDesignation")) {
16958      JsonArray array = json.getAsJsonArray("specialDesignation");
16959      for (int i = 0; i < array.size(); i++) {
16960        res.getSpecialDesignation().add(parseMedicinalProductMedicinalProductSpecialDesignationComponent(array.get(i).getAsJsonObject(), res));
16961      }
16962    };
16963  }
16964
16965  protected MedicinalProduct.MedicinalProductNameComponent parseMedicinalProductMedicinalProductNameComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
16966    MedicinalProduct.MedicinalProductNameComponent res = new MedicinalProduct.MedicinalProductNameComponent();
16967    parseMedicinalProductMedicinalProductNameComponentProperties(json, owner, res);
16968    return res;
16969  }
16970
16971  protected void parseMedicinalProductMedicinalProductNameComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductNameComponent res) throws IOException, FHIRFormatError {
16972    parseBackboneElementProperties(json, res);
16973    if (json.has("productName"))
16974      res.setProductNameElement(parseString(json.get("productName").getAsString()));
16975    if (json.has("_productName"))
16976      parseElementProperties(json.getAsJsonObject("_productName"), res.getProductNameElement());
16977    if (json.has("namePart")) {
16978      JsonArray array = json.getAsJsonArray("namePart");
16979      for (int i = 0; i < array.size(); i++) {
16980        res.getNamePart().add(parseMedicinalProductMedicinalProductNameNamePartComponent(array.get(i).getAsJsonObject(), owner));
16981      }
16982    };
16983    if (json.has("countryLanguage")) {
16984      JsonArray array = json.getAsJsonArray("countryLanguage");
16985      for (int i = 0; i < array.size(); i++) {
16986        res.getCountryLanguage().add(parseMedicinalProductMedicinalProductNameCountryLanguageComponent(array.get(i).getAsJsonObject(), owner));
16987      }
16988    };
16989  }
16990
16991  protected MedicinalProduct.MedicinalProductNameNamePartComponent parseMedicinalProductMedicinalProductNameNamePartComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
16992    MedicinalProduct.MedicinalProductNameNamePartComponent res = new MedicinalProduct.MedicinalProductNameNamePartComponent();
16993    parseMedicinalProductMedicinalProductNameNamePartComponentProperties(json, owner, res);
16994    return res;
16995  }
16996
16997  protected void parseMedicinalProductMedicinalProductNameNamePartComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductNameNamePartComponent res) throws IOException, FHIRFormatError {
16998    parseBackboneElementProperties(json, res);
16999    if (json.has("part"))
17000      res.setPartElement(parseString(json.get("part").getAsString()));
17001    if (json.has("_part"))
17002      parseElementProperties(json.getAsJsonObject("_part"), res.getPartElement());
17003    if (json.has("type"))
17004      res.setType(parseCoding(json.getAsJsonObject("type")));
17005  }
17006
17007  protected MedicinalProduct.MedicinalProductNameCountryLanguageComponent parseMedicinalProductMedicinalProductNameCountryLanguageComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
17008    MedicinalProduct.MedicinalProductNameCountryLanguageComponent res = new MedicinalProduct.MedicinalProductNameCountryLanguageComponent();
17009    parseMedicinalProductMedicinalProductNameCountryLanguageComponentProperties(json, owner, res);
17010    return res;
17011  }
17012
17013  protected void parseMedicinalProductMedicinalProductNameCountryLanguageComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductNameCountryLanguageComponent res) throws IOException, FHIRFormatError {
17014    parseBackboneElementProperties(json, res);
17015    if (json.has("country"))
17016      res.setCountry(parseCodeableConcept(json.getAsJsonObject("country")));
17017    if (json.has("jurisdiction"))
17018      res.setJurisdiction(parseCodeableConcept(json.getAsJsonObject("jurisdiction")));
17019    if (json.has("language"))
17020      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
17021  }
17022
17023  protected MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
17024    MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent res = new MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent();
17025    parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponentProperties(json, owner, res);
17026    return res;
17027  }
17028
17029  protected void parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent res) throws IOException, FHIRFormatError {
17030    parseBackboneElementProperties(json, res);
17031    if (json.has("operationType"))
17032      res.setOperationType(parseCodeableConcept(json.getAsJsonObject("operationType")));
17033    if (json.has("authorisationReferenceNumber"))
17034      res.setAuthorisationReferenceNumber(parseIdentifier(json.getAsJsonObject("authorisationReferenceNumber")));
17035    if (json.has("effectiveDate"))
17036      res.setEffectiveDateElement(parseDateTime(json.get("effectiveDate").getAsString()));
17037    if (json.has("_effectiveDate"))
17038      parseElementProperties(json.getAsJsonObject("_effectiveDate"), res.getEffectiveDateElement());
17039    if (json.has("confidentialityIndicator"))
17040      res.setConfidentialityIndicator(parseCodeableConcept(json.getAsJsonObject("confidentialityIndicator")));
17041    if (json.has("manufacturer")) {
17042      JsonArray array = json.getAsJsonArray("manufacturer");
17043      for (int i = 0; i < array.size(); i++) {
17044        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
17045      }
17046    };
17047    if (json.has("regulator"))
17048      res.setRegulator(parseReference(json.getAsJsonObject("regulator")));
17049  }
17050
17051  protected MedicinalProduct.MedicinalProductSpecialDesignationComponent parseMedicinalProductMedicinalProductSpecialDesignationComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
17052    MedicinalProduct.MedicinalProductSpecialDesignationComponent res = new MedicinalProduct.MedicinalProductSpecialDesignationComponent();
17053    parseMedicinalProductMedicinalProductSpecialDesignationComponentProperties(json, owner, res);
17054    return res;
17055  }
17056
17057  protected void parseMedicinalProductMedicinalProductSpecialDesignationComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductSpecialDesignationComponent res) throws IOException, FHIRFormatError {
17058    parseBackboneElementProperties(json, res);
17059    if (json.has("identifier")) {
17060      JsonArray array = json.getAsJsonArray("identifier");
17061      for (int i = 0; i < array.size(); i++) {
17062        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17063      }
17064    };
17065    if (json.has("type"))
17066      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17067    if (json.has("intendedUse"))
17068      res.setIntendedUse(parseCodeableConcept(json.getAsJsonObject("intendedUse")));
17069    Type indication = parseType("indication", json);
17070    if (indication != null)
17071      res.setIndication(indication);
17072    if (json.has("status"))
17073      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
17074    if (json.has("date"))
17075      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17076    if (json.has("_date"))
17077      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
17078    if (json.has("species"))
17079      res.setSpecies(parseCodeableConcept(json.getAsJsonObject("species")));
17080  }
17081
17082  protected MedicinalProductAuthorization parseMedicinalProductAuthorization(JsonObject json) throws IOException, FHIRFormatError {
17083    MedicinalProductAuthorization res = new MedicinalProductAuthorization();
17084    parseMedicinalProductAuthorizationProperties(json, res);
17085    return res;
17086  }
17087
17088  protected void parseMedicinalProductAuthorizationProperties(JsonObject json, MedicinalProductAuthorization res) throws IOException, FHIRFormatError {
17089    parseDomainResourceProperties(json, res);
17090    if (json.has("identifier")) {
17091      JsonArray array = json.getAsJsonArray("identifier");
17092      for (int i = 0; i < array.size(); i++) {
17093        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17094      }
17095    };
17096    if (json.has("subject"))
17097      res.setSubject(parseReference(json.getAsJsonObject("subject")));
17098    if (json.has("country")) {
17099      JsonArray array = json.getAsJsonArray("country");
17100      for (int i = 0; i < array.size(); i++) {
17101        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17102      }
17103    };
17104    if (json.has("jurisdiction")) {
17105      JsonArray array = json.getAsJsonArray("jurisdiction");
17106      for (int i = 0; i < array.size(); i++) {
17107        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17108      }
17109    };
17110    if (json.has("status"))
17111      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
17112    if (json.has("statusDate"))
17113      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
17114    if (json.has("_statusDate"))
17115      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
17116    if (json.has("restoreDate"))
17117      res.setRestoreDateElement(parseDateTime(json.get("restoreDate").getAsString()));
17118    if (json.has("_restoreDate"))
17119      parseElementProperties(json.getAsJsonObject("_restoreDate"), res.getRestoreDateElement());
17120    if (json.has("validityPeriod"))
17121      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
17122    if (json.has("dataExclusivityPeriod"))
17123      res.setDataExclusivityPeriod(parsePeriod(json.getAsJsonObject("dataExclusivityPeriod")));
17124    if (json.has("dateOfFirstAuthorization"))
17125      res.setDateOfFirstAuthorizationElement(parseDateTime(json.get("dateOfFirstAuthorization").getAsString()));
17126    if (json.has("_dateOfFirstAuthorization"))
17127      parseElementProperties(json.getAsJsonObject("_dateOfFirstAuthorization"), res.getDateOfFirstAuthorizationElement());
17128    if (json.has("internationalBirthDate"))
17129      res.setInternationalBirthDateElement(parseDateTime(json.get("internationalBirthDate").getAsString()));
17130    if (json.has("_internationalBirthDate"))
17131      parseElementProperties(json.getAsJsonObject("_internationalBirthDate"), res.getInternationalBirthDateElement());
17132    if (json.has("legalBasis"))
17133      res.setLegalBasis(parseCodeableConcept(json.getAsJsonObject("legalBasis")));
17134    if (json.has("jurisdictionalAuthorization")) {
17135      JsonArray array = json.getAsJsonArray("jurisdictionalAuthorization");
17136      for (int i = 0; i < array.size(); i++) {
17137        res.getJurisdictionalAuthorization().add(parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(array.get(i).getAsJsonObject(), res));
17138      }
17139    };
17140    if (json.has("holder"))
17141      res.setHolder(parseReference(json.getAsJsonObject("holder")));
17142    if (json.has("regulator"))
17143      res.setRegulator(parseReference(json.getAsJsonObject("regulator")));
17144    if (json.has("procedure"))
17145      res.setProcedure(parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(json.getAsJsonObject("procedure"), res));
17146  }
17147
17148  protected MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(JsonObject json, MedicinalProductAuthorization owner) throws IOException, FHIRFormatError {
17149    MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent res = new MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent();
17150    parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentProperties(json, owner, res);
17151    return res;
17152  }
17153
17154  protected void parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentProperties(JsonObject json, MedicinalProductAuthorization owner, MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent res) throws IOException, FHIRFormatError {
17155    parseBackboneElementProperties(json, res);
17156    if (json.has("identifier")) {
17157      JsonArray array = json.getAsJsonArray("identifier");
17158      for (int i = 0; i < array.size(); i++) {
17159        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17160      }
17161    };
17162    if (json.has("country"))
17163      res.setCountry(parseCodeableConcept(json.getAsJsonObject("country")));
17164    if (json.has("jurisdiction")) {
17165      JsonArray array = json.getAsJsonArray("jurisdiction");
17166      for (int i = 0; i < array.size(); i++) {
17167        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17168      }
17169    };
17170    if (json.has("legalStatusOfSupply"))
17171      res.setLegalStatusOfSupply(parseCodeableConcept(json.getAsJsonObject("legalStatusOfSupply")));
17172    if (json.has("validityPeriod"))
17173      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
17174  }
17175
17176  protected MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(JsonObject json, MedicinalProductAuthorization owner) throws IOException, FHIRFormatError {
17177    MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent res = new MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent();
17178    parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentProperties(json, owner, res);
17179    return res;
17180  }
17181
17182  protected void parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentProperties(JsonObject json, MedicinalProductAuthorization owner, MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent res) throws IOException, FHIRFormatError {
17183    parseBackboneElementProperties(json, res);
17184    if (json.has("identifier"))
17185      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
17186    if (json.has("type"))
17187      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17188    Type date = parseType("date", json);
17189    if (date != null)
17190      res.setDate(date);
17191    if (json.has("application")) {
17192      JsonArray array = json.getAsJsonArray("application");
17193      for (int i = 0; i < array.size(); i++) {
17194        res.getApplication().add(parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(array.get(i).getAsJsonObject(), owner));
17195      }
17196    };
17197  }
17198
17199  protected MedicinalProductContraindication parseMedicinalProductContraindication(JsonObject json) throws IOException, FHIRFormatError {
17200    MedicinalProductContraindication res = new MedicinalProductContraindication();
17201    parseMedicinalProductContraindicationProperties(json, res);
17202    return res;
17203  }
17204
17205  protected void parseMedicinalProductContraindicationProperties(JsonObject json, MedicinalProductContraindication res) throws IOException, FHIRFormatError {
17206    parseDomainResourceProperties(json, res);
17207    if (json.has("subject")) {
17208      JsonArray array = json.getAsJsonArray("subject");
17209      for (int i = 0; i < array.size(); i++) {
17210        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
17211      }
17212    };
17213    if (json.has("disease"))
17214      res.setDisease(parseCodeableConcept(json.getAsJsonObject("disease")));
17215    if (json.has("diseaseStatus"))
17216      res.setDiseaseStatus(parseCodeableConcept(json.getAsJsonObject("diseaseStatus")));
17217    if (json.has("comorbidity")) {
17218      JsonArray array = json.getAsJsonArray("comorbidity");
17219      for (int i = 0; i < array.size(); i++) {
17220        res.getComorbidity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17221      }
17222    };
17223    if (json.has("therapeuticIndication")) {
17224      JsonArray array = json.getAsJsonArray("therapeuticIndication");
17225      for (int i = 0; i < array.size(); i++) {
17226        res.getTherapeuticIndication().add(parseReference(array.get(i).getAsJsonObject()));
17227      }
17228    };
17229    if (json.has("otherTherapy")) {
17230      JsonArray array = json.getAsJsonArray("otherTherapy");
17231      for (int i = 0; i < array.size(); i++) {
17232        res.getOtherTherapy().add(parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(array.get(i).getAsJsonObject(), res));
17233      }
17234    };
17235    if (json.has("population")) {
17236      JsonArray array = json.getAsJsonArray("population");
17237      for (int i = 0; i < array.size(); i++) {
17238        res.getPopulation().add(parsePopulation(array.get(i).getAsJsonObject()));
17239      }
17240    };
17241  }
17242
17243  protected MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(JsonObject json, MedicinalProductContraindication owner) throws IOException, FHIRFormatError {
17244    MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent res = new MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent();
17245    parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentProperties(json, owner, res);
17246    return res;
17247  }
17248
17249  protected void parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentProperties(JsonObject json, MedicinalProductContraindication owner, MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent res) throws IOException, FHIRFormatError {
17250    parseBackboneElementProperties(json, res);
17251    if (json.has("therapyRelationshipType"))
17252      res.setTherapyRelationshipType(parseCodeableConcept(json.getAsJsonObject("therapyRelationshipType")));
17253    Type medication = parseType("medication", json);
17254    if (medication != null)
17255      res.setMedication(medication);
17256  }
17257
17258  protected MedicinalProductIndication parseMedicinalProductIndication(JsonObject json) throws IOException, FHIRFormatError {
17259    MedicinalProductIndication res = new MedicinalProductIndication();
17260    parseMedicinalProductIndicationProperties(json, res);
17261    return res;
17262  }
17263
17264  protected void parseMedicinalProductIndicationProperties(JsonObject json, MedicinalProductIndication res) throws IOException, FHIRFormatError {
17265    parseDomainResourceProperties(json, res);
17266    if (json.has("subject")) {
17267      JsonArray array = json.getAsJsonArray("subject");
17268      for (int i = 0; i < array.size(); i++) {
17269        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
17270      }
17271    };
17272    if (json.has("diseaseSymptomProcedure"))
17273      res.setDiseaseSymptomProcedure(parseCodeableConcept(json.getAsJsonObject("diseaseSymptomProcedure")));
17274    if (json.has("diseaseStatus"))
17275      res.setDiseaseStatus(parseCodeableConcept(json.getAsJsonObject("diseaseStatus")));
17276    if (json.has("comorbidity")) {
17277      JsonArray array = json.getAsJsonArray("comorbidity");
17278      for (int i = 0; i < array.size(); i++) {
17279        res.getComorbidity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17280      }
17281    };
17282    if (json.has("intendedEffect"))
17283      res.setIntendedEffect(parseCodeableConcept(json.getAsJsonObject("intendedEffect")));
17284    if (json.has("duration"))
17285      res.setDuration(parseQuantity(json.getAsJsonObject("duration")));
17286    if (json.has("otherTherapy")) {
17287      JsonArray array = json.getAsJsonArray("otherTherapy");
17288      for (int i = 0; i < array.size(); i++) {
17289        res.getOtherTherapy().add(parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(array.get(i).getAsJsonObject(), res));
17290      }
17291    };
17292    if (json.has("undesirableEffect")) {
17293      JsonArray array = json.getAsJsonArray("undesirableEffect");
17294      for (int i = 0; i < array.size(); i++) {
17295        res.getUndesirableEffect().add(parseReference(array.get(i).getAsJsonObject()));
17296      }
17297    };
17298    if (json.has("population")) {
17299      JsonArray array = json.getAsJsonArray("population");
17300      for (int i = 0; i < array.size(); i++) {
17301        res.getPopulation().add(parsePopulation(array.get(i).getAsJsonObject()));
17302      }
17303    };
17304  }
17305
17306  protected MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(JsonObject json, MedicinalProductIndication owner) throws IOException, FHIRFormatError {
17307    MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent res = new MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent();
17308    parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentProperties(json, owner, res);
17309    return res;
17310  }
17311
17312  protected void parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentProperties(JsonObject json, MedicinalProductIndication owner, MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent res) throws IOException, FHIRFormatError {
17313    parseBackboneElementProperties(json, res);
17314    if (json.has("therapyRelationshipType"))
17315      res.setTherapyRelationshipType(parseCodeableConcept(json.getAsJsonObject("therapyRelationshipType")));
17316    Type medication = parseType("medication", json);
17317    if (medication != null)
17318      res.setMedication(medication);
17319  }
17320
17321  protected MedicinalProductIngredient parseMedicinalProductIngredient(JsonObject json) throws IOException, FHIRFormatError {
17322    MedicinalProductIngredient res = new MedicinalProductIngredient();
17323    parseMedicinalProductIngredientProperties(json, res);
17324    return res;
17325  }
17326
17327  protected void parseMedicinalProductIngredientProperties(JsonObject json, MedicinalProductIngredient res) throws IOException, FHIRFormatError {
17328    parseDomainResourceProperties(json, res);
17329    if (json.has("identifier"))
17330      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
17331    if (json.has("role"))
17332      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
17333    if (json.has("allergenicIndicator"))
17334      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
17335    if (json.has("_allergenicIndicator"))
17336      parseElementProperties(json.getAsJsonObject("_allergenicIndicator"), res.getAllergenicIndicatorElement());
17337    if (json.has("manufacturer")) {
17338      JsonArray array = json.getAsJsonArray("manufacturer");
17339      for (int i = 0; i < array.size(); i++) {
17340        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
17341      }
17342    };
17343    if (json.has("specifiedSubstance")) {
17344      JsonArray array = json.getAsJsonArray("specifiedSubstance");
17345      for (int i = 0; i < array.size(); i++) {
17346        res.getSpecifiedSubstance().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(array.get(i).getAsJsonObject(), res));
17347      }
17348    };
17349    if (json.has("substance"))
17350      res.setSubstance(parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(json.getAsJsonObject("substance"), res));
17351  }
17352
17353  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
17354    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent();
17355    parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentProperties(json, owner, res);
17356    return res;
17357  }
17358
17359  protected void parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent res) throws IOException, FHIRFormatError {
17360    parseBackboneElementProperties(json, res);
17361    if (json.has("code"))
17362      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17363    if (json.has("group"))
17364      res.setGroup(parseCodeableConcept(json.getAsJsonObject("group")));
17365    if (json.has("confidentiality"))
17366      res.setConfidentiality(parseCodeableConcept(json.getAsJsonObject("confidentiality")));
17367    if (json.has("strength")) {
17368      JsonArray array = json.getAsJsonArray("strength");
17369      for (int i = 0; i < array.size(); i++) {
17370        res.getStrength().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(array.get(i).getAsJsonObject(), owner));
17371      }
17372    };
17373  }
17374
17375  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
17376    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent();
17377    parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentProperties(json, owner, res);
17378    return res;
17379  }
17380
17381  protected void parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent res) throws IOException, FHIRFormatError {
17382    parseBackboneElementProperties(json, res);
17383    if (json.has("presentation"))
17384      res.setPresentation(parseRatio(json.getAsJsonObject("presentation")));
17385    if (json.has("presentationLowLimit"))
17386      res.setPresentationLowLimit(parseRatio(json.getAsJsonObject("presentationLowLimit")));
17387    if (json.has("concentration"))
17388      res.setConcentration(parseRatio(json.getAsJsonObject("concentration")));
17389    if (json.has("concentrationLowLimit"))
17390      res.setConcentrationLowLimit(parseRatio(json.getAsJsonObject("concentrationLowLimit")));
17391    if (json.has("measurementPoint"))
17392      res.setMeasurementPointElement(parseString(json.get("measurementPoint").getAsString()));
17393    if (json.has("_measurementPoint"))
17394      parseElementProperties(json.getAsJsonObject("_measurementPoint"), res.getMeasurementPointElement());
17395    if (json.has("country")) {
17396      JsonArray array = json.getAsJsonArray("country");
17397      for (int i = 0; i < array.size(); i++) {
17398        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17399      }
17400    };
17401    if (json.has("referenceStrength")) {
17402      JsonArray array = json.getAsJsonArray("referenceStrength");
17403      for (int i = 0; i < array.size(); i++) {
17404        res.getReferenceStrength().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(array.get(i).getAsJsonObject(), owner));
17405      }
17406    };
17407  }
17408
17409  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
17410    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent();
17411    parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentProperties(json, owner, res);
17412    return res;
17413  }
17414
17415  protected void parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent res) throws IOException, FHIRFormatError {
17416    parseBackboneElementProperties(json, res);
17417    if (json.has("substance"))
17418      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
17419    if (json.has("strength"))
17420      res.setStrength(parseRatio(json.getAsJsonObject("strength")));
17421    if (json.has("strengthLowLimit"))
17422      res.setStrengthLowLimit(parseRatio(json.getAsJsonObject("strengthLowLimit")));
17423    if (json.has("measurementPoint"))
17424      res.setMeasurementPointElement(parseString(json.get("measurementPoint").getAsString()));
17425    if (json.has("_measurementPoint"))
17426      parseElementProperties(json.getAsJsonObject("_measurementPoint"), res.getMeasurementPointElement());
17427    if (json.has("country")) {
17428      JsonArray array = json.getAsJsonArray("country");
17429      for (int i = 0; i < array.size(); i++) {
17430        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17431      }
17432    };
17433  }
17434
17435  protected MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
17436    MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent();
17437    parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentProperties(json, owner, res);
17438    return res;
17439  }
17440
17441  protected void parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent res) throws IOException, FHIRFormatError {
17442    parseBackboneElementProperties(json, res);
17443    if (json.has("code"))
17444      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17445    if (json.has("strength")) {
17446      JsonArray array = json.getAsJsonArray("strength");
17447      for (int i = 0; i < array.size(); i++) {
17448        res.getStrength().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(array.get(i).getAsJsonObject(), owner));
17449      }
17450    };
17451  }
17452
17453  protected MedicinalProductInteraction parseMedicinalProductInteraction(JsonObject json) throws IOException, FHIRFormatError {
17454    MedicinalProductInteraction res = new MedicinalProductInteraction();
17455    parseMedicinalProductInteractionProperties(json, res);
17456    return res;
17457  }
17458
17459  protected void parseMedicinalProductInteractionProperties(JsonObject json, MedicinalProductInteraction res) throws IOException, FHIRFormatError {
17460    parseDomainResourceProperties(json, res);
17461    if (json.has("subject")) {
17462      JsonArray array = json.getAsJsonArray("subject");
17463      for (int i = 0; i < array.size(); i++) {
17464        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
17465      }
17466    };
17467    if (json.has("description"))
17468      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17469    if (json.has("_description"))
17470      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17471    if (json.has("interactant")) {
17472      JsonArray array = json.getAsJsonArray("interactant");
17473      for (int i = 0; i < array.size(); i++) {
17474        res.getInteractant().add(parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(array.get(i).getAsJsonObject(), res));
17475      }
17476    };
17477    if (json.has("type"))
17478      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17479    if (json.has("effect"))
17480      res.setEffect(parseCodeableConcept(json.getAsJsonObject("effect")));
17481    if (json.has("incidence"))
17482      res.setIncidence(parseCodeableConcept(json.getAsJsonObject("incidence")));
17483    if (json.has("management"))
17484      res.setManagement(parseCodeableConcept(json.getAsJsonObject("management")));
17485  }
17486
17487  protected MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(JsonObject json, MedicinalProductInteraction owner) throws IOException, FHIRFormatError {
17488    MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent res = new MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent();
17489    parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponentProperties(json, owner, res);
17490    return res;
17491  }
17492
17493  protected void parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponentProperties(JsonObject json, MedicinalProductInteraction owner, MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent res) throws IOException, FHIRFormatError {
17494    parseBackboneElementProperties(json, res);
17495    Type item = parseType("item", json);
17496    if (item != null)
17497      res.setItem(item);
17498  }
17499
17500  protected MedicinalProductManufactured parseMedicinalProductManufactured(JsonObject json) throws IOException, FHIRFormatError {
17501    MedicinalProductManufactured res = new MedicinalProductManufactured();
17502    parseMedicinalProductManufacturedProperties(json, res);
17503    return res;
17504  }
17505
17506  protected void parseMedicinalProductManufacturedProperties(JsonObject json, MedicinalProductManufactured res) throws IOException, FHIRFormatError {
17507    parseDomainResourceProperties(json, res);
17508    if (json.has("manufacturedDoseForm"))
17509      res.setManufacturedDoseForm(parseCodeableConcept(json.getAsJsonObject("manufacturedDoseForm")));
17510    if (json.has("unitOfPresentation"))
17511      res.setUnitOfPresentation(parseCodeableConcept(json.getAsJsonObject("unitOfPresentation")));
17512    if (json.has("quantity"))
17513      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
17514    if (json.has("manufacturer")) {
17515      JsonArray array = json.getAsJsonArray("manufacturer");
17516      for (int i = 0; i < array.size(); i++) {
17517        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
17518      }
17519    };
17520    if (json.has("ingredient")) {
17521      JsonArray array = json.getAsJsonArray("ingredient");
17522      for (int i = 0; i < array.size(); i++) {
17523        res.getIngredient().add(parseReference(array.get(i).getAsJsonObject()));
17524      }
17525    };
17526    if (json.has("physicalCharacteristics"))
17527      res.setPhysicalCharacteristics(parseProdCharacteristic(json.getAsJsonObject("physicalCharacteristics")));
17528    if (json.has("otherCharacteristics")) {
17529      JsonArray array = json.getAsJsonArray("otherCharacteristics");
17530      for (int i = 0; i < array.size(); i++) {
17531        res.getOtherCharacteristics().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17532      }
17533    };
17534  }
17535
17536  protected MedicinalProductPackaged parseMedicinalProductPackaged(JsonObject json) throws IOException, FHIRFormatError {
17537    MedicinalProductPackaged res = new MedicinalProductPackaged();
17538    parseMedicinalProductPackagedProperties(json, res);
17539    return res;
17540  }
17541
17542  protected void parseMedicinalProductPackagedProperties(JsonObject json, MedicinalProductPackaged res) throws IOException, FHIRFormatError {
17543    parseDomainResourceProperties(json, res);
17544    if (json.has("identifier")) {
17545      JsonArray array = json.getAsJsonArray("identifier");
17546      for (int i = 0; i < array.size(); i++) {
17547        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17548      }
17549    };
17550    if (json.has("subject")) {
17551      JsonArray array = json.getAsJsonArray("subject");
17552      for (int i = 0; i < array.size(); i++) {
17553        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
17554      }
17555    };
17556    if (json.has("description"))
17557      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17558    if (json.has("_description"))
17559      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17560    if (json.has("legalStatusOfSupply"))
17561      res.setLegalStatusOfSupply(parseCodeableConcept(json.getAsJsonObject("legalStatusOfSupply")));
17562    if (json.has("marketingStatus")) {
17563      JsonArray array = json.getAsJsonArray("marketingStatus");
17564      for (int i = 0; i < array.size(); i++) {
17565        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
17566      }
17567    };
17568    if (json.has("marketingAuthorization"))
17569      res.setMarketingAuthorization(parseReference(json.getAsJsonObject("marketingAuthorization")));
17570    if (json.has("manufacturer")) {
17571      JsonArray array = json.getAsJsonArray("manufacturer");
17572      for (int i = 0; i < array.size(); i++) {
17573        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
17574      }
17575    };
17576    if (json.has("batchIdentifier")) {
17577      JsonArray array = json.getAsJsonArray("batchIdentifier");
17578      for (int i = 0; i < array.size(); i++) {
17579        res.getBatchIdentifier().add(parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(array.get(i).getAsJsonObject(), res));
17580      }
17581    };
17582    if (json.has("packageItem")) {
17583      JsonArray array = json.getAsJsonArray("packageItem");
17584      for (int i = 0; i < array.size(); i++) {
17585        res.getPackageItem().add(parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(array.get(i).getAsJsonObject(), res));
17586      }
17587    };
17588  }
17589
17590  protected MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(JsonObject json, MedicinalProductPackaged owner) throws IOException, FHIRFormatError {
17591    MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent res = new MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent();
17592    parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentProperties(json, owner, res);
17593    return res;
17594  }
17595
17596  protected void parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentProperties(JsonObject json, MedicinalProductPackaged owner, MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent res) throws IOException, FHIRFormatError {
17597    parseBackboneElementProperties(json, res);
17598    if (json.has("outerPackaging"))
17599      res.setOuterPackaging(parseIdentifier(json.getAsJsonObject("outerPackaging")));
17600    if (json.has("immediatePackaging"))
17601      res.setImmediatePackaging(parseIdentifier(json.getAsJsonObject("immediatePackaging")));
17602  }
17603
17604  protected MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(JsonObject json, MedicinalProductPackaged owner) throws IOException, FHIRFormatError {
17605    MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent res = new MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent();
17606    parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentProperties(json, owner, res);
17607    return res;
17608  }
17609
17610  protected void parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentProperties(JsonObject json, MedicinalProductPackaged owner, MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent res) throws IOException, FHIRFormatError {
17611    parseBackboneElementProperties(json, res);
17612    if (json.has("identifier")) {
17613      JsonArray array = json.getAsJsonArray("identifier");
17614      for (int i = 0; i < array.size(); i++) {
17615        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17616      }
17617    };
17618    if (json.has("type"))
17619      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17620    if (json.has("quantity"))
17621      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
17622    if (json.has("material")) {
17623      JsonArray array = json.getAsJsonArray("material");
17624      for (int i = 0; i < array.size(); i++) {
17625        res.getMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17626      }
17627    };
17628    if (json.has("alternateMaterial")) {
17629      JsonArray array = json.getAsJsonArray("alternateMaterial");
17630      for (int i = 0; i < array.size(); i++) {
17631        res.getAlternateMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17632      }
17633    };
17634    if (json.has("device")) {
17635      JsonArray array = json.getAsJsonArray("device");
17636      for (int i = 0; i < array.size(); i++) {
17637        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
17638      }
17639    };
17640    if (json.has("manufacturedItem")) {
17641      JsonArray array = json.getAsJsonArray("manufacturedItem");
17642      for (int i = 0; i < array.size(); i++) {
17643        res.getManufacturedItem().add(parseReference(array.get(i).getAsJsonObject()));
17644      }
17645    };
17646    if (json.has("packageItem")) {
17647      JsonArray array = json.getAsJsonArray("packageItem");
17648      for (int i = 0; i < array.size(); i++) {
17649        res.getPackageItem().add(parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(array.get(i).getAsJsonObject(), owner));
17650      }
17651    };
17652    if (json.has("physicalCharacteristics"))
17653      res.setPhysicalCharacteristics(parseProdCharacteristic(json.getAsJsonObject("physicalCharacteristics")));
17654    if (json.has("otherCharacteristics")) {
17655      JsonArray array = json.getAsJsonArray("otherCharacteristics");
17656      for (int i = 0; i < array.size(); i++) {
17657        res.getOtherCharacteristics().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17658      }
17659    };
17660    if (json.has("shelfLifeStorage")) {
17661      JsonArray array = json.getAsJsonArray("shelfLifeStorage");
17662      for (int i = 0; i < array.size(); i++) {
17663        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
17664      }
17665    };
17666    if (json.has("manufacturer")) {
17667      JsonArray array = json.getAsJsonArray("manufacturer");
17668      for (int i = 0; i < array.size(); i++) {
17669        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
17670      }
17671    };
17672  }
17673
17674  protected MedicinalProductPharmaceutical parseMedicinalProductPharmaceutical(JsonObject json) throws IOException, FHIRFormatError {
17675    MedicinalProductPharmaceutical res = new MedicinalProductPharmaceutical();
17676    parseMedicinalProductPharmaceuticalProperties(json, res);
17677    return res;
17678  }
17679
17680  protected void parseMedicinalProductPharmaceuticalProperties(JsonObject json, MedicinalProductPharmaceutical res) throws IOException, FHIRFormatError {
17681    parseDomainResourceProperties(json, res);
17682    if (json.has("identifier")) {
17683      JsonArray array = json.getAsJsonArray("identifier");
17684      for (int i = 0; i < array.size(); i++) {
17685        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17686      }
17687    };
17688    if (json.has("administrableDoseForm"))
17689      res.setAdministrableDoseForm(parseCodeableConcept(json.getAsJsonObject("administrableDoseForm")));
17690    if (json.has("unitOfPresentation"))
17691      res.setUnitOfPresentation(parseCodeableConcept(json.getAsJsonObject("unitOfPresentation")));
17692    if (json.has("ingredient")) {
17693      JsonArray array = json.getAsJsonArray("ingredient");
17694      for (int i = 0; i < array.size(); i++) {
17695        res.getIngredient().add(parseReference(array.get(i).getAsJsonObject()));
17696      }
17697    };
17698    if (json.has("device")) {
17699      JsonArray array = json.getAsJsonArray("device");
17700      for (int i = 0; i < array.size(); i++) {
17701        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
17702      }
17703    };
17704    if (json.has("characteristics")) {
17705      JsonArray array = json.getAsJsonArray("characteristics");
17706      for (int i = 0; i < array.size(); i++) {
17707        res.getCharacteristics().add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(array.get(i).getAsJsonObject(), res));
17708      }
17709    };
17710    if (json.has("routeOfAdministration")) {
17711      JsonArray array = json.getAsJsonArray("routeOfAdministration");
17712      for (int i = 0; i < array.size(); i++) {
17713        res.getRouteOfAdministration().add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(array.get(i).getAsJsonObject(), res));
17714      }
17715    };
17716  }
17717
17718  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
17719    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent();
17720    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentProperties(json, owner, res);
17721    return res;
17722  }
17723
17724  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentProperties(JsonObject json, MedicinalProductPharmaceutical owner, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent res) throws IOException, FHIRFormatError {
17725    parseBackboneElementProperties(json, res);
17726    if (json.has("code"))
17727      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17728    if (json.has("status"))
17729      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
17730  }
17731
17732  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
17733    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent();
17734    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentProperties(json, owner, res);
17735    return res;
17736  }
17737
17738  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentProperties(JsonObject json, MedicinalProductPharmaceutical owner, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent res) throws IOException, FHIRFormatError {
17739    parseBackboneElementProperties(json, res);
17740    if (json.has("code"))
17741      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17742    if (json.has("firstDose"))
17743      res.setFirstDose(parseQuantity(json.getAsJsonObject("firstDose")));
17744    if (json.has("maxSingleDose"))
17745      res.setMaxSingleDose(parseQuantity(json.getAsJsonObject("maxSingleDose")));
17746    if (json.has("maxDosePerDay"))
17747      res.setMaxDosePerDay(parseQuantity(json.getAsJsonObject("maxDosePerDay")));
17748    if (json.has("maxDosePerTreatmentPeriod"))
17749      res.setMaxDosePerTreatmentPeriod(parseRatio(json.getAsJsonObject("maxDosePerTreatmentPeriod")));
17750    if (json.has("maxTreatmentPeriod"))
17751      res.setMaxTreatmentPeriod(parseDuration(json.getAsJsonObject("maxTreatmentPeriod")));
17752    if (json.has("targetSpecies")) {
17753      JsonArray array = json.getAsJsonArray("targetSpecies");
17754      for (int i = 0; i < array.size(); i++) {
17755        res.getTargetSpecies().add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(array.get(i).getAsJsonObject(), owner));
17756      }
17757    };
17758  }
17759
17760  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
17761    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent();
17762    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentProperties(json, owner, res);
17763    return res;
17764  }
17765
17766  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentProperties(JsonObject json, MedicinalProductPharmaceutical owner, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent res) throws IOException, FHIRFormatError {
17767    parseBackboneElementProperties(json, res);
17768    if (json.has("code"))
17769      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17770    if (json.has("withdrawalPeriod")) {
17771      JsonArray array = json.getAsJsonArray("withdrawalPeriod");
17772      for (int i = 0; i < array.size(); i++) {
17773        res.getWithdrawalPeriod().add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(array.get(i).getAsJsonObject(), owner));
17774      }
17775    };
17776  }
17777
17778  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
17779    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent();
17780    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(json, owner, res);
17781    return res;
17782  }
17783
17784  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(JsonObject json, MedicinalProductPharmaceutical owner, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res) throws IOException, FHIRFormatError {
17785    parseBackboneElementProperties(json, res);
17786    if (json.has("tissue"))
17787      res.setTissue(parseCodeableConcept(json.getAsJsonObject("tissue")));
17788    if (json.has("value"))
17789      res.setValue(parseQuantity(json.getAsJsonObject("value")));
17790    if (json.has("supportingInformation"))
17791      res.setSupportingInformationElement(parseString(json.get("supportingInformation").getAsString()));
17792    if (json.has("_supportingInformation"))
17793      parseElementProperties(json.getAsJsonObject("_supportingInformation"), res.getSupportingInformationElement());
17794  }
17795
17796  protected MedicinalProductUndesirableEffect parseMedicinalProductUndesirableEffect(JsonObject json) throws IOException, FHIRFormatError {
17797    MedicinalProductUndesirableEffect res = new MedicinalProductUndesirableEffect();
17798    parseMedicinalProductUndesirableEffectProperties(json, res);
17799    return res;
17800  }
17801
17802  protected void parseMedicinalProductUndesirableEffectProperties(JsonObject json, MedicinalProductUndesirableEffect res) throws IOException, FHIRFormatError {
17803    parseDomainResourceProperties(json, res);
17804    if (json.has("subject")) {
17805      JsonArray array = json.getAsJsonArray("subject");
17806      for (int i = 0; i < array.size(); i++) {
17807        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
17808      }
17809    };
17810    if (json.has("symptomConditionEffect"))
17811      res.setSymptomConditionEffect(parseCodeableConcept(json.getAsJsonObject("symptomConditionEffect")));
17812    if (json.has("classification"))
17813      res.setClassification(parseCodeableConcept(json.getAsJsonObject("classification")));
17814    if (json.has("frequencyOfOccurrence"))
17815      res.setFrequencyOfOccurrence(parseCodeableConcept(json.getAsJsonObject("frequencyOfOccurrence")));
17816    if (json.has("population")) {
17817      JsonArray array = json.getAsJsonArray("population");
17818      for (int i = 0; i < array.size(); i++) {
17819        res.getPopulation().add(parsePopulation(array.get(i).getAsJsonObject()));
17820      }
17821    };
17822  }
17823
17824  protected MessageDefinition parseMessageDefinition(JsonObject json) throws IOException, FHIRFormatError {
17825    MessageDefinition res = new MessageDefinition();
17826    parseMessageDefinitionProperties(json, res);
17827    return res;
17828  }
17829
17830  protected void parseMessageDefinitionProperties(JsonObject json, MessageDefinition res) throws IOException, FHIRFormatError {
17831    parseDomainResourceProperties(json, res);
17832    if (json.has("url"))
17833      res.setUrlElement(parseUri(json.get("url").getAsString()));
17834    if (json.has("_url"))
17835      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
17836    if (json.has("identifier")) {
17837      JsonArray array = json.getAsJsonArray("identifier");
17838      for (int i = 0; i < array.size(); i++) {
17839        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17840      }
17841    };
17842    if (json.has("version"))
17843      res.setVersionElement(parseString(json.get("version").getAsString()));
17844    if (json.has("_version"))
17845      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
17846    if (json.has("name"))
17847      res.setNameElement(parseString(json.get("name").getAsString()));
17848    if (json.has("_name"))
17849      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17850    if (json.has("title"))
17851      res.setTitleElement(parseString(json.get("title").getAsString()));
17852    if (json.has("_title"))
17853      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
17854    if (json.has("replaces")) {
17855      JsonArray array = json.getAsJsonArray("replaces");
17856      for (int i = 0; i < array.size(); i++) {
17857        res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
17858      }
17859    };
17860    if (json.has("_replaces")) {
17861      JsonArray array = json.getAsJsonArray("_replaces");
17862      for (int i = 0; i < array.size(); i++) {
17863        if (i == res.getReplaces().size())
17864          res.getReplaces().add(parseCanonical(null));
17865        if (array.get(i) instanceof JsonObject) 
17866          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
17867      }
17868    };
17869    if (json.has("status"))
17870      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
17871    if (json.has("_status"))
17872      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17873    if (json.has("experimental"))
17874      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
17875    if (json.has("_experimental"))
17876      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
17877    if (json.has("date"))
17878      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17879    if (json.has("_date"))
17880      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
17881    if (json.has("publisher"))
17882      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
17883    if (json.has("_publisher"))
17884      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
17885    if (json.has("contact")) {
17886      JsonArray array = json.getAsJsonArray("contact");
17887      for (int i = 0; i < array.size(); i++) {
17888        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
17889      }
17890    };
17891    if (json.has("description"))
17892      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
17893    if (json.has("_description"))
17894      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17895    if (json.has("useContext")) {
17896      JsonArray array = json.getAsJsonArray("useContext");
17897      for (int i = 0; i < array.size(); i++) {
17898        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
17899      }
17900    };
17901    if (json.has("jurisdiction")) {
17902      JsonArray array = json.getAsJsonArray("jurisdiction");
17903      for (int i = 0; i < array.size(); i++) {
17904        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17905      }
17906    };
17907    if (json.has("purpose"))
17908      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
17909    if (json.has("_purpose"))
17910      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
17911    if (json.has("copyright"))
17912      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
17913    if (json.has("_copyright"))
17914      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
17915    if (json.has("base"))
17916      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
17917    if (json.has("_base"))
17918      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
17919    if (json.has("parent")) {
17920      JsonArray array = json.getAsJsonArray("parent");
17921      for (int i = 0; i < array.size(); i++) {
17922        res.getParent().add(parseCanonical(array.get(i).getAsString()));
17923      }
17924    };
17925    if (json.has("_parent")) {
17926      JsonArray array = json.getAsJsonArray("_parent");
17927      for (int i = 0; i < array.size(); i++) {
17928        if (i == res.getParent().size())
17929          res.getParent().add(parseCanonical(null));
17930        if (array.get(i) instanceof JsonObject) 
17931          parseElementProperties(array.get(i).getAsJsonObject(), res.getParent().get(i));
17932      }
17933    };
17934    Type event = parseType("event", json);
17935    if (event != null)
17936      res.setEvent(event);
17937    if (json.has("category"))
17938      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), MessageDefinition.MessageSignificanceCategory.NULL, new MessageDefinition.MessageSignificanceCategoryEnumFactory()));
17939    if (json.has("_category"))
17940      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
17941    if (json.has("focus")) {
17942      JsonArray array = json.getAsJsonArray("focus");
17943      for (int i = 0; i < array.size(); i++) {
17944        res.getFocus().add(parseMessageDefinitionMessageDefinitionFocusComponent(array.get(i).getAsJsonObject(), res));
17945      }
17946    };
17947    if (json.has("responseRequired"))
17948      res.setResponseRequiredElement(parseEnumeration(json.get("responseRequired").getAsString(), MessageDefinition.MessageheaderResponseRequest.NULL, new MessageDefinition.MessageheaderResponseRequestEnumFactory()));
17949    if (json.has("_responseRequired"))
17950      parseElementProperties(json.getAsJsonObject("_responseRequired"), res.getResponseRequiredElement());
17951    if (json.has("allowedResponse")) {
17952      JsonArray array = json.getAsJsonArray("allowedResponse");
17953      for (int i = 0; i < array.size(); i++) {
17954        res.getAllowedResponse().add(parseMessageDefinitionMessageDefinitionAllowedResponseComponent(array.get(i).getAsJsonObject(), res));
17955      }
17956    };
17957    if (json.has("graph")) {
17958      JsonArray array = json.getAsJsonArray("graph");
17959      for (int i = 0; i < array.size(); i++) {
17960        res.getGraph().add(parseCanonical(array.get(i).getAsString()));
17961      }
17962    };
17963    if (json.has("_graph")) {
17964      JsonArray array = json.getAsJsonArray("_graph");
17965      for (int i = 0; i < array.size(); i++) {
17966        if (i == res.getGraph().size())
17967          res.getGraph().add(parseCanonical(null));
17968        if (array.get(i) instanceof JsonObject) 
17969          parseElementProperties(array.get(i).getAsJsonObject(), res.getGraph().get(i));
17970      }
17971    };
17972  }
17973
17974  protected MessageDefinition.MessageDefinitionFocusComponent parseMessageDefinitionMessageDefinitionFocusComponent(JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
17975    MessageDefinition.MessageDefinitionFocusComponent res = new MessageDefinition.MessageDefinitionFocusComponent();
17976    parseMessageDefinitionMessageDefinitionFocusComponentProperties(json, owner, res);
17977    return res;
17978  }
17979
17980  protected void parseMessageDefinitionMessageDefinitionFocusComponentProperties(JsonObject json, MessageDefinition owner, MessageDefinition.MessageDefinitionFocusComponent res) throws IOException, FHIRFormatError {
17981    parseBackboneElementProperties(json, res);
17982    if (json.has("code"))
17983      res.setCodeElement(parseCode(json.get("code").getAsString()));
17984    if (json.has("_code"))
17985      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
17986    if (json.has("profile"))
17987      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
17988    if (json.has("_profile"))
17989      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
17990    if (json.has("min"))
17991      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
17992    if (json.has("_min"))
17993      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
17994    if (json.has("max"))
17995      res.setMaxElement(parseString(json.get("max").getAsString()));
17996    if (json.has("_max"))
17997      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
17998  }
17999
18000  protected MessageDefinition.MessageDefinitionAllowedResponseComponent parseMessageDefinitionMessageDefinitionAllowedResponseComponent(JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
18001    MessageDefinition.MessageDefinitionAllowedResponseComponent res = new MessageDefinition.MessageDefinitionAllowedResponseComponent();
18002    parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(json, owner, res);
18003    return res;
18004  }
18005
18006  protected void parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(JsonObject json, MessageDefinition owner, MessageDefinition.MessageDefinitionAllowedResponseComponent res) throws IOException, FHIRFormatError {
18007    parseBackboneElementProperties(json, res);
18008    if (json.has("message"))
18009      res.setMessageElement(parseCanonical(json.get("message").getAsString()));
18010    if (json.has("_message"))
18011      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
18012    if (json.has("situation"))
18013      res.setSituationElement(parseMarkdown(json.get("situation").getAsString()));
18014    if (json.has("_situation"))
18015      parseElementProperties(json.getAsJsonObject("_situation"), res.getSituationElement());
18016  }
18017
18018  protected MessageHeader parseMessageHeader(JsonObject json) throws IOException, FHIRFormatError {
18019    MessageHeader res = new MessageHeader();
18020    parseMessageHeaderProperties(json, res);
18021    return res;
18022  }
18023
18024  protected void parseMessageHeaderProperties(JsonObject json, MessageHeader res) throws IOException, FHIRFormatError {
18025    parseDomainResourceProperties(json, res);
18026    Type event = parseType("event", json);
18027    if (event != null)
18028      res.setEvent(event);
18029    if (json.has("destination")) {
18030      JsonArray array = json.getAsJsonArray("destination");
18031      for (int i = 0; i < array.size(); i++) {
18032        res.getDestination().add(parseMessageHeaderMessageDestinationComponent(array.get(i).getAsJsonObject(), res));
18033      }
18034    };
18035    if (json.has("sender"))
18036      res.setSender(parseReference(json.getAsJsonObject("sender")));
18037    if (json.has("enterer"))
18038      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
18039    if (json.has("author"))
18040      res.setAuthor(parseReference(json.getAsJsonObject("author")));
18041    if (json.has("source"))
18042      res.setSource(parseMessageHeaderMessageSourceComponent(json.getAsJsonObject("source"), res));
18043    if (json.has("responsible"))
18044      res.setResponsible(parseReference(json.getAsJsonObject("responsible")));
18045    if (json.has("reason"))
18046      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
18047    if (json.has("response"))
18048      res.setResponse(parseMessageHeaderMessageHeaderResponseComponent(json.getAsJsonObject("response"), res));
18049    if (json.has("focus")) {
18050      JsonArray array = json.getAsJsonArray("focus");
18051      for (int i = 0; i < array.size(); i++) {
18052        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
18053      }
18054    };
18055    if (json.has("definition"))
18056      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
18057    if (json.has("_definition"))
18058      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
18059  }
18060
18061  protected MessageHeader.MessageDestinationComponent parseMessageHeaderMessageDestinationComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
18062    MessageHeader.MessageDestinationComponent res = new MessageHeader.MessageDestinationComponent();
18063    parseMessageHeaderMessageDestinationComponentProperties(json, owner, res);
18064    return res;
18065  }
18066
18067  protected void parseMessageHeaderMessageDestinationComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageDestinationComponent res) throws IOException, FHIRFormatError {
18068    parseBackboneElementProperties(json, res);
18069    if (json.has("name"))
18070      res.setNameElement(parseString(json.get("name").getAsString()));
18071    if (json.has("_name"))
18072      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18073    if (json.has("target"))
18074      res.setTarget(parseReference(json.getAsJsonObject("target")));
18075    if (json.has("endpoint"))
18076      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
18077    if (json.has("_endpoint"))
18078      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
18079    if (json.has("receiver"))
18080      res.setReceiver(parseReference(json.getAsJsonObject("receiver")));
18081  }
18082
18083  protected MessageHeader.MessageSourceComponent parseMessageHeaderMessageSourceComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
18084    MessageHeader.MessageSourceComponent res = new MessageHeader.MessageSourceComponent();
18085    parseMessageHeaderMessageSourceComponentProperties(json, owner, res);
18086    return res;
18087  }
18088
18089  protected void parseMessageHeaderMessageSourceComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageSourceComponent res) throws IOException, FHIRFormatError {
18090    parseBackboneElementProperties(json, res);
18091    if (json.has("name"))
18092      res.setNameElement(parseString(json.get("name").getAsString()));
18093    if (json.has("_name"))
18094      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18095    if (json.has("software"))
18096      res.setSoftwareElement(parseString(json.get("software").getAsString()));
18097    if (json.has("_software"))
18098      parseElementProperties(json.getAsJsonObject("_software"), res.getSoftwareElement());
18099    if (json.has("version"))
18100      res.setVersionElement(parseString(json.get("version").getAsString()));
18101    if (json.has("_version"))
18102      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
18103    if (json.has("contact"))
18104      res.setContact(parseContactPoint(json.getAsJsonObject("contact")));
18105    if (json.has("endpoint"))
18106      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
18107    if (json.has("_endpoint"))
18108      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
18109  }
18110
18111  protected MessageHeader.MessageHeaderResponseComponent parseMessageHeaderMessageHeaderResponseComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
18112    MessageHeader.MessageHeaderResponseComponent res = new MessageHeader.MessageHeaderResponseComponent();
18113    parseMessageHeaderMessageHeaderResponseComponentProperties(json, owner, res);
18114    return res;
18115  }
18116
18117  protected void parseMessageHeaderMessageHeaderResponseComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageHeaderResponseComponent res) throws IOException, FHIRFormatError {
18118    parseBackboneElementProperties(json, res);
18119    if (json.has("identifier"))
18120      res.setIdentifierElement(parseId(json.get("identifier").getAsString()));
18121    if (json.has("_identifier"))
18122      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
18123    if (json.has("code"))
18124      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), MessageHeader.ResponseType.NULL, new MessageHeader.ResponseTypeEnumFactory()));
18125    if (json.has("_code"))
18126      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
18127    if (json.has("details"))
18128      res.setDetails(parseReference(json.getAsJsonObject("details")));
18129  }
18130
18131  protected MolecularSequence parseMolecularSequence(JsonObject json) throws IOException, FHIRFormatError {
18132    MolecularSequence res = new MolecularSequence();
18133    parseMolecularSequenceProperties(json, res);
18134    return res;
18135  }
18136
18137  protected void parseMolecularSequenceProperties(JsonObject json, MolecularSequence res) throws IOException, FHIRFormatError {
18138    parseDomainResourceProperties(json, res);
18139    if (json.has("identifier")) {
18140      JsonArray array = json.getAsJsonArray("identifier");
18141      for (int i = 0; i < array.size(); i++) {
18142        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18143      }
18144    };
18145    if (json.has("type"))
18146      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.SequenceType.NULL, new MolecularSequence.SequenceTypeEnumFactory()));
18147    if (json.has("_type"))
18148      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
18149    if (json.has("coordinateSystem"))
18150      res.setCoordinateSystemElement(parseInteger(json.get("coordinateSystem").getAsLong()));
18151    if (json.has("_coordinateSystem"))
18152      parseElementProperties(json.getAsJsonObject("_coordinateSystem"), res.getCoordinateSystemElement());
18153    if (json.has("patient"))
18154      res.setPatient(parseReference(json.getAsJsonObject("patient")));
18155    if (json.has("specimen"))
18156      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
18157    if (json.has("device"))
18158      res.setDevice(parseReference(json.getAsJsonObject("device")));
18159    if (json.has("performer"))
18160      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
18161    if (json.has("quantity"))
18162      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
18163    if (json.has("referenceSeq"))
18164      res.setReferenceSeq(parseMolecularSequenceMolecularSequenceReferenceSeqComponent(json.getAsJsonObject("referenceSeq"), res));
18165    if (json.has("variant")) {
18166      JsonArray array = json.getAsJsonArray("variant");
18167      for (int i = 0; i < array.size(); i++) {
18168        res.getVariant().add(parseMolecularSequenceMolecularSequenceVariantComponent(array.get(i).getAsJsonObject(), res));
18169      }
18170    };
18171    if (json.has("observedSeq"))
18172      res.setObservedSeqElement(parseString(json.get("observedSeq").getAsString()));
18173    if (json.has("_observedSeq"))
18174      parseElementProperties(json.getAsJsonObject("_observedSeq"), res.getObservedSeqElement());
18175    if (json.has("quality")) {
18176      JsonArray array = json.getAsJsonArray("quality");
18177      for (int i = 0; i < array.size(); i++) {
18178        res.getQuality().add(parseMolecularSequenceMolecularSequenceQualityComponent(array.get(i).getAsJsonObject(), res));
18179      }
18180    };
18181    if (json.has("readCoverage"))
18182      res.setReadCoverageElement(parseInteger(json.get("readCoverage").getAsLong()));
18183    if (json.has("_readCoverage"))
18184      parseElementProperties(json.getAsJsonObject("_readCoverage"), res.getReadCoverageElement());
18185    if (json.has("repository")) {
18186      JsonArray array = json.getAsJsonArray("repository");
18187      for (int i = 0; i < array.size(); i++) {
18188        res.getRepository().add(parseMolecularSequenceMolecularSequenceRepositoryComponent(array.get(i).getAsJsonObject(), res));
18189      }
18190    };
18191    if (json.has("pointer")) {
18192      JsonArray array = json.getAsJsonArray("pointer");
18193      for (int i = 0; i < array.size(); i++) {
18194        res.getPointer().add(parseReference(array.get(i).getAsJsonObject()));
18195      }
18196    };
18197    if (json.has("structureVariant")) {
18198      JsonArray array = json.getAsJsonArray("structureVariant");
18199      for (int i = 0; i < array.size(); i++) {
18200        res.getStructureVariant().add(parseMolecularSequenceMolecularSequenceStructureVariantComponent(array.get(i).getAsJsonObject(), res));
18201      }
18202    };
18203  }
18204
18205  protected MolecularSequence.MolecularSequenceReferenceSeqComponent parseMolecularSequenceMolecularSequenceReferenceSeqComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18206    MolecularSequence.MolecularSequenceReferenceSeqComponent res = new MolecularSequence.MolecularSequenceReferenceSeqComponent();
18207    parseMolecularSequenceMolecularSequenceReferenceSeqComponentProperties(json, owner, res);
18208    return res;
18209  }
18210
18211  protected void parseMolecularSequenceMolecularSequenceReferenceSeqComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceReferenceSeqComponent res) throws IOException, FHIRFormatError {
18212    parseBackboneElementProperties(json, res);
18213    if (json.has("chromosome"))
18214      res.setChromosome(parseCodeableConcept(json.getAsJsonObject("chromosome")));
18215    if (json.has("genomeBuild"))
18216      res.setGenomeBuildElement(parseString(json.get("genomeBuild").getAsString()));
18217    if (json.has("_genomeBuild"))
18218      parseElementProperties(json.getAsJsonObject("_genomeBuild"), res.getGenomeBuildElement());
18219    if (json.has("orientation"))
18220      res.setOrientationElement(parseEnumeration(json.get("orientation").getAsString(), MolecularSequence.OrientationType.NULL, new MolecularSequence.OrientationTypeEnumFactory()));
18221    if (json.has("_orientation"))
18222      parseElementProperties(json.getAsJsonObject("_orientation"), res.getOrientationElement());
18223    if (json.has("referenceSeqId"))
18224      res.setReferenceSeqId(parseCodeableConcept(json.getAsJsonObject("referenceSeqId")));
18225    if (json.has("referenceSeqPointer"))
18226      res.setReferenceSeqPointer(parseReference(json.getAsJsonObject("referenceSeqPointer")));
18227    if (json.has("referenceSeqString"))
18228      res.setReferenceSeqStringElement(parseString(json.get("referenceSeqString").getAsString()));
18229    if (json.has("_referenceSeqString"))
18230      parseElementProperties(json.getAsJsonObject("_referenceSeqString"), res.getReferenceSeqStringElement());
18231    if (json.has("strand"))
18232      res.setStrandElement(parseEnumeration(json.get("strand").getAsString(), MolecularSequence.StrandType.NULL, new MolecularSequence.StrandTypeEnumFactory()));
18233    if (json.has("_strand"))
18234      parseElementProperties(json.getAsJsonObject("_strand"), res.getStrandElement());
18235    if (json.has("windowStart"))
18236      res.setWindowStartElement(parseInteger(json.get("windowStart").getAsLong()));
18237    if (json.has("_windowStart"))
18238      parseElementProperties(json.getAsJsonObject("_windowStart"), res.getWindowStartElement());
18239    if (json.has("windowEnd"))
18240      res.setWindowEndElement(parseInteger(json.get("windowEnd").getAsLong()));
18241    if (json.has("_windowEnd"))
18242      parseElementProperties(json.getAsJsonObject("_windowEnd"), res.getWindowEndElement());
18243  }
18244
18245  protected MolecularSequence.MolecularSequenceVariantComponent parseMolecularSequenceMolecularSequenceVariantComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18246    MolecularSequence.MolecularSequenceVariantComponent res = new MolecularSequence.MolecularSequenceVariantComponent();
18247    parseMolecularSequenceMolecularSequenceVariantComponentProperties(json, owner, res);
18248    return res;
18249  }
18250
18251  protected void parseMolecularSequenceMolecularSequenceVariantComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceVariantComponent res) throws IOException, FHIRFormatError {
18252    parseBackboneElementProperties(json, res);
18253    if (json.has("start"))
18254      res.setStartElement(parseInteger(json.get("start").getAsLong()));
18255    if (json.has("_start"))
18256      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
18257    if (json.has("end"))
18258      res.setEndElement(parseInteger(json.get("end").getAsLong()));
18259    if (json.has("_end"))
18260      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
18261    if (json.has("observedAllele"))
18262      res.setObservedAlleleElement(parseString(json.get("observedAllele").getAsString()));
18263    if (json.has("_observedAllele"))
18264      parseElementProperties(json.getAsJsonObject("_observedAllele"), res.getObservedAlleleElement());
18265    if (json.has("referenceAllele"))
18266      res.setReferenceAlleleElement(parseString(json.get("referenceAllele").getAsString()));
18267    if (json.has("_referenceAllele"))
18268      parseElementProperties(json.getAsJsonObject("_referenceAllele"), res.getReferenceAlleleElement());
18269    if (json.has("cigar"))
18270      res.setCigarElement(parseString(json.get("cigar").getAsString()));
18271    if (json.has("_cigar"))
18272      parseElementProperties(json.getAsJsonObject("_cigar"), res.getCigarElement());
18273    if (json.has("variantPointer"))
18274      res.setVariantPointer(parseReference(json.getAsJsonObject("variantPointer")));
18275  }
18276
18277  protected MolecularSequence.MolecularSequenceQualityComponent parseMolecularSequenceMolecularSequenceQualityComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18278    MolecularSequence.MolecularSequenceQualityComponent res = new MolecularSequence.MolecularSequenceQualityComponent();
18279    parseMolecularSequenceMolecularSequenceQualityComponentProperties(json, owner, res);
18280    return res;
18281  }
18282
18283  protected void parseMolecularSequenceMolecularSequenceQualityComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceQualityComponent res) throws IOException, FHIRFormatError {
18284    parseBackboneElementProperties(json, res);
18285    if (json.has("type"))
18286      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.QualityType.NULL, new MolecularSequence.QualityTypeEnumFactory()));
18287    if (json.has("_type"))
18288      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
18289    if (json.has("standardSequence"))
18290      res.setStandardSequence(parseCodeableConcept(json.getAsJsonObject("standardSequence")));
18291    if (json.has("start"))
18292      res.setStartElement(parseInteger(json.get("start").getAsLong()));
18293    if (json.has("_start"))
18294      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
18295    if (json.has("end"))
18296      res.setEndElement(parseInteger(json.get("end").getAsLong()));
18297    if (json.has("_end"))
18298      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
18299    if (json.has("score"))
18300      res.setScore(parseQuantity(json.getAsJsonObject("score")));
18301    if (json.has("method"))
18302      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
18303    if (json.has("truthTP"))
18304      res.setTruthTPElement(parseDecimal(json.get("truthTP").getAsBigDecimal()));
18305    if (json.has("_truthTP"))
18306      parseElementProperties(json.getAsJsonObject("_truthTP"), res.getTruthTPElement());
18307    if (json.has("queryTP"))
18308      res.setQueryTPElement(parseDecimal(json.get("queryTP").getAsBigDecimal()));
18309    if (json.has("_queryTP"))
18310      parseElementProperties(json.getAsJsonObject("_queryTP"), res.getQueryTPElement());
18311    if (json.has("truthFN"))
18312      res.setTruthFNElement(parseDecimal(json.get("truthFN").getAsBigDecimal()));
18313    if (json.has("_truthFN"))
18314      parseElementProperties(json.getAsJsonObject("_truthFN"), res.getTruthFNElement());
18315    if (json.has("queryFP"))
18316      res.setQueryFPElement(parseDecimal(json.get("queryFP").getAsBigDecimal()));
18317    if (json.has("_queryFP"))
18318      parseElementProperties(json.getAsJsonObject("_queryFP"), res.getQueryFPElement());
18319    if (json.has("gtFP"))
18320      res.setGtFPElement(parseDecimal(json.get("gtFP").getAsBigDecimal()));
18321    if (json.has("_gtFP"))
18322      parseElementProperties(json.getAsJsonObject("_gtFP"), res.getGtFPElement());
18323    if (json.has("precision"))
18324      res.setPrecisionElement(parseDecimal(json.get("precision").getAsBigDecimal()));
18325    if (json.has("_precision"))
18326      parseElementProperties(json.getAsJsonObject("_precision"), res.getPrecisionElement());
18327    if (json.has("recall"))
18328      res.setRecallElement(parseDecimal(json.get("recall").getAsBigDecimal()));
18329    if (json.has("_recall"))
18330      parseElementProperties(json.getAsJsonObject("_recall"), res.getRecallElement());
18331    if (json.has("fScore"))
18332      res.setFScoreElement(parseDecimal(json.get("fScore").getAsBigDecimal()));
18333    if (json.has("_fScore"))
18334      parseElementProperties(json.getAsJsonObject("_fScore"), res.getFScoreElement());
18335    if (json.has("roc"))
18336      res.setRoc(parseMolecularSequenceMolecularSequenceQualityRocComponent(json.getAsJsonObject("roc"), owner));
18337  }
18338
18339  protected MolecularSequence.MolecularSequenceQualityRocComponent parseMolecularSequenceMolecularSequenceQualityRocComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18340    MolecularSequence.MolecularSequenceQualityRocComponent res = new MolecularSequence.MolecularSequenceQualityRocComponent();
18341    parseMolecularSequenceMolecularSequenceQualityRocComponentProperties(json, owner, res);
18342    return res;
18343  }
18344
18345  protected void parseMolecularSequenceMolecularSequenceQualityRocComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceQualityRocComponent res) throws IOException, FHIRFormatError {
18346    parseBackboneElementProperties(json, res);
18347    if (json.has("score")) {
18348      JsonArray array = json.getAsJsonArray("score");
18349      for (int i = 0; i < array.size(); i++) {
18350        res.getScore().add(parseInteger(array.get(i).getAsLong()));
18351      }
18352    };
18353    if (json.has("_score")) {
18354      JsonArray array = json.getAsJsonArray("_score");
18355      for (int i = 0; i < array.size(); i++) {
18356        if (i == res.getScore().size())
18357          res.getScore().add(parseInteger(null));
18358        if (array.get(i) instanceof JsonObject) 
18359          parseElementProperties(array.get(i).getAsJsonObject(), res.getScore().get(i));
18360      }
18361    };
18362    if (json.has("numTP")) {
18363      JsonArray array = json.getAsJsonArray("numTP");
18364      for (int i = 0; i < array.size(); i++) {
18365        res.getNumTP().add(parseInteger(array.get(i).getAsLong()));
18366      }
18367    };
18368    if (json.has("_numTP")) {
18369      JsonArray array = json.getAsJsonArray("_numTP");
18370      for (int i = 0; i < array.size(); i++) {
18371        if (i == res.getNumTP().size())
18372          res.getNumTP().add(parseInteger(null));
18373        if (array.get(i) instanceof JsonObject) 
18374          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumTP().get(i));
18375      }
18376    };
18377    if (json.has("numFP")) {
18378      JsonArray array = json.getAsJsonArray("numFP");
18379      for (int i = 0; i < array.size(); i++) {
18380        res.getNumFP().add(parseInteger(array.get(i).getAsLong()));
18381      }
18382    };
18383    if (json.has("_numFP")) {
18384      JsonArray array = json.getAsJsonArray("_numFP");
18385      for (int i = 0; i < array.size(); i++) {
18386        if (i == res.getNumFP().size())
18387          res.getNumFP().add(parseInteger(null));
18388        if (array.get(i) instanceof JsonObject) 
18389          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumFP().get(i));
18390      }
18391    };
18392    if (json.has("numFN")) {
18393      JsonArray array = json.getAsJsonArray("numFN");
18394      for (int i = 0; i < array.size(); i++) {
18395        res.getNumFN().add(parseInteger(array.get(i).getAsLong()));
18396      }
18397    };
18398    if (json.has("_numFN")) {
18399      JsonArray array = json.getAsJsonArray("_numFN");
18400      for (int i = 0; i < array.size(); i++) {
18401        if (i == res.getNumFN().size())
18402          res.getNumFN().add(parseInteger(null));
18403        if (array.get(i) instanceof JsonObject) 
18404          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumFN().get(i));
18405      }
18406    };
18407    if (json.has("precision")) {
18408      JsonArray array = json.getAsJsonArray("precision");
18409      for (int i = 0; i < array.size(); i++) {
18410        res.getPrecision().add(parseDecimal(array.get(i).getAsBigDecimal()));
18411      }
18412    };
18413    if (json.has("_precision")) {
18414      JsonArray array = json.getAsJsonArray("_precision");
18415      for (int i = 0; i < array.size(); i++) {
18416        if (i == res.getPrecision().size())
18417          res.getPrecision().add(parseDecimal(null));
18418        if (array.get(i) instanceof JsonObject) 
18419          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrecision().get(i));
18420      }
18421    };
18422    if (json.has("sensitivity")) {
18423      JsonArray array = json.getAsJsonArray("sensitivity");
18424      for (int i = 0; i < array.size(); i++) {
18425        res.getSensitivity().add(parseDecimal(array.get(i).getAsBigDecimal()));
18426      }
18427    };
18428    if (json.has("_sensitivity")) {
18429      JsonArray array = json.getAsJsonArray("_sensitivity");
18430      for (int i = 0; i < array.size(); i++) {
18431        if (i == res.getSensitivity().size())
18432          res.getSensitivity().add(parseDecimal(null));
18433        if (array.get(i) instanceof JsonObject) 
18434          parseElementProperties(array.get(i).getAsJsonObject(), res.getSensitivity().get(i));
18435      }
18436    };
18437    if (json.has("fMeasure")) {
18438      JsonArray array = json.getAsJsonArray("fMeasure");
18439      for (int i = 0; i < array.size(); i++) {
18440        res.getFMeasure().add(parseDecimal(array.get(i).getAsBigDecimal()));
18441      }
18442    };
18443    if (json.has("_fMeasure")) {
18444      JsonArray array = json.getAsJsonArray("_fMeasure");
18445      for (int i = 0; i < array.size(); i++) {
18446        if (i == res.getFMeasure().size())
18447          res.getFMeasure().add(parseDecimal(null));
18448        if (array.get(i) instanceof JsonObject) 
18449          parseElementProperties(array.get(i).getAsJsonObject(), res.getFMeasure().get(i));
18450      }
18451    };
18452  }
18453
18454  protected MolecularSequence.MolecularSequenceRepositoryComponent parseMolecularSequenceMolecularSequenceRepositoryComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18455    MolecularSequence.MolecularSequenceRepositoryComponent res = new MolecularSequence.MolecularSequenceRepositoryComponent();
18456    parseMolecularSequenceMolecularSequenceRepositoryComponentProperties(json, owner, res);
18457    return res;
18458  }
18459
18460  protected void parseMolecularSequenceMolecularSequenceRepositoryComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceRepositoryComponent res) throws IOException, FHIRFormatError {
18461    parseBackboneElementProperties(json, res);
18462    if (json.has("type"))
18463      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.RepositoryType.NULL, new MolecularSequence.RepositoryTypeEnumFactory()));
18464    if (json.has("_type"))
18465      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
18466    if (json.has("url"))
18467      res.setUrlElement(parseUri(json.get("url").getAsString()));
18468    if (json.has("_url"))
18469      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
18470    if (json.has("name"))
18471      res.setNameElement(parseString(json.get("name").getAsString()));
18472    if (json.has("_name"))
18473      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18474    if (json.has("datasetId"))
18475      res.setDatasetIdElement(parseString(json.get("datasetId").getAsString()));
18476    if (json.has("_datasetId"))
18477      parseElementProperties(json.getAsJsonObject("_datasetId"), res.getDatasetIdElement());
18478    if (json.has("variantsetId"))
18479      res.setVariantsetIdElement(parseString(json.get("variantsetId").getAsString()));
18480    if (json.has("_variantsetId"))
18481      parseElementProperties(json.getAsJsonObject("_variantsetId"), res.getVariantsetIdElement());
18482    if (json.has("readsetId"))
18483      res.setReadsetIdElement(parseString(json.get("readsetId").getAsString()));
18484    if (json.has("_readsetId"))
18485      parseElementProperties(json.getAsJsonObject("_readsetId"), res.getReadsetIdElement());
18486  }
18487
18488  protected MolecularSequence.MolecularSequenceStructureVariantComponent parseMolecularSequenceMolecularSequenceStructureVariantComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18489    MolecularSequence.MolecularSequenceStructureVariantComponent res = new MolecularSequence.MolecularSequenceStructureVariantComponent();
18490    parseMolecularSequenceMolecularSequenceStructureVariantComponentProperties(json, owner, res);
18491    return res;
18492  }
18493
18494  protected void parseMolecularSequenceMolecularSequenceStructureVariantComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceStructureVariantComponent res) throws IOException, FHIRFormatError {
18495    parseBackboneElementProperties(json, res);
18496    if (json.has("variantType"))
18497      res.setVariantType(parseCodeableConcept(json.getAsJsonObject("variantType")));
18498    if (json.has("exact"))
18499      res.setExactElement(parseBoolean(json.get("exact").getAsBoolean()));
18500    if (json.has("_exact"))
18501      parseElementProperties(json.getAsJsonObject("_exact"), res.getExactElement());
18502    if (json.has("length"))
18503      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
18504    if (json.has("_length"))
18505      parseElementProperties(json.getAsJsonObject("_length"), res.getLengthElement());
18506    if (json.has("outer"))
18507      res.setOuter(parseMolecularSequenceMolecularSequenceStructureVariantOuterComponent(json.getAsJsonObject("outer"), owner));
18508    if (json.has("inner"))
18509      res.setInner(parseMolecularSequenceMolecularSequenceStructureVariantInnerComponent(json.getAsJsonObject("inner"), owner));
18510  }
18511
18512  protected MolecularSequence.MolecularSequenceStructureVariantOuterComponent parseMolecularSequenceMolecularSequenceStructureVariantOuterComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18513    MolecularSequence.MolecularSequenceStructureVariantOuterComponent res = new MolecularSequence.MolecularSequenceStructureVariantOuterComponent();
18514    parseMolecularSequenceMolecularSequenceStructureVariantOuterComponentProperties(json, owner, res);
18515    return res;
18516  }
18517
18518  protected void parseMolecularSequenceMolecularSequenceStructureVariantOuterComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceStructureVariantOuterComponent res) throws IOException, FHIRFormatError {
18519    parseBackboneElementProperties(json, res);
18520    if (json.has("start"))
18521      res.setStartElement(parseInteger(json.get("start").getAsLong()));
18522    if (json.has("_start"))
18523      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
18524    if (json.has("end"))
18525      res.setEndElement(parseInteger(json.get("end").getAsLong()));
18526    if (json.has("_end"))
18527      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
18528  }
18529
18530  protected MolecularSequence.MolecularSequenceStructureVariantInnerComponent parseMolecularSequenceMolecularSequenceStructureVariantInnerComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18531    MolecularSequence.MolecularSequenceStructureVariantInnerComponent res = new MolecularSequence.MolecularSequenceStructureVariantInnerComponent();
18532    parseMolecularSequenceMolecularSequenceStructureVariantInnerComponentProperties(json, owner, res);
18533    return res;
18534  }
18535
18536  protected void parseMolecularSequenceMolecularSequenceStructureVariantInnerComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceStructureVariantInnerComponent res) throws IOException, FHIRFormatError {
18537    parseBackboneElementProperties(json, res);
18538    if (json.has("start"))
18539      res.setStartElement(parseInteger(json.get("start").getAsLong()));
18540    if (json.has("_start"))
18541      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
18542    if (json.has("end"))
18543      res.setEndElement(parseInteger(json.get("end").getAsLong()));
18544    if (json.has("_end"))
18545      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
18546  }
18547
18548  protected NamingSystem parseNamingSystem(JsonObject json) throws IOException, FHIRFormatError {
18549    NamingSystem res = new NamingSystem();
18550    parseNamingSystemProperties(json, res);
18551    return res;
18552  }
18553
18554  protected void parseNamingSystemProperties(JsonObject json, NamingSystem res) throws IOException, FHIRFormatError {
18555    parseDomainResourceProperties(json, res);
18556    if (json.has("name"))
18557      res.setNameElement(parseString(json.get("name").getAsString()));
18558    if (json.has("_name"))
18559      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18560    if (json.has("status"))
18561      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
18562    if (json.has("_status"))
18563      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18564    if (json.has("kind"))
18565      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), NamingSystem.NamingSystemType.NULL, new NamingSystem.NamingSystemTypeEnumFactory()));
18566    if (json.has("_kind"))
18567      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
18568    if (json.has("date"))
18569      res.setDateElement(parseDateTime(json.get("date").getAsString()));
18570    if (json.has("_date"))
18571      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
18572    if (json.has("publisher"))
18573      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
18574    if (json.has("_publisher"))
18575      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
18576    if (json.has("contact")) {
18577      JsonArray array = json.getAsJsonArray("contact");
18578      for (int i = 0; i < array.size(); i++) {
18579        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
18580      }
18581    };
18582    if (json.has("responsible"))
18583      res.setResponsibleElement(parseString(json.get("responsible").getAsString()));
18584    if (json.has("_responsible"))
18585      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
18586    if (json.has("type"))
18587      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18588    if (json.has("description"))
18589      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
18590    if (json.has("_description"))
18591      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18592    if (json.has("useContext")) {
18593      JsonArray array = json.getAsJsonArray("useContext");
18594      for (int i = 0; i < array.size(); i++) {
18595        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
18596      }
18597    };
18598    if (json.has("jurisdiction")) {
18599      JsonArray array = json.getAsJsonArray("jurisdiction");
18600      for (int i = 0; i < array.size(); i++) {
18601        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18602      }
18603    };
18604    if (json.has("usage"))
18605      res.setUsageElement(parseString(json.get("usage").getAsString()));
18606    if (json.has("_usage"))
18607      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
18608    if (json.has("uniqueId")) {
18609      JsonArray array = json.getAsJsonArray("uniqueId");
18610      for (int i = 0; i < array.size(); i++) {
18611        res.getUniqueId().add(parseNamingSystemNamingSystemUniqueIdComponent(array.get(i).getAsJsonObject(), res));
18612      }
18613    };
18614  }
18615
18616  protected NamingSystem.NamingSystemUniqueIdComponent parseNamingSystemNamingSystemUniqueIdComponent(JsonObject json, NamingSystem owner) throws IOException, FHIRFormatError {
18617    NamingSystem.NamingSystemUniqueIdComponent res = new NamingSystem.NamingSystemUniqueIdComponent();
18618    parseNamingSystemNamingSystemUniqueIdComponentProperties(json, owner, res);
18619    return res;
18620  }
18621
18622  protected void parseNamingSystemNamingSystemUniqueIdComponentProperties(JsonObject json, NamingSystem owner, NamingSystem.NamingSystemUniqueIdComponent res) throws IOException, FHIRFormatError {
18623    parseBackboneElementProperties(json, res);
18624    if (json.has("type"))
18625      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), NamingSystem.NamingSystemIdentifierType.NULL, new NamingSystem.NamingSystemIdentifierTypeEnumFactory()));
18626    if (json.has("_type"))
18627      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
18628    if (json.has("value"))
18629      res.setValueElement(parseString(json.get("value").getAsString()));
18630    if (json.has("_value"))
18631      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
18632    if (json.has("preferred"))
18633      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
18634    if (json.has("_preferred"))
18635      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
18636    if (json.has("comment"))
18637      res.setCommentElement(parseString(json.get("comment").getAsString()));
18638    if (json.has("_comment"))
18639      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
18640    if (json.has("period"))
18641      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
18642  }
18643
18644  protected NutritionOrder parseNutritionOrder(JsonObject json) throws IOException, FHIRFormatError {
18645    NutritionOrder res = new NutritionOrder();
18646    parseNutritionOrderProperties(json, res);
18647    return res;
18648  }
18649
18650  protected void parseNutritionOrderProperties(JsonObject json, NutritionOrder res) throws IOException, FHIRFormatError {
18651    parseDomainResourceProperties(json, res);
18652    if (json.has("identifier")) {
18653      JsonArray array = json.getAsJsonArray("identifier");
18654      for (int i = 0; i < array.size(); i++) {
18655        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18656      }
18657    };
18658    if (json.has("instantiatesCanonical")) {
18659      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
18660      for (int i = 0; i < array.size(); i++) {
18661        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
18662      }
18663    };
18664    if (json.has("_instantiatesCanonical")) {
18665      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
18666      for (int i = 0; i < array.size(); i++) {
18667        if (i == res.getInstantiatesCanonical().size())
18668          res.getInstantiatesCanonical().add(parseCanonical(null));
18669        if (array.get(i) instanceof JsonObject) 
18670          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
18671      }
18672    };
18673    if (json.has("instantiatesUri")) {
18674      JsonArray array = json.getAsJsonArray("instantiatesUri");
18675      for (int i = 0; i < array.size(); i++) {
18676        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
18677      }
18678    };
18679    if (json.has("_instantiatesUri")) {
18680      JsonArray array = json.getAsJsonArray("_instantiatesUri");
18681      for (int i = 0; i < array.size(); i++) {
18682        if (i == res.getInstantiatesUri().size())
18683          res.getInstantiatesUri().add(parseUri(null));
18684        if (array.get(i) instanceof JsonObject) 
18685          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
18686      }
18687    };
18688    if (json.has("instantiates")) {
18689      JsonArray array = json.getAsJsonArray("instantiates");
18690      for (int i = 0; i < array.size(); i++) {
18691        res.getInstantiates().add(parseUri(array.get(i).getAsString()));
18692      }
18693    };
18694    if (json.has("_instantiates")) {
18695      JsonArray array = json.getAsJsonArray("_instantiates");
18696      for (int i = 0; i < array.size(); i++) {
18697        if (i == res.getInstantiates().size())
18698          res.getInstantiates().add(parseUri(null));
18699        if (array.get(i) instanceof JsonObject) 
18700          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
18701      }
18702    };
18703    if (json.has("status"))
18704      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), NutritionOrder.NutritionOrderStatus.NULL, new NutritionOrder.NutritionOrderStatusEnumFactory()));
18705    if (json.has("_status"))
18706      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18707    if (json.has("intent"))
18708      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), NutritionOrder.NutritiionOrderIntent.NULL, new NutritionOrder.NutritiionOrderIntentEnumFactory()));
18709    if (json.has("_intent"))
18710      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
18711    if (json.has("patient"))
18712      res.setPatient(parseReference(json.getAsJsonObject("patient")));
18713    if (json.has("encounter"))
18714      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
18715    if (json.has("dateTime"))
18716      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
18717    if (json.has("_dateTime"))
18718      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
18719    if (json.has("orderer"))
18720      res.setOrderer(parseReference(json.getAsJsonObject("orderer")));
18721    if (json.has("allergyIntolerance")) {
18722      JsonArray array = json.getAsJsonArray("allergyIntolerance");
18723      for (int i = 0; i < array.size(); i++) {
18724        res.getAllergyIntolerance().add(parseReference(array.get(i).getAsJsonObject()));
18725      }
18726    };
18727    if (json.has("foodPreferenceModifier")) {
18728      JsonArray array = json.getAsJsonArray("foodPreferenceModifier");
18729      for (int i = 0; i < array.size(); i++) {
18730        res.getFoodPreferenceModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18731      }
18732    };
18733    if (json.has("excludeFoodModifier")) {
18734      JsonArray array = json.getAsJsonArray("excludeFoodModifier");
18735      for (int i = 0; i < array.size(); i++) {
18736        res.getExcludeFoodModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18737      }
18738    };
18739    if (json.has("oralDiet"))
18740      res.setOralDiet(parseNutritionOrderNutritionOrderOralDietComponent(json.getAsJsonObject("oralDiet"), res));
18741    if (json.has("supplement")) {
18742      JsonArray array = json.getAsJsonArray("supplement");
18743      for (int i = 0; i < array.size(); i++) {
18744        res.getSupplement().add(parseNutritionOrderNutritionOrderSupplementComponent(array.get(i).getAsJsonObject(), res));
18745      }
18746    };
18747    if (json.has("enteralFormula"))
18748      res.setEnteralFormula(parseNutritionOrderNutritionOrderEnteralFormulaComponent(json.getAsJsonObject("enteralFormula"), res));
18749    if (json.has("note")) {
18750      JsonArray array = json.getAsJsonArray("note");
18751      for (int i = 0; i < array.size(); i++) {
18752        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
18753      }
18754    };
18755  }
18756
18757  protected NutritionOrder.NutritionOrderOralDietComponent parseNutritionOrderNutritionOrderOralDietComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
18758    NutritionOrder.NutritionOrderOralDietComponent res = new NutritionOrder.NutritionOrderOralDietComponent();
18759    parseNutritionOrderNutritionOrderOralDietComponentProperties(json, owner, res);
18760    return res;
18761  }
18762
18763  protected void parseNutritionOrderNutritionOrderOralDietComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietComponent res) throws IOException, FHIRFormatError {
18764    parseBackboneElementProperties(json, res);
18765    if (json.has("type")) {
18766      JsonArray array = json.getAsJsonArray("type");
18767      for (int i = 0; i < array.size(); i++) {
18768        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18769      }
18770    };
18771    if (json.has("schedule")) {
18772      JsonArray array = json.getAsJsonArray("schedule");
18773      for (int i = 0; i < array.size(); i++) {
18774        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
18775      }
18776    };
18777    if (json.has("nutrient")) {
18778      JsonArray array = json.getAsJsonArray("nutrient");
18779      for (int i = 0; i < array.size(); i++) {
18780        res.getNutrient().add(parseNutritionOrderNutritionOrderOralDietNutrientComponent(array.get(i).getAsJsonObject(), owner));
18781      }
18782    };
18783    if (json.has("texture")) {
18784      JsonArray array = json.getAsJsonArray("texture");
18785      for (int i = 0; i < array.size(); i++) {
18786        res.getTexture().add(parseNutritionOrderNutritionOrderOralDietTextureComponent(array.get(i).getAsJsonObject(), owner));
18787      }
18788    };
18789    if (json.has("fluidConsistencyType")) {
18790      JsonArray array = json.getAsJsonArray("fluidConsistencyType");
18791      for (int i = 0; i < array.size(); i++) {
18792        res.getFluidConsistencyType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18793      }
18794    };
18795    if (json.has("instruction"))
18796      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
18797    if (json.has("_instruction"))
18798      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
18799  }
18800
18801  protected NutritionOrder.NutritionOrderOralDietNutrientComponent parseNutritionOrderNutritionOrderOralDietNutrientComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
18802    NutritionOrder.NutritionOrderOralDietNutrientComponent res = new NutritionOrder.NutritionOrderOralDietNutrientComponent();
18803    parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(json, owner, res);
18804    return res;
18805  }
18806
18807  protected void parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietNutrientComponent res) throws IOException, FHIRFormatError {
18808    parseBackboneElementProperties(json, res);
18809    if (json.has("modifier"))
18810      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
18811    if (json.has("amount"))
18812      res.setAmount(parseQuantity(json.getAsJsonObject("amount")));
18813  }
18814
18815  protected NutritionOrder.NutritionOrderOralDietTextureComponent parseNutritionOrderNutritionOrderOralDietTextureComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
18816    NutritionOrder.NutritionOrderOralDietTextureComponent res = new NutritionOrder.NutritionOrderOralDietTextureComponent();
18817    parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(json, owner, res);
18818    return res;
18819  }
18820
18821  protected void parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietTextureComponent res) throws IOException, FHIRFormatError {
18822    parseBackboneElementProperties(json, res);
18823    if (json.has("modifier"))
18824      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
18825    if (json.has("foodType"))
18826      res.setFoodType(parseCodeableConcept(json.getAsJsonObject("foodType")));
18827  }
18828
18829  protected NutritionOrder.NutritionOrderSupplementComponent parseNutritionOrderNutritionOrderSupplementComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
18830    NutritionOrder.NutritionOrderSupplementComponent res = new NutritionOrder.NutritionOrderSupplementComponent();
18831    parseNutritionOrderNutritionOrderSupplementComponentProperties(json, owner, res);
18832    return res;
18833  }
18834
18835  protected void parseNutritionOrderNutritionOrderSupplementComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderSupplementComponent res) throws IOException, FHIRFormatError {
18836    parseBackboneElementProperties(json, res);
18837    if (json.has("type"))
18838      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18839    if (json.has("productName"))
18840      res.setProductNameElement(parseString(json.get("productName").getAsString()));
18841    if (json.has("_productName"))
18842      parseElementProperties(json.getAsJsonObject("_productName"), res.getProductNameElement());
18843    if (json.has("schedule")) {
18844      JsonArray array = json.getAsJsonArray("schedule");
18845      for (int i = 0; i < array.size(); i++) {
18846        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
18847      }
18848    };
18849    if (json.has("quantity"))
18850      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
18851    if (json.has("instruction"))
18852      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
18853    if (json.has("_instruction"))
18854      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
18855  }
18856
18857  protected NutritionOrder.NutritionOrderEnteralFormulaComponent parseNutritionOrderNutritionOrderEnteralFormulaComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
18858    NutritionOrder.NutritionOrderEnteralFormulaComponent res = new NutritionOrder.NutritionOrderEnteralFormulaComponent();
18859    parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(json, owner, res);
18860    return res;
18861  }
18862
18863  protected void parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaComponent res) throws IOException, FHIRFormatError {
18864    parseBackboneElementProperties(json, res);
18865    if (json.has("baseFormulaType"))
18866      res.setBaseFormulaType(parseCodeableConcept(json.getAsJsonObject("baseFormulaType")));
18867    if (json.has("baseFormulaProductName"))
18868      res.setBaseFormulaProductNameElement(parseString(json.get("baseFormulaProductName").getAsString()));
18869    if (json.has("_baseFormulaProductName"))
18870      parseElementProperties(json.getAsJsonObject("_baseFormulaProductName"), res.getBaseFormulaProductNameElement());
18871    if (json.has("additiveType"))
18872      res.setAdditiveType(parseCodeableConcept(json.getAsJsonObject("additiveType")));
18873    if (json.has("additiveProductName"))
18874      res.setAdditiveProductNameElement(parseString(json.get("additiveProductName").getAsString()));
18875    if (json.has("_additiveProductName"))
18876      parseElementProperties(json.getAsJsonObject("_additiveProductName"), res.getAdditiveProductNameElement());
18877    if (json.has("caloricDensity"))
18878      res.setCaloricDensity(parseQuantity(json.getAsJsonObject("caloricDensity")));
18879    if (json.has("routeofAdministration"))
18880      res.setRouteofAdministration(parseCodeableConcept(json.getAsJsonObject("routeofAdministration")));
18881    if (json.has("administration")) {
18882      JsonArray array = json.getAsJsonArray("administration");
18883      for (int i = 0; i < array.size(); i++) {
18884        res.getAdministration().add(parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(array.get(i).getAsJsonObject(), owner));
18885      }
18886    };
18887    if (json.has("maxVolumeToDeliver"))
18888      res.setMaxVolumeToDeliver(parseQuantity(json.getAsJsonObject("maxVolumeToDeliver")));
18889    if (json.has("administrationInstruction"))
18890      res.setAdministrationInstructionElement(parseString(json.get("administrationInstruction").getAsString()));
18891    if (json.has("_administrationInstruction"))
18892      parseElementProperties(json.getAsJsonObject("_administrationInstruction"), res.getAdministrationInstructionElement());
18893  }
18894
18895  protected NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
18896    NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res = new NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent();
18897    parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(json, owner, res);
18898    return res;
18899  }
18900
18901  protected void parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res) throws IOException, FHIRFormatError {
18902    parseBackboneElementProperties(json, res);
18903    if (json.has("schedule"))
18904      res.setSchedule(parseTiming(json.getAsJsonObject("schedule")));
18905    if (json.has("quantity"))
18906      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
18907    Type rate = parseType("rate", json);
18908    if (rate != null)
18909      res.setRate(rate);
18910  }
18911
18912  protected Observation parseObservation(JsonObject json) throws IOException, FHIRFormatError {
18913    Observation res = new Observation();
18914    parseObservationProperties(json, res);
18915    return res;
18916  }
18917
18918  protected void parseObservationProperties(JsonObject json, Observation res) throws IOException, FHIRFormatError {
18919    parseDomainResourceProperties(json, res);
18920    if (json.has("identifier")) {
18921      JsonArray array = json.getAsJsonArray("identifier");
18922      for (int i = 0; i < array.size(); i++) {
18923        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18924      }
18925    };
18926    if (json.has("basedOn")) {
18927      JsonArray array = json.getAsJsonArray("basedOn");
18928      for (int i = 0; i < array.size(); i++) {
18929        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
18930      }
18931    };
18932    if (json.has("partOf")) {
18933      JsonArray array = json.getAsJsonArray("partOf");
18934      for (int i = 0; i < array.size(); i++) {
18935        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
18936      }
18937    };
18938    if (json.has("status"))
18939      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Observation.ObservationStatus.NULL, new Observation.ObservationStatusEnumFactory()));
18940    if (json.has("_status"))
18941      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18942    if (json.has("category")) {
18943      JsonArray array = json.getAsJsonArray("category");
18944      for (int i = 0; i < array.size(); i++) {
18945        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18946      }
18947    };
18948    if (json.has("code"))
18949      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
18950    if (json.has("subject"))
18951      res.setSubject(parseReference(json.getAsJsonObject("subject")));
18952    if (json.has("focus")) {
18953      JsonArray array = json.getAsJsonArray("focus");
18954      for (int i = 0; i < array.size(); i++) {
18955        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
18956      }
18957    };
18958    if (json.has("encounter"))
18959      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
18960    Type effective = parseType("effective", json);
18961    if (effective != null)
18962      res.setEffective(effective);
18963    if (json.has("issued"))
18964      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
18965    if (json.has("_issued"))
18966      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
18967    if (json.has("performer")) {
18968      JsonArray array = json.getAsJsonArray("performer");
18969      for (int i = 0; i < array.size(); i++) {
18970        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
18971      }
18972    };
18973    Type value = parseType("value", json);
18974    if (value != null)
18975      res.setValue(value);
18976    if (json.has("dataAbsentReason"))
18977      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
18978    if (json.has("interpretation")) {
18979      JsonArray array = json.getAsJsonArray("interpretation");
18980      for (int i = 0; i < array.size(); i++) {
18981        res.getInterpretation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18982      }
18983    };
18984    if (json.has("note")) {
18985      JsonArray array = json.getAsJsonArray("note");
18986      for (int i = 0; i < array.size(); i++) {
18987        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
18988      }
18989    };
18990    if (json.has("bodySite"))
18991      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
18992    if (json.has("method"))
18993      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
18994    if (json.has("specimen"))
18995      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
18996    if (json.has("device"))
18997      res.setDevice(parseReference(json.getAsJsonObject("device")));
18998    if (json.has("referenceRange")) {
18999      JsonArray array = json.getAsJsonArray("referenceRange");
19000      for (int i = 0; i < array.size(); i++) {
19001        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), res));
19002      }
19003    };
19004    if (json.has("hasMember")) {
19005      JsonArray array = json.getAsJsonArray("hasMember");
19006      for (int i = 0; i < array.size(); i++) {
19007        res.getHasMember().add(parseReference(array.get(i).getAsJsonObject()));
19008      }
19009    };
19010    if (json.has("derivedFrom")) {
19011      JsonArray array = json.getAsJsonArray("derivedFrom");
19012      for (int i = 0; i < array.size(); i++) {
19013        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
19014      }
19015    };
19016    if (json.has("component")) {
19017      JsonArray array = json.getAsJsonArray("component");
19018      for (int i = 0; i < array.size(); i++) {
19019        res.getComponent().add(parseObservationObservationComponentComponent(array.get(i).getAsJsonObject(), res));
19020      }
19021    };
19022  }
19023
19024  protected Observation.ObservationReferenceRangeComponent parseObservationObservationReferenceRangeComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
19025    Observation.ObservationReferenceRangeComponent res = new Observation.ObservationReferenceRangeComponent();
19026    parseObservationObservationReferenceRangeComponentProperties(json, owner, res);
19027    return res;
19028  }
19029
19030  protected void parseObservationObservationReferenceRangeComponentProperties(JsonObject json, Observation owner, Observation.ObservationReferenceRangeComponent res) throws IOException, FHIRFormatError {
19031    parseBackboneElementProperties(json, res);
19032    if (json.has("low"))
19033      res.setLow(parseQuantity(json.getAsJsonObject("low")));
19034    if (json.has("high"))
19035      res.setHigh(parseQuantity(json.getAsJsonObject("high")));
19036    if (json.has("type"))
19037      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
19038    if (json.has("appliesTo")) {
19039      JsonArray array = json.getAsJsonArray("appliesTo");
19040      for (int i = 0; i < array.size(); i++) {
19041        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19042      }
19043    };
19044    if (json.has("age"))
19045      res.setAge(parseRange(json.getAsJsonObject("age")));
19046    if (json.has("text"))
19047      res.setTextElement(parseString(json.get("text").getAsString()));
19048    if (json.has("_text"))
19049      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
19050  }
19051
19052  protected Observation.ObservationComponentComponent parseObservationObservationComponentComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
19053    Observation.ObservationComponentComponent res = new Observation.ObservationComponentComponent();
19054    parseObservationObservationComponentComponentProperties(json, owner, res);
19055    return res;
19056  }
19057
19058  protected void parseObservationObservationComponentComponentProperties(JsonObject json, Observation owner, Observation.ObservationComponentComponent res) throws IOException, FHIRFormatError {
19059    parseBackboneElementProperties(json, res);
19060    if (json.has("code"))
19061      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
19062    Type value = parseType("value", json);
19063    if (value != null)
19064      res.setValue(value);
19065    if (json.has("dataAbsentReason"))
19066      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
19067    if (json.has("interpretation")) {
19068      JsonArray array = json.getAsJsonArray("interpretation");
19069      for (int i = 0; i < array.size(); i++) {
19070        res.getInterpretation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19071      }
19072    };
19073    if (json.has("referenceRange")) {
19074      JsonArray array = json.getAsJsonArray("referenceRange");
19075      for (int i = 0; i < array.size(); i++) {
19076        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), owner));
19077      }
19078    };
19079  }
19080
19081  protected ObservationDefinition parseObservationDefinition(JsonObject json) throws IOException, FHIRFormatError {
19082    ObservationDefinition res = new ObservationDefinition();
19083    parseObservationDefinitionProperties(json, res);
19084    return res;
19085  }
19086
19087  protected void parseObservationDefinitionProperties(JsonObject json, ObservationDefinition res) throws IOException, FHIRFormatError {
19088    parseDomainResourceProperties(json, res);
19089    if (json.has("category")) {
19090      JsonArray array = json.getAsJsonArray("category");
19091      for (int i = 0; i < array.size(); i++) {
19092        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19093      }
19094    };
19095    if (json.has("code"))
19096      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
19097    if (json.has("identifier")) {
19098      JsonArray array = json.getAsJsonArray("identifier");
19099      for (int i = 0; i < array.size(); i++) {
19100        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19101      }
19102    };
19103    if (json.has("permittedDataType")) {
19104      JsonArray array = json.getAsJsonArray("permittedDataType");
19105      for (int i = 0; i < array.size(); i++) {
19106        res.getPermittedDataType().add(parseEnumeration(array.get(i).getAsString(), ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
19107      }
19108    };
19109    if (json.has("_permittedDataType")) {
19110      JsonArray array = json.getAsJsonArray("_permittedDataType");
19111      for (int i = 0; i < array.size(); i++) {
19112        if (i == res.getPermittedDataType().size())
19113          res.getPermittedDataType().add(parseEnumeration(null, ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
19114        if (array.get(i) instanceof JsonObject) 
19115          parseElementProperties(array.get(i).getAsJsonObject(), res.getPermittedDataType().get(i));
19116      }
19117    };
19118    if (json.has("multipleResultsAllowed"))
19119      res.setMultipleResultsAllowedElement(parseBoolean(json.get("multipleResultsAllowed").getAsBoolean()));
19120    if (json.has("_multipleResultsAllowed"))
19121      parseElementProperties(json.getAsJsonObject("_multipleResultsAllowed"), res.getMultipleResultsAllowedElement());
19122    if (json.has("method"))
19123      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
19124    if (json.has("preferredReportName"))
19125      res.setPreferredReportNameElement(parseString(json.get("preferredReportName").getAsString()));
19126    if (json.has("_preferredReportName"))
19127      parseElementProperties(json.getAsJsonObject("_preferredReportName"), res.getPreferredReportNameElement());
19128    if (json.has("quantitativeDetails"))
19129      res.setQuantitativeDetails(parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(json.getAsJsonObject("quantitativeDetails"), res));
19130    if (json.has("qualifiedInterval")) {
19131      JsonArray array = json.getAsJsonArray("qualifiedInterval");
19132      for (int i = 0; i < array.size(); i++) {
19133        res.getQualifiedInterval().add(parseObservationDefinitionObservationDefinitionQualifiedIntervalComponent(array.get(i).getAsJsonObject(), res));
19134      }
19135    };
19136    if (json.has("validCodedValueSet"))
19137      res.setValidCodedValueSet(parseReference(json.getAsJsonObject("validCodedValueSet")));
19138    if (json.has("normalCodedValueSet"))
19139      res.setNormalCodedValueSet(parseReference(json.getAsJsonObject("normalCodedValueSet")));
19140    if (json.has("abnormalCodedValueSet"))
19141      res.setAbnormalCodedValueSet(parseReference(json.getAsJsonObject("abnormalCodedValueSet")));
19142    if (json.has("criticalCodedValueSet"))
19143      res.setCriticalCodedValueSet(parseReference(json.getAsJsonObject("criticalCodedValueSet")));
19144  }
19145
19146  protected ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(JsonObject json, ObservationDefinition owner) throws IOException, FHIRFormatError {
19147    ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res = new ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent();
19148    parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponentProperties(json, owner, res);
19149    return res;
19150  }
19151
19152  protected void parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponentProperties(JsonObject json, ObservationDefinition owner, ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res) throws IOException, FHIRFormatError {
19153    parseBackboneElementProperties(json, res);
19154    if (json.has("customaryUnit"))
19155      res.setCustomaryUnit(parseCodeableConcept(json.getAsJsonObject("customaryUnit")));
19156    if (json.has("unit"))
19157      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
19158    if (json.has("conversionFactor"))
19159      res.setConversionFactorElement(parseDecimal(json.get("conversionFactor").getAsBigDecimal()));
19160    if (json.has("_conversionFactor"))
19161      parseElementProperties(json.getAsJsonObject("_conversionFactor"), res.getConversionFactorElement());
19162    if (json.has("decimalPrecision"))
19163      res.setDecimalPrecisionElement(parseInteger(json.get("decimalPrecision").getAsLong()));
19164    if (json.has("_decimalPrecision"))
19165      parseElementProperties(json.getAsJsonObject("_decimalPrecision"), res.getDecimalPrecisionElement());
19166  }
19167
19168  protected ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent parseObservationDefinitionObservationDefinitionQualifiedIntervalComponent(JsonObject json, ObservationDefinition owner) throws IOException, FHIRFormatError {
19169    ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res = new ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent();
19170    parseObservationDefinitionObservationDefinitionQualifiedIntervalComponentProperties(json, owner, res);
19171    return res;
19172  }
19173
19174  protected void parseObservationDefinitionObservationDefinitionQualifiedIntervalComponentProperties(JsonObject json, ObservationDefinition owner, ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res) throws IOException, FHIRFormatError {
19175    parseBackboneElementProperties(json, res);
19176    if (json.has("category"))
19177      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), ObservationDefinition.ObservationRangeCategory.NULL, new ObservationDefinition.ObservationRangeCategoryEnumFactory()));
19178    if (json.has("_category"))
19179      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
19180    if (json.has("range"))
19181      res.setRange(parseRange(json.getAsJsonObject("range")));
19182    if (json.has("context"))
19183      res.setContext(parseCodeableConcept(json.getAsJsonObject("context")));
19184    if (json.has("appliesTo")) {
19185      JsonArray array = json.getAsJsonArray("appliesTo");
19186      for (int i = 0; i < array.size(); i++) {
19187        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19188      }
19189    };
19190    if (json.has("gender"))
19191      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
19192    if (json.has("_gender"))
19193      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
19194    if (json.has("age"))
19195      res.setAge(parseRange(json.getAsJsonObject("age")));
19196    if (json.has("gestationalAge"))
19197      res.setGestationalAge(parseRange(json.getAsJsonObject("gestationalAge")));
19198    if (json.has("condition"))
19199      res.setConditionElement(parseString(json.get("condition").getAsString()));
19200    if (json.has("_condition"))
19201      parseElementProperties(json.getAsJsonObject("_condition"), res.getConditionElement());
19202  }
19203
19204  protected OperationDefinition parseOperationDefinition(JsonObject json) throws IOException, FHIRFormatError {
19205    OperationDefinition res = new OperationDefinition();
19206    parseOperationDefinitionProperties(json, res);
19207    return res;
19208  }
19209
19210  protected void parseOperationDefinitionProperties(JsonObject json, OperationDefinition res) throws IOException, FHIRFormatError {
19211    parseDomainResourceProperties(json, res);
19212    if (json.has("url"))
19213      res.setUrlElement(parseUri(json.get("url").getAsString()));
19214    if (json.has("_url"))
19215      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
19216    if (json.has("version"))
19217      res.setVersionElement(parseString(json.get("version").getAsString()));
19218    if (json.has("_version"))
19219      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
19220    if (json.has("name"))
19221      res.setNameElement(parseString(json.get("name").getAsString()));
19222    if (json.has("_name"))
19223      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19224    if (json.has("title"))
19225      res.setTitleElement(parseString(json.get("title").getAsString()));
19226    if (json.has("_title"))
19227      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
19228    if (json.has("status"))
19229      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
19230    if (json.has("_status"))
19231      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19232    if (json.has("kind"))
19233      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), OperationDefinition.OperationKind.NULL, new OperationDefinition.OperationKindEnumFactory()));
19234    if (json.has("_kind"))
19235      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
19236    if (json.has("experimental"))
19237      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
19238    if (json.has("_experimental"))
19239      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
19240    if (json.has("date"))
19241      res.setDateElement(parseDateTime(json.get("date").getAsString()));
19242    if (json.has("_date"))
19243      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
19244    if (json.has("publisher"))
19245      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
19246    if (json.has("_publisher"))
19247      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
19248    if (json.has("contact")) {
19249      JsonArray array = json.getAsJsonArray("contact");
19250      for (int i = 0; i < array.size(); i++) {
19251        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
19252      }
19253    };
19254    if (json.has("description"))
19255      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
19256    if (json.has("_description"))
19257      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
19258    if (json.has("useContext")) {
19259      JsonArray array = json.getAsJsonArray("useContext");
19260      for (int i = 0; i < array.size(); i++) {
19261        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
19262      }
19263    };
19264    if (json.has("jurisdiction")) {
19265      JsonArray array = json.getAsJsonArray("jurisdiction");
19266      for (int i = 0; i < array.size(); i++) {
19267        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19268      }
19269    };
19270    if (json.has("purpose"))
19271      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
19272    if (json.has("_purpose"))
19273      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
19274    if (json.has("affectsState"))
19275      res.setAffectsStateElement(parseBoolean(json.get("affectsState").getAsBoolean()));
19276    if (json.has("_affectsState"))
19277      parseElementProperties(json.getAsJsonObject("_affectsState"), res.getAffectsStateElement());
19278    if (json.has("code"))
19279      res.setCodeElement(parseCode(json.get("code").getAsString()));
19280    if (json.has("_code"))
19281      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
19282    if (json.has("comment"))
19283      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
19284    if (json.has("_comment"))
19285      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
19286    if (json.has("base"))
19287      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
19288    if (json.has("_base"))
19289      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
19290    if (json.has("resource")) {
19291      JsonArray array = json.getAsJsonArray("resource");
19292      for (int i = 0; i < array.size(); i++) {
19293        res.getResource().add(parseCode(array.get(i).getAsString()));
19294      }
19295    };
19296    if (json.has("_resource")) {
19297      JsonArray array = json.getAsJsonArray("_resource");
19298      for (int i = 0; i < array.size(); i++) {
19299        if (i == res.getResource().size())
19300          res.getResource().add(parseCode(null));
19301        if (array.get(i) instanceof JsonObject) 
19302          parseElementProperties(array.get(i).getAsJsonObject(), res.getResource().get(i));
19303      }
19304    };
19305    if (json.has("system"))
19306      res.setSystemElement(parseBoolean(json.get("system").getAsBoolean()));
19307    if (json.has("_system"))
19308      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
19309    if (json.has("type"))
19310      res.setTypeElement(parseBoolean(json.get("type").getAsBoolean()));
19311    if (json.has("_type"))
19312      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
19313    if (json.has("instance"))
19314      res.setInstanceElement(parseBoolean(json.get("instance").getAsBoolean()));
19315    if (json.has("_instance"))
19316      parseElementProperties(json.getAsJsonObject("_instance"), res.getInstanceElement());
19317    if (json.has("inputProfile"))
19318      res.setInputProfileElement(parseCanonical(json.get("inputProfile").getAsString()));
19319    if (json.has("_inputProfile"))
19320      parseElementProperties(json.getAsJsonObject("_inputProfile"), res.getInputProfileElement());
19321    if (json.has("outputProfile"))
19322      res.setOutputProfileElement(parseCanonical(json.get("outputProfile").getAsString()));
19323    if (json.has("_outputProfile"))
19324      parseElementProperties(json.getAsJsonObject("_outputProfile"), res.getOutputProfileElement());
19325    if (json.has("parameter")) {
19326      JsonArray array = json.getAsJsonArray("parameter");
19327      for (int i = 0; i < array.size(); i++) {
19328        res.getParameter().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), res));
19329      }
19330    };
19331    if (json.has("overload")) {
19332      JsonArray array = json.getAsJsonArray("overload");
19333      for (int i = 0; i < array.size(); i++) {
19334        res.getOverload().add(parseOperationDefinitionOperationDefinitionOverloadComponent(array.get(i).getAsJsonObject(), res));
19335      }
19336    };
19337  }
19338
19339  protected OperationDefinition.OperationDefinitionParameterComponent parseOperationDefinitionOperationDefinitionParameterComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
19340    OperationDefinition.OperationDefinitionParameterComponent res = new OperationDefinition.OperationDefinitionParameterComponent();
19341    parseOperationDefinitionOperationDefinitionParameterComponentProperties(json, owner, res);
19342    return res;
19343  }
19344
19345  protected void parseOperationDefinitionOperationDefinitionParameterComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterComponent res) throws IOException, FHIRFormatError {
19346    parseBackboneElementProperties(json, res);
19347    if (json.has("name"))
19348      res.setNameElement(parseCode(json.get("name").getAsString()));
19349    if (json.has("_name"))
19350      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19351    if (json.has("use"))
19352      res.setUseElement(parseEnumeration(json.get("use").getAsString(), OperationDefinition.OperationParameterUse.NULL, new OperationDefinition.OperationParameterUseEnumFactory()));
19353    if (json.has("_use"))
19354      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
19355    if (json.has("min"))
19356      res.setMinElement(parseInteger(json.get("min").getAsLong()));
19357    if (json.has("_min"))
19358      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
19359    if (json.has("max"))
19360      res.setMaxElement(parseString(json.get("max").getAsString()));
19361    if (json.has("_max"))
19362      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
19363    if (json.has("documentation"))
19364      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
19365    if (json.has("_documentation"))
19366      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
19367    if (json.has("type"))
19368      res.setTypeElement(parseCode(json.get("type").getAsString()));
19369    if (json.has("_type"))
19370      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
19371    if (json.has("targetProfile")) {
19372      JsonArray array = json.getAsJsonArray("targetProfile");
19373      for (int i = 0; i < array.size(); i++) {
19374        res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
19375      }
19376    };
19377    if (json.has("_targetProfile")) {
19378      JsonArray array = json.getAsJsonArray("_targetProfile");
19379      for (int i = 0; i < array.size(); i++) {
19380        if (i == res.getTargetProfile().size())
19381          res.getTargetProfile().add(parseCanonical(null));
19382        if (array.get(i) instanceof JsonObject) 
19383          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
19384      }
19385    };
19386    if (json.has("searchType"))
19387      res.setSearchTypeElement(parseEnumeration(json.get("searchType").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
19388    if (json.has("_searchType"))
19389      parseElementProperties(json.getAsJsonObject("_searchType"), res.getSearchTypeElement());
19390    if (json.has("binding"))
19391      res.setBinding(parseOperationDefinitionOperationDefinitionParameterBindingComponent(json.getAsJsonObject("binding"), owner));
19392    if (json.has("referencedFrom")) {
19393      JsonArray array = json.getAsJsonArray("referencedFrom");
19394      for (int i = 0; i < array.size(); i++) {
19395        res.getReferencedFrom().add(parseOperationDefinitionOperationDefinitionParameterReferencedFromComponent(array.get(i).getAsJsonObject(), owner));
19396      }
19397    };
19398    if (json.has("part")) {
19399      JsonArray array = json.getAsJsonArray("part");
19400      for (int i = 0; i < array.size(); i++) {
19401        res.getPart().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), owner));
19402      }
19403    };
19404  }
19405
19406  protected OperationDefinition.OperationDefinitionParameterBindingComponent parseOperationDefinitionOperationDefinitionParameterBindingComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
19407    OperationDefinition.OperationDefinitionParameterBindingComponent res = new OperationDefinition.OperationDefinitionParameterBindingComponent();
19408    parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(json, owner, res);
19409    return res;
19410  }
19411
19412  protected void parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterBindingComponent res) throws IOException, FHIRFormatError {
19413    parseBackboneElementProperties(json, res);
19414    if (json.has("strength"))
19415      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
19416    if (json.has("_strength"))
19417      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
19418    if (json.has("valueSet"))
19419      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
19420    if (json.has("_valueSet"))
19421      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
19422  }
19423
19424  protected OperationDefinition.OperationDefinitionParameterReferencedFromComponent parseOperationDefinitionOperationDefinitionParameterReferencedFromComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
19425    OperationDefinition.OperationDefinitionParameterReferencedFromComponent res = new OperationDefinition.OperationDefinitionParameterReferencedFromComponent();
19426    parseOperationDefinitionOperationDefinitionParameterReferencedFromComponentProperties(json, owner, res);
19427    return res;
19428  }
19429
19430  protected void parseOperationDefinitionOperationDefinitionParameterReferencedFromComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterReferencedFromComponent res) throws IOException, FHIRFormatError {
19431    parseBackboneElementProperties(json, res);
19432    if (json.has("source"))
19433      res.setSourceElement(parseString(json.get("source").getAsString()));
19434    if (json.has("_source"))
19435      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
19436    if (json.has("sourceId"))
19437      res.setSourceIdElement(parseString(json.get("sourceId").getAsString()));
19438    if (json.has("_sourceId"))
19439      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
19440  }
19441
19442  protected OperationDefinition.OperationDefinitionOverloadComponent parseOperationDefinitionOperationDefinitionOverloadComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
19443    OperationDefinition.OperationDefinitionOverloadComponent res = new OperationDefinition.OperationDefinitionOverloadComponent();
19444    parseOperationDefinitionOperationDefinitionOverloadComponentProperties(json, owner, res);
19445    return res;
19446  }
19447
19448  protected void parseOperationDefinitionOperationDefinitionOverloadComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionOverloadComponent res) throws IOException, FHIRFormatError {
19449    parseBackboneElementProperties(json, res);
19450    if (json.has("parameterName")) {
19451      JsonArray array = json.getAsJsonArray("parameterName");
19452      for (int i = 0; i < array.size(); i++) {
19453        res.getParameterName().add(parseString(array.get(i).getAsString()));
19454      }
19455    };
19456    if (json.has("_parameterName")) {
19457      JsonArray array = json.getAsJsonArray("_parameterName");
19458      for (int i = 0; i < array.size(); i++) {
19459        if (i == res.getParameterName().size())
19460          res.getParameterName().add(parseString(null));
19461        if (array.get(i) instanceof JsonObject) 
19462          parseElementProperties(array.get(i).getAsJsonObject(), res.getParameterName().get(i));
19463      }
19464    };
19465    if (json.has("comment"))
19466      res.setCommentElement(parseString(json.get("comment").getAsString()));
19467    if (json.has("_comment"))
19468      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
19469  }
19470
19471  protected OperationOutcome parseOperationOutcome(JsonObject json) throws IOException, FHIRFormatError {
19472    OperationOutcome res = new OperationOutcome();
19473    parseOperationOutcomeProperties(json, res);
19474    return res;
19475  }
19476
19477  protected void parseOperationOutcomeProperties(JsonObject json, OperationOutcome res) throws IOException, FHIRFormatError {
19478    parseDomainResourceProperties(json, res);
19479    if (json.has("issue")) {
19480      JsonArray array = json.getAsJsonArray("issue");
19481      for (int i = 0; i < array.size(); i++) {
19482        res.getIssue().add(parseOperationOutcomeOperationOutcomeIssueComponent(array.get(i).getAsJsonObject(), res));
19483      }
19484    };
19485  }
19486
19487  protected OperationOutcome.OperationOutcomeIssueComponent parseOperationOutcomeOperationOutcomeIssueComponent(JsonObject json, OperationOutcome owner) throws IOException, FHIRFormatError {
19488    OperationOutcome.OperationOutcomeIssueComponent res = new OperationOutcome.OperationOutcomeIssueComponent();
19489    parseOperationOutcomeOperationOutcomeIssueComponentProperties(json, owner, res);
19490    return res;
19491  }
19492
19493  protected void parseOperationOutcomeOperationOutcomeIssueComponentProperties(JsonObject json, OperationOutcome owner, OperationOutcome.OperationOutcomeIssueComponent res) throws IOException, FHIRFormatError {
19494    parseBackboneElementProperties(json, res);
19495    if (json.has("severity"))
19496      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), OperationOutcome.IssueSeverity.NULL, new OperationOutcome.IssueSeverityEnumFactory()));
19497    if (json.has("_severity"))
19498      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
19499    if (json.has("code"))
19500      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), OperationOutcome.IssueType.NULL, new OperationOutcome.IssueTypeEnumFactory()));
19501    if (json.has("_code"))
19502      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
19503    if (json.has("details"))
19504      res.setDetails(parseCodeableConcept(json.getAsJsonObject("details")));
19505    if (json.has("diagnostics"))
19506      res.setDiagnosticsElement(parseString(json.get("diagnostics").getAsString()));
19507    if (json.has("_diagnostics"))
19508      parseElementProperties(json.getAsJsonObject("_diagnostics"), res.getDiagnosticsElement());
19509    if (json.has("location")) {
19510      JsonArray array = json.getAsJsonArray("location");
19511      for (int i = 0; i < array.size(); i++) {
19512        res.getLocation().add(parseString(array.get(i).getAsString()));
19513      }
19514    };
19515    if (json.has("_location")) {
19516      JsonArray array = json.getAsJsonArray("_location");
19517      for (int i = 0; i < array.size(); i++) {
19518        if (i == res.getLocation().size())
19519          res.getLocation().add(parseString(null));
19520        if (array.get(i) instanceof JsonObject) 
19521          parseElementProperties(array.get(i).getAsJsonObject(), res.getLocation().get(i));
19522      }
19523    };
19524    if (json.has("expression")) {
19525      JsonArray array = json.getAsJsonArray("expression");
19526      for (int i = 0; i < array.size(); i++) {
19527        res.getExpression().add(parseString(array.get(i).getAsString()));
19528      }
19529    };
19530    if (json.has("_expression")) {
19531      JsonArray array = json.getAsJsonArray("_expression");
19532      for (int i = 0; i < array.size(); i++) {
19533        if (i == res.getExpression().size())
19534          res.getExpression().add(parseString(null));
19535        if (array.get(i) instanceof JsonObject) 
19536          parseElementProperties(array.get(i).getAsJsonObject(), res.getExpression().get(i));
19537      }
19538    };
19539  }
19540
19541  protected Organization parseOrganization(JsonObject json) throws IOException, FHIRFormatError {
19542    Organization res = new Organization();
19543    parseOrganizationProperties(json, res);
19544    return res;
19545  }
19546
19547  protected void parseOrganizationProperties(JsonObject json, Organization res) throws IOException, FHIRFormatError {
19548    parseDomainResourceProperties(json, res);
19549    if (json.has("identifier")) {
19550      JsonArray array = json.getAsJsonArray("identifier");
19551      for (int i = 0; i < array.size(); i++) {
19552        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19553      }
19554    };
19555    if (json.has("active"))
19556      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
19557    if (json.has("_active"))
19558      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
19559    if (json.has("type")) {
19560      JsonArray array = json.getAsJsonArray("type");
19561      for (int i = 0; i < array.size(); i++) {
19562        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19563      }
19564    };
19565    if (json.has("name"))
19566      res.setNameElement(parseString(json.get("name").getAsString()));
19567    if (json.has("_name"))
19568      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19569    if (json.has("alias")) {
19570      JsonArray array = json.getAsJsonArray("alias");
19571      for (int i = 0; i < array.size(); i++) {
19572        res.getAlias().add(parseString(array.get(i).getAsString()));
19573      }
19574    };
19575    if (json.has("_alias")) {
19576      JsonArray array = json.getAsJsonArray("_alias");
19577      for (int i = 0; i < array.size(); i++) {
19578        if (i == res.getAlias().size())
19579          res.getAlias().add(parseString(null));
19580        if (array.get(i) instanceof JsonObject) 
19581          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
19582      }
19583    };
19584    if (json.has("telecom")) {
19585      JsonArray array = json.getAsJsonArray("telecom");
19586      for (int i = 0; i < array.size(); i++) {
19587        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
19588      }
19589    };
19590    if (json.has("address")) {
19591      JsonArray array = json.getAsJsonArray("address");
19592      for (int i = 0; i < array.size(); i++) {
19593        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
19594      }
19595    };
19596    if (json.has("partOf"))
19597      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
19598    if (json.has("contact")) {
19599      JsonArray array = json.getAsJsonArray("contact");
19600      for (int i = 0; i < array.size(); i++) {
19601        res.getContact().add(parseOrganizationOrganizationContactComponent(array.get(i).getAsJsonObject(), res));
19602      }
19603    };
19604    if (json.has("endpoint")) {
19605      JsonArray array = json.getAsJsonArray("endpoint");
19606      for (int i = 0; i < array.size(); i++) {
19607        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
19608      }
19609    };
19610  }
19611
19612  protected Organization.OrganizationContactComponent parseOrganizationOrganizationContactComponent(JsonObject json, Organization owner) throws IOException, FHIRFormatError {
19613    Organization.OrganizationContactComponent res = new Organization.OrganizationContactComponent();
19614    parseOrganizationOrganizationContactComponentProperties(json, owner, res);
19615    return res;
19616  }
19617
19618  protected void parseOrganizationOrganizationContactComponentProperties(JsonObject json, Organization owner, Organization.OrganizationContactComponent res) throws IOException, FHIRFormatError {
19619    parseBackboneElementProperties(json, res);
19620    if (json.has("purpose"))
19621      res.setPurpose(parseCodeableConcept(json.getAsJsonObject("purpose")));
19622    if (json.has("name"))
19623      res.setName(parseHumanName(json.getAsJsonObject("name")));
19624    if (json.has("telecom")) {
19625      JsonArray array = json.getAsJsonArray("telecom");
19626      for (int i = 0; i < array.size(); i++) {
19627        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
19628      }
19629    };
19630    if (json.has("address"))
19631      res.setAddress(parseAddress(json.getAsJsonObject("address")));
19632  }
19633
19634  protected OrganizationAffiliation parseOrganizationAffiliation(JsonObject json) throws IOException, FHIRFormatError {
19635    OrganizationAffiliation res = new OrganizationAffiliation();
19636    parseOrganizationAffiliationProperties(json, res);
19637    return res;
19638  }
19639
19640  protected void parseOrganizationAffiliationProperties(JsonObject json, OrganizationAffiliation res) throws IOException, FHIRFormatError {
19641    parseDomainResourceProperties(json, res);
19642    if (json.has("identifier")) {
19643      JsonArray array = json.getAsJsonArray("identifier");
19644      for (int i = 0; i < array.size(); i++) {
19645        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19646      }
19647    };
19648    if (json.has("active"))
19649      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
19650    if (json.has("_active"))
19651      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
19652    if (json.has("period"))
19653      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
19654    if (json.has("organization"))
19655      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
19656    if (json.has("participatingOrganization"))
19657      res.setParticipatingOrganization(parseReference(json.getAsJsonObject("participatingOrganization")));
19658    if (json.has("network")) {
19659      JsonArray array = json.getAsJsonArray("network");
19660      for (int i = 0; i < array.size(); i++) {
19661        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
19662      }
19663    };
19664    if (json.has("code")) {
19665      JsonArray array = json.getAsJsonArray("code");
19666      for (int i = 0; i < array.size(); i++) {
19667        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19668      }
19669    };
19670    if (json.has("specialty")) {
19671      JsonArray array = json.getAsJsonArray("specialty");
19672      for (int i = 0; i < array.size(); i++) {
19673        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19674      }
19675    };
19676    if (json.has("location")) {
19677      JsonArray array = json.getAsJsonArray("location");
19678      for (int i = 0; i < array.size(); i++) {
19679        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
19680      }
19681    };
19682    if (json.has("healthcareService")) {
19683      JsonArray array = json.getAsJsonArray("healthcareService");
19684      for (int i = 0; i < array.size(); i++) {
19685        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
19686      }
19687    };
19688    if (json.has("telecom")) {
19689      JsonArray array = json.getAsJsonArray("telecom");
19690      for (int i = 0; i < array.size(); i++) {
19691        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
19692      }
19693    };
19694    if (json.has("endpoint")) {
19695      JsonArray array = json.getAsJsonArray("endpoint");
19696      for (int i = 0; i < array.size(); i++) {
19697        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
19698      }
19699    };
19700  }
19701
19702  protected Patient parsePatient(JsonObject json) throws IOException, FHIRFormatError {
19703    Patient res = new Patient();
19704    parsePatientProperties(json, res);
19705    return res;
19706  }
19707
19708  protected void parsePatientProperties(JsonObject json, Patient res) throws IOException, FHIRFormatError {
19709    parseDomainResourceProperties(json, res);
19710    if (json.has("identifier")) {
19711      JsonArray array = json.getAsJsonArray("identifier");
19712      for (int i = 0; i < array.size(); i++) {
19713        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19714      }
19715    };
19716    if (json.has("active"))
19717      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
19718    if (json.has("_active"))
19719      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
19720    if (json.has("name")) {
19721      JsonArray array = json.getAsJsonArray("name");
19722      for (int i = 0; i < array.size(); i++) {
19723        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
19724      }
19725    };
19726    if (json.has("telecom")) {
19727      JsonArray array = json.getAsJsonArray("telecom");
19728      for (int i = 0; i < array.size(); i++) {
19729        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
19730      }
19731    };
19732    if (json.has("gender"))
19733      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
19734    if (json.has("_gender"))
19735      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
19736    if (json.has("birthDate"))
19737      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
19738    if (json.has("_birthDate"))
19739      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
19740    Type deceased = parseType("deceased", json);
19741    if (deceased != null)
19742      res.setDeceased(deceased);
19743    if (json.has("address")) {
19744      JsonArray array = json.getAsJsonArray("address");
19745      for (int i = 0; i < array.size(); i++) {
19746        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
19747      }
19748    };
19749    if (json.has("maritalStatus"))
19750      res.setMaritalStatus(parseCodeableConcept(json.getAsJsonObject("maritalStatus")));
19751    Type multipleBirth = parseType("multipleBirth", json);
19752    if (multipleBirth != null)
19753      res.setMultipleBirth(multipleBirth);
19754    if (json.has("photo")) {
19755      JsonArray array = json.getAsJsonArray("photo");
19756      for (int i = 0; i < array.size(); i++) {
19757        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
19758      }
19759    };
19760    if (json.has("contact")) {
19761      JsonArray array = json.getAsJsonArray("contact");
19762      for (int i = 0; i < array.size(); i++) {
19763        res.getContact().add(parsePatientContactComponent(array.get(i).getAsJsonObject(), res));
19764      }
19765    };
19766    if (json.has("communication")) {
19767      JsonArray array = json.getAsJsonArray("communication");
19768      for (int i = 0; i < array.size(); i++) {
19769        res.getCommunication().add(parsePatientPatientCommunicationComponent(array.get(i).getAsJsonObject(), res));
19770      }
19771    };
19772    if (json.has("generalPractitioner")) {
19773      JsonArray array = json.getAsJsonArray("generalPractitioner");
19774      for (int i = 0; i < array.size(); i++) {
19775        res.getGeneralPractitioner().add(parseReference(array.get(i).getAsJsonObject()));
19776      }
19777    };
19778    if (json.has("managingOrganization"))
19779      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
19780    if (json.has("link")) {
19781      JsonArray array = json.getAsJsonArray("link");
19782      for (int i = 0; i < array.size(); i++) {
19783        res.getLink().add(parsePatientPatientLinkComponent(array.get(i).getAsJsonObject(), res));
19784      }
19785    };
19786  }
19787
19788  protected Patient.ContactComponent parsePatientContactComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
19789    Patient.ContactComponent res = new Patient.ContactComponent();
19790    parsePatientContactComponentProperties(json, owner, res);
19791    return res;
19792  }
19793
19794  protected void parsePatientContactComponentProperties(JsonObject json, Patient owner, Patient.ContactComponent res) throws IOException, FHIRFormatError {
19795    parseBackboneElementProperties(json, res);
19796    if (json.has("relationship")) {
19797      JsonArray array = json.getAsJsonArray("relationship");
19798      for (int i = 0; i < array.size(); i++) {
19799        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19800      }
19801    };
19802    if (json.has("name"))
19803      res.setName(parseHumanName(json.getAsJsonObject("name")));
19804    if (json.has("telecom")) {
19805      JsonArray array = json.getAsJsonArray("telecom");
19806      for (int i = 0; i < array.size(); i++) {
19807        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
19808      }
19809    };
19810    if (json.has("address"))
19811      res.setAddress(parseAddress(json.getAsJsonObject("address")));
19812    if (json.has("gender"))
19813      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
19814    if (json.has("_gender"))
19815      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
19816    if (json.has("organization"))
19817      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
19818    if (json.has("period"))
19819      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
19820  }
19821
19822  protected Patient.PatientCommunicationComponent parsePatientPatientCommunicationComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
19823    Patient.PatientCommunicationComponent res = new Patient.PatientCommunicationComponent();
19824    parsePatientPatientCommunicationComponentProperties(json, owner, res);
19825    return res;
19826  }
19827
19828  protected void parsePatientPatientCommunicationComponentProperties(JsonObject json, Patient owner, Patient.PatientCommunicationComponent res) throws IOException, FHIRFormatError {
19829    parseBackboneElementProperties(json, res);
19830    if (json.has("language"))
19831      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
19832    if (json.has("preferred"))
19833      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
19834    if (json.has("_preferred"))
19835      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
19836  }
19837
19838  protected Patient.PatientLinkComponent parsePatientPatientLinkComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
19839    Patient.PatientLinkComponent res = new Patient.PatientLinkComponent();
19840    parsePatientPatientLinkComponentProperties(json, owner, res);
19841    return res;
19842  }
19843
19844  protected void parsePatientPatientLinkComponentProperties(JsonObject json, Patient owner, Patient.PatientLinkComponent res) throws IOException, FHIRFormatError {
19845    parseBackboneElementProperties(json, res);
19846    if (json.has("other"))
19847      res.setOther(parseReference(json.getAsJsonObject("other")));
19848    if (json.has("type"))
19849      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Patient.LinkType.NULL, new Patient.LinkTypeEnumFactory()));
19850    if (json.has("_type"))
19851      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
19852  }
19853
19854  protected PaymentNotice parsePaymentNotice(JsonObject json) throws IOException, FHIRFormatError {
19855    PaymentNotice res = new PaymentNotice();
19856    parsePaymentNoticeProperties(json, res);
19857    return res;
19858  }
19859
19860  protected void parsePaymentNoticeProperties(JsonObject json, PaymentNotice res) throws IOException, FHIRFormatError {
19861    parseDomainResourceProperties(json, res);
19862    if (json.has("identifier")) {
19863      JsonArray array = json.getAsJsonArray("identifier");
19864      for (int i = 0; i < array.size(); i++) {
19865        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19866      }
19867    };
19868    if (json.has("status"))
19869      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), PaymentNotice.PaymentNoticeStatus.NULL, new PaymentNotice.PaymentNoticeStatusEnumFactory()));
19870    if (json.has("_status"))
19871      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19872    if (json.has("request"))
19873      res.setRequest(parseReference(json.getAsJsonObject("request")));
19874    if (json.has("response"))
19875      res.setResponse(parseReference(json.getAsJsonObject("response")));
19876    if (json.has("created"))
19877      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
19878    if (json.has("_created"))
19879      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
19880    if (json.has("provider"))
19881      res.setProvider(parseReference(json.getAsJsonObject("provider")));
19882    if (json.has("payment"))
19883      res.setPayment(parseReference(json.getAsJsonObject("payment")));
19884    if (json.has("paymentDate"))
19885      res.setPaymentDateElement(parseDate(json.get("paymentDate").getAsString()));
19886    if (json.has("_paymentDate"))
19887      parseElementProperties(json.getAsJsonObject("_paymentDate"), res.getPaymentDateElement());
19888    if (json.has("payee"))
19889      res.setPayee(parseReference(json.getAsJsonObject("payee")));
19890    if (json.has("recipient"))
19891      res.setRecipient(parseReference(json.getAsJsonObject("recipient")));
19892    if (json.has("amount"))
19893      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
19894    if (json.has("paymentStatus"))
19895      res.setPaymentStatus(parseCodeableConcept(json.getAsJsonObject("paymentStatus")));
19896  }
19897
19898  protected PaymentReconciliation parsePaymentReconciliation(JsonObject json) throws IOException, FHIRFormatError {
19899    PaymentReconciliation res = new PaymentReconciliation();
19900    parsePaymentReconciliationProperties(json, res);
19901    return res;
19902  }
19903
19904  protected void parsePaymentReconciliationProperties(JsonObject json, PaymentReconciliation res) throws IOException, FHIRFormatError {
19905    parseDomainResourceProperties(json, res);
19906    if (json.has("identifier")) {
19907      JsonArray array = json.getAsJsonArray("identifier");
19908      for (int i = 0; i < array.size(); i++) {
19909        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19910      }
19911    };
19912    if (json.has("status"))
19913      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), PaymentReconciliation.PaymentReconciliationStatus.NULL, new PaymentReconciliation.PaymentReconciliationStatusEnumFactory()));
19914    if (json.has("_status"))
19915      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19916    if (json.has("period"))
19917      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
19918    if (json.has("created"))
19919      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
19920    if (json.has("_created"))
19921      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
19922    if (json.has("paymentIssuer"))
19923      res.setPaymentIssuer(parseReference(json.getAsJsonObject("paymentIssuer")));
19924    if (json.has("request"))
19925      res.setRequest(parseReference(json.getAsJsonObject("request")));
19926    if (json.has("requestor"))
19927      res.setRequestor(parseReference(json.getAsJsonObject("requestor")));
19928    if (json.has("outcome"))
19929      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
19930    if (json.has("_outcome"))
19931      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
19932    if (json.has("disposition"))
19933      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
19934    if (json.has("_disposition"))
19935      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
19936    if (json.has("paymentDate"))
19937      res.setPaymentDateElement(parseDate(json.get("paymentDate").getAsString()));
19938    if (json.has("_paymentDate"))
19939      parseElementProperties(json.getAsJsonObject("_paymentDate"), res.getPaymentDateElement());
19940    if (json.has("paymentAmount"))
19941      res.setPaymentAmount(parseMoney(json.getAsJsonObject("paymentAmount")));
19942    if (json.has("paymentIdentifier"))
19943      res.setPaymentIdentifier(parseIdentifier(json.getAsJsonObject("paymentIdentifier")));
19944    if (json.has("detail")) {
19945      JsonArray array = json.getAsJsonArray("detail");
19946      for (int i = 0; i < array.size(); i++) {
19947        res.getDetail().add(parsePaymentReconciliationDetailsComponent(array.get(i).getAsJsonObject(), res));
19948      }
19949    };
19950    if (json.has("formCode"))
19951      res.setFormCode(parseCodeableConcept(json.getAsJsonObject("formCode")));
19952    if (json.has("processNote")) {
19953      JsonArray array = json.getAsJsonArray("processNote");
19954      for (int i = 0; i < array.size(); i++) {
19955        res.getProcessNote().add(parsePaymentReconciliationNotesComponent(array.get(i).getAsJsonObject(), res));
19956      }
19957    };
19958  }
19959
19960  protected PaymentReconciliation.DetailsComponent parsePaymentReconciliationDetailsComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
19961    PaymentReconciliation.DetailsComponent res = new PaymentReconciliation.DetailsComponent();
19962    parsePaymentReconciliationDetailsComponentProperties(json, owner, res);
19963    return res;
19964  }
19965
19966  protected void parsePaymentReconciliationDetailsComponentProperties(JsonObject json, PaymentReconciliation owner, PaymentReconciliation.DetailsComponent res) throws IOException, FHIRFormatError {
19967    parseBackboneElementProperties(json, res);
19968    if (json.has("identifier"))
19969      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
19970    if (json.has("predecessor"))
19971      res.setPredecessor(parseIdentifier(json.getAsJsonObject("predecessor")));
19972    if (json.has("type"))
19973      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
19974    if (json.has("request"))
19975      res.setRequest(parseReference(json.getAsJsonObject("request")));
19976    if (json.has("submitter"))
19977      res.setSubmitter(parseReference(json.getAsJsonObject("submitter")));
19978    if (json.has("response"))
19979      res.setResponse(parseReference(json.getAsJsonObject("response")));
19980    if (json.has("date"))
19981      res.setDateElement(parseDate(json.get("date").getAsString()));
19982    if (json.has("_date"))
19983      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
19984    if (json.has("responsible"))
19985      res.setResponsible(parseReference(json.getAsJsonObject("responsible")));
19986    if (json.has("payee"))
19987      res.setPayee(parseReference(json.getAsJsonObject("payee")));
19988    if (json.has("amount"))
19989      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
19990  }
19991
19992  protected PaymentReconciliation.NotesComponent parsePaymentReconciliationNotesComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
19993    PaymentReconciliation.NotesComponent res = new PaymentReconciliation.NotesComponent();
19994    parsePaymentReconciliationNotesComponentProperties(json, owner, res);
19995    return res;
19996  }
19997
19998  protected void parsePaymentReconciliationNotesComponentProperties(JsonObject json, PaymentReconciliation owner, PaymentReconciliation.NotesComponent res) throws IOException, FHIRFormatError {
19999    parseBackboneElementProperties(json, res);
20000    if (json.has("type"))
20001      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
20002    if (json.has("_type"))
20003      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
20004    if (json.has("text"))
20005      res.setTextElement(parseString(json.get("text").getAsString()));
20006    if (json.has("_text"))
20007      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
20008  }
20009
20010  protected Person parsePerson(JsonObject json) throws IOException, FHIRFormatError {
20011    Person res = new Person();
20012    parsePersonProperties(json, res);
20013    return res;
20014  }
20015
20016  protected void parsePersonProperties(JsonObject json, Person res) throws IOException, FHIRFormatError {
20017    parseDomainResourceProperties(json, res);
20018    if (json.has("identifier")) {
20019      JsonArray array = json.getAsJsonArray("identifier");
20020      for (int i = 0; i < array.size(); i++) {
20021        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20022      }
20023    };
20024    if (json.has("name")) {
20025      JsonArray array = json.getAsJsonArray("name");
20026      for (int i = 0; i < array.size(); i++) {
20027        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
20028      }
20029    };
20030    if (json.has("telecom")) {
20031      JsonArray array = json.getAsJsonArray("telecom");
20032      for (int i = 0; i < array.size(); i++) {
20033        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20034      }
20035    };
20036    if (json.has("gender"))
20037      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
20038    if (json.has("_gender"))
20039      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
20040    if (json.has("birthDate"))
20041      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
20042    if (json.has("_birthDate"))
20043      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
20044    if (json.has("address")) {
20045      JsonArray array = json.getAsJsonArray("address");
20046      for (int i = 0; i < array.size(); i++) {
20047        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
20048      }
20049    };
20050    if (json.has("photo"))
20051      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
20052    if (json.has("managingOrganization"))
20053      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
20054    if (json.has("active"))
20055      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20056    if (json.has("_active"))
20057      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
20058    if (json.has("link")) {
20059      JsonArray array = json.getAsJsonArray("link");
20060      for (int i = 0; i < array.size(); i++) {
20061        res.getLink().add(parsePersonPersonLinkComponent(array.get(i).getAsJsonObject(), res));
20062      }
20063    };
20064  }
20065
20066  protected Person.PersonLinkComponent parsePersonPersonLinkComponent(JsonObject json, Person owner) throws IOException, FHIRFormatError {
20067    Person.PersonLinkComponent res = new Person.PersonLinkComponent();
20068    parsePersonPersonLinkComponentProperties(json, owner, res);
20069    return res;
20070  }
20071
20072  protected void parsePersonPersonLinkComponentProperties(JsonObject json, Person owner, Person.PersonLinkComponent res) throws IOException, FHIRFormatError {
20073    parseBackboneElementProperties(json, res);
20074    if (json.has("target"))
20075      res.setTarget(parseReference(json.getAsJsonObject("target")));
20076    if (json.has("assurance"))
20077      res.setAssuranceElement(parseEnumeration(json.get("assurance").getAsString(), Person.IdentityAssuranceLevel.NULL, new Person.IdentityAssuranceLevelEnumFactory()));
20078    if (json.has("_assurance"))
20079      parseElementProperties(json.getAsJsonObject("_assurance"), res.getAssuranceElement());
20080  }
20081
20082  protected PlanDefinition parsePlanDefinition(JsonObject json) throws IOException, FHIRFormatError {
20083    PlanDefinition res = new PlanDefinition();
20084    parsePlanDefinitionProperties(json, res);
20085    return res;
20086  }
20087
20088  protected void parsePlanDefinitionProperties(JsonObject json, PlanDefinition res) throws IOException, FHIRFormatError {
20089    parseDomainResourceProperties(json, res);
20090    if (json.has("url"))
20091      res.setUrlElement(parseUri(json.get("url").getAsString()));
20092    if (json.has("_url"))
20093      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
20094    if (json.has("identifier")) {
20095      JsonArray array = json.getAsJsonArray("identifier");
20096      for (int i = 0; i < array.size(); i++) {
20097        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20098      }
20099    };
20100    if (json.has("version"))
20101      res.setVersionElement(parseString(json.get("version").getAsString()));
20102    if (json.has("_version"))
20103      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
20104    if (json.has("name"))
20105      res.setNameElement(parseString(json.get("name").getAsString()));
20106    if (json.has("_name"))
20107      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
20108    if (json.has("title"))
20109      res.setTitleElement(parseString(json.get("title").getAsString()));
20110    if (json.has("_title"))
20111      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
20112    if (json.has("subtitle"))
20113      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
20114    if (json.has("_subtitle"))
20115      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
20116    if (json.has("type"))
20117      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
20118    if (json.has("status"))
20119      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
20120    if (json.has("_status"))
20121      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
20122    if (json.has("experimental"))
20123      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
20124    if (json.has("_experimental"))
20125      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
20126    Type subject = parseType("subject", json);
20127    if (subject != null)
20128      res.setSubject(subject);
20129    if (json.has("date"))
20130      res.setDateElement(parseDateTime(json.get("date").getAsString()));
20131    if (json.has("_date"))
20132      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
20133    if (json.has("publisher"))
20134      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
20135    if (json.has("_publisher"))
20136      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
20137    if (json.has("contact")) {
20138      JsonArray array = json.getAsJsonArray("contact");
20139      for (int i = 0; i < array.size(); i++) {
20140        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
20141      }
20142    };
20143    if (json.has("description"))
20144      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
20145    if (json.has("_description"))
20146      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
20147    if (json.has("useContext")) {
20148      JsonArray array = json.getAsJsonArray("useContext");
20149      for (int i = 0; i < array.size(); i++) {
20150        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
20151      }
20152    };
20153    if (json.has("jurisdiction")) {
20154      JsonArray array = json.getAsJsonArray("jurisdiction");
20155      for (int i = 0; i < array.size(); i++) {
20156        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20157      }
20158    };
20159    if (json.has("purpose"))
20160      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
20161    if (json.has("_purpose"))
20162      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
20163    if (json.has("usage"))
20164      res.setUsageElement(parseString(json.get("usage").getAsString()));
20165    if (json.has("_usage"))
20166      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
20167    if (json.has("copyright"))
20168      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
20169    if (json.has("_copyright"))
20170      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
20171    if (json.has("approvalDate"))
20172      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
20173    if (json.has("_approvalDate"))
20174      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
20175    if (json.has("lastReviewDate"))
20176      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
20177    if (json.has("_lastReviewDate"))
20178      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
20179    if (json.has("effectivePeriod"))
20180      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
20181    if (json.has("topic")) {
20182      JsonArray array = json.getAsJsonArray("topic");
20183      for (int i = 0; i < array.size(); i++) {
20184        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20185      }
20186    };
20187    if (json.has("author")) {
20188      JsonArray array = json.getAsJsonArray("author");
20189      for (int i = 0; i < array.size(); i++) {
20190        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
20191      }
20192    };
20193    if (json.has("editor")) {
20194      JsonArray array = json.getAsJsonArray("editor");
20195      for (int i = 0; i < array.size(); i++) {
20196        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
20197      }
20198    };
20199    if (json.has("reviewer")) {
20200      JsonArray array = json.getAsJsonArray("reviewer");
20201      for (int i = 0; i < array.size(); i++) {
20202        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
20203      }
20204    };
20205    if (json.has("endorser")) {
20206      JsonArray array = json.getAsJsonArray("endorser");
20207      for (int i = 0; i < array.size(); i++) {
20208        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
20209      }
20210    };
20211    if (json.has("relatedArtifact")) {
20212      JsonArray array = json.getAsJsonArray("relatedArtifact");
20213      for (int i = 0; i < array.size(); i++) {
20214        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
20215      }
20216    };
20217    if (json.has("library")) {
20218      JsonArray array = json.getAsJsonArray("library");
20219      for (int i = 0; i < array.size(); i++) {
20220        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
20221      }
20222    };
20223    if (json.has("_library")) {
20224      JsonArray array = json.getAsJsonArray("_library");
20225      for (int i = 0; i < array.size(); i++) {
20226        if (i == res.getLibrary().size())
20227          res.getLibrary().add(parseCanonical(null));
20228        if (array.get(i) instanceof JsonObject) 
20229          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
20230      }
20231    };
20232    if (json.has("goal")) {
20233      JsonArray array = json.getAsJsonArray("goal");
20234      for (int i = 0; i < array.size(); i++) {
20235        res.getGoal().add(parsePlanDefinitionPlanDefinitionGoalComponent(array.get(i).getAsJsonObject(), res));
20236      }
20237    };
20238    if (json.has("action")) {
20239      JsonArray array = json.getAsJsonArray("action");
20240      for (int i = 0; i < array.size(); i++) {
20241        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), res));
20242      }
20243    };
20244  }
20245
20246  protected PlanDefinition.PlanDefinitionGoalComponent parsePlanDefinitionPlanDefinitionGoalComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20247    PlanDefinition.PlanDefinitionGoalComponent res = new PlanDefinition.PlanDefinitionGoalComponent();
20248    parsePlanDefinitionPlanDefinitionGoalComponentProperties(json, owner, res);
20249    return res;
20250  }
20251
20252  protected void parsePlanDefinitionPlanDefinitionGoalComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalComponent res) throws IOException, FHIRFormatError {
20253    parseBackboneElementProperties(json, res);
20254    if (json.has("category"))
20255      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
20256    if (json.has("description"))
20257      res.setDescription(parseCodeableConcept(json.getAsJsonObject("description")));
20258    if (json.has("priority"))
20259      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
20260    if (json.has("start"))
20261      res.setStart(parseCodeableConcept(json.getAsJsonObject("start")));
20262    if (json.has("addresses")) {
20263      JsonArray array = json.getAsJsonArray("addresses");
20264      for (int i = 0; i < array.size(); i++) {
20265        res.getAddresses().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20266      }
20267    };
20268    if (json.has("documentation")) {
20269      JsonArray array = json.getAsJsonArray("documentation");
20270      for (int i = 0; i < array.size(); i++) {
20271        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
20272      }
20273    };
20274    if (json.has("target")) {
20275      JsonArray array = json.getAsJsonArray("target");
20276      for (int i = 0; i < array.size(); i++) {
20277        res.getTarget().add(parsePlanDefinitionPlanDefinitionGoalTargetComponent(array.get(i).getAsJsonObject(), owner));
20278      }
20279    };
20280  }
20281
20282  protected PlanDefinition.PlanDefinitionGoalTargetComponent parsePlanDefinitionPlanDefinitionGoalTargetComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20283    PlanDefinition.PlanDefinitionGoalTargetComponent res = new PlanDefinition.PlanDefinitionGoalTargetComponent();
20284    parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(json, owner, res);
20285    return res;
20286  }
20287
20288  protected void parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalTargetComponent res) throws IOException, FHIRFormatError {
20289    parseBackboneElementProperties(json, res);
20290    if (json.has("measure"))
20291      res.setMeasure(parseCodeableConcept(json.getAsJsonObject("measure")));
20292    Type detail = parseType("detail", json);
20293    if (detail != null)
20294      res.setDetail(detail);
20295    if (json.has("due"))
20296      res.setDue(parseDuration(json.getAsJsonObject("due")));
20297  }
20298
20299  protected PlanDefinition.PlanDefinitionActionComponent parsePlanDefinitionPlanDefinitionActionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20300    PlanDefinition.PlanDefinitionActionComponent res = new PlanDefinition.PlanDefinitionActionComponent();
20301    parsePlanDefinitionPlanDefinitionActionComponentProperties(json, owner, res);
20302    return res;
20303  }
20304
20305  protected void parsePlanDefinitionPlanDefinitionActionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionComponent res) throws IOException, FHIRFormatError {
20306    parseBackboneElementProperties(json, res);
20307    if (json.has("prefix"))
20308      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
20309    if (json.has("_prefix"))
20310      parseElementProperties(json.getAsJsonObject("_prefix"), res.getPrefixElement());
20311    if (json.has("title"))
20312      res.setTitleElement(parseString(json.get("title").getAsString()));
20313    if (json.has("_title"))
20314      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
20315    if (json.has("description"))
20316      res.setDescriptionElement(parseString(json.get("description").getAsString()));
20317    if (json.has("_description"))
20318      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
20319    if (json.has("textEquivalent"))
20320      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
20321    if (json.has("_textEquivalent"))
20322      parseElementProperties(json.getAsJsonObject("_textEquivalent"), res.getTextEquivalentElement());
20323    if (json.has("priority"))
20324      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), PlanDefinition.RequestPriority.NULL, new PlanDefinition.RequestPriorityEnumFactory()));
20325    if (json.has("_priority"))
20326      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
20327    if (json.has("code")) {
20328      JsonArray array = json.getAsJsonArray("code");
20329      for (int i = 0; i < array.size(); i++) {
20330        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20331      }
20332    };
20333    if (json.has("reason")) {
20334      JsonArray array = json.getAsJsonArray("reason");
20335      for (int i = 0; i < array.size(); i++) {
20336        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20337      }
20338    };
20339    if (json.has("documentation")) {
20340      JsonArray array = json.getAsJsonArray("documentation");
20341      for (int i = 0; i < array.size(); i++) {
20342        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
20343      }
20344    };
20345    if (json.has("goalId")) {
20346      JsonArray array = json.getAsJsonArray("goalId");
20347      for (int i = 0; i < array.size(); i++) {
20348        res.getGoalId().add(parseId(array.get(i).getAsString()));
20349      }
20350    };
20351    if (json.has("_goalId")) {
20352      JsonArray array = json.getAsJsonArray("_goalId");
20353      for (int i = 0; i < array.size(); i++) {
20354        if (i == res.getGoalId().size())
20355          res.getGoalId().add(parseId(null));
20356        if (array.get(i) instanceof JsonObject) 
20357          parseElementProperties(array.get(i).getAsJsonObject(), res.getGoalId().get(i));
20358      }
20359    };
20360    Type subject = parseType("subject", json);
20361    if (subject != null)
20362      res.setSubject(subject);
20363    if (json.has("trigger")) {
20364      JsonArray array = json.getAsJsonArray("trigger");
20365      for (int i = 0; i < array.size(); i++) {
20366        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
20367      }
20368    };
20369    if (json.has("condition")) {
20370      JsonArray array = json.getAsJsonArray("condition");
20371      for (int i = 0; i < array.size(); i++) {
20372        res.getCondition().add(parsePlanDefinitionPlanDefinitionActionConditionComponent(array.get(i).getAsJsonObject(), owner));
20373      }
20374    };
20375    if (json.has("input")) {
20376      JsonArray array = json.getAsJsonArray("input");
20377      for (int i = 0; i < array.size(); i++) {
20378        res.getInput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
20379      }
20380    };
20381    if (json.has("output")) {
20382      JsonArray array = json.getAsJsonArray("output");
20383      for (int i = 0; i < array.size(); i++) {
20384        res.getOutput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
20385      }
20386    };
20387    if (json.has("relatedAction")) {
20388      JsonArray array = json.getAsJsonArray("relatedAction");
20389      for (int i = 0; i < array.size(); i++) {
20390        res.getRelatedAction().add(parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
20391      }
20392    };
20393    Type timing = parseType("timing", json);
20394    if (timing != null)
20395      res.setTiming(timing);
20396    if (json.has("participant")) {
20397      JsonArray array = json.getAsJsonArray("participant");
20398      for (int i = 0; i < array.size(); i++) {
20399        res.getParticipant().add(parsePlanDefinitionPlanDefinitionActionParticipantComponent(array.get(i).getAsJsonObject(), owner));
20400      }
20401    };
20402    if (json.has("type"))
20403      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
20404    if (json.has("groupingBehavior"))
20405      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), PlanDefinition.ActionGroupingBehavior.NULL, new PlanDefinition.ActionGroupingBehaviorEnumFactory()));
20406    if (json.has("_groupingBehavior"))
20407      parseElementProperties(json.getAsJsonObject("_groupingBehavior"), res.getGroupingBehaviorElement());
20408    if (json.has("selectionBehavior"))
20409      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), PlanDefinition.ActionSelectionBehavior.NULL, new PlanDefinition.ActionSelectionBehaviorEnumFactory()));
20410    if (json.has("_selectionBehavior"))
20411      parseElementProperties(json.getAsJsonObject("_selectionBehavior"), res.getSelectionBehaviorElement());
20412    if (json.has("requiredBehavior"))
20413      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), PlanDefinition.ActionRequiredBehavior.NULL, new PlanDefinition.ActionRequiredBehaviorEnumFactory()));
20414    if (json.has("_requiredBehavior"))
20415      parseElementProperties(json.getAsJsonObject("_requiredBehavior"), res.getRequiredBehaviorElement());
20416    if (json.has("precheckBehavior"))
20417      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), PlanDefinition.ActionPrecheckBehavior.NULL, new PlanDefinition.ActionPrecheckBehaviorEnumFactory()));
20418    if (json.has("_precheckBehavior"))
20419      parseElementProperties(json.getAsJsonObject("_precheckBehavior"), res.getPrecheckBehaviorElement());
20420    if (json.has("cardinalityBehavior"))
20421      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), PlanDefinition.ActionCardinalityBehavior.NULL, new PlanDefinition.ActionCardinalityBehaviorEnumFactory()));
20422    if (json.has("_cardinalityBehavior"))
20423      parseElementProperties(json.getAsJsonObject("_cardinalityBehavior"), res.getCardinalityBehaviorElement());
20424    Type definition = parseType("definition", json);
20425    if (definition != null)
20426      res.setDefinition(definition);
20427    if (json.has("transform"))
20428      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
20429    if (json.has("_transform"))
20430      parseElementProperties(json.getAsJsonObject("_transform"), res.getTransformElement());
20431    if (json.has("dynamicValue")) {
20432      JsonArray array = json.getAsJsonArray("dynamicValue");
20433      for (int i = 0; i < array.size(); i++) {
20434        res.getDynamicValue().add(parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(array.get(i).getAsJsonObject(), owner));
20435      }
20436    };
20437    if (json.has("action")) {
20438      JsonArray array = json.getAsJsonArray("action");
20439      for (int i = 0; i < array.size(); i++) {
20440        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), owner));
20441      }
20442    };
20443  }
20444
20445  protected PlanDefinition.PlanDefinitionActionConditionComponent parsePlanDefinitionPlanDefinitionActionConditionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20446    PlanDefinition.PlanDefinitionActionConditionComponent res = new PlanDefinition.PlanDefinitionActionConditionComponent();
20447    parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(json, owner, res);
20448    return res;
20449  }
20450
20451  protected void parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionConditionComponent res) throws IOException, FHIRFormatError {
20452    parseBackboneElementProperties(json, res);
20453    if (json.has("kind"))
20454      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), PlanDefinition.ActionConditionKind.NULL, new PlanDefinition.ActionConditionKindEnumFactory()));
20455    if (json.has("_kind"))
20456      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
20457    if (json.has("expression"))
20458      res.setExpression(parseExpression(json.getAsJsonObject("expression")));
20459  }
20460
20461  protected PlanDefinition.PlanDefinitionActionRelatedActionComponent parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20462    PlanDefinition.PlanDefinitionActionRelatedActionComponent res = new PlanDefinition.PlanDefinitionActionRelatedActionComponent();
20463    parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(json, owner, res);
20464    return res;
20465  }
20466
20467  protected void parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionRelatedActionComponent res) throws IOException, FHIRFormatError {
20468    parseBackboneElementProperties(json, res);
20469    if (json.has("actionId"))
20470      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
20471    if (json.has("_actionId"))
20472      parseElementProperties(json.getAsJsonObject("_actionId"), res.getActionIdElement());
20473    if (json.has("relationship"))
20474      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), PlanDefinition.ActionRelationshipType.NULL, new PlanDefinition.ActionRelationshipTypeEnumFactory()));
20475    if (json.has("_relationship"))
20476      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
20477    Type offset = parseType("offset", json);
20478    if (offset != null)
20479      res.setOffset(offset);
20480  }
20481
20482  protected PlanDefinition.PlanDefinitionActionParticipantComponent parsePlanDefinitionPlanDefinitionActionParticipantComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20483    PlanDefinition.PlanDefinitionActionParticipantComponent res = new PlanDefinition.PlanDefinitionActionParticipantComponent();
20484    parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(json, owner, res);
20485    return res;
20486  }
20487
20488  protected void parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionParticipantComponent res) throws IOException, FHIRFormatError {
20489    parseBackboneElementProperties(json, res);
20490    if (json.has("type"))
20491      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), PlanDefinition.ActionParticipantType.NULL, new PlanDefinition.ActionParticipantTypeEnumFactory()));
20492    if (json.has("_type"))
20493      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
20494    if (json.has("role"))
20495      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
20496  }
20497
20498  protected PlanDefinition.PlanDefinitionActionDynamicValueComponent parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20499    PlanDefinition.PlanDefinitionActionDynamicValueComponent res = new PlanDefinition.PlanDefinitionActionDynamicValueComponent();
20500    parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(json, owner, res);
20501    return res;
20502  }
20503
20504  protected void parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionDynamicValueComponent res) throws IOException, FHIRFormatError {
20505    parseBackboneElementProperties(json, res);
20506    if (json.has("path"))
20507      res.setPathElement(parseString(json.get("path").getAsString()));
20508    if (json.has("_path"))
20509      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
20510    if (json.has("expression"))
20511      res.setExpression(parseExpression(json.getAsJsonObject("expression")));
20512  }
20513
20514  protected Practitioner parsePractitioner(JsonObject json) throws IOException, FHIRFormatError {
20515    Practitioner res = new Practitioner();
20516    parsePractitionerProperties(json, res);
20517    return res;
20518  }
20519
20520  protected void parsePractitionerProperties(JsonObject json, Practitioner res) throws IOException, FHIRFormatError {
20521    parseDomainResourceProperties(json, res);
20522    if (json.has("identifier")) {
20523      JsonArray array = json.getAsJsonArray("identifier");
20524      for (int i = 0; i < array.size(); i++) {
20525        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20526      }
20527    };
20528    if (json.has("active"))
20529      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20530    if (json.has("_active"))
20531      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
20532    if (json.has("name")) {
20533      JsonArray array = json.getAsJsonArray("name");
20534      for (int i = 0; i < array.size(); i++) {
20535        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
20536      }
20537    };
20538    if (json.has("telecom")) {
20539      JsonArray array = json.getAsJsonArray("telecom");
20540      for (int i = 0; i < array.size(); i++) {
20541        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20542      }
20543    };
20544    if (json.has("address")) {
20545      JsonArray array = json.getAsJsonArray("address");
20546      for (int i = 0; i < array.size(); i++) {
20547        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
20548      }
20549    };
20550    if (json.has("gender"))
20551      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
20552    if (json.has("_gender"))
20553      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
20554    if (json.has("birthDate"))
20555      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
20556    if (json.has("_birthDate"))
20557      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
20558    if (json.has("photo")) {
20559      JsonArray array = json.getAsJsonArray("photo");
20560      for (int i = 0; i < array.size(); i++) {
20561        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
20562      }
20563    };
20564    if (json.has("qualification")) {
20565      JsonArray array = json.getAsJsonArray("qualification");
20566      for (int i = 0; i < array.size(); i++) {
20567        res.getQualification().add(parsePractitionerPractitionerQualificationComponent(array.get(i).getAsJsonObject(), res));
20568      }
20569    };
20570    if (json.has("communication")) {
20571      JsonArray array = json.getAsJsonArray("communication");
20572      for (int i = 0; i < array.size(); i++) {
20573        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20574      }
20575    };
20576  }
20577
20578  protected Practitioner.PractitionerQualificationComponent parsePractitionerPractitionerQualificationComponent(JsonObject json, Practitioner owner) throws IOException, FHIRFormatError {
20579    Practitioner.PractitionerQualificationComponent res = new Practitioner.PractitionerQualificationComponent();
20580    parsePractitionerPractitionerQualificationComponentProperties(json, owner, res);
20581    return res;
20582  }
20583
20584  protected void parsePractitionerPractitionerQualificationComponentProperties(JsonObject json, Practitioner owner, Practitioner.PractitionerQualificationComponent res) throws IOException, FHIRFormatError {
20585    parseBackboneElementProperties(json, res);
20586    if (json.has("identifier")) {
20587      JsonArray array = json.getAsJsonArray("identifier");
20588      for (int i = 0; i < array.size(); i++) {
20589        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20590      }
20591    };
20592    if (json.has("code"))
20593      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
20594    if (json.has("period"))
20595      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
20596    if (json.has("issuer"))
20597      res.setIssuer(parseReference(json.getAsJsonObject("issuer")));
20598  }
20599
20600  protected PractitionerRole parsePractitionerRole(JsonObject json) throws IOException, FHIRFormatError {
20601    PractitionerRole res = new PractitionerRole();
20602    parsePractitionerRoleProperties(json, res);
20603    return res;
20604  }
20605
20606  protected void parsePractitionerRoleProperties(JsonObject json, PractitionerRole res) throws IOException, FHIRFormatError {
20607    parseDomainResourceProperties(json, res);
20608    if (json.has("identifier")) {
20609      JsonArray array = json.getAsJsonArray("identifier");
20610      for (int i = 0; i < array.size(); i++) {
20611        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20612      }
20613    };
20614    if (json.has("active"))
20615      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20616    if (json.has("_active"))
20617      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
20618    if (json.has("period"))
20619      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
20620    if (json.has("practitioner"))
20621      res.setPractitioner(parseReference(json.getAsJsonObject("practitioner")));
20622    if (json.has("organization"))
20623      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
20624    if (json.has("code")) {
20625      JsonArray array = json.getAsJsonArray("code");
20626      for (int i = 0; i < array.size(); i++) {
20627        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20628      }
20629    };
20630    if (json.has("specialty")) {
20631      JsonArray array = json.getAsJsonArray("specialty");
20632      for (int i = 0; i < array.size(); i++) {
20633        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20634      }
20635    };
20636    if (json.has("location")) {
20637      JsonArray array = json.getAsJsonArray("location");
20638      for (int i = 0; i < array.size(); i++) {
20639        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
20640      }
20641    };
20642    if (json.has("healthcareService")) {
20643      JsonArray array = json.getAsJsonArray("healthcareService");
20644      for (int i = 0; i < array.size(); i++) {
20645        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
20646      }
20647    };
20648    if (json.has("telecom")) {
20649      JsonArray array = json.getAsJsonArray("telecom");
20650      for (int i = 0; i < array.size(); i++) {
20651        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20652      }
20653    };
20654    if (json.has("availableTime")) {
20655      JsonArray array = json.getAsJsonArray("availableTime");
20656      for (int i = 0; i < array.size(); i++) {
20657        res.getAvailableTime().add(parsePractitionerRolePractitionerRoleAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
20658      }
20659    };
20660    if (json.has("notAvailable")) {
20661      JsonArray array = json.getAsJsonArray("notAvailable");
20662      for (int i = 0; i < array.size(); i++) {
20663        res.getNotAvailable().add(parsePractitionerRolePractitionerRoleNotAvailableComponent(array.get(i).getAsJsonObject(), res));
20664      }
20665    };
20666    if (json.has("availabilityExceptions"))
20667      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
20668    if (json.has("_availabilityExceptions"))
20669      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
20670    if (json.has("endpoint")) {
20671      JsonArray array = json.getAsJsonArray("endpoint");
20672      for (int i = 0; i < array.size(); i++) {
20673        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
20674      }
20675    };
20676  }
20677
20678  protected PractitionerRole.PractitionerRoleAvailableTimeComponent parsePractitionerRolePractitionerRoleAvailableTimeComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
20679    PractitionerRole.PractitionerRoleAvailableTimeComponent res = new PractitionerRole.PractitionerRoleAvailableTimeComponent();
20680    parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(json, owner, res);
20681    return res;
20682  }
20683
20684  protected void parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(JsonObject json, PractitionerRole owner, PractitionerRole.PractitionerRoleAvailableTimeComponent res) throws IOException, FHIRFormatError {
20685    parseBackboneElementProperties(json, res);
20686    if (json.has("daysOfWeek")) {
20687      JsonArray array = json.getAsJsonArray("daysOfWeek");
20688      for (int i = 0; i < array.size(); i++) {
20689        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
20690      }
20691    };
20692    if (json.has("_daysOfWeek")) {
20693      JsonArray array = json.getAsJsonArray("_daysOfWeek");
20694      for (int i = 0; i < array.size(); i++) {
20695        if (i == res.getDaysOfWeek().size())
20696          res.getDaysOfWeek().add(parseEnumeration(null, PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
20697        if (array.get(i) instanceof JsonObject) 
20698          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
20699      }
20700    };
20701    if (json.has("allDay"))
20702      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
20703    if (json.has("_allDay"))
20704      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
20705    if (json.has("availableStartTime"))
20706      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
20707    if (json.has("_availableStartTime"))
20708      parseElementProperties(json.getAsJsonObject("_availableStartTime"), res.getAvailableStartTimeElement());
20709    if (json.has("availableEndTime"))
20710      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
20711    if (json.has("_availableEndTime"))
20712      parseElementProperties(json.getAsJsonObject("_availableEndTime"), res.getAvailableEndTimeElement());
20713  }
20714
20715  protected PractitionerRole.PractitionerRoleNotAvailableComponent parsePractitionerRolePractitionerRoleNotAvailableComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
20716    PractitionerRole.PractitionerRoleNotAvailableComponent res = new PractitionerRole.PractitionerRoleNotAvailableComponent();
20717    parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(json, owner, res);
20718    return res;
20719  }
20720
20721  protected void parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(JsonObject json, PractitionerRole owner, PractitionerRole.PractitionerRoleNotAvailableComponent res) throws IOException, FHIRFormatError {
20722    parseBackboneElementProperties(json, res);
20723    if (json.has("description"))
20724      res.setDescriptionElement(parseString(json.get("description").getAsString()));
20725    if (json.has("_description"))
20726      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
20727    if (json.has("during"))
20728      res.setDuring(parsePeriod(json.getAsJsonObject("during")));
20729  }
20730
20731  protected Procedure parseProcedure(JsonObject json) throws IOException, FHIRFormatError {
20732    Procedure res = new Procedure();
20733    parseProcedureProperties(json, res);
20734    return res;
20735  }
20736
20737  protected void parseProcedureProperties(JsonObject json, Procedure res) throws IOException, FHIRFormatError {
20738    parseDomainResourceProperties(json, res);
20739    if (json.has("identifier")) {
20740      JsonArray array = json.getAsJsonArray("identifier");
20741      for (int i = 0; i < array.size(); i++) {
20742        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20743      }
20744    };
20745    if (json.has("instantiatesCanonical")) {
20746      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
20747      for (int i = 0; i < array.size(); i++) {
20748        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
20749      }
20750    };
20751    if (json.has("_instantiatesCanonical")) {
20752      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
20753      for (int i = 0; i < array.size(); i++) {
20754        if (i == res.getInstantiatesCanonical().size())
20755          res.getInstantiatesCanonical().add(parseCanonical(null));
20756        if (array.get(i) instanceof JsonObject) 
20757          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
20758      }
20759    };
20760    if (json.has("instantiatesUri")) {
20761      JsonArray array = json.getAsJsonArray("instantiatesUri");
20762      for (int i = 0; i < array.size(); i++) {
20763        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
20764      }
20765    };
20766    if (json.has("_instantiatesUri")) {
20767      JsonArray array = json.getAsJsonArray("_instantiatesUri");
20768      for (int i = 0; i < array.size(); i++) {
20769        if (i == res.getInstantiatesUri().size())
20770          res.getInstantiatesUri().add(parseUri(null));
20771        if (array.get(i) instanceof JsonObject) 
20772          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
20773      }
20774    };
20775    if (json.has("basedOn")) {
20776      JsonArray array = json.getAsJsonArray("basedOn");
20777      for (int i = 0; i < array.size(); i++) {
20778        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
20779      }
20780    };
20781    if (json.has("partOf")) {
20782      JsonArray array = json.getAsJsonArray("partOf");
20783      for (int i = 0; i < array.size(); i++) {
20784        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
20785      }
20786    };
20787    if (json.has("status"))
20788      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Procedure.ProcedureStatus.NULL, new Procedure.ProcedureStatusEnumFactory()));
20789    if (json.has("_status"))
20790      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
20791    if (json.has("statusReason"))
20792      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
20793    if (json.has("category"))
20794      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
20795    if (json.has("code"))
20796      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
20797    if (json.has("subject"))
20798      res.setSubject(parseReference(json.getAsJsonObject("subject")));
20799    if (json.has("encounter"))
20800      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
20801    Type performed = parseType("performed", json);
20802    if (performed != null)
20803      res.setPerformed(performed);
20804    if (json.has("recorder"))
20805      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
20806    if (json.has("asserter"))
20807      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
20808    if (json.has("performer")) {
20809      JsonArray array = json.getAsJsonArray("performer");
20810      for (int i = 0; i < array.size(); i++) {
20811        res.getPerformer().add(parseProcedureProcedurePerformerComponent(array.get(i).getAsJsonObject(), res));
20812      }
20813    };
20814    if (json.has("location"))
20815      res.setLocation(parseReference(json.getAsJsonObject("location")));
20816    if (json.has("reasonCode")) {
20817      JsonArray array = json.getAsJsonArray("reasonCode");
20818      for (int i = 0; i < array.size(); i++) {
20819        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20820      }
20821    };
20822    if (json.has("reasonReference")) {
20823      JsonArray array = json.getAsJsonArray("reasonReference");
20824      for (int i = 0; i < array.size(); i++) {
20825        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
20826      }
20827    };
20828    if (json.has("bodySite")) {
20829      JsonArray array = json.getAsJsonArray("bodySite");
20830      for (int i = 0; i < array.size(); i++) {
20831        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20832      }
20833    };
20834    if (json.has("outcome"))
20835      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
20836    if (json.has("report")) {
20837      JsonArray array = json.getAsJsonArray("report");
20838      for (int i = 0; i < array.size(); i++) {
20839        res.getReport().add(parseReference(array.get(i).getAsJsonObject()));
20840      }
20841    };
20842    if (json.has("complication")) {
20843      JsonArray array = json.getAsJsonArray("complication");
20844      for (int i = 0; i < array.size(); i++) {
20845        res.getComplication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20846      }
20847    };
20848    if (json.has("complicationDetail")) {
20849      JsonArray array = json.getAsJsonArray("complicationDetail");
20850      for (int i = 0; i < array.size(); i++) {
20851        res.getComplicationDetail().add(parseReference(array.get(i).getAsJsonObject()));
20852      }
20853    };
20854    if (json.has("followUp")) {
20855      JsonArray array = json.getAsJsonArray("followUp");
20856      for (int i = 0; i < array.size(); i++) {
20857        res.getFollowUp().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20858      }
20859    };
20860    if (json.has("note")) {
20861      JsonArray array = json.getAsJsonArray("note");
20862      for (int i = 0; i < array.size(); i++) {
20863        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
20864      }
20865    };
20866    if (json.has("focalDevice")) {
20867      JsonArray array = json.getAsJsonArray("focalDevice");
20868      for (int i = 0; i < array.size(); i++) {
20869        res.getFocalDevice().add(parseProcedureProcedureFocalDeviceComponent(array.get(i).getAsJsonObject(), res));
20870      }
20871    };
20872    if (json.has("usedReference")) {
20873      JsonArray array = json.getAsJsonArray("usedReference");
20874      for (int i = 0; i < array.size(); i++) {
20875        res.getUsedReference().add(parseReference(array.get(i).getAsJsonObject()));
20876      }
20877    };
20878    if (json.has("usedCode")) {
20879      JsonArray array = json.getAsJsonArray("usedCode");
20880      for (int i = 0; i < array.size(); i++) {
20881        res.getUsedCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20882      }
20883    };
20884  }
20885
20886  protected Procedure.ProcedurePerformerComponent parseProcedureProcedurePerformerComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
20887    Procedure.ProcedurePerformerComponent res = new Procedure.ProcedurePerformerComponent();
20888    parseProcedureProcedurePerformerComponentProperties(json, owner, res);
20889    return res;
20890  }
20891
20892  protected void parseProcedureProcedurePerformerComponentProperties(JsonObject json, Procedure owner, Procedure.ProcedurePerformerComponent res) throws IOException, FHIRFormatError {
20893    parseBackboneElementProperties(json, res);
20894    if (json.has("function"))
20895      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
20896    if (json.has("actor"))
20897      res.setActor(parseReference(json.getAsJsonObject("actor")));
20898    if (json.has("onBehalfOf"))
20899      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
20900  }
20901
20902  protected Procedure.ProcedureFocalDeviceComponent parseProcedureProcedureFocalDeviceComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
20903    Procedure.ProcedureFocalDeviceComponent res = new Procedure.ProcedureFocalDeviceComponent();
20904    parseProcedureProcedureFocalDeviceComponentProperties(json, owner, res);
20905    return res;
20906  }
20907
20908  protected void parseProcedureProcedureFocalDeviceComponentProperties(JsonObject json, Procedure owner, Procedure.ProcedureFocalDeviceComponent res) throws IOException, FHIRFormatError {
20909    parseBackboneElementProperties(json, res);
20910    if (json.has("action"))
20911      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
20912    if (json.has("manipulated"))
20913      res.setManipulated(parseReference(json.getAsJsonObject("manipulated")));
20914  }
20915
20916  protected Provenance parseProvenance(JsonObject json) throws IOException, FHIRFormatError {
20917    Provenance res = new Provenance();
20918    parseProvenanceProperties(json, res);
20919    return res;
20920  }
20921
20922  protected void parseProvenanceProperties(JsonObject json, Provenance res) throws IOException, FHIRFormatError {
20923    parseDomainResourceProperties(json, res);
20924    if (json.has("target")) {
20925      JsonArray array = json.getAsJsonArray("target");
20926      for (int i = 0; i < array.size(); i++) {
20927        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
20928      }
20929    };
20930    Type occurred = parseType("occurred", json);
20931    if (occurred != null)
20932      res.setOccurred(occurred);
20933    if (json.has("recorded"))
20934      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
20935    if (json.has("_recorded"))
20936      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
20937    if (json.has("policy")) {
20938      JsonArray array = json.getAsJsonArray("policy");
20939      for (int i = 0; i < array.size(); i++) {
20940        res.getPolicy().add(parseUri(array.get(i).getAsString()));
20941      }
20942    };
20943    if (json.has("_policy")) {
20944      JsonArray array = json.getAsJsonArray("_policy");
20945      for (int i = 0; i < array.size(); i++) {
20946        if (i == res.getPolicy().size())
20947          res.getPolicy().add(parseUri(null));
20948        if (array.get(i) instanceof JsonObject) 
20949          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
20950      }
20951    };
20952    if (json.has("location"))
20953      res.setLocation(parseReference(json.getAsJsonObject("location")));
20954    if (json.has("reason")) {
20955      JsonArray array = json.getAsJsonArray("reason");
20956      for (int i = 0; i < array.size(); i++) {
20957        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20958      }
20959    };
20960    if (json.has("activity"))
20961      res.setActivity(parseCodeableConcept(json.getAsJsonObject("activity")));
20962    if (json.has("agent")) {
20963      JsonArray array = json.getAsJsonArray("agent");
20964      for (int i = 0; i < array.size(); i++) {
20965        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), res));
20966      }
20967    };
20968    if (json.has("entity")) {
20969      JsonArray array = json.getAsJsonArray("entity");
20970      for (int i = 0; i < array.size(); i++) {
20971        res.getEntity().add(parseProvenanceProvenanceEntityComponent(array.get(i).getAsJsonObject(), res));
20972      }
20973    };
20974    if (json.has("signature")) {
20975      JsonArray array = json.getAsJsonArray("signature");
20976      for (int i = 0; i < array.size(); i++) {
20977        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
20978      }
20979    };
20980  }
20981
20982  protected Provenance.ProvenanceAgentComponent parseProvenanceProvenanceAgentComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
20983    Provenance.ProvenanceAgentComponent res = new Provenance.ProvenanceAgentComponent();
20984    parseProvenanceProvenanceAgentComponentProperties(json, owner, res);
20985    return res;
20986  }
20987
20988  protected void parseProvenanceProvenanceAgentComponentProperties(JsonObject json, Provenance owner, Provenance.ProvenanceAgentComponent res) throws IOException, FHIRFormatError {
20989    parseBackboneElementProperties(json, res);
20990    if (json.has("type"))
20991      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
20992    if (json.has("role")) {
20993      JsonArray array = json.getAsJsonArray("role");
20994      for (int i = 0; i < array.size(); i++) {
20995        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20996      }
20997    };
20998    if (json.has("who"))
20999      res.setWho(parseReference(json.getAsJsonObject("who")));
21000    if (json.has("onBehalfOf"))
21001      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
21002  }
21003
21004  protected Provenance.ProvenanceEntityComponent parseProvenanceProvenanceEntityComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
21005    Provenance.ProvenanceEntityComponent res = new Provenance.ProvenanceEntityComponent();
21006    parseProvenanceProvenanceEntityComponentProperties(json, owner, res);
21007    return res;
21008  }
21009
21010  protected void parseProvenanceProvenanceEntityComponentProperties(JsonObject json, Provenance owner, Provenance.ProvenanceEntityComponent res) throws IOException, FHIRFormatError {
21011    parseBackboneElementProperties(json, res);
21012    if (json.has("role"))
21013      res.setRoleElement(parseEnumeration(json.get("role").getAsString(), Provenance.ProvenanceEntityRole.NULL, new Provenance.ProvenanceEntityRoleEnumFactory()));
21014    if (json.has("_role"))
21015      parseElementProperties(json.getAsJsonObject("_role"), res.getRoleElement());
21016    if (json.has("what"))
21017      res.setWhat(parseReference(json.getAsJsonObject("what")));
21018    if (json.has("agent")) {
21019      JsonArray array = json.getAsJsonArray("agent");
21020      for (int i = 0; i < array.size(); i++) {
21021        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), owner));
21022      }
21023    };
21024  }
21025
21026  protected Questionnaire parseQuestionnaire(JsonObject json) throws IOException, FHIRFormatError {
21027    Questionnaire res = new Questionnaire();
21028    parseQuestionnaireProperties(json, res);
21029    return res;
21030  }
21031
21032  protected void parseQuestionnaireProperties(JsonObject json, Questionnaire res) throws IOException, FHIRFormatError {
21033    parseDomainResourceProperties(json, res);
21034    if (json.has("url"))
21035      res.setUrlElement(parseUri(json.get("url").getAsString()));
21036    if (json.has("_url"))
21037      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
21038    if (json.has("identifier")) {
21039      JsonArray array = json.getAsJsonArray("identifier");
21040      for (int i = 0; i < array.size(); i++) {
21041        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21042      }
21043    };
21044    if (json.has("version"))
21045      res.setVersionElement(parseString(json.get("version").getAsString()));
21046    if (json.has("_version"))
21047      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
21048    if (json.has("name"))
21049      res.setNameElement(parseString(json.get("name").getAsString()));
21050    if (json.has("_name"))
21051      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
21052    if (json.has("title"))
21053      res.setTitleElement(parseString(json.get("title").getAsString()));
21054    if (json.has("_title"))
21055      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
21056    if (json.has("derivedFrom")) {
21057      JsonArray array = json.getAsJsonArray("derivedFrom");
21058      for (int i = 0; i < array.size(); i++) {
21059        res.getDerivedFrom().add(parseCanonical(array.get(i).getAsString()));
21060      }
21061    };
21062    if (json.has("_derivedFrom")) {
21063      JsonArray array = json.getAsJsonArray("_derivedFrom");
21064      for (int i = 0; i < array.size(); i++) {
21065        if (i == res.getDerivedFrom().size())
21066          res.getDerivedFrom().add(parseCanonical(null));
21067        if (array.get(i) instanceof JsonObject) 
21068          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFrom().get(i));
21069      }
21070    };
21071    if (json.has("status"))
21072      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
21073    if (json.has("_status"))
21074      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
21075    if (json.has("experimental"))
21076      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
21077    if (json.has("_experimental"))
21078      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
21079    if (json.has("subjectType")) {
21080      JsonArray array = json.getAsJsonArray("subjectType");
21081      for (int i = 0; i < array.size(); i++) {
21082        res.getSubjectType().add(parseCode(array.get(i).getAsString()));
21083      }
21084    };
21085    if (json.has("_subjectType")) {
21086      JsonArray array = json.getAsJsonArray("_subjectType");
21087      for (int i = 0; i < array.size(); i++) {
21088        if (i == res.getSubjectType().size())
21089          res.getSubjectType().add(parseCode(null));
21090        if (array.get(i) instanceof JsonObject) 
21091          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubjectType().get(i));
21092      }
21093    };
21094    if (json.has("date"))
21095      res.setDateElement(parseDateTime(json.get("date").getAsString()));
21096    if (json.has("_date"))
21097      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
21098    if (json.has("publisher"))
21099      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
21100    if (json.has("_publisher"))
21101      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
21102    if (json.has("contact")) {
21103      JsonArray array = json.getAsJsonArray("contact");
21104      for (int i = 0; i < array.size(); i++) {
21105        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
21106      }
21107    };
21108    if (json.has("description"))
21109      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
21110    if (json.has("_description"))
21111      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
21112    if (json.has("useContext")) {
21113      JsonArray array = json.getAsJsonArray("useContext");
21114      for (int i = 0; i < array.size(); i++) {
21115        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
21116      }
21117    };
21118    if (json.has("jurisdiction")) {
21119      JsonArray array = json.getAsJsonArray("jurisdiction");
21120      for (int i = 0; i < array.size(); i++) {
21121        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21122      }
21123    };
21124    if (json.has("purpose"))
21125      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
21126    if (json.has("_purpose"))
21127      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
21128    if (json.has("copyright"))
21129      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
21130    if (json.has("_copyright"))
21131      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
21132    if (json.has("approvalDate"))
21133      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
21134    if (json.has("_approvalDate"))
21135      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
21136    if (json.has("lastReviewDate"))
21137      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
21138    if (json.has("_lastReviewDate"))
21139      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
21140    if (json.has("effectivePeriod"))
21141      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
21142    if (json.has("code")) {
21143      JsonArray array = json.getAsJsonArray("code");
21144      for (int i = 0; i < array.size(); i++) {
21145        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
21146      }
21147    };
21148    if (json.has("item")) {
21149      JsonArray array = json.getAsJsonArray("item");
21150      for (int i = 0; i < array.size(); i++) {
21151        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), res));
21152      }
21153    };
21154  }
21155
21156  protected Questionnaire.QuestionnaireItemComponent parseQuestionnaireQuestionnaireItemComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
21157    Questionnaire.QuestionnaireItemComponent res = new Questionnaire.QuestionnaireItemComponent();
21158    parseQuestionnaireQuestionnaireItemComponentProperties(json, owner, res);
21159    return res;
21160  }
21161
21162  protected void parseQuestionnaireQuestionnaireItemComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemComponent res) throws IOException, FHIRFormatError {
21163    parseBackboneElementProperties(json, res);
21164    if (json.has("linkId"))
21165      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
21166    if (json.has("_linkId"))
21167      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
21168    if (json.has("definition"))
21169      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
21170    if (json.has("_definition"))
21171      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
21172    if (json.has("code")) {
21173      JsonArray array = json.getAsJsonArray("code");
21174      for (int i = 0; i < array.size(); i++) {
21175        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
21176      }
21177    };
21178    if (json.has("prefix"))
21179      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
21180    if (json.has("_prefix"))
21181      parseElementProperties(json.getAsJsonObject("_prefix"), res.getPrefixElement());
21182    if (json.has("text"))
21183      res.setTextElement(parseString(json.get("text").getAsString()));
21184    if (json.has("_text"))
21185      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
21186    if (json.has("type"))
21187      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Questionnaire.QuestionnaireItemType.NULL, new Questionnaire.QuestionnaireItemTypeEnumFactory()));
21188    if (json.has("_type"))
21189      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
21190    if (json.has("enableWhen")) {
21191      JsonArray array = json.getAsJsonArray("enableWhen");
21192      for (int i = 0; i < array.size(); i++) {
21193        res.getEnableWhen().add(parseQuestionnaireQuestionnaireItemEnableWhenComponent(array.get(i).getAsJsonObject(), owner));
21194      }
21195    };
21196    if (json.has("enableBehavior"))
21197      res.setEnableBehaviorElement(parseEnumeration(json.get("enableBehavior").getAsString(), Questionnaire.EnableWhenBehavior.NULL, new Questionnaire.EnableWhenBehaviorEnumFactory()));
21198    if (json.has("_enableBehavior"))
21199      parseElementProperties(json.getAsJsonObject("_enableBehavior"), res.getEnableBehaviorElement());
21200    if (json.has("required"))
21201      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
21202    if (json.has("_required"))
21203      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
21204    if (json.has("repeats"))
21205      res.setRepeatsElement(parseBoolean(json.get("repeats").getAsBoolean()));
21206    if (json.has("_repeats"))
21207      parseElementProperties(json.getAsJsonObject("_repeats"), res.getRepeatsElement());
21208    if (json.has("readOnly"))
21209      res.setReadOnlyElement(parseBoolean(json.get("readOnly").getAsBoolean()));
21210    if (json.has("_readOnly"))
21211      parseElementProperties(json.getAsJsonObject("_readOnly"), res.getReadOnlyElement());
21212    if (json.has("maxLength"))
21213      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
21214    if (json.has("_maxLength"))
21215      parseElementProperties(json.getAsJsonObject("_maxLength"), res.getMaxLengthElement());
21216    if (json.has("answerValueSet"))
21217      res.setAnswerValueSetElement(parseCanonical(json.get("answerValueSet").getAsString()));
21218    if (json.has("_answerValueSet"))
21219      parseElementProperties(json.getAsJsonObject("_answerValueSet"), res.getAnswerValueSetElement());
21220    if (json.has("answerOption")) {
21221      JsonArray array = json.getAsJsonArray("answerOption");
21222      for (int i = 0; i < array.size(); i++) {
21223        res.getAnswerOption().add(parseQuestionnaireQuestionnaireItemAnswerOptionComponent(array.get(i).getAsJsonObject(), owner));
21224      }
21225    };
21226    if (json.has("initial")) {
21227      JsonArray array = json.getAsJsonArray("initial");
21228      for (int i = 0; i < array.size(); i++) {
21229        res.getInitial().add(parseQuestionnaireQuestionnaireItemInitialComponent(array.get(i).getAsJsonObject(), owner));
21230      }
21231    };
21232    if (json.has("item")) {
21233      JsonArray array = json.getAsJsonArray("item");
21234      for (int i = 0; i < array.size(); i++) {
21235        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), owner));
21236      }
21237    };
21238  }
21239
21240  protected Questionnaire.QuestionnaireItemEnableWhenComponent parseQuestionnaireQuestionnaireItemEnableWhenComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
21241    Questionnaire.QuestionnaireItemEnableWhenComponent res = new Questionnaire.QuestionnaireItemEnableWhenComponent();
21242    parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(json, owner, res);
21243    return res;
21244  }
21245
21246  protected void parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemEnableWhenComponent res) throws IOException, FHIRFormatError {
21247    parseBackboneElementProperties(json, res);
21248    if (json.has("question"))
21249      res.setQuestionElement(parseString(json.get("question").getAsString()));
21250    if (json.has("_question"))
21251      parseElementProperties(json.getAsJsonObject("_question"), res.getQuestionElement());
21252    if (json.has("operator"))
21253      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), Questionnaire.QuestionnaireItemOperator.NULL, new Questionnaire.QuestionnaireItemOperatorEnumFactory()));
21254    if (json.has("_operator"))
21255      parseElementProperties(json.getAsJsonObject("_operator"), res.getOperatorElement());
21256    Type answer = parseType("answer", json);
21257    if (answer != null)
21258      res.setAnswer(answer);
21259  }
21260
21261  protected Questionnaire.QuestionnaireItemAnswerOptionComponent parseQuestionnaireQuestionnaireItemAnswerOptionComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
21262    Questionnaire.QuestionnaireItemAnswerOptionComponent res = new Questionnaire.QuestionnaireItemAnswerOptionComponent();
21263    parseQuestionnaireQuestionnaireItemAnswerOptionComponentProperties(json, owner, res);
21264    return res;
21265  }
21266
21267  protected void parseQuestionnaireQuestionnaireItemAnswerOptionComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemAnswerOptionComponent res) throws IOException, FHIRFormatError {
21268    parseBackboneElementProperties(json, res);
21269    Type value = parseType("value", json);
21270    if (value != null)
21271      res.setValue(value);
21272    if (json.has("initialSelected"))
21273      res.setInitialSelectedElement(parseBoolean(json.get("initialSelected").getAsBoolean()));
21274    if (json.has("_initialSelected"))
21275      parseElementProperties(json.getAsJsonObject("_initialSelected"), res.getInitialSelectedElement());
21276  }
21277
21278  protected Questionnaire.QuestionnaireItemInitialComponent parseQuestionnaireQuestionnaireItemInitialComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
21279    Questionnaire.QuestionnaireItemInitialComponent res = new Questionnaire.QuestionnaireItemInitialComponent();
21280    parseQuestionnaireQuestionnaireItemInitialComponentProperties(json, owner, res);
21281    return res;
21282  }
21283
21284  protected void parseQuestionnaireQuestionnaireItemInitialComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemInitialComponent res) throws IOException, FHIRFormatError {
21285    parseBackboneElementProperties(json, res);
21286    Type value = parseType("value", json);
21287    if (value != null)
21288      res.setValue(value);
21289  }
21290
21291  protected QuestionnaireResponse parseQuestionnaireResponse(JsonObject json) throws IOException, FHIRFormatError {
21292    QuestionnaireResponse res = new QuestionnaireResponse();
21293    parseQuestionnaireResponseProperties(json, res);
21294    return res;
21295  }
21296
21297  protected void parseQuestionnaireResponseProperties(JsonObject json, QuestionnaireResponse res) throws IOException, FHIRFormatError {
21298    parseDomainResourceProperties(json, res);
21299    if (json.has("identifier"))
21300      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
21301    if (json.has("basedOn")) {
21302      JsonArray array = json.getAsJsonArray("basedOn");
21303      for (int i = 0; i < array.size(); i++) {
21304        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
21305      }
21306    };
21307    if (json.has("partOf")) {
21308      JsonArray array = json.getAsJsonArray("partOf");
21309      for (int i = 0; i < array.size(); i++) {
21310        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
21311      }
21312    };
21313    if (json.has("questionnaire"))
21314      res.setQuestionnaireElement(parseCanonical(json.get("questionnaire").getAsString()));
21315    if (json.has("_questionnaire"))
21316      parseElementProperties(json.getAsJsonObject("_questionnaire"), res.getQuestionnaireElement());
21317    if (json.has("status"))
21318      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), QuestionnaireResponse.QuestionnaireResponseStatus.NULL, new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory()));
21319    if (json.has("_status"))
21320      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
21321    if (json.has("subject"))
21322      res.setSubject(parseReference(json.getAsJsonObject("subject")));
21323    if (json.has("encounter"))
21324      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
21325    if (json.has("authored"))
21326      res.setAuthoredElement(parseDateTime(json.get("authored").getAsString()));
21327    if (json.has("_authored"))
21328      parseElementProperties(json.getAsJsonObject("_authored"), res.getAuthoredElement());
21329    if (json.has("author"))
21330      res.setAuthor(parseReference(json.getAsJsonObject("author")));
21331    if (json.has("source"))
21332      res.setSource(parseReference(json.getAsJsonObject("source")));
21333    if (json.has("item")) {
21334      JsonArray array = json.getAsJsonArray("item");
21335      for (int i = 0; i < array.size(); i++) {
21336        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), res));
21337      }
21338    };
21339  }
21340
21341  protected QuestionnaireResponse.QuestionnaireResponseItemComponent parseQuestionnaireResponseQuestionnaireResponseItemComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
21342    QuestionnaireResponse.QuestionnaireResponseItemComponent res = new QuestionnaireResponse.QuestionnaireResponseItemComponent();
21343    parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(json, owner, res);
21344    return res;
21345  }
21346
21347  protected void parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(JsonObject json, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemComponent res) throws IOException, FHIRFormatError {
21348    parseBackboneElementProperties(json, res);
21349    if (json.has("linkId"))
21350      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
21351    if (json.has("_linkId"))
21352      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
21353    if (json.has("definition"))
21354      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
21355    if (json.has("_definition"))
21356      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
21357    if (json.has("text"))
21358      res.setTextElement(parseString(json.get("text").getAsString()));
21359    if (json.has("_text"))
21360      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
21361    if (json.has("answer")) {
21362      JsonArray array = json.getAsJsonArray("answer");
21363      for (int i = 0; i < array.size(); i++) {
21364        res.getAnswer().add(parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(array.get(i).getAsJsonObject(), owner));
21365      }
21366    };
21367    if (json.has("item")) {
21368      JsonArray array = json.getAsJsonArray("item");
21369      for (int i = 0; i < array.size(); i++) {
21370        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
21371      }
21372    };
21373  }
21374
21375  protected QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
21376    QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res = new QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent();
21377    parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(json, owner, res);
21378    return res;
21379  }
21380
21381  protected void parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(JsonObject json, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res) throws IOException, FHIRFormatError {
21382    parseBackboneElementProperties(json, res);
21383    Type value = parseType("value", json);
21384    if (value != null)
21385      res.setValue(value);
21386    if (json.has("item")) {
21387      JsonArray array = json.getAsJsonArray("item");
21388      for (int i = 0; i < array.size(); i++) {
21389        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
21390      }
21391    };
21392  }
21393
21394  protected RelatedPerson parseRelatedPerson(JsonObject json) throws IOException, FHIRFormatError {
21395    RelatedPerson res = new RelatedPerson();
21396    parseRelatedPersonProperties(json, res);
21397    return res;
21398  }
21399
21400  protected void parseRelatedPersonProperties(JsonObject json, RelatedPerson res) throws IOException, FHIRFormatError {
21401    parseDomainResourceProperties(json, res);
21402    if (json.has("identifier")) {
21403      JsonArray array = json.getAsJsonArray("identifier");
21404      for (int i = 0; i < array.size(); i++) {
21405        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21406      }
21407    };
21408    if (json.has("active"))
21409      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
21410    if (json.has("_active"))
21411      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
21412    if (json.has("patient"))
21413      res.setPatient(parseReference(json.getAsJsonObject("patient")));
21414    if (json.has("relationship")) {
21415      JsonArray array = json.getAsJsonArray("relationship");
21416      for (int i = 0; i < array.size(); i++) {
21417        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21418      }
21419    };
21420    if (json.has("name")) {
21421      JsonArray array = json.getAsJsonArray("name");
21422      for (int i = 0; i < array.size(); i++) {
21423        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
21424      }
21425    };
21426    if (json.has("telecom")) {
21427      JsonArray array = json.getAsJsonArray("telecom");
21428      for (int i = 0; i < array.size(); i++) {
21429        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
21430      }
21431    };
21432    if (json.has("gender"))
21433      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
21434    if (json.has("_gender"))
21435      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
21436    if (json.has("birthDate"))
21437      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
21438    if (json.has("_birthDate"))
21439      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
21440    if (json.has("address")) {
21441      JsonArray array = json.getAsJsonArray("address");
21442      for (int i = 0; i < array.size(); i++) {
21443        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
21444      }
21445    };
21446    if (json.has("photo")) {
21447      JsonArray array = json.getAsJsonArray("photo");
21448      for (int i = 0; i < array.size(); i++) {
21449        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
21450      }
21451    };
21452    if (json.has("period"))
21453      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
21454    if (json.has("communication")) {
21455      JsonArray array = json.getAsJsonArray("communication");
21456      for (int i = 0; i < array.size(); i++) {
21457        res.getCommunication().add(parseRelatedPersonRelatedPersonCommunicationComponent(array.get(i).getAsJsonObject(), res));
21458      }
21459    };
21460  }
21461
21462  protected RelatedPerson.RelatedPersonCommunicationComponent parseRelatedPersonRelatedPersonCommunicationComponent(JsonObject json, RelatedPerson owner) throws IOException, FHIRFormatError {
21463    RelatedPerson.RelatedPersonCommunicationComponent res = new RelatedPerson.RelatedPersonCommunicationComponent();
21464    parseRelatedPersonRelatedPersonCommunicationComponentProperties(json, owner, res);
21465    return res;
21466  }
21467
21468  protected void parseRelatedPersonRelatedPersonCommunicationComponentProperties(JsonObject json, RelatedPerson owner, RelatedPerson.RelatedPersonCommunicationComponent res) throws IOException, FHIRFormatError {
21469    parseBackboneElementProperties(json, res);
21470    if (json.has("language"))
21471      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
21472    if (json.has("preferred"))
21473      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
21474    if (json.has("_preferred"))
21475      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
21476  }
21477
21478  protected RequestGroup parseRequestGroup(JsonObject json) throws IOException, FHIRFormatError {
21479    RequestGroup res = new RequestGroup();
21480    parseRequestGroupProperties(json, res);
21481    return res;
21482  }
21483
21484  protected void parseRequestGroupProperties(JsonObject json, RequestGroup res) throws IOException, FHIRFormatError {
21485    parseDomainResourceProperties(json, res);
21486    if (json.has("identifier")) {
21487      JsonArray array = json.getAsJsonArray("identifier");
21488      for (int i = 0; i < array.size(); i++) {
21489        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21490      }
21491    };
21492    if (json.has("instantiatesCanonical")) {
21493      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
21494      for (int i = 0; i < array.size(); i++) {
21495        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
21496      }
21497    };
21498    if (json.has("_instantiatesCanonical")) {
21499      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
21500      for (int i = 0; i < array.size(); i++) {
21501        if (i == res.getInstantiatesCanonical().size())
21502          res.getInstantiatesCanonical().add(parseCanonical(null));
21503        if (array.get(i) instanceof JsonObject) 
21504          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
21505      }
21506    };
21507    if (json.has("instantiatesUri")) {
21508      JsonArray array = json.getAsJsonArray("instantiatesUri");
21509      for (int i = 0; i < array.size(); i++) {
21510        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
21511      }
21512    };
21513    if (json.has("_instantiatesUri")) {
21514      JsonArray array = json.getAsJsonArray("_instantiatesUri");
21515      for (int i = 0; i < array.size(); i++) {
21516        if (i == res.getInstantiatesUri().size())
21517          res.getInstantiatesUri().add(parseUri(null));
21518        if (array.get(i) instanceof JsonObject) 
21519          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
21520      }
21521    };
21522    if (json.has("basedOn")) {
21523      JsonArray array = json.getAsJsonArray("basedOn");
21524      for (int i = 0; i < array.size(); i++) {
21525        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
21526      }
21527    };
21528    if (json.has("replaces")) {
21529      JsonArray array = json.getAsJsonArray("replaces");
21530      for (int i = 0; i < array.size(); i++) {
21531        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
21532      }
21533    };
21534    if (json.has("groupIdentifier"))
21535      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
21536    if (json.has("status"))
21537      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RequestGroup.RequestStatus.NULL, new RequestGroup.RequestStatusEnumFactory()));
21538    if (json.has("_status"))
21539      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
21540    if (json.has("intent"))
21541      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), RequestGroup.RequestIntent.NULL, new RequestGroup.RequestIntentEnumFactory()));
21542    if (json.has("_intent"))
21543      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
21544    if (json.has("priority"))
21545      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), RequestGroup.RequestPriority.NULL, new RequestGroup.RequestPriorityEnumFactory()));
21546    if (json.has("_priority"))
21547      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
21548    if (json.has("code"))
21549      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
21550    if (json.has("subject"))
21551      res.setSubject(parseReference(json.getAsJsonObject("subject")));
21552    if (json.has("encounter"))
21553      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
21554    if (json.has("authoredOn"))
21555      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
21556    if (json.has("_authoredOn"))
21557      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
21558    if (json.has("author"))
21559      res.setAuthor(parseReference(json.getAsJsonObject("author")));
21560    if (json.has("reasonCode")) {
21561      JsonArray array = json.getAsJsonArray("reasonCode");
21562      for (int i = 0; i < array.size(); i++) {
21563        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21564      }
21565    };
21566    if (json.has("reasonReference")) {
21567      JsonArray array = json.getAsJsonArray("reasonReference");
21568      for (int i = 0; i < array.size(); i++) {
21569        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
21570      }
21571    };
21572    if (json.has("note")) {
21573      JsonArray array = json.getAsJsonArray("note");
21574      for (int i = 0; i < array.size(); i++) {
21575        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
21576      }
21577    };
21578    if (json.has("action")) {
21579      JsonArray array = json.getAsJsonArray("action");
21580      for (int i = 0; i < array.size(); i++) {
21581        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), res));
21582      }
21583    };
21584  }
21585
21586  protected RequestGroup.RequestGroupActionComponent parseRequestGroupRequestGroupActionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
21587    RequestGroup.RequestGroupActionComponent res = new RequestGroup.RequestGroupActionComponent();
21588    parseRequestGroupRequestGroupActionComponentProperties(json, owner, res);
21589    return res;
21590  }
21591
21592  protected void parseRequestGroupRequestGroupActionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionComponent res) throws IOException, FHIRFormatError {
21593    parseBackboneElementProperties(json, res);
21594    if (json.has("prefix"))
21595      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
21596    if (json.has("_prefix"))
21597      parseElementProperties(json.getAsJsonObject("_prefix"), res.getPrefixElement());
21598    if (json.has("title"))
21599      res.setTitleElement(parseString(json.get("title").getAsString()));
21600    if (json.has("_title"))
21601      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
21602    if (json.has("description"))
21603      res.setDescriptionElement(parseString(json.get("description").getAsString()));
21604    if (json.has("_description"))
21605      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
21606    if (json.has("textEquivalent"))
21607      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
21608    if (json.has("_textEquivalent"))
21609      parseElementProperties(json.getAsJsonObject("_textEquivalent"), res.getTextEquivalentElement());
21610    if (json.has("priority"))
21611      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), RequestGroup.RequestPriority.NULL, new RequestGroup.RequestPriorityEnumFactory()));
21612    if (json.has("_priority"))
21613      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
21614    if (json.has("code")) {
21615      JsonArray array = json.getAsJsonArray("code");
21616      for (int i = 0; i < array.size(); i++) {
21617        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21618      }
21619    };
21620    if (json.has("documentation")) {
21621      JsonArray array = json.getAsJsonArray("documentation");
21622      for (int i = 0; i < array.size(); i++) {
21623        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
21624      }
21625    };
21626    if (json.has("condition")) {
21627      JsonArray array = json.getAsJsonArray("condition");
21628      for (int i = 0; i < array.size(); i++) {
21629        res.getCondition().add(parseRequestGroupRequestGroupActionConditionComponent(array.get(i).getAsJsonObject(), owner));
21630      }
21631    };
21632    if (json.has("relatedAction")) {
21633      JsonArray array = json.getAsJsonArray("relatedAction");
21634      for (int i = 0; i < array.size(); i++) {
21635        res.getRelatedAction().add(parseRequestGroupRequestGroupActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
21636      }
21637    };
21638    Type timing = parseType("timing", json);
21639    if (timing != null)
21640      res.setTiming(timing);
21641    if (json.has("participant")) {
21642      JsonArray array = json.getAsJsonArray("participant");
21643      for (int i = 0; i < array.size(); i++) {
21644        res.getParticipant().add(parseReference(array.get(i).getAsJsonObject()));
21645      }
21646    };
21647    if (json.has("type"))
21648      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
21649    if (json.has("groupingBehavior"))
21650      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), RequestGroup.ActionGroupingBehavior.NULL, new RequestGroup.ActionGroupingBehaviorEnumFactory()));
21651    if (json.has("_groupingBehavior"))
21652      parseElementProperties(json.getAsJsonObject("_groupingBehavior"), res.getGroupingBehaviorElement());
21653    if (json.has("selectionBehavior"))
21654      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), RequestGroup.ActionSelectionBehavior.NULL, new RequestGroup.ActionSelectionBehaviorEnumFactory()));
21655    if (json.has("_selectionBehavior"))
21656      parseElementProperties(json.getAsJsonObject("_selectionBehavior"), res.getSelectionBehaviorElement());
21657    if (json.has("requiredBehavior"))
21658      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), RequestGroup.ActionRequiredBehavior.NULL, new RequestGroup.ActionRequiredBehaviorEnumFactory()));
21659    if (json.has("_requiredBehavior"))
21660      parseElementProperties(json.getAsJsonObject("_requiredBehavior"), res.getRequiredBehaviorElement());
21661    if (json.has("precheckBehavior"))
21662      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), RequestGroup.ActionPrecheckBehavior.NULL, new RequestGroup.ActionPrecheckBehaviorEnumFactory()));
21663    if (json.has("_precheckBehavior"))
21664      parseElementProperties(json.getAsJsonObject("_precheckBehavior"), res.getPrecheckBehaviorElement());
21665    if (json.has("cardinalityBehavior"))
21666      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), RequestGroup.ActionCardinalityBehavior.NULL, new RequestGroup.ActionCardinalityBehaviorEnumFactory()));
21667    if (json.has("_cardinalityBehavior"))
21668      parseElementProperties(json.getAsJsonObject("_cardinalityBehavior"), res.getCardinalityBehaviorElement());
21669    if (json.has("resource"))
21670      res.setResource(parseReference(json.getAsJsonObject("resource")));
21671    if (json.has("action")) {
21672      JsonArray array = json.getAsJsonArray("action");
21673      for (int i = 0; i < array.size(); i++) {
21674        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), owner));
21675      }
21676    };
21677  }
21678
21679  protected RequestGroup.RequestGroupActionConditionComponent parseRequestGroupRequestGroupActionConditionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
21680    RequestGroup.RequestGroupActionConditionComponent res = new RequestGroup.RequestGroupActionConditionComponent();
21681    parseRequestGroupRequestGroupActionConditionComponentProperties(json, owner, res);
21682    return res;
21683  }
21684
21685  protected void parseRequestGroupRequestGroupActionConditionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionConditionComponent res) throws IOException, FHIRFormatError {
21686    parseBackboneElementProperties(json, res);
21687    if (json.has("kind"))
21688      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), RequestGroup.ActionConditionKind.NULL, new RequestGroup.ActionConditionKindEnumFactory()));
21689    if (json.has("_kind"))
21690      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
21691    if (json.has("expression"))
21692      res.setExpression(parseExpression(json.getAsJsonObject("expression")));
21693  }
21694
21695  protected RequestGroup.RequestGroupActionRelatedActionComponent parseRequestGroupRequestGroupActionRelatedActionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
21696    RequestGroup.RequestGroupActionRelatedActionComponent res = new RequestGroup.RequestGroupActionRelatedActionComponent();
21697    parseRequestGroupRequestGroupActionRelatedActionComponentProperties(json, owner, res);
21698    return res;
21699  }
21700
21701  protected void parseRequestGroupRequestGroupActionRelatedActionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionRelatedActionComponent res) throws IOException, FHIRFormatError {
21702    parseBackboneElementProperties(json, res);
21703    if (json.has("actionId"))
21704      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
21705    if (json.has("_actionId"))
21706      parseElementProperties(json.getAsJsonObject("_actionId"), res.getActionIdElement());
21707    if (json.has("relationship"))
21708      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), RequestGroup.ActionRelationshipType.NULL, new RequestGroup.ActionRelationshipTypeEnumFactory()));
21709    if (json.has("_relationship"))
21710      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
21711    Type offset = parseType("offset", json);
21712    if (offset != null)
21713      res.setOffset(offset);
21714  }
21715
21716  protected ResearchDefinition parseResearchDefinition(JsonObject json) throws IOException, FHIRFormatError {
21717    ResearchDefinition res = new ResearchDefinition();
21718    parseResearchDefinitionProperties(json, res);
21719    return res;
21720  }
21721
21722  protected void parseResearchDefinitionProperties(JsonObject json, ResearchDefinition res) throws IOException, FHIRFormatError {
21723    parseDomainResourceProperties(json, res);
21724    if (json.has("url"))
21725      res.setUrlElement(parseUri(json.get("url").getAsString()));
21726    if (json.has("_url"))
21727      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
21728    if (json.has("identifier")) {
21729      JsonArray array = json.getAsJsonArray("identifier");
21730      for (int i = 0; i < array.size(); i++) {
21731        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21732      }
21733    };
21734    if (json.has("version"))
21735      res.setVersionElement(parseString(json.get("version").getAsString()));
21736    if (json.has("_version"))
21737      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
21738    if (json.has("name"))
21739      res.setNameElement(parseString(json.get("name").getAsString()));
21740    if (json.has("_name"))
21741      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
21742    if (json.has("title"))
21743      res.setTitleElement(parseString(json.get("title").getAsString()));
21744    if (json.has("_title"))
21745      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
21746    if (json.has("shortTitle"))
21747      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
21748    if (json.has("_shortTitle"))
21749      parseElementProperties(json.getAsJsonObject("_shortTitle"), res.getShortTitleElement());
21750    if (json.has("subtitle"))
21751      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
21752    if (json.has("_subtitle"))
21753      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
21754    if (json.has("status"))
21755      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
21756    if (json.has("_status"))
21757      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
21758    if (json.has("experimental"))
21759      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
21760    if (json.has("_experimental"))
21761      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
21762    Type subject = parseType("subject", json);
21763    if (subject != null)
21764      res.setSubject(subject);
21765    if (json.has("date"))
21766      res.setDateElement(parseDateTime(json.get("date").getAsString()));
21767    if (json.has("_date"))
21768      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
21769    if (json.has("publisher"))
21770      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
21771    if (json.has("_publisher"))
21772      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
21773    if (json.has("contact")) {
21774      JsonArray array = json.getAsJsonArray("contact");
21775      for (int i = 0; i < array.size(); i++) {
21776        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
21777      }
21778    };
21779    if (json.has("description"))
21780      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
21781    if (json.has("_description"))
21782      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
21783    if (json.has("comment")) {
21784      JsonArray array = json.getAsJsonArray("comment");
21785      for (int i = 0; i < array.size(); i++) {
21786        res.getComment().add(parseString(array.get(i).getAsString()));
21787      }
21788    };
21789    if (json.has("_comment")) {
21790      JsonArray array = json.getAsJsonArray("_comment");
21791      for (int i = 0; i < array.size(); i++) {
21792        if (i == res.getComment().size())
21793          res.getComment().add(parseString(null));
21794        if (array.get(i) instanceof JsonObject) 
21795          parseElementProperties(array.get(i).getAsJsonObject(), res.getComment().get(i));
21796      }
21797    };
21798    if (json.has("useContext")) {
21799      JsonArray array = json.getAsJsonArray("useContext");
21800      for (int i = 0; i < array.size(); i++) {
21801        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
21802      }
21803    };
21804    if (json.has("jurisdiction")) {
21805      JsonArray array = json.getAsJsonArray("jurisdiction");
21806      for (int i = 0; i < array.size(); i++) {
21807        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21808      }
21809    };
21810    if (json.has("purpose"))
21811      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
21812    if (json.has("_purpose"))
21813      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
21814    if (json.has("usage"))
21815      res.setUsageElement(parseString(json.get("usage").getAsString()));
21816    if (json.has("_usage"))
21817      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
21818    if (json.has("copyright"))
21819      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
21820    if (json.has("_copyright"))
21821      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
21822    if (json.has("approvalDate"))
21823      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
21824    if (json.has("_approvalDate"))
21825      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
21826    if (json.has("lastReviewDate"))
21827      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
21828    if (json.has("_lastReviewDate"))
21829      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
21830    if (json.has("effectivePeriod"))
21831      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
21832    if (json.has("topic")) {
21833      JsonArray array = json.getAsJsonArray("topic");
21834      for (int i = 0; i < array.size(); i++) {
21835        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21836      }
21837    };
21838    if (json.has("author")) {
21839      JsonArray array = json.getAsJsonArray("author");
21840      for (int i = 0; i < array.size(); i++) {
21841        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
21842      }
21843    };
21844    if (json.has("editor")) {
21845      JsonArray array = json.getAsJsonArray("editor");
21846      for (int i = 0; i < array.size(); i++) {
21847        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
21848      }
21849    };
21850    if (json.has("reviewer")) {
21851      JsonArray array = json.getAsJsonArray("reviewer");
21852      for (int i = 0; i < array.size(); i++) {
21853        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
21854      }
21855    };
21856    if (json.has("endorser")) {
21857      JsonArray array = json.getAsJsonArray("endorser");
21858      for (int i = 0; i < array.size(); i++) {
21859        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
21860      }
21861    };
21862    if (json.has("relatedArtifact")) {
21863      JsonArray array = json.getAsJsonArray("relatedArtifact");
21864      for (int i = 0; i < array.size(); i++) {
21865        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
21866      }
21867    };
21868    if (json.has("library")) {
21869      JsonArray array = json.getAsJsonArray("library");
21870      for (int i = 0; i < array.size(); i++) {
21871        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
21872      }
21873    };
21874    if (json.has("_library")) {
21875      JsonArray array = json.getAsJsonArray("_library");
21876      for (int i = 0; i < array.size(); i++) {
21877        if (i == res.getLibrary().size())
21878          res.getLibrary().add(parseCanonical(null));
21879        if (array.get(i) instanceof JsonObject) 
21880          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
21881      }
21882    };
21883    if (json.has("population"))
21884      res.setPopulation(parseReference(json.getAsJsonObject("population")));
21885    if (json.has("exposure"))
21886      res.setExposure(parseReference(json.getAsJsonObject("exposure")));
21887    if (json.has("exposureAlternative"))
21888      res.setExposureAlternative(parseReference(json.getAsJsonObject("exposureAlternative")));
21889    if (json.has("outcome"))
21890      res.setOutcome(parseReference(json.getAsJsonObject("outcome")));
21891  }
21892
21893  protected ResearchElementDefinition parseResearchElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
21894    ResearchElementDefinition res = new ResearchElementDefinition();
21895    parseResearchElementDefinitionProperties(json, res);
21896    return res;
21897  }
21898
21899  protected void parseResearchElementDefinitionProperties(JsonObject json, ResearchElementDefinition res) throws IOException, FHIRFormatError {
21900    parseDomainResourceProperties(json, res);
21901    if (json.has("url"))
21902      res.setUrlElement(parseUri(json.get("url").getAsString()));
21903    if (json.has("_url"))
21904      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
21905    if (json.has("identifier")) {
21906      JsonArray array = json.getAsJsonArray("identifier");
21907      for (int i = 0; i < array.size(); i++) {
21908        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21909      }
21910    };
21911    if (json.has("version"))
21912      res.setVersionElement(parseString(json.get("version").getAsString()));
21913    if (json.has("_version"))
21914      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
21915    if (json.has("name"))
21916      res.setNameElement(parseString(json.get("name").getAsString()));
21917    if (json.has("_name"))
21918      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
21919    if (json.has("title"))
21920      res.setTitleElement(parseString(json.get("title").getAsString()));
21921    if (json.has("_title"))
21922      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
21923    if (json.has("shortTitle"))
21924      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
21925    if (json.has("_shortTitle"))
21926      parseElementProperties(json.getAsJsonObject("_shortTitle"), res.getShortTitleElement());
21927    if (json.has("subtitle"))
21928      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
21929    if (json.has("_subtitle"))
21930      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
21931    if (json.has("status"))
21932      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
21933    if (json.has("_status"))
21934      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
21935    if (json.has("experimental"))
21936      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
21937    if (json.has("_experimental"))
21938      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
21939    Type subject = parseType("subject", json);
21940    if (subject != null)
21941      res.setSubject(subject);
21942    if (json.has("date"))
21943      res.setDateElement(parseDateTime(json.get("date").getAsString()));
21944    if (json.has("_date"))
21945      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
21946    if (json.has("publisher"))
21947      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
21948    if (json.has("_publisher"))
21949      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
21950    if (json.has("contact")) {
21951      JsonArray array = json.getAsJsonArray("contact");
21952      for (int i = 0; i < array.size(); i++) {
21953        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
21954      }
21955    };
21956    if (json.has("description"))
21957      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
21958    if (json.has("_description"))
21959      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
21960    if (json.has("comment")) {
21961      JsonArray array = json.getAsJsonArray("comment");
21962      for (int i = 0; i < array.size(); i++) {
21963        res.getComment().add(parseString(array.get(i).getAsString()));
21964      }
21965    };
21966    if (json.has("_comment")) {
21967      JsonArray array = json.getAsJsonArray("_comment");
21968      for (int i = 0; i < array.size(); i++) {
21969        if (i == res.getComment().size())
21970          res.getComment().add(parseString(null));
21971        if (array.get(i) instanceof JsonObject) 
21972          parseElementProperties(array.get(i).getAsJsonObject(), res.getComment().get(i));
21973      }
21974    };
21975    if (json.has("useContext")) {
21976      JsonArray array = json.getAsJsonArray("useContext");
21977      for (int i = 0; i < array.size(); i++) {
21978        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
21979      }
21980    };
21981    if (json.has("jurisdiction")) {
21982      JsonArray array = json.getAsJsonArray("jurisdiction");
21983      for (int i = 0; i < array.size(); i++) {
21984        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21985      }
21986    };
21987    if (json.has("purpose"))
21988      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
21989    if (json.has("_purpose"))
21990      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
21991    if (json.has("usage"))
21992      res.setUsageElement(parseString(json.get("usage").getAsString()));
21993    if (json.has("_usage"))
21994      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
21995    if (json.has("copyright"))
21996      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
21997    if (json.has("_copyright"))
21998      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
21999    if (json.has("approvalDate"))
22000      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
22001    if (json.has("_approvalDate"))
22002      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
22003    if (json.has("lastReviewDate"))
22004      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
22005    if (json.has("_lastReviewDate"))
22006      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
22007    if (json.has("effectivePeriod"))
22008      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
22009    if (json.has("topic")) {
22010      JsonArray array = json.getAsJsonArray("topic");
22011      for (int i = 0; i < array.size(); i++) {
22012        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22013      }
22014    };
22015    if (json.has("author")) {
22016      JsonArray array = json.getAsJsonArray("author");
22017      for (int i = 0; i < array.size(); i++) {
22018        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
22019      }
22020    };
22021    if (json.has("editor")) {
22022      JsonArray array = json.getAsJsonArray("editor");
22023      for (int i = 0; i < array.size(); i++) {
22024        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
22025      }
22026    };
22027    if (json.has("reviewer")) {
22028      JsonArray array = json.getAsJsonArray("reviewer");
22029      for (int i = 0; i < array.size(); i++) {
22030        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
22031      }
22032    };
22033    if (json.has("endorser")) {
22034      JsonArray array = json.getAsJsonArray("endorser");
22035      for (int i = 0; i < array.size(); i++) {
22036        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
22037      }
22038    };
22039    if (json.has("relatedArtifact")) {
22040      JsonArray array = json.getAsJsonArray("relatedArtifact");
22041      for (int i = 0; i < array.size(); i++) {
22042        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
22043      }
22044    };
22045    if (json.has("library")) {
22046      JsonArray array = json.getAsJsonArray("library");
22047      for (int i = 0; i < array.size(); i++) {
22048        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
22049      }
22050    };
22051    if (json.has("_library")) {
22052      JsonArray array = json.getAsJsonArray("_library");
22053      for (int i = 0; i < array.size(); i++) {
22054        if (i == res.getLibrary().size())
22055          res.getLibrary().add(parseCanonical(null));
22056        if (array.get(i) instanceof JsonObject) 
22057          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
22058      }
22059    };
22060    if (json.has("type"))
22061      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ResearchElementDefinition.ResearchElementType.NULL, new ResearchElementDefinition.ResearchElementTypeEnumFactory()));
22062    if (json.has("_type"))
22063      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
22064    if (json.has("variableType"))
22065      res.setVariableTypeElement(parseEnumeration(json.get("variableType").getAsString(), ResearchElementDefinition.VariableType.NULL, new ResearchElementDefinition.VariableTypeEnumFactory()));
22066    if (json.has("_variableType"))
22067      parseElementProperties(json.getAsJsonObject("_variableType"), res.getVariableTypeElement());
22068    if (json.has("characteristic")) {
22069      JsonArray array = json.getAsJsonArray("characteristic");
22070      for (int i = 0; i < array.size(); i++) {
22071        res.getCharacteristic().add(parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(array.get(i).getAsJsonObject(), res));
22072      }
22073    };
22074  }
22075
22076  protected ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(JsonObject json, ResearchElementDefinition owner) throws IOException, FHIRFormatError {
22077    ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent res = new ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent();
22078    parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponentProperties(json, owner, res);
22079    return res;
22080  }
22081
22082  protected void parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponentProperties(JsonObject json, ResearchElementDefinition owner, ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent res) throws IOException, FHIRFormatError {
22083    parseBackboneElementProperties(json, res);
22084    Type definition = parseType("definition", json);
22085    if (definition != null)
22086      res.setDefinition(definition);
22087    if (json.has("usageContext")) {
22088      JsonArray array = json.getAsJsonArray("usageContext");
22089      for (int i = 0; i < array.size(); i++) {
22090        res.getUsageContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
22091      }
22092    };
22093    if (json.has("exclude"))
22094      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
22095    if (json.has("_exclude"))
22096      parseElementProperties(json.getAsJsonObject("_exclude"), res.getExcludeElement());
22097    if (json.has("unitOfMeasure"))
22098      res.setUnitOfMeasure(parseCodeableConcept(json.getAsJsonObject("unitOfMeasure")));
22099    if (json.has("studyEffectiveDescription"))
22100      res.setStudyEffectiveDescriptionElement(parseString(json.get("studyEffectiveDescription").getAsString()));
22101    if (json.has("_studyEffectiveDescription"))
22102      parseElementProperties(json.getAsJsonObject("_studyEffectiveDescription"), res.getStudyEffectiveDescriptionElement());
22103    Type studyEffective = parseType("studyEffective", json);
22104    if (studyEffective != null)
22105      res.setStudyEffective(studyEffective);
22106    if (json.has("studyEffectiveTimeFromStart"))
22107      res.setStudyEffectiveTimeFromStart(parseDuration(json.getAsJsonObject("studyEffectiveTimeFromStart")));
22108    if (json.has("studyEffectiveGroupMeasure"))
22109      res.setStudyEffectiveGroupMeasureElement(parseEnumeration(json.get("studyEffectiveGroupMeasure").getAsString(), ResearchElementDefinition.GroupMeasure.NULL, new ResearchElementDefinition.GroupMeasureEnumFactory()));
22110    if (json.has("_studyEffectiveGroupMeasure"))
22111      parseElementProperties(json.getAsJsonObject("_studyEffectiveGroupMeasure"), res.getStudyEffectiveGroupMeasureElement());
22112    if (json.has("participantEffectiveDescription"))
22113      res.setParticipantEffectiveDescriptionElement(parseString(json.get("participantEffectiveDescription").getAsString()));
22114    if (json.has("_participantEffectiveDescription"))
22115      parseElementProperties(json.getAsJsonObject("_participantEffectiveDescription"), res.getParticipantEffectiveDescriptionElement());
22116    Type participantEffective = parseType("participantEffective", json);
22117    if (participantEffective != null)
22118      res.setParticipantEffective(participantEffective);
22119    if (json.has("participantEffectiveTimeFromStart"))
22120      res.setParticipantEffectiveTimeFromStart(parseDuration(json.getAsJsonObject("participantEffectiveTimeFromStart")));
22121    if (json.has("participantEffectiveGroupMeasure"))
22122      res.setParticipantEffectiveGroupMeasureElement(parseEnumeration(json.get("participantEffectiveGroupMeasure").getAsString(), ResearchElementDefinition.GroupMeasure.NULL, new ResearchElementDefinition.GroupMeasureEnumFactory()));
22123    if (json.has("_participantEffectiveGroupMeasure"))
22124      parseElementProperties(json.getAsJsonObject("_participantEffectiveGroupMeasure"), res.getParticipantEffectiveGroupMeasureElement());
22125  }
22126
22127  protected ResearchStudy parseResearchStudy(JsonObject json) throws IOException, FHIRFormatError {
22128    ResearchStudy res = new ResearchStudy();
22129    parseResearchStudyProperties(json, res);
22130    return res;
22131  }
22132
22133  protected void parseResearchStudyProperties(JsonObject json, ResearchStudy res) throws IOException, FHIRFormatError {
22134    parseDomainResourceProperties(json, res);
22135    if (json.has("identifier")) {
22136      JsonArray array = json.getAsJsonArray("identifier");
22137      for (int i = 0; i < array.size(); i++) {
22138        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22139      }
22140    };
22141    if (json.has("title"))
22142      res.setTitleElement(parseString(json.get("title").getAsString()));
22143    if (json.has("_title"))
22144      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
22145    if (json.has("protocol")) {
22146      JsonArray array = json.getAsJsonArray("protocol");
22147      for (int i = 0; i < array.size(); i++) {
22148        res.getProtocol().add(parseReference(array.get(i).getAsJsonObject()));
22149      }
22150    };
22151    if (json.has("partOf")) {
22152      JsonArray array = json.getAsJsonArray("partOf");
22153      for (int i = 0; i < array.size(); i++) {
22154        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
22155      }
22156    };
22157    if (json.has("status"))
22158      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchStudy.ResearchStudyStatus.NULL, new ResearchStudy.ResearchStudyStatusEnumFactory()));
22159    if (json.has("_status"))
22160      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22161    if (json.has("primaryPurposeType"))
22162      res.setPrimaryPurposeType(parseCodeableConcept(json.getAsJsonObject("primaryPurposeType")));
22163    if (json.has("phase"))
22164      res.setPhase(parseCodeableConcept(json.getAsJsonObject("phase")));
22165    if (json.has("category")) {
22166      JsonArray array = json.getAsJsonArray("category");
22167      for (int i = 0; i < array.size(); i++) {
22168        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22169      }
22170    };
22171    if (json.has("focus")) {
22172      JsonArray array = json.getAsJsonArray("focus");
22173      for (int i = 0; i < array.size(); i++) {
22174        res.getFocus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22175      }
22176    };
22177    if (json.has("condition")) {
22178      JsonArray array = json.getAsJsonArray("condition");
22179      for (int i = 0; i < array.size(); i++) {
22180        res.getCondition().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22181      }
22182    };
22183    if (json.has("contact")) {
22184      JsonArray array = json.getAsJsonArray("contact");
22185      for (int i = 0; i < array.size(); i++) {
22186        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
22187      }
22188    };
22189    if (json.has("relatedArtifact")) {
22190      JsonArray array = json.getAsJsonArray("relatedArtifact");
22191      for (int i = 0; i < array.size(); i++) {
22192        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
22193      }
22194    };
22195    if (json.has("keyword")) {
22196      JsonArray array = json.getAsJsonArray("keyword");
22197      for (int i = 0; i < array.size(); i++) {
22198        res.getKeyword().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22199      }
22200    };
22201    if (json.has("location")) {
22202      JsonArray array = json.getAsJsonArray("location");
22203      for (int i = 0; i < array.size(); i++) {
22204        res.getLocation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22205      }
22206    };
22207    if (json.has("description"))
22208      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22209    if (json.has("_description"))
22210      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22211    if (json.has("enrollment")) {
22212      JsonArray array = json.getAsJsonArray("enrollment");
22213      for (int i = 0; i < array.size(); i++) {
22214        res.getEnrollment().add(parseReference(array.get(i).getAsJsonObject()));
22215      }
22216    };
22217    if (json.has("period"))
22218      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
22219    if (json.has("sponsor"))
22220      res.setSponsor(parseReference(json.getAsJsonObject("sponsor")));
22221    if (json.has("principalInvestigator"))
22222      res.setPrincipalInvestigator(parseReference(json.getAsJsonObject("principalInvestigator")));
22223    if (json.has("site")) {
22224      JsonArray array = json.getAsJsonArray("site");
22225      for (int i = 0; i < array.size(); i++) {
22226        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
22227      }
22228    };
22229    if (json.has("reasonStopped"))
22230      res.setReasonStopped(parseCodeableConcept(json.getAsJsonObject("reasonStopped")));
22231    if (json.has("note")) {
22232      JsonArray array = json.getAsJsonArray("note");
22233      for (int i = 0; i < array.size(); i++) {
22234        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22235      }
22236    };
22237    if (json.has("arm")) {
22238      JsonArray array = json.getAsJsonArray("arm");
22239      for (int i = 0; i < array.size(); i++) {
22240        res.getArm().add(parseResearchStudyResearchStudyArmComponent(array.get(i).getAsJsonObject(), res));
22241      }
22242    };
22243    if (json.has("objective")) {
22244      JsonArray array = json.getAsJsonArray("objective");
22245      for (int i = 0; i < array.size(); i++) {
22246        res.getObjective().add(parseResearchStudyResearchStudyObjectiveComponent(array.get(i).getAsJsonObject(), res));
22247      }
22248    };
22249  }
22250
22251  protected ResearchStudy.ResearchStudyArmComponent parseResearchStudyResearchStudyArmComponent(JsonObject json, ResearchStudy owner) throws IOException, FHIRFormatError {
22252    ResearchStudy.ResearchStudyArmComponent res = new ResearchStudy.ResearchStudyArmComponent();
22253    parseResearchStudyResearchStudyArmComponentProperties(json, owner, res);
22254    return res;
22255  }
22256
22257  protected void parseResearchStudyResearchStudyArmComponentProperties(JsonObject json, ResearchStudy owner, ResearchStudy.ResearchStudyArmComponent res) throws IOException, FHIRFormatError {
22258    parseBackboneElementProperties(json, res);
22259    if (json.has("name"))
22260      res.setNameElement(parseString(json.get("name").getAsString()));
22261    if (json.has("_name"))
22262      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22263    if (json.has("type"))
22264      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22265    if (json.has("description"))
22266      res.setDescriptionElement(parseString(json.get("description").getAsString()));
22267    if (json.has("_description"))
22268      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22269  }
22270
22271  protected ResearchStudy.ResearchStudyObjectiveComponent parseResearchStudyResearchStudyObjectiveComponent(JsonObject json, ResearchStudy owner) throws IOException, FHIRFormatError {
22272    ResearchStudy.ResearchStudyObjectiveComponent res = new ResearchStudy.ResearchStudyObjectiveComponent();
22273    parseResearchStudyResearchStudyObjectiveComponentProperties(json, owner, res);
22274    return res;
22275  }
22276
22277  protected void parseResearchStudyResearchStudyObjectiveComponentProperties(JsonObject json, ResearchStudy owner, ResearchStudy.ResearchStudyObjectiveComponent res) throws IOException, FHIRFormatError {
22278    parseBackboneElementProperties(json, res);
22279    if (json.has("name"))
22280      res.setNameElement(parseString(json.get("name").getAsString()));
22281    if (json.has("_name"))
22282      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22283    if (json.has("type"))
22284      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22285  }
22286
22287  protected ResearchSubject parseResearchSubject(JsonObject json) throws IOException, FHIRFormatError {
22288    ResearchSubject res = new ResearchSubject();
22289    parseResearchSubjectProperties(json, res);
22290    return res;
22291  }
22292
22293  protected void parseResearchSubjectProperties(JsonObject json, ResearchSubject res) throws IOException, FHIRFormatError {
22294    parseDomainResourceProperties(json, res);
22295    if (json.has("identifier")) {
22296      JsonArray array = json.getAsJsonArray("identifier");
22297      for (int i = 0; i < array.size(); i++) {
22298        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22299      }
22300    };
22301    if (json.has("status"))
22302      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchSubject.ResearchSubjectStatus.NULL, new ResearchSubject.ResearchSubjectStatusEnumFactory()));
22303    if (json.has("_status"))
22304      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22305    if (json.has("period"))
22306      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
22307    if (json.has("study"))
22308      res.setStudy(parseReference(json.getAsJsonObject("study")));
22309    if (json.has("individual"))
22310      res.setIndividual(parseReference(json.getAsJsonObject("individual")));
22311    if (json.has("assignedArm"))
22312      res.setAssignedArmElement(parseString(json.get("assignedArm").getAsString()));
22313    if (json.has("_assignedArm"))
22314      parseElementProperties(json.getAsJsonObject("_assignedArm"), res.getAssignedArmElement());
22315    if (json.has("actualArm"))
22316      res.setActualArmElement(parseString(json.get("actualArm").getAsString()));
22317    if (json.has("_actualArm"))
22318      parseElementProperties(json.getAsJsonObject("_actualArm"), res.getActualArmElement());
22319    if (json.has("consent"))
22320      res.setConsent(parseReference(json.getAsJsonObject("consent")));
22321  }
22322
22323  protected RiskAssessment parseRiskAssessment(JsonObject json) throws IOException, FHIRFormatError {
22324    RiskAssessment res = new RiskAssessment();
22325    parseRiskAssessmentProperties(json, res);
22326    return res;
22327  }
22328
22329  protected void parseRiskAssessmentProperties(JsonObject json, RiskAssessment res) throws IOException, FHIRFormatError {
22330    parseDomainResourceProperties(json, res);
22331    if (json.has("identifier")) {
22332      JsonArray array = json.getAsJsonArray("identifier");
22333      for (int i = 0; i < array.size(); i++) {
22334        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22335      }
22336    };
22337    if (json.has("basedOn"))
22338      res.setBasedOn(parseReference(json.getAsJsonObject("basedOn")));
22339    if (json.has("parent"))
22340      res.setParent(parseReference(json.getAsJsonObject("parent")));
22341    if (json.has("status"))
22342      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RiskAssessment.RiskAssessmentStatus.NULL, new RiskAssessment.RiskAssessmentStatusEnumFactory()));
22343    if (json.has("_status"))
22344      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22345    if (json.has("method"))
22346      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
22347    if (json.has("code"))
22348      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
22349    if (json.has("subject"))
22350      res.setSubject(parseReference(json.getAsJsonObject("subject")));
22351    if (json.has("encounter"))
22352      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
22353    Type occurrence = parseType("occurrence", json);
22354    if (occurrence != null)
22355      res.setOccurrence(occurrence);
22356    if (json.has("condition"))
22357      res.setCondition(parseReference(json.getAsJsonObject("condition")));
22358    if (json.has("performer"))
22359      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
22360    if (json.has("reasonCode")) {
22361      JsonArray array = json.getAsJsonArray("reasonCode");
22362      for (int i = 0; i < array.size(); i++) {
22363        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22364      }
22365    };
22366    if (json.has("reasonReference")) {
22367      JsonArray array = json.getAsJsonArray("reasonReference");
22368      for (int i = 0; i < array.size(); i++) {
22369        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
22370      }
22371    };
22372    if (json.has("basis")) {
22373      JsonArray array = json.getAsJsonArray("basis");
22374      for (int i = 0; i < array.size(); i++) {
22375        res.getBasis().add(parseReference(array.get(i).getAsJsonObject()));
22376      }
22377    };
22378    if (json.has("prediction")) {
22379      JsonArray array = json.getAsJsonArray("prediction");
22380      for (int i = 0; i < array.size(); i++) {
22381        res.getPrediction().add(parseRiskAssessmentRiskAssessmentPredictionComponent(array.get(i).getAsJsonObject(), res));
22382      }
22383    };
22384    if (json.has("mitigation"))
22385      res.setMitigationElement(parseString(json.get("mitigation").getAsString()));
22386    if (json.has("_mitigation"))
22387      parseElementProperties(json.getAsJsonObject("_mitigation"), res.getMitigationElement());
22388    if (json.has("note")) {
22389      JsonArray array = json.getAsJsonArray("note");
22390      for (int i = 0; i < array.size(); i++) {
22391        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22392      }
22393    };
22394  }
22395
22396  protected RiskAssessment.RiskAssessmentPredictionComponent parseRiskAssessmentRiskAssessmentPredictionComponent(JsonObject json, RiskAssessment owner) throws IOException, FHIRFormatError {
22397    RiskAssessment.RiskAssessmentPredictionComponent res = new RiskAssessment.RiskAssessmentPredictionComponent();
22398    parseRiskAssessmentRiskAssessmentPredictionComponentProperties(json, owner, res);
22399    return res;
22400  }
22401
22402  protected void parseRiskAssessmentRiskAssessmentPredictionComponentProperties(JsonObject json, RiskAssessment owner, RiskAssessment.RiskAssessmentPredictionComponent res) throws IOException, FHIRFormatError {
22403    parseBackboneElementProperties(json, res);
22404    if (json.has("outcome"))
22405      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
22406    Type probability = parseType("probability", json);
22407    if (probability != null)
22408      res.setProbability(probability);
22409    if (json.has("qualitativeRisk"))
22410      res.setQualitativeRisk(parseCodeableConcept(json.getAsJsonObject("qualitativeRisk")));
22411    if (json.has("relativeRisk"))
22412      res.setRelativeRiskElement(parseDecimal(json.get("relativeRisk").getAsBigDecimal()));
22413    if (json.has("_relativeRisk"))
22414      parseElementProperties(json.getAsJsonObject("_relativeRisk"), res.getRelativeRiskElement());
22415    Type when = parseType("when", json);
22416    if (when != null)
22417      res.setWhen(when);
22418    if (json.has("rationale"))
22419      res.setRationaleElement(parseString(json.get("rationale").getAsString()));
22420    if (json.has("_rationale"))
22421      parseElementProperties(json.getAsJsonObject("_rationale"), res.getRationaleElement());
22422  }
22423
22424  protected RiskEvidenceSynthesis parseRiskEvidenceSynthesis(JsonObject json) throws IOException, FHIRFormatError {
22425    RiskEvidenceSynthesis res = new RiskEvidenceSynthesis();
22426    parseRiskEvidenceSynthesisProperties(json, res);
22427    return res;
22428  }
22429
22430  protected void parseRiskEvidenceSynthesisProperties(JsonObject json, RiskEvidenceSynthesis res) throws IOException, FHIRFormatError {
22431    parseDomainResourceProperties(json, res);
22432    if (json.has("url"))
22433      res.setUrlElement(parseUri(json.get("url").getAsString()));
22434    if (json.has("_url"))
22435      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
22436    if (json.has("identifier")) {
22437      JsonArray array = json.getAsJsonArray("identifier");
22438      for (int i = 0; i < array.size(); i++) {
22439        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22440      }
22441    };
22442    if (json.has("version"))
22443      res.setVersionElement(parseString(json.get("version").getAsString()));
22444    if (json.has("_version"))
22445      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
22446    if (json.has("name"))
22447      res.setNameElement(parseString(json.get("name").getAsString()));
22448    if (json.has("_name"))
22449      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22450    if (json.has("title"))
22451      res.setTitleElement(parseString(json.get("title").getAsString()));
22452    if (json.has("_title"))
22453      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
22454    if (json.has("status"))
22455      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
22456    if (json.has("_status"))
22457      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22458    if (json.has("date"))
22459      res.setDateElement(parseDateTime(json.get("date").getAsString()));
22460    if (json.has("_date"))
22461      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
22462    if (json.has("publisher"))
22463      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
22464    if (json.has("_publisher"))
22465      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
22466    if (json.has("contact")) {
22467      JsonArray array = json.getAsJsonArray("contact");
22468      for (int i = 0; i < array.size(); i++) {
22469        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
22470      }
22471    };
22472    if (json.has("description"))
22473      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22474    if (json.has("_description"))
22475      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22476    if (json.has("note")) {
22477      JsonArray array = json.getAsJsonArray("note");
22478      for (int i = 0; i < array.size(); i++) {
22479        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22480      }
22481    };
22482    if (json.has("useContext")) {
22483      JsonArray array = json.getAsJsonArray("useContext");
22484      for (int i = 0; i < array.size(); i++) {
22485        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
22486      }
22487    };
22488    if (json.has("jurisdiction")) {
22489      JsonArray array = json.getAsJsonArray("jurisdiction");
22490      for (int i = 0; i < array.size(); i++) {
22491        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22492      }
22493    };
22494    if (json.has("copyright"))
22495      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
22496    if (json.has("_copyright"))
22497      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
22498    if (json.has("approvalDate"))
22499      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
22500    if (json.has("_approvalDate"))
22501      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
22502    if (json.has("lastReviewDate"))
22503      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
22504    if (json.has("_lastReviewDate"))
22505      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
22506    if (json.has("effectivePeriod"))
22507      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
22508    if (json.has("topic")) {
22509      JsonArray array = json.getAsJsonArray("topic");
22510      for (int i = 0; i < array.size(); i++) {
22511        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22512      }
22513    };
22514    if (json.has("author")) {
22515      JsonArray array = json.getAsJsonArray("author");
22516      for (int i = 0; i < array.size(); i++) {
22517        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
22518      }
22519    };
22520    if (json.has("editor")) {
22521      JsonArray array = json.getAsJsonArray("editor");
22522      for (int i = 0; i < array.size(); i++) {
22523        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
22524      }
22525    };
22526    if (json.has("reviewer")) {
22527      JsonArray array = json.getAsJsonArray("reviewer");
22528      for (int i = 0; i < array.size(); i++) {
22529        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
22530      }
22531    };
22532    if (json.has("endorser")) {
22533      JsonArray array = json.getAsJsonArray("endorser");
22534      for (int i = 0; i < array.size(); i++) {
22535        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
22536      }
22537    };
22538    if (json.has("relatedArtifact")) {
22539      JsonArray array = json.getAsJsonArray("relatedArtifact");
22540      for (int i = 0; i < array.size(); i++) {
22541        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
22542      }
22543    };
22544    if (json.has("synthesisType"))
22545      res.setSynthesisType(parseCodeableConcept(json.getAsJsonObject("synthesisType")));
22546    if (json.has("studyType"))
22547      res.setStudyType(parseCodeableConcept(json.getAsJsonObject("studyType")));
22548    if (json.has("population"))
22549      res.setPopulation(parseReference(json.getAsJsonObject("population")));
22550    if (json.has("exposure"))
22551      res.setExposure(parseReference(json.getAsJsonObject("exposure")));
22552    if (json.has("outcome"))
22553      res.setOutcome(parseReference(json.getAsJsonObject("outcome")));
22554    if (json.has("sampleSize"))
22555      res.setSampleSize(parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent(json.getAsJsonObject("sampleSize"), res));
22556    if (json.has("riskEstimate"))
22557      res.setRiskEstimate(parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent(json.getAsJsonObject("riskEstimate"), res));
22558    if (json.has("certainty")) {
22559      JsonArray array = json.getAsJsonArray("certainty");
22560      for (int i = 0; i < array.size(); i++) {
22561        res.getCertainty().add(parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(array.get(i).getAsJsonObject(), res));
22562      }
22563    };
22564  }
22565
22566  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent(JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
22567    RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent();
22568    parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentProperties(json, owner, res);
22569    return res;
22570  }
22571
22572  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentProperties(JsonObject json, RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent res) throws IOException, FHIRFormatError {
22573    parseBackboneElementProperties(json, res);
22574    if (json.has("description"))
22575      res.setDescriptionElement(parseString(json.get("description").getAsString()));
22576    if (json.has("_description"))
22577      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22578    if (json.has("numberOfStudies"))
22579      res.setNumberOfStudiesElement(parseInteger(json.get("numberOfStudies").getAsLong()));
22580    if (json.has("_numberOfStudies"))
22581      parseElementProperties(json.getAsJsonObject("_numberOfStudies"), res.getNumberOfStudiesElement());
22582    if (json.has("numberOfParticipants"))
22583      res.setNumberOfParticipantsElement(parseInteger(json.get("numberOfParticipants").getAsLong()));
22584    if (json.has("_numberOfParticipants"))
22585      parseElementProperties(json.getAsJsonObject("_numberOfParticipants"), res.getNumberOfParticipantsElement());
22586  }
22587
22588  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent(JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
22589    RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent();
22590    parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentProperties(json, owner, res);
22591    return res;
22592  }
22593
22594  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentProperties(JsonObject json, RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent res) throws IOException, FHIRFormatError {
22595    parseBackboneElementProperties(json, res);
22596    if (json.has("description"))
22597      res.setDescriptionElement(parseString(json.get("description").getAsString()));
22598    if (json.has("_description"))
22599      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22600    if (json.has("type"))
22601      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22602    if (json.has("value"))
22603      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
22604    if (json.has("_value"))
22605      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
22606    if (json.has("unitOfMeasure"))
22607      res.setUnitOfMeasure(parseCodeableConcept(json.getAsJsonObject("unitOfMeasure")));
22608    if (json.has("denominatorCount"))
22609      res.setDenominatorCountElement(parseInteger(json.get("denominatorCount").getAsLong()));
22610    if (json.has("_denominatorCount"))
22611      parseElementProperties(json.getAsJsonObject("_denominatorCount"), res.getDenominatorCountElement());
22612    if (json.has("numeratorCount"))
22613      res.setNumeratorCountElement(parseInteger(json.get("numeratorCount").getAsLong()));
22614    if (json.has("_numeratorCount"))
22615      parseElementProperties(json.getAsJsonObject("_numeratorCount"), res.getNumeratorCountElement());
22616    if (json.has("precisionEstimate")) {
22617      JsonArray array = json.getAsJsonArray("precisionEstimate");
22618      for (int i = 0; i < array.size(); i++) {
22619        res.getPrecisionEstimate().add(parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(array.get(i).getAsJsonObject(), owner));
22620      }
22621    };
22622  }
22623
22624  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
22625    RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent();
22626    parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentProperties(json, owner, res);
22627    return res;
22628  }
22629
22630  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentProperties(JsonObject json, RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent res) throws IOException, FHIRFormatError {
22631    parseBackboneElementProperties(json, res);
22632    if (json.has("type"))
22633      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22634    if (json.has("level"))
22635      res.setLevelElement(parseDecimal(json.get("level").getAsBigDecimal()));
22636    if (json.has("_level"))
22637      parseElementProperties(json.getAsJsonObject("_level"), res.getLevelElement());
22638    if (json.has("from"))
22639      res.setFromElement(parseDecimal(json.get("from").getAsBigDecimal()));
22640    if (json.has("_from"))
22641      parseElementProperties(json.getAsJsonObject("_from"), res.getFromElement());
22642    if (json.has("to"))
22643      res.setToElement(parseDecimal(json.get("to").getAsBigDecimal()));
22644    if (json.has("_to"))
22645      parseElementProperties(json.getAsJsonObject("_to"), res.getToElement());
22646  }
22647
22648  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
22649    RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent();
22650    parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentProperties(json, owner, res);
22651    return res;
22652  }
22653
22654  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentProperties(JsonObject json, RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent res) throws IOException, FHIRFormatError {
22655    parseBackboneElementProperties(json, res);
22656    if (json.has("rating")) {
22657      JsonArray array = json.getAsJsonArray("rating");
22658      for (int i = 0; i < array.size(); i++) {
22659        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22660      }
22661    };
22662    if (json.has("note")) {
22663      JsonArray array = json.getAsJsonArray("note");
22664      for (int i = 0; i < array.size(); i++) {
22665        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22666      }
22667    };
22668    if (json.has("certaintySubcomponent")) {
22669      JsonArray array = json.getAsJsonArray("certaintySubcomponent");
22670      for (int i = 0; i < array.size(); i++) {
22671        res.getCertaintySubcomponent().add(parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(array.get(i).getAsJsonObject(), owner));
22672      }
22673    };
22674  }
22675
22676  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
22677    RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent();
22678    parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentProperties(json, owner, res);
22679    return res;
22680  }
22681
22682  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentProperties(JsonObject json, RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent res) throws IOException, FHIRFormatError {
22683    parseBackboneElementProperties(json, res);
22684    if (json.has("type"))
22685      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22686    if (json.has("rating")) {
22687      JsonArray array = json.getAsJsonArray("rating");
22688      for (int i = 0; i < array.size(); i++) {
22689        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22690      }
22691    };
22692    if (json.has("note")) {
22693      JsonArray array = json.getAsJsonArray("note");
22694      for (int i = 0; i < array.size(); i++) {
22695        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22696      }
22697    };
22698  }
22699
22700  protected Schedule parseSchedule(JsonObject json) throws IOException, FHIRFormatError {
22701    Schedule res = new Schedule();
22702    parseScheduleProperties(json, res);
22703    return res;
22704  }
22705
22706  protected void parseScheduleProperties(JsonObject json, Schedule res) throws IOException, FHIRFormatError {
22707    parseDomainResourceProperties(json, res);
22708    if (json.has("identifier")) {
22709      JsonArray array = json.getAsJsonArray("identifier");
22710      for (int i = 0; i < array.size(); i++) {
22711        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22712      }
22713    };
22714    if (json.has("active"))
22715      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
22716    if (json.has("_active"))
22717      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
22718    if (json.has("serviceCategory")) {
22719      JsonArray array = json.getAsJsonArray("serviceCategory");
22720      for (int i = 0; i < array.size(); i++) {
22721        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22722      }
22723    };
22724    if (json.has("serviceType")) {
22725      JsonArray array = json.getAsJsonArray("serviceType");
22726      for (int i = 0; i < array.size(); i++) {
22727        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22728      }
22729    };
22730    if (json.has("specialty")) {
22731      JsonArray array = json.getAsJsonArray("specialty");
22732      for (int i = 0; i < array.size(); i++) {
22733        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22734      }
22735    };
22736    if (json.has("actor")) {
22737      JsonArray array = json.getAsJsonArray("actor");
22738      for (int i = 0; i < array.size(); i++) {
22739        res.getActor().add(parseReference(array.get(i).getAsJsonObject()));
22740      }
22741    };
22742    if (json.has("planningHorizon"))
22743      res.setPlanningHorizon(parsePeriod(json.getAsJsonObject("planningHorizon")));
22744    if (json.has("comment"))
22745      res.setCommentElement(parseString(json.get("comment").getAsString()));
22746    if (json.has("_comment"))
22747      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
22748  }
22749
22750  protected SearchParameter parseSearchParameter(JsonObject json) throws IOException, FHIRFormatError {
22751    SearchParameter res = new SearchParameter();
22752    parseSearchParameterProperties(json, res);
22753    return res;
22754  }
22755
22756  protected void parseSearchParameterProperties(JsonObject json, SearchParameter res) throws IOException, FHIRFormatError {
22757    parseDomainResourceProperties(json, res);
22758    if (json.has("url"))
22759      res.setUrlElement(parseUri(json.get("url").getAsString()));
22760    if (json.has("_url"))
22761      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
22762    if (json.has("version"))
22763      res.setVersionElement(parseString(json.get("version").getAsString()));
22764    if (json.has("_version"))
22765      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
22766    if (json.has("name"))
22767      res.setNameElement(parseString(json.get("name").getAsString()));
22768    if (json.has("_name"))
22769      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22770    if (json.has("derivedFrom"))
22771      res.setDerivedFromElement(parseCanonical(json.get("derivedFrom").getAsString()));
22772    if (json.has("_derivedFrom"))
22773      parseElementProperties(json.getAsJsonObject("_derivedFrom"), res.getDerivedFromElement());
22774    if (json.has("status"))
22775      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
22776    if (json.has("_status"))
22777      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22778    if (json.has("experimental"))
22779      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
22780    if (json.has("_experimental"))
22781      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
22782    if (json.has("date"))
22783      res.setDateElement(parseDateTime(json.get("date").getAsString()));
22784    if (json.has("_date"))
22785      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
22786    if (json.has("publisher"))
22787      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
22788    if (json.has("_publisher"))
22789      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
22790    if (json.has("contact")) {
22791      JsonArray array = json.getAsJsonArray("contact");
22792      for (int i = 0; i < array.size(); i++) {
22793        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
22794      }
22795    };
22796    if (json.has("description"))
22797      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22798    if (json.has("_description"))
22799      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22800    if (json.has("useContext")) {
22801      JsonArray array = json.getAsJsonArray("useContext");
22802      for (int i = 0; i < array.size(); i++) {
22803        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
22804      }
22805    };
22806    if (json.has("jurisdiction")) {
22807      JsonArray array = json.getAsJsonArray("jurisdiction");
22808      for (int i = 0; i < array.size(); i++) {
22809        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22810      }
22811    };
22812    if (json.has("purpose"))
22813      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
22814    if (json.has("_purpose"))
22815      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
22816    if (json.has("code"))
22817      res.setCodeElement(parseCode(json.get("code").getAsString()));
22818    if (json.has("_code"))
22819      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
22820    if (json.has("base")) {
22821      JsonArray array = json.getAsJsonArray("base");
22822      for (int i = 0; i < array.size(); i++) {
22823        res.getBase().add(parseCode(array.get(i).getAsString()));
22824      }
22825    };
22826    if (json.has("_base")) {
22827      JsonArray array = json.getAsJsonArray("_base");
22828      for (int i = 0; i < array.size(); i++) {
22829        if (i == res.getBase().size())
22830          res.getBase().add(parseCode(null));
22831        if (array.get(i) instanceof JsonObject) 
22832          parseElementProperties(array.get(i).getAsJsonObject(), res.getBase().get(i));
22833      }
22834    };
22835    if (json.has("type"))
22836      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
22837    if (json.has("_type"))
22838      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
22839    if (json.has("expression"))
22840      res.setExpressionElement(parseString(json.get("expression").getAsString()));
22841    if (json.has("_expression"))
22842      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
22843    if (json.has("xpath"))
22844      res.setXpathElement(parseString(json.get("xpath").getAsString()));
22845    if (json.has("_xpath"))
22846      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
22847    if (json.has("xpathUsage"))
22848      res.setXpathUsageElement(parseEnumeration(json.get("xpathUsage").getAsString(), SearchParameter.XPathUsageType.NULL, new SearchParameter.XPathUsageTypeEnumFactory()));
22849    if (json.has("_xpathUsage"))
22850      parseElementProperties(json.getAsJsonObject("_xpathUsage"), res.getXpathUsageElement());
22851    if (json.has("target")) {
22852      JsonArray array = json.getAsJsonArray("target");
22853      for (int i = 0; i < array.size(); i++) {
22854        res.getTarget().add(parseCode(array.get(i).getAsString()));
22855      }
22856    };
22857    if (json.has("_target")) {
22858      JsonArray array = json.getAsJsonArray("_target");
22859      for (int i = 0; i < array.size(); i++) {
22860        if (i == res.getTarget().size())
22861          res.getTarget().add(parseCode(null));
22862        if (array.get(i) instanceof JsonObject) 
22863          parseElementProperties(array.get(i).getAsJsonObject(), res.getTarget().get(i));
22864      }
22865    };
22866    if (json.has("multipleOr"))
22867      res.setMultipleOrElement(parseBoolean(json.get("multipleOr").getAsBoolean()));
22868    if (json.has("_multipleOr"))
22869      parseElementProperties(json.getAsJsonObject("_multipleOr"), res.getMultipleOrElement());
22870    if (json.has("multipleAnd"))
22871      res.setMultipleAndElement(parseBoolean(json.get("multipleAnd").getAsBoolean()));
22872    if (json.has("_multipleAnd"))
22873      parseElementProperties(json.getAsJsonObject("_multipleAnd"), res.getMultipleAndElement());
22874    if (json.has("comparator")) {
22875      JsonArray array = json.getAsJsonArray("comparator");
22876      for (int i = 0; i < array.size(); i++) {
22877        res.getComparator().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
22878      }
22879    };
22880    if (json.has("_comparator")) {
22881      JsonArray array = json.getAsJsonArray("_comparator");
22882      for (int i = 0; i < array.size(); i++) {
22883        if (i == res.getComparator().size())
22884          res.getComparator().add(parseEnumeration(null, SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
22885        if (array.get(i) instanceof JsonObject) 
22886          parseElementProperties(array.get(i).getAsJsonObject(), res.getComparator().get(i));
22887      }
22888    };
22889    if (json.has("modifier")) {
22890      JsonArray array = json.getAsJsonArray("modifier");
22891      for (int i = 0; i < array.size(); i++) {
22892        res.getModifier().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
22893      }
22894    };
22895    if (json.has("_modifier")) {
22896      JsonArray array = json.getAsJsonArray("_modifier");
22897      for (int i = 0; i < array.size(); i++) {
22898        if (i == res.getModifier().size())
22899          res.getModifier().add(parseEnumeration(null, SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
22900        if (array.get(i) instanceof JsonObject) 
22901          parseElementProperties(array.get(i).getAsJsonObject(), res.getModifier().get(i));
22902      }
22903    };
22904    if (json.has("chain")) {
22905      JsonArray array = json.getAsJsonArray("chain");
22906      for (int i = 0; i < array.size(); i++) {
22907        res.getChain().add(parseString(array.get(i).getAsString()));
22908      }
22909    };
22910    if (json.has("_chain")) {
22911      JsonArray array = json.getAsJsonArray("_chain");
22912      for (int i = 0; i < array.size(); i++) {
22913        if (i == res.getChain().size())
22914          res.getChain().add(parseString(null));
22915        if (array.get(i) instanceof JsonObject) 
22916          parseElementProperties(array.get(i).getAsJsonObject(), res.getChain().get(i));
22917      }
22918    };
22919    if (json.has("component")) {
22920      JsonArray array = json.getAsJsonArray("component");
22921      for (int i = 0; i < array.size(); i++) {
22922        res.getComponent().add(parseSearchParameterSearchParameterComponentComponent(array.get(i).getAsJsonObject(), res));
22923      }
22924    };
22925  }
22926
22927  protected SearchParameter.SearchParameterComponentComponent parseSearchParameterSearchParameterComponentComponent(JsonObject json, SearchParameter owner) throws IOException, FHIRFormatError {
22928    SearchParameter.SearchParameterComponentComponent res = new SearchParameter.SearchParameterComponentComponent();
22929    parseSearchParameterSearchParameterComponentComponentProperties(json, owner, res);
22930    return res;
22931  }
22932
22933  protected void parseSearchParameterSearchParameterComponentComponentProperties(JsonObject json, SearchParameter owner, SearchParameter.SearchParameterComponentComponent res) throws IOException, FHIRFormatError {
22934    parseBackboneElementProperties(json, res);
22935    if (json.has("definition"))
22936      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
22937    if (json.has("_definition"))
22938      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
22939    if (json.has("expression"))
22940      res.setExpressionElement(parseString(json.get("expression").getAsString()));
22941    if (json.has("_expression"))
22942      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
22943  }
22944
22945  protected ServiceRequest parseServiceRequest(JsonObject json) throws IOException, FHIRFormatError {
22946    ServiceRequest res = new ServiceRequest();
22947    parseServiceRequestProperties(json, res);
22948    return res;
22949  }
22950
22951  protected void parseServiceRequestProperties(JsonObject json, ServiceRequest res) throws IOException, FHIRFormatError {
22952    parseDomainResourceProperties(json, res);
22953    if (json.has("identifier")) {
22954      JsonArray array = json.getAsJsonArray("identifier");
22955      for (int i = 0; i < array.size(); i++) {
22956        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22957      }
22958    };
22959    if (json.has("instantiatesCanonical")) {
22960      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
22961      for (int i = 0; i < array.size(); i++) {
22962        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
22963      }
22964    };
22965    if (json.has("_instantiatesCanonical")) {
22966      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
22967      for (int i = 0; i < array.size(); i++) {
22968        if (i == res.getInstantiatesCanonical().size())
22969          res.getInstantiatesCanonical().add(parseCanonical(null));
22970        if (array.get(i) instanceof JsonObject) 
22971          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
22972      }
22973    };
22974    if (json.has("instantiatesUri")) {
22975      JsonArray array = json.getAsJsonArray("instantiatesUri");
22976      for (int i = 0; i < array.size(); i++) {
22977        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
22978      }
22979    };
22980    if (json.has("_instantiatesUri")) {
22981      JsonArray array = json.getAsJsonArray("_instantiatesUri");
22982      for (int i = 0; i < array.size(); i++) {
22983        if (i == res.getInstantiatesUri().size())
22984          res.getInstantiatesUri().add(parseUri(null));
22985        if (array.get(i) instanceof JsonObject) 
22986          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
22987      }
22988    };
22989    if (json.has("basedOn")) {
22990      JsonArray array = json.getAsJsonArray("basedOn");
22991      for (int i = 0; i < array.size(); i++) {
22992        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
22993      }
22994    };
22995    if (json.has("replaces")) {
22996      JsonArray array = json.getAsJsonArray("replaces");
22997      for (int i = 0; i < array.size(); i++) {
22998        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
22999      }
23000    };
23001    if (json.has("requisition"))
23002      res.setRequisition(parseIdentifier(json.getAsJsonObject("requisition")));
23003    if (json.has("status"))
23004      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ServiceRequest.ServiceRequestStatus.NULL, new ServiceRequest.ServiceRequestStatusEnumFactory()));
23005    if (json.has("_status"))
23006      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23007    if (json.has("intent"))
23008      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), ServiceRequest.ServiceRequestIntent.NULL, new ServiceRequest.ServiceRequestIntentEnumFactory()));
23009    if (json.has("_intent"))
23010      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
23011    if (json.has("category")) {
23012      JsonArray array = json.getAsJsonArray("category");
23013      for (int i = 0; i < array.size(); i++) {
23014        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23015      }
23016    };
23017    if (json.has("priority"))
23018      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ServiceRequest.ServiceRequestPriority.NULL, new ServiceRequest.ServiceRequestPriorityEnumFactory()));
23019    if (json.has("_priority"))
23020      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
23021    if (json.has("doNotPerform"))
23022      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
23023    if (json.has("_doNotPerform"))
23024      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
23025    if (json.has("code"))
23026      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
23027    if (json.has("orderDetail")) {
23028      JsonArray array = json.getAsJsonArray("orderDetail");
23029      for (int i = 0; i < array.size(); i++) {
23030        res.getOrderDetail().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23031      }
23032    };
23033    Type quantity = parseType("quantity", json);
23034    if (quantity != null)
23035      res.setQuantity(quantity);
23036    if (json.has("subject"))
23037      res.setSubject(parseReference(json.getAsJsonObject("subject")));
23038    if (json.has("encounter"))
23039      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
23040    Type occurrence = parseType("occurrence", json);
23041    if (occurrence != null)
23042      res.setOccurrence(occurrence);
23043    Type asNeeded = parseType("asNeeded", json);
23044    if (asNeeded != null)
23045      res.setAsNeeded(asNeeded);
23046    if (json.has("authoredOn"))
23047      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
23048    if (json.has("_authoredOn"))
23049      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
23050    if (json.has("requester"))
23051      res.setRequester(parseReference(json.getAsJsonObject("requester")));
23052    if (json.has("performerType"))
23053      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
23054    if (json.has("performer")) {
23055      JsonArray array = json.getAsJsonArray("performer");
23056      for (int i = 0; i < array.size(); i++) {
23057        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
23058      }
23059    };
23060    if (json.has("locationCode")) {
23061      JsonArray array = json.getAsJsonArray("locationCode");
23062      for (int i = 0; i < array.size(); i++) {
23063        res.getLocationCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23064      }
23065    };
23066    if (json.has("locationReference")) {
23067      JsonArray array = json.getAsJsonArray("locationReference");
23068      for (int i = 0; i < array.size(); i++) {
23069        res.getLocationReference().add(parseReference(array.get(i).getAsJsonObject()));
23070      }
23071    };
23072    if (json.has("reasonCode")) {
23073      JsonArray array = json.getAsJsonArray("reasonCode");
23074      for (int i = 0; i < array.size(); i++) {
23075        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23076      }
23077    };
23078    if (json.has("reasonReference")) {
23079      JsonArray array = json.getAsJsonArray("reasonReference");
23080      for (int i = 0; i < array.size(); i++) {
23081        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
23082      }
23083    };
23084    if (json.has("insurance")) {
23085      JsonArray array = json.getAsJsonArray("insurance");
23086      for (int i = 0; i < array.size(); i++) {
23087        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
23088      }
23089    };
23090    if (json.has("supportingInfo")) {
23091      JsonArray array = json.getAsJsonArray("supportingInfo");
23092      for (int i = 0; i < array.size(); i++) {
23093        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
23094      }
23095    };
23096    if (json.has("specimen")) {
23097      JsonArray array = json.getAsJsonArray("specimen");
23098      for (int i = 0; i < array.size(); i++) {
23099        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
23100      }
23101    };
23102    if (json.has("bodySite")) {
23103      JsonArray array = json.getAsJsonArray("bodySite");
23104      for (int i = 0; i < array.size(); i++) {
23105        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23106      }
23107    };
23108    if (json.has("note")) {
23109      JsonArray array = json.getAsJsonArray("note");
23110      for (int i = 0; i < array.size(); i++) {
23111        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
23112      }
23113    };
23114    if (json.has("patientInstruction"))
23115      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
23116    if (json.has("_patientInstruction"))
23117      parseElementProperties(json.getAsJsonObject("_patientInstruction"), res.getPatientInstructionElement());
23118    if (json.has("relevantHistory")) {
23119      JsonArray array = json.getAsJsonArray("relevantHistory");
23120      for (int i = 0; i < array.size(); i++) {
23121        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
23122      }
23123    };
23124  }
23125
23126  protected Slot parseSlot(JsonObject json) throws IOException, FHIRFormatError {
23127    Slot res = new Slot();
23128    parseSlotProperties(json, res);
23129    return res;
23130  }
23131
23132  protected void parseSlotProperties(JsonObject json, Slot res) throws IOException, FHIRFormatError {
23133    parseDomainResourceProperties(json, res);
23134    if (json.has("identifier")) {
23135      JsonArray array = json.getAsJsonArray("identifier");
23136      for (int i = 0; i < array.size(); i++) {
23137        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23138      }
23139    };
23140    if (json.has("serviceCategory")) {
23141      JsonArray array = json.getAsJsonArray("serviceCategory");
23142      for (int i = 0; i < array.size(); i++) {
23143        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23144      }
23145    };
23146    if (json.has("serviceType")) {
23147      JsonArray array = json.getAsJsonArray("serviceType");
23148      for (int i = 0; i < array.size(); i++) {
23149        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23150      }
23151    };
23152    if (json.has("specialty")) {
23153      JsonArray array = json.getAsJsonArray("specialty");
23154      for (int i = 0; i < array.size(); i++) {
23155        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23156      }
23157    };
23158    if (json.has("appointmentType"))
23159      res.setAppointmentType(parseCodeableConcept(json.getAsJsonObject("appointmentType")));
23160    if (json.has("schedule"))
23161      res.setSchedule(parseReference(json.getAsJsonObject("schedule")));
23162    if (json.has("status"))
23163      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Slot.SlotStatus.NULL, new Slot.SlotStatusEnumFactory()));
23164    if (json.has("_status"))
23165      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23166    if (json.has("start"))
23167      res.setStartElement(parseInstant(json.get("start").getAsString()));
23168    if (json.has("_start"))
23169      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
23170    if (json.has("end"))
23171      res.setEndElement(parseInstant(json.get("end").getAsString()));
23172    if (json.has("_end"))
23173      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
23174    if (json.has("overbooked"))
23175      res.setOverbookedElement(parseBoolean(json.get("overbooked").getAsBoolean()));
23176    if (json.has("_overbooked"))
23177      parseElementProperties(json.getAsJsonObject("_overbooked"), res.getOverbookedElement());
23178    if (json.has("comment"))
23179      res.setCommentElement(parseString(json.get("comment").getAsString()));
23180    if (json.has("_comment"))
23181      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
23182  }
23183
23184  protected Specimen parseSpecimen(JsonObject json) throws IOException, FHIRFormatError {
23185    Specimen res = new Specimen();
23186    parseSpecimenProperties(json, res);
23187    return res;
23188  }
23189
23190  protected void parseSpecimenProperties(JsonObject json, Specimen res) throws IOException, FHIRFormatError {
23191    parseDomainResourceProperties(json, res);
23192    if (json.has("identifier")) {
23193      JsonArray array = json.getAsJsonArray("identifier");
23194      for (int i = 0; i < array.size(); i++) {
23195        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23196      }
23197    };
23198    if (json.has("accessionIdentifier"))
23199      res.setAccessionIdentifier(parseIdentifier(json.getAsJsonObject("accessionIdentifier")));
23200    if (json.has("status"))
23201      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Specimen.SpecimenStatus.NULL, new Specimen.SpecimenStatusEnumFactory()));
23202    if (json.has("_status"))
23203      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23204    if (json.has("type"))
23205      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23206    if (json.has("subject"))
23207      res.setSubject(parseReference(json.getAsJsonObject("subject")));
23208    if (json.has("receivedTime"))
23209      res.setReceivedTimeElement(parseDateTime(json.get("receivedTime").getAsString()));
23210    if (json.has("_receivedTime"))
23211      parseElementProperties(json.getAsJsonObject("_receivedTime"), res.getReceivedTimeElement());
23212    if (json.has("parent")) {
23213      JsonArray array = json.getAsJsonArray("parent");
23214      for (int i = 0; i < array.size(); i++) {
23215        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
23216      }
23217    };
23218    if (json.has("request")) {
23219      JsonArray array = json.getAsJsonArray("request");
23220      for (int i = 0; i < array.size(); i++) {
23221        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
23222      }
23223    };
23224    if (json.has("collection"))
23225      res.setCollection(parseSpecimenSpecimenCollectionComponent(json.getAsJsonObject("collection"), res));
23226    if (json.has("processing")) {
23227      JsonArray array = json.getAsJsonArray("processing");
23228      for (int i = 0; i < array.size(); i++) {
23229        res.getProcessing().add(parseSpecimenSpecimenProcessingComponent(array.get(i).getAsJsonObject(), res));
23230      }
23231    };
23232    if (json.has("container")) {
23233      JsonArray array = json.getAsJsonArray("container");
23234      for (int i = 0; i < array.size(); i++) {
23235        res.getContainer().add(parseSpecimenSpecimenContainerComponent(array.get(i).getAsJsonObject(), res));
23236      }
23237    };
23238    if (json.has("condition")) {
23239      JsonArray array = json.getAsJsonArray("condition");
23240      for (int i = 0; i < array.size(); i++) {
23241        res.getCondition().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23242      }
23243    };
23244    if (json.has("note")) {
23245      JsonArray array = json.getAsJsonArray("note");
23246      for (int i = 0; i < array.size(); i++) {
23247        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
23248      }
23249    };
23250  }
23251
23252  protected Specimen.SpecimenCollectionComponent parseSpecimenSpecimenCollectionComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
23253    Specimen.SpecimenCollectionComponent res = new Specimen.SpecimenCollectionComponent();
23254    parseSpecimenSpecimenCollectionComponentProperties(json, owner, res);
23255    return res;
23256  }
23257
23258  protected void parseSpecimenSpecimenCollectionComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenCollectionComponent res) throws IOException, FHIRFormatError {
23259    parseBackboneElementProperties(json, res);
23260    if (json.has("collector"))
23261      res.setCollector(parseReference(json.getAsJsonObject("collector")));
23262    Type collected = parseType("collected", json);
23263    if (collected != null)
23264      res.setCollected(collected);
23265    if (json.has("duration"))
23266      res.setDuration(parseDuration(json.getAsJsonObject("duration")));
23267    if (json.has("quantity"))
23268      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
23269    if (json.has("method"))
23270      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
23271    if (json.has("bodySite"))
23272      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
23273    Type fastingStatus = parseType("fastingStatus", json);
23274    if (fastingStatus != null)
23275      res.setFastingStatus(fastingStatus);
23276  }
23277
23278  protected Specimen.SpecimenProcessingComponent parseSpecimenSpecimenProcessingComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
23279    Specimen.SpecimenProcessingComponent res = new Specimen.SpecimenProcessingComponent();
23280    parseSpecimenSpecimenProcessingComponentProperties(json, owner, res);
23281    return res;
23282  }
23283
23284  protected void parseSpecimenSpecimenProcessingComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenProcessingComponent res) throws IOException, FHIRFormatError {
23285    parseBackboneElementProperties(json, res);
23286    if (json.has("description"))
23287      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23288    if (json.has("_description"))
23289      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23290    if (json.has("procedure"))
23291      res.setProcedure(parseCodeableConcept(json.getAsJsonObject("procedure")));
23292    if (json.has("additive")) {
23293      JsonArray array = json.getAsJsonArray("additive");
23294      for (int i = 0; i < array.size(); i++) {
23295        res.getAdditive().add(parseReference(array.get(i).getAsJsonObject()));
23296      }
23297    };
23298    Type time = parseType("time", json);
23299    if (time != null)
23300      res.setTime(time);
23301  }
23302
23303  protected Specimen.SpecimenContainerComponent parseSpecimenSpecimenContainerComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
23304    Specimen.SpecimenContainerComponent res = new Specimen.SpecimenContainerComponent();
23305    parseSpecimenSpecimenContainerComponentProperties(json, owner, res);
23306    return res;
23307  }
23308
23309  protected void parseSpecimenSpecimenContainerComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenContainerComponent res) throws IOException, FHIRFormatError {
23310    parseBackboneElementProperties(json, res);
23311    if (json.has("identifier")) {
23312      JsonArray array = json.getAsJsonArray("identifier");
23313      for (int i = 0; i < array.size(); i++) {
23314        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23315      }
23316    };
23317    if (json.has("description"))
23318      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23319    if (json.has("_description"))
23320      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23321    if (json.has("type"))
23322      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23323    if (json.has("capacity"))
23324      res.setCapacity(parseQuantity(json.getAsJsonObject("capacity")));
23325    if (json.has("specimenQuantity"))
23326      res.setSpecimenQuantity(parseQuantity(json.getAsJsonObject("specimenQuantity")));
23327    Type additive = parseType("additive", json);
23328    if (additive != null)
23329      res.setAdditive(additive);
23330  }
23331
23332  protected SpecimenDefinition parseSpecimenDefinition(JsonObject json) throws IOException, FHIRFormatError {
23333    SpecimenDefinition res = new SpecimenDefinition();
23334    parseSpecimenDefinitionProperties(json, res);
23335    return res;
23336  }
23337
23338  protected void parseSpecimenDefinitionProperties(JsonObject json, SpecimenDefinition res) throws IOException, FHIRFormatError {
23339    parseDomainResourceProperties(json, res);
23340    if (json.has("identifier"))
23341      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
23342    if (json.has("typeCollected"))
23343      res.setTypeCollected(parseCodeableConcept(json.getAsJsonObject("typeCollected")));
23344    if (json.has("patientPreparation")) {
23345      JsonArray array = json.getAsJsonArray("patientPreparation");
23346      for (int i = 0; i < array.size(); i++) {
23347        res.getPatientPreparation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23348      }
23349    };
23350    if (json.has("timeAspect"))
23351      res.setTimeAspectElement(parseString(json.get("timeAspect").getAsString()));
23352    if (json.has("_timeAspect"))
23353      parseElementProperties(json.getAsJsonObject("_timeAspect"), res.getTimeAspectElement());
23354    if (json.has("collection")) {
23355      JsonArray array = json.getAsJsonArray("collection");
23356      for (int i = 0; i < array.size(); i++) {
23357        res.getCollection().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23358      }
23359    };
23360    if (json.has("typeTested")) {
23361      JsonArray array = json.getAsJsonArray("typeTested");
23362      for (int i = 0; i < array.size(); i++) {
23363        res.getTypeTested().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(array.get(i).getAsJsonObject(), res));
23364      }
23365    };
23366  }
23367
23368  protected SpecimenDefinition.SpecimenDefinitionTypeTestedComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
23369    SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedComponent();
23370    parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponentProperties(json, owner, res);
23371    return res;
23372  }
23373
23374  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res) throws IOException, FHIRFormatError {
23375    parseBackboneElementProperties(json, res);
23376    if (json.has("isDerived"))
23377      res.setIsDerivedElement(parseBoolean(json.get("isDerived").getAsBoolean()));
23378    if (json.has("_isDerived"))
23379      parseElementProperties(json.getAsJsonObject("_isDerived"), res.getIsDerivedElement());
23380    if (json.has("type"))
23381      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23382    if (json.has("preference"))
23383      res.setPreferenceElement(parseEnumeration(json.get("preference").getAsString(), SpecimenDefinition.SpecimenContainedPreference.NULL, new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory()));
23384    if (json.has("_preference"))
23385      parseElementProperties(json.getAsJsonObject("_preference"), res.getPreferenceElement());
23386    if (json.has("container"))
23387      res.setContainer(parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(json.getAsJsonObject("container"), owner));
23388    if (json.has("requirement"))
23389      res.setRequirementElement(parseString(json.get("requirement").getAsString()));
23390    if (json.has("_requirement"))
23391      parseElementProperties(json.getAsJsonObject("_requirement"), res.getRequirementElement());
23392    if (json.has("retentionTime"))
23393      res.setRetentionTime(parseDuration(json.getAsJsonObject("retentionTime")));
23394    if (json.has("rejectionCriterion")) {
23395      JsonArray array = json.getAsJsonArray("rejectionCriterion");
23396      for (int i = 0; i < array.size(); i++) {
23397        res.getRejectionCriterion().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23398      }
23399    };
23400    if (json.has("handling")) {
23401      JsonArray array = json.getAsJsonArray("handling");
23402      for (int i = 0; i < array.size(); i++) {
23403        res.getHandling().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(array.get(i).getAsJsonObject(), owner));
23404      }
23405    };
23406  }
23407
23408  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
23409    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent();
23410    parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentProperties(json, owner, res);
23411    return res;
23412  }
23413
23414  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res) throws IOException, FHIRFormatError {
23415    parseBackboneElementProperties(json, res);
23416    if (json.has("material"))
23417      res.setMaterial(parseCodeableConcept(json.getAsJsonObject("material")));
23418    if (json.has("type"))
23419      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23420    if (json.has("cap"))
23421      res.setCap(parseCodeableConcept(json.getAsJsonObject("cap")));
23422    if (json.has("description"))
23423      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23424    if (json.has("_description"))
23425      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23426    if (json.has("capacity"))
23427      res.setCapacity(parseQuantity(json.getAsJsonObject("capacity")));
23428    Type minimumVolume = parseType("minimumVolume", json);
23429    if (minimumVolume != null)
23430      res.setMinimumVolume(minimumVolume);
23431    if (json.has("additive")) {
23432      JsonArray array = json.getAsJsonArray("additive");
23433      for (int i = 0; i < array.size(); i++) {
23434        res.getAdditive().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(array.get(i).getAsJsonObject(), owner));
23435      }
23436    };
23437    if (json.has("preparation"))
23438      res.setPreparationElement(parseString(json.get("preparation").getAsString()));
23439    if (json.has("_preparation"))
23440      parseElementProperties(json.getAsJsonObject("_preparation"), res.getPreparationElement());
23441  }
23442
23443  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
23444    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent();
23445    parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(json, owner, res);
23446    return res;
23447  }
23448
23449  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res) throws IOException, FHIRFormatError {
23450    parseBackboneElementProperties(json, res);
23451    Type additive = parseType("additive", json);
23452    if (additive != null)
23453      res.setAdditive(additive);
23454  }
23455
23456  protected SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
23457    SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent();
23458    parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentProperties(json, owner, res);
23459    return res;
23460  }
23461
23462  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res) throws IOException, FHIRFormatError {
23463    parseBackboneElementProperties(json, res);
23464    if (json.has("temperatureQualifier"))
23465      res.setTemperatureQualifier(parseCodeableConcept(json.getAsJsonObject("temperatureQualifier")));
23466    if (json.has("temperatureRange"))
23467      res.setTemperatureRange(parseRange(json.getAsJsonObject("temperatureRange")));
23468    if (json.has("maxDuration"))
23469      res.setMaxDuration(parseDuration(json.getAsJsonObject("maxDuration")));
23470    if (json.has("instruction"))
23471      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
23472    if (json.has("_instruction"))
23473      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
23474  }
23475
23476  protected StructureDefinition parseStructureDefinition(JsonObject json) throws IOException, FHIRFormatError {
23477    StructureDefinition res = new StructureDefinition();
23478    parseStructureDefinitionProperties(json, res);
23479    return res;
23480  }
23481
23482  protected void parseStructureDefinitionProperties(JsonObject json, StructureDefinition res) throws IOException, FHIRFormatError {
23483    parseDomainResourceProperties(json, res);
23484    if (json.has("url"))
23485      res.setUrlElement(parseUri(json.get("url").getAsString()));
23486    if (json.has("_url"))
23487      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
23488    if (json.has("identifier")) {
23489      JsonArray array = json.getAsJsonArray("identifier");
23490      for (int i = 0; i < array.size(); i++) {
23491        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23492      }
23493    };
23494    if (json.has("version"))
23495      res.setVersionElement(parseString(json.get("version").getAsString()));
23496    if (json.has("_version"))
23497      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
23498    if (json.has("name"))
23499      res.setNameElement(parseString(json.get("name").getAsString()));
23500    if (json.has("_name"))
23501      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23502    if (json.has("title"))
23503      res.setTitleElement(parseString(json.get("title").getAsString()));
23504    if (json.has("_title"))
23505      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
23506    if (json.has("status"))
23507      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
23508    if (json.has("_status"))
23509      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23510    if (json.has("experimental"))
23511      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
23512    if (json.has("_experimental"))
23513      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
23514    if (json.has("date"))
23515      res.setDateElement(parseDateTime(json.get("date").getAsString()));
23516    if (json.has("_date"))
23517      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
23518    if (json.has("publisher"))
23519      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
23520    if (json.has("_publisher"))
23521      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
23522    if (json.has("contact")) {
23523      JsonArray array = json.getAsJsonArray("contact");
23524      for (int i = 0; i < array.size(); i++) {
23525        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
23526      }
23527    };
23528    if (json.has("description"))
23529      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
23530    if (json.has("_description"))
23531      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23532    if (json.has("useContext")) {
23533      JsonArray array = json.getAsJsonArray("useContext");
23534      for (int i = 0; i < array.size(); i++) {
23535        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
23536      }
23537    };
23538    if (json.has("jurisdiction")) {
23539      JsonArray array = json.getAsJsonArray("jurisdiction");
23540      for (int i = 0; i < array.size(); i++) {
23541        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23542      }
23543    };
23544    if (json.has("purpose"))
23545      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
23546    if (json.has("_purpose"))
23547      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
23548    if (json.has("copyright"))
23549      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
23550    if (json.has("_copyright"))
23551      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
23552    if (json.has("keyword")) {
23553      JsonArray array = json.getAsJsonArray("keyword");
23554      for (int i = 0; i < array.size(); i++) {
23555        res.getKeyword().add(parseCoding(array.get(i).getAsJsonObject()));
23556      }
23557    };
23558    if (json.has("fhirVersion"))
23559      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
23560    if (json.has("_fhirVersion"))
23561      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
23562    if (json.has("mapping")) {
23563      JsonArray array = json.getAsJsonArray("mapping");
23564      for (int i = 0; i < array.size(); i++) {
23565        res.getMapping().add(parseStructureDefinitionStructureDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
23566      }
23567    };
23568    if (json.has("kind"))
23569      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), StructureDefinition.StructureDefinitionKind.NULL, new StructureDefinition.StructureDefinitionKindEnumFactory()));
23570    if (json.has("_kind"))
23571      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
23572    if (json.has("abstract"))
23573      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
23574    if (json.has("_abstract"))
23575      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
23576    if (json.has("context")) {
23577      JsonArray array = json.getAsJsonArray("context");
23578      for (int i = 0; i < array.size(); i++) {
23579        res.getContext().add(parseStructureDefinitionStructureDefinitionContextComponent(array.get(i).getAsJsonObject(), res));
23580      }
23581    };
23582    if (json.has("contextInvariant")) {
23583      JsonArray array = json.getAsJsonArray("contextInvariant");
23584      for (int i = 0; i < array.size(); i++) {
23585        res.getContextInvariant().add(parseString(array.get(i).getAsString()));
23586      }
23587    };
23588    if (json.has("_contextInvariant")) {
23589      JsonArray array = json.getAsJsonArray("_contextInvariant");
23590      for (int i = 0; i < array.size(); i++) {
23591        if (i == res.getContextInvariant().size())
23592          res.getContextInvariant().add(parseString(null));
23593        if (array.get(i) instanceof JsonObject) 
23594          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextInvariant().get(i));
23595      }
23596    };
23597    if (json.has("type"))
23598      res.setTypeElement(parseUri(json.get("type").getAsString()));
23599    if (json.has("_type"))
23600      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
23601    if (json.has("baseDefinition"))
23602      res.setBaseDefinitionElement(parseCanonical(json.get("baseDefinition").getAsString()));
23603    if (json.has("_baseDefinition"))
23604      parseElementProperties(json.getAsJsonObject("_baseDefinition"), res.getBaseDefinitionElement());
23605    if (json.has("derivation"))
23606      res.setDerivationElement(parseEnumeration(json.get("derivation").getAsString(), StructureDefinition.TypeDerivationRule.NULL, new StructureDefinition.TypeDerivationRuleEnumFactory()));
23607    if (json.has("_derivation"))
23608      parseElementProperties(json.getAsJsonObject("_derivation"), res.getDerivationElement());
23609    if (json.has("snapshot"))
23610      res.setSnapshot(parseStructureDefinitionStructureDefinitionSnapshotComponent(json.getAsJsonObject("snapshot"), res));
23611    if (json.has("differential"))
23612      res.setDifferential(parseStructureDefinitionStructureDefinitionDifferentialComponent(json.getAsJsonObject("differential"), res));
23613  }
23614
23615  protected StructureDefinition.StructureDefinitionMappingComponent parseStructureDefinitionStructureDefinitionMappingComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
23616    StructureDefinition.StructureDefinitionMappingComponent res = new StructureDefinition.StructureDefinitionMappingComponent();
23617    parseStructureDefinitionStructureDefinitionMappingComponentProperties(json, owner, res);
23618    return res;
23619  }
23620
23621  protected void parseStructureDefinitionStructureDefinitionMappingComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionMappingComponent res) throws IOException, FHIRFormatError {
23622    parseBackboneElementProperties(json, res);
23623    if (json.has("identity"))
23624      res.setIdentityElement(parseId(json.get("identity").getAsString()));
23625    if (json.has("_identity"))
23626      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
23627    if (json.has("uri"))
23628      res.setUriElement(parseUri(json.get("uri").getAsString()));
23629    if (json.has("_uri"))
23630      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
23631    if (json.has("name"))
23632      res.setNameElement(parseString(json.get("name").getAsString()));
23633    if (json.has("_name"))
23634      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23635    if (json.has("comment"))
23636      res.setCommentElement(parseString(json.get("comment").getAsString()));
23637    if (json.has("_comment"))
23638      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
23639  }
23640
23641  protected StructureDefinition.StructureDefinitionContextComponent parseStructureDefinitionStructureDefinitionContextComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
23642    StructureDefinition.StructureDefinitionContextComponent res = new StructureDefinition.StructureDefinitionContextComponent();
23643    parseStructureDefinitionStructureDefinitionContextComponentProperties(json, owner, res);
23644    return res;
23645  }
23646
23647  protected void parseStructureDefinitionStructureDefinitionContextComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionContextComponent res) throws IOException, FHIRFormatError {
23648    parseBackboneElementProperties(json, res);
23649    if (json.has("type"))
23650      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), StructureDefinition.ExtensionContextType.NULL, new StructureDefinition.ExtensionContextTypeEnumFactory()));
23651    if (json.has("_type"))
23652      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
23653    if (json.has("expression"))
23654      res.setExpressionElement(parseString(json.get("expression").getAsString()));
23655    if (json.has("_expression"))
23656      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
23657  }
23658
23659  protected StructureDefinition.StructureDefinitionSnapshotComponent parseStructureDefinitionStructureDefinitionSnapshotComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
23660    StructureDefinition.StructureDefinitionSnapshotComponent res = new StructureDefinition.StructureDefinitionSnapshotComponent();
23661    parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(json, owner, res);
23662    return res;
23663  }
23664
23665  protected void parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionSnapshotComponent res) throws IOException, FHIRFormatError {
23666    parseBackboneElementProperties(json, res);
23667    if (json.has("element")) {
23668      JsonArray array = json.getAsJsonArray("element");
23669      for (int i = 0; i < array.size(); i++) {
23670        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
23671      }
23672    };
23673  }
23674
23675  protected StructureDefinition.StructureDefinitionDifferentialComponent parseStructureDefinitionStructureDefinitionDifferentialComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
23676    StructureDefinition.StructureDefinitionDifferentialComponent res = new StructureDefinition.StructureDefinitionDifferentialComponent();
23677    parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(json, owner, res);
23678    return res;
23679  }
23680
23681  protected void parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionDifferentialComponent res) throws IOException, FHIRFormatError {
23682    parseBackboneElementProperties(json, res);
23683    if (json.has("element")) {
23684      JsonArray array = json.getAsJsonArray("element");
23685      for (int i = 0; i < array.size(); i++) {
23686        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
23687      }
23688    };
23689  }
23690
23691  protected StructureMap parseStructureMap(JsonObject json) throws IOException, FHIRFormatError {
23692    StructureMap res = new StructureMap();
23693    parseStructureMapProperties(json, res);
23694    return res;
23695  }
23696
23697  protected void parseStructureMapProperties(JsonObject json, StructureMap res) throws IOException, FHIRFormatError {
23698    parseDomainResourceProperties(json, res);
23699    if (json.has("url"))
23700      res.setUrlElement(parseUri(json.get("url").getAsString()));
23701    if (json.has("_url"))
23702      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
23703    if (json.has("identifier")) {
23704      JsonArray array = json.getAsJsonArray("identifier");
23705      for (int i = 0; i < array.size(); i++) {
23706        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23707      }
23708    };
23709    if (json.has("version"))
23710      res.setVersionElement(parseString(json.get("version").getAsString()));
23711    if (json.has("_version"))
23712      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
23713    if (json.has("name"))
23714      res.setNameElement(parseString(json.get("name").getAsString()));
23715    if (json.has("_name"))
23716      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23717    if (json.has("title"))
23718      res.setTitleElement(parseString(json.get("title").getAsString()));
23719    if (json.has("_title"))
23720      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
23721    if (json.has("status"))
23722      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
23723    if (json.has("_status"))
23724      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23725    if (json.has("experimental"))
23726      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
23727    if (json.has("_experimental"))
23728      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
23729    if (json.has("date"))
23730      res.setDateElement(parseDateTime(json.get("date").getAsString()));
23731    if (json.has("_date"))
23732      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
23733    if (json.has("publisher"))
23734      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
23735    if (json.has("_publisher"))
23736      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
23737    if (json.has("contact")) {
23738      JsonArray array = json.getAsJsonArray("contact");
23739      for (int i = 0; i < array.size(); i++) {
23740        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
23741      }
23742    };
23743    if (json.has("description"))
23744      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
23745    if (json.has("_description"))
23746      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23747    if (json.has("useContext")) {
23748      JsonArray array = json.getAsJsonArray("useContext");
23749      for (int i = 0; i < array.size(); i++) {
23750        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
23751      }
23752    };
23753    if (json.has("jurisdiction")) {
23754      JsonArray array = json.getAsJsonArray("jurisdiction");
23755      for (int i = 0; i < array.size(); i++) {
23756        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23757      }
23758    };
23759    if (json.has("purpose"))
23760      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
23761    if (json.has("_purpose"))
23762      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
23763    if (json.has("copyright"))
23764      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
23765    if (json.has("_copyright"))
23766      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
23767    if (json.has("structure")) {
23768      JsonArray array = json.getAsJsonArray("structure");
23769      for (int i = 0; i < array.size(); i++) {
23770        res.getStructure().add(parseStructureMapStructureMapStructureComponent(array.get(i).getAsJsonObject(), res));
23771      }
23772    };
23773    if (json.has("import")) {
23774      JsonArray array = json.getAsJsonArray("import");
23775      for (int i = 0; i < array.size(); i++) {
23776        res.getImport().add(parseCanonical(array.get(i).getAsString()));
23777      }
23778    };
23779    if (json.has("_import")) {
23780      JsonArray array = json.getAsJsonArray("_import");
23781      for (int i = 0; i < array.size(); i++) {
23782        if (i == res.getImport().size())
23783          res.getImport().add(parseCanonical(null));
23784        if (array.get(i) instanceof JsonObject) 
23785          parseElementProperties(array.get(i).getAsJsonObject(), res.getImport().get(i));
23786      }
23787    };
23788    if (json.has("group")) {
23789      JsonArray array = json.getAsJsonArray("group");
23790      for (int i = 0; i < array.size(); i++) {
23791        res.getGroup().add(parseStructureMapStructureMapGroupComponent(array.get(i).getAsJsonObject(), res));
23792      }
23793    };
23794  }
23795
23796  protected StructureMap.StructureMapStructureComponent parseStructureMapStructureMapStructureComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
23797    StructureMap.StructureMapStructureComponent res = new StructureMap.StructureMapStructureComponent();
23798    parseStructureMapStructureMapStructureComponentProperties(json, owner, res);
23799    return res;
23800  }
23801
23802  protected void parseStructureMapStructureMapStructureComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapStructureComponent res) throws IOException, FHIRFormatError {
23803    parseBackboneElementProperties(json, res);
23804    if (json.has("url"))
23805      res.setUrlElement(parseCanonical(json.get("url").getAsString()));
23806    if (json.has("_url"))
23807      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
23808    if (json.has("mode"))
23809      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapModelMode.NULL, new StructureMap.StructureMapModelModeEnumFactory()));
23810    if (json.has("_mode"))
23811      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
23812    if (json.has("alias"))
23813      res.setAliasElement(parseString(json.get("alias").getAsString()));
23814    if (json.has("_alias"))
23815      parseElementProperties(json.getAsJsonObject("_alias"), res.getAliasElement());
23816    if (json.has("documentation"))
23817      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
23818    if (json.has("_documentation"))
23819      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
23820  }
23821
23822  protected StructureMap.StructureMapGroupComponent parseStructureMapStructureMapGroupComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
23823    StructureMap.StructureMapGroupComponent res = new StructureMap.StructureMapGroupComponent();
23824    parseStructureMapStructureMapGroupComponentProperties(json, owner, res);
23825    return res;
23826  }
23827
23828  protected void parseStructureMapStructureMapGroupComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupComponent res) throws IOException, FHIRFormatError {
23829    parseBackboneElementProperties(json, res);
23830    if (json.has("name"))
23831      res.setNameElement(parseId(json.get("name").getAsString()));
23832    if (json.has("_name"))
23833      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23834    if (json.has("extends"))
23835      res.setExtendsElement(parseId(json.get("extends").getAsString()));
23836    if (json.has("_extends"))
23837      parseElementProperties(json.getAsJsonObject("_extends"), res.getExtendsElement());
23838    if (json.has("typeMode"))
23839      res.setTypeModeElement(parseEnumeration(json.get("typeMode").getAsString(), StructureMap.StructureMapGroupTypeMode.NULL, new StructureMap.StructureMapGroupTypeModeEnumFactory()));
23840    if (json.has("_typeMode"))
23841      parseElementProperties(json.getAsJsonObject("_typeMode"), res.getTypeModeElement());
23842    if (json.has("documentation"))
23843      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
23844    if (json.has("_documentation"))
23845      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
23846    if (json.has("input")) {
23847      JsonArray array = json.getAsJsonArray("input");
23848      for (int i = 0; i < array.size(); i++) {
23849        res.getInput().add(parseStructureMapStructureMapGroupInputComponent(array.get(i).getAsJsonObject(), owner));
23850      }
23851    };
23852    if (json.has("rule")) {
23853      JsonArray array = json.getAsJsonArray("rule");
23854      for (int i = 0; i < array.size(); i++) {
23855        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
23856      }
23857    };
23858  }
23859
23860  protected StructureMap.StructureMapGroupInputComponent parseStructureMapStructureMapGroupInputComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
23861    StructureMap.StructureMapGroupInputComponent res = new StructureMap.StructureMapGroupInputComponent();
23862    parseStructureMapStructureMapGroupInputComponentProperties(json, owner, res);
23863    return res;
23864  }
23865
23866  protected void parseStructureMapStructureMapGroupInputComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupInputComponent res) throws IOException, FHIRFormatError {
23867    parseBackboneElementProperties(json, res);
23868    if (json.has("name"))
23869      res.setNameElement(parseId(json.get("name").getAsString()));
23870    if (json.has("_name"))
23871      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23872    if (json.has("type"))
23873      res.setTypeElement(parseString(json.get("type").getAsString()));
23874    if (json.has("_type"))
23875      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
23876    if (json.has("mode"))
23877      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapInputMode.NULL, new StructureMap.StructureMapInputModeEnumFactory()));
23878    if (json.has("_mode"))
23879      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
23880    if (json.has("documentation"))
23881      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
23882    if (json.has("_documentation"))
23883      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
23884  }
23885
23886  protected StructureMap.StructureMapGroupRuleComponent parseStructureMapStructureMapGroupRuleComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
23887    StructureMap.StructureMapGroupRuleComponent res = new StructureMap.StructureMapGroupRuleComponent();
23888    parseStructureMapStructureMapGroupRuleComponentProperties(json, owner, res);
23889    return res;
23890  }
23891
23892  protected void parseStructureMapStructureMapGroupRuleComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleComponent res) throws IOException, FHIRFormatError {
23893    parseBackboneElementProperties(json, res);
23894    if (json.has("name"))
23895      res.setNameElement(parseId(json.get("name").getAsString()));
23896    if (json.has("_name"))
23897      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23898    if (json.has("source")) {
23899      JsonArray array = json.getAsJsonArray("source");
23900      for (int i = 0; i < array.size(); i++) {
23901        res.getSource().add(parseStructureMapStructureMapGroupRuleSourceComponent(array.get(i).getAsJsonObject(), owner));
23902      }
23903    };
23904    if (json.has("target")) {
23905      JsonArray array = json.getAsJsonArray("target");
23906      for (int i = 0; i < array.size(); i++) {
23907        res.getTarget().add(parseStructureMapStructureMapGroupRuleTargetComponent(array.get(i).getAsJsonObject(), owner));
23908      }
23909    };
23910    if (json.has("rule")) {
23911      JsonArray array = json.getAsJsonArray("rule");
23912      for (int i = 0; i < array.size(); i++) {
23913        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
23914      }
23915    };
23916    if (json.has("dependent")) {
23917      JsonArray array = json.getAsJsonArray("dependent");
23918      for (int i = 0; i < array.size(); i++) {
23919        res.getDependent().add(parseStructureMapStructureMapGroupRuleDependentComponent(array.get(i).getAsJsonObject(), owner));
23920      }
23921    };
23922    if (json.has("documentation"))
23923      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
23924    if (json.has("_documentation"))
23925      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
23926  }
23927
23928  protected StructureMap.StructureMapGroupRuleSourceComponent parseStructureMapStructureMapGroupRuleSourceComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
23929    StructureMap.StructureMapGroupRuleSourceComponent res = new StructureMap.StructureMapGroupRuleSourceComponent();
23930    parseStructureMapStructureMapGroupRuleSourceComponentProperties(json, owner, res);
23931    return res;
23932  }
23933
23934  protected void parseStructureMapStructureMapGroupRuleSourceComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleSourceComponent res) throws IOException, FHIRFormatError {
23935    parseBackboneElementProperties(json, res);
23936    if (json.has("context"))
23937      res.setContextElement(parseId(json.get("context").getAsString()));
23938    if (json.has("_context"))
23939      parseElementProperties(json.getAsJsonObject("_context"), res.getContextElement());
23940    if (json.has("min"))
23941      res.setMinElement(parseInteger(json.get("min").getAsLong()));
23942    if (json.has("_min"))
23943      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
23944    if (json.has("max"))
23945      res.setMaxElement(parseString(json.get("max").getAsString()));
23946    if (json.has("_max"))
23947      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
23948    if (json.has("type"))
23949      res.setTypeElement(parseString(json.get("type").getAsString()));
23950    if (json.has("_type"))
23951      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
23952    Type defaultValue = parseType("defaultValue", json);
23953    if (defaultValue != null)
23954      res.setDefaultValue(defaultValue);
23955    if (json.has("element"))
23956      res.setElementElement(parseString(json.get("element").getAsString()));
23957    if (json.has("_element"))
23958      parseElementProperties(json.getAsJsonObject("_element"), res.getElementElement());
23959    if (json.has("listMode"))
23960      res.setListModeElement(parseEnumeration(json.get("listMode").getAsString(), StructureMap.StructureMapSourceListMode.NULL, new StructureMap.StructureMapSourceListModeEnumFactory()));
23961    if (json.has("_listMode"))
23962      parseElementProperties(json.getAsJsonObject("_listMode"), res.getListModeElement());
23963    if (json.has("variable"))
23964      res.setVariableElement(parseId(json.get("variable").getAsString()));
23965    if (json.has("_variable"))
23966      parseElementProperties(json.getAsJsonObject("_variable"), res.getVariableElement());
23967    if (json.has("condition"))
23968      res.setConditionElement(parseString(json.get("condition").getAsString()));
23969    if (json.has("_condition"))
23970      parseElementProperties(json.getAsJsonObject("_condition"), res.getConditionElement());
23971    if (json.has("check"))
23972      res.setCheckElement(parseString(json.get("check").getAsString()));
23973    if (json.has("_check"))
23974      parseElementProperties(json.getAsJsonObject("_check"), res.getCheckElement());
23975    if (json.has("logMessage"))
23976      res.setLogMessageElement(parseString(json.get("logMessage").getAsString()));
23977    if (json.has("_logMessage"))
23978      parseElementProperties(json.getAsJsonObject("_logMessage"), res.getLogMessageElement());
23979  }
23980
23981  protected StructureMap.StructureMapGroupRuleTargetComponent parseStructureMapStructureMapGroupRuleTargetComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
23982    StructureMap.StructureMapGroupRuleTargetComponent res = new StructureMap.StructureMapGroupRuleTargetComponent();
23983    parseStructureMapStructureMapGroupRuleTargetComponentProperties(json, owner, res);
23984    return res;
23985  }
23986
23987  protected void parseStructureMapStructureMapGroupRuleTargetComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleTargetComponent res) throws IOException, FHIRFormatError {
23988    parseBackboneElementProperties(json, res);
23989    if (json.has("context"))
23990      res.setContextElement(parseId(json.get("context").getAsString()));
23991    if (json.has("_context"))
23992      parseElementProperties(json.getAsJsonObject("_context"), res.getContextElement());
23993    if (json.has("contextType"))
23994      res.setContextTypeElement(parseEnumeration(json.get("contextType").getAsString(), StructureMap.StructureMapContextType.NULL, new StructureMap.StructureMapContextTypeEnumFactory()));
23995    if (json.has("_contextType"))
23996      parseElementProperties(json.getAsJsonObject("_contextType"), res.getContextTypeElement());
23997    if (json.has("element"))
23998      res.setElementElement(parseString(json.get("element").getAsString()));
23999    if (json.has("_element"))
24000      parseElementProperties(json.getAsJsonObject("_element"), res.getElementElement());
24001    if (json.has("variable"))
24002      res.setVariableElement(parseId(json.get("variable").getAsString()));
24003    if (json.has("_variable"))
24004      parseElementProperties(json.getAsJsonObject("_variable"), res.getVariableElement());
24005    if (json.has("listMode")) {
24006      JsonArray array = json.getAsJsonArray("listMode");
24007      for (int i = 0; i < array.size(); i++) {
24008        res.getListMode().add(parseEnumeration(array.get(i).getAsString(), StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
24009      }
24010    };
24011    if (json.has("_listMode")) {
24012      JsonArray array = json.getAsJsonArray("_listMode");
24013      for (int i = 0; i < array.size(); i++) {
24014        if (i == res.getListMode().size())
24015          res.getListMode().add(parseEnumeration(null, StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
24016        if (array.get(i) instanceof JsonObject) 
24017          parseElementProperties(array.get(i).getAsJsonObject(), res.getListMode().get(i));
24018      }
24019    };
24020    if (json.has("listRuleId"))
24021      res.setListRuleIdElement(parseId(json.get("listRuleId").getAsString()));
24022    if (json.has("_listRuleId"))
24023      parseElementProperties(json.getAsJsonObject("_listRuleId"), res.getListRuleIdElement());
24024    if (json.has("transform"))
24025      res.setTransformElement(parseEnumeration(json.get("transform").getAsString(), StructureMap.StructureMapTransform.NULL, new StructureMap.StructureMapTransformEnumFactory()));
24026    if (json.has("_transform"))
24027      parseElementProperties(json.getAsJsonObject("_transform"), res.getTransformElement());
24028    if (json.has("parameter")) {
24029      JsonArray array = json.getAsJsonArray("parameter");
24030      for (int i = 0; i < array.size(); i++) {
24031        res.getParameter().add(parseStructureMapStructureMapGroupRuleTargetParameterComponent(array.get(i).getAsJsonObject(), owner));
24032      }
24033    };
24034  }
24035
24036  protected StructureMap.StructureMapGroupRuleTargetParameterComponent parseStructureMapStructureMapGroupRuleTargetParameterComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24037    StructureMap.StructureMapGroupRuleTargetParameterComponent res = new StructureMap.StructureMapGroupRuleTargetParameterComponent();
24038    parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(json, owner, res);
24039    return res;
24040  }
24041
24042  protected void parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleTargetParameterComponent res) throws IOException, FHIRFormatError {
24043    parseBackboneElementProperties(json, res);
24044    Type value = parseType("value", json);
24045    if (value != null)
24046      res.setValue(value);
24047  }
24048
24049  protected StructureMap.StructureMapGroupRuleDependentComponent parseStructureMapStructureMapGroupRuleDependentComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24050    StructureMap.StructureMapGroupRuleDependentComponent res = new StructureMap.StructureMapGroupRuleDependentComponent();
24051    parseStructureMapStructureMapGroupRuleDependentComponentProperties(json, owner, res);
24052    return res;
24053  }
24054
24055  protected void parseStructureMapStructureMapGroupRuleDependentComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleDependentComponent res) throws IOException, FHIRFormatError {
24056    parseBackboneElementProperties(json, res);
24057    if (json.has("name"))
24058      res.setNameElement(parseId(json.get("name").getAsString()));
24059    if (json.has("_name"))
24060      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24061    if (json.has("variable")) {
24062      JsonArray array = json.getAsJsonArray("variable");
24063      for (int i = 0; i < array.size(); i++) {
24064        res.getVariable().add(parseString(array.get(i).getAsString()));
24065      }
24066    };
24067    if (json.has("_variable")) {
24068      JsonArray array = json.getAsJsonArray("_variable");
24069      for (int i = 0; i < array.size(); i++) {
24070        if (i == res.getVariable().size())
24071          res.getVariable().add(parseString(null));
24072        if (array.get(i) instanceof JsonObject) 
24073          parseElementProperties(array.get(i).getAsJsonObject(), res.getVariable().get(i));
24074      }
24075    };
24076  }
24077
24078  protected Subscription parseSubscription(JsonObject json) throws IOException, FHIRFormatError {
24079    Subscription res = new Subscription();
24080    parseSubscriptionProperties(json, res);
24081    return res;
24082  }
24083
24084  protected void parseSubscriptionProperties(JsonObject json, Subscription res) throws IOException, FHIRFormatError {
24085    parseDomainResourceProperties(json, res);
24086    if (json.has("status"))
24087      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Subscription.SubscriptionStatus.NULL, new Subscription.SubscriptionStatusEnumFactory()));
24088    if (json.has("_status"))
24089      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
24090    if (json.has("contact")) {
24091      JsonArray array = json.getAsJsonArray("contact");
24092      for (int i = 0; i < array.size(); i++) {
24093        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
24094      }
24095    };
24096    if (json.has("end"))
24097      res.setEndElement(parseInstant(json.get("end").getAsString()));
24098    if (json.has("_end"))
24099      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
24100    if (json.has("reason"))
24101      res.setReasonElement(parseString(json.get("reason").getAsString()));
24102    if (json.has("_reason"))
24103      parseElementProperties(json.getAsJsonObject("_reason"), res.getReasonElement());
24104    if (json.has("criteria"))
24105      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
24106    if (json.has("_criteria"))
24107      parseElementProperties(json.getAsJsonObject("_criteria"), res.getCriteriaElement());
24108    if (json.has("error"))
24109      res.setErrorElement(parseString(json.get("error").getAsString()));
24110    if (json.has("_error"))
24111      parseElementProperties(json.getAsJsonObject("_error"), res.getErrorElement());
24112    if (json.has("channel"))
24113      res.setChannel(parseSubscriptionSubscriptionChannelComponent(json.getAsJsonObject("channel"), res));
24114  }
24115
24116  protected Subscription.SubscriptionChannelComponent parseSubscriptionSubscriptionChannelComponent(JsonObject json, Subscription owner) throws IOException, FHIRFormatError {
24117    Subscription.SubscriptionChannelComponent res = new Subscription.SubscriptionChannelComponent();
24118    parseSubscriptionSubscriptionChannelComponentProperties(json, owner, res);
24119    return res;
24120  }
24121
24122  protected void parseSubscriptionSubscriptionChannelComponentProperties(JsonObject json, Subscription owner, Subscription.SubscriptionChannelComponent res) throws IOException, FHIRFormatError {
24123    parseBackboneElementProperties(json, res);
24124    if (json.has("type"))
24125      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Subscription.SubscriptionChannelType.NULL, new Subscription.SubscriptionChannelTypeEnumFactory()));
24126    if (json.has("_type"))
24127      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
24128    if (json.has("endpoint"))
24129      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
24130    if (json.has("_endpoint"))
24131      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
24132    if (json.has("payload"))
24133      res.setPayloadElement(parseCode(json.get("payload").getAsString()));
24134    if (json.has("_payload"))
24135      parseElementProperties(json.getAsJsonObject("_payload"), res.getPayloadElement());
24136    if (json.has("header")) {
24137      JsonArray array = json.getAsJsonArray("header");
24138      for (int i = 0; i < array.size(); i++) {
24139        res.getHeader().add(parseString(array.get(i).getAsString()));
24140      }
24141    };
24142    if (json.has("_header")) {
24143      JsonArray array = json.getAsJsonArray("_header");
24144      for (int i = 0; i < array.size(); i++) {
24145        if (i == res.getHeader().size())
24146          res.getHeader().add(parseString(null));
24147        if (array.get(i) instanceof JsonObject) 
24148          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
24149      }
24150    };
24151  }
24152
24153  protected Substance parseSubstance(JsonObject json) throws IOException, FHIRFormatError {
24154    Substance res = new Substance();
24155    parseSubstanceProperties(json, res);
24156    return res;
24157  }
24158
24159  protected void parseSubstanceProperties(JsonObject json, Substance res) throws IOException, FHIRFormatError {
24160    parseDomainResourceProperties(json, res);
24161    if (json.has("identifier")) {
24162      JsonArray array = json.getAsJsonArray("identifier");
24163      for (int i = 0; i < array.size(); i++) {
24164        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24165      }
24166    };
24167    if (json.has("status"))
24168      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Substance.FHIRSubstanceStatus.NULL, new Substance.FHIRSubstanceStatusEnumFactory()));
24169    if (json.has("_status"))
24170      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
24171    if (json.has("category")) {
24172      JsonArray array = json.getAsJsonArray("category");
24173      for (int i = 0; i < array.size(); i++) {
24174        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24175      }
24176    };
24177    if (json.has("code"))
24178      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
24179    if (json.has("description"))
24180      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24181    if (json.has("_description"))
24182      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
24183    if (json.has("instance")) {
24184      JsonArray array = json.getAsJsonArray("instance");
24185      for (int i = 0; i < array.size(); i++) {
24186        res.getInstance().add(parseSubstanceSubstanceInstanceComponent(array.get(i).getAsJsonObject(), res));
24187      }
24188    };
24189    if (json.has("ingredient")) {
24190      JsonArray array = json.getAsJsonArray("ingredient");
24191      for (int i = 0; i < array.size(); i++) {
24192        res.getIngredient().add(parseSubstanceSubstanceIngredientComponent(array.get(i).getAsJsonObject(), res));
24193      }
24194    };
24195  }
24196
24197  protected Substance.SubstanceInstanceComponent parseSubstanceSubstanceInstanceComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
24198    Substance.SubstanceInstanceComponent res = new Substance.SubstanceInstanceComponent();
24199    parseSubstanceSubstanceInstanceComponentProperties(json, owner, res);
24200    return res;
24201  }
24202
24203  protected void parseSubstanceSubstanceInstanceComponentProperties(JsonObject json, Substance owner, Substance.SubstanceInstanceComponent res) throws IOException, FHIRFormatError {
24204    parseBackboneElementProperties(json, res);
24205    if (json.has("identifier"))
24206      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
24207    if (json.has("expiry"))
24208      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
24209    if (json.has("_expiry"))
24210      parseElementProperties(json.getAsJsonObject("_expiry"), res.getExpiryElement());
24211    if (json.has("quantity"))
24212      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
24213  }
24214
24215  protected Substance.SubstanceIngredientComponent parseSubstanceSubstanceIngredientComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
24216    Substance.SubstanceIngredientComponent res = new Substance.SubstanceIngredientComponent();
24217    parseSubstanceSubstanceIngredientComponentProperties(json, owner, res);
24218    return res;
24219  }
24220
24221  protected void parseSubstanceSubstanceIngredientComponentProperties(JsonObject json, Substance owner, Substance.SubstanceIngredientComponent res) throws IOException, FHIRFormatError {
24222    parseBackboneElementProperties(json, res);
24223    if (json.has("quantity"))
24224      res.setQuantity(parseRatio(json.getAsJsonObject("quantity")));
24225    Type substance = parseType("substance", json);
24226    if (substance != null)
24227      res.setSubstance(substance);
24228  }
24229
24230  protected SubstanceNucleicAcid parseSubstanceNucleicAcid(JsonObject json) throws IOException, FHIRFormatError {
24231    SubstanceNucleicAcid res = new SubstanceNucleicAcid();
24232    parseSubstanceNucleicAcidProperties(json, res);
24233    return res;
24234  }
24235
24236  protected void parseSubstanceNucleicAcidProperties(JsonObject json, SubstanceNucleicAcid res) throws IOException, FHIRFormatError {
24237    parseDomainResourceProperties(json, res);
24238    if (json.has("sequenceType"))
24239      res.setSequenceType(parseCodeableConcept(json.getAsJsonObject("sequenceType")));
24240    if (json.has("numberOfSubunits"))
24241      res.setNumberOfSubunitsElement(parseInteger(json.get("numberOfSubunits").getAsLong()));
24242    if (json.has("_numberOfSubunits"))
24243      parseElementProperties(json.getAsJsonObject("_numberOfSubunits"), res.getNumberOfSubunitsElement());
24244    if (json.has("areaOfHybridisation"))
24245      res.setAreaOfHybridisationElement(parseString(json.get("areaOfHybridisation").getAsString()));
24246    if (json.has("_areaOfHybridisation"))
24247      parseElementProperties(json.getAsJsonObject("_areaOfHybridisation"), res.getAreaOfHybridisationElement());
24248    if (json.has("oligoNucleotideType"))
24249      res.setOligoNucleotideType(parseCodeableConcept(json.getAsJsonObject("oligoNucleotideType")));
24250    if (json.has("subunit")) {
24251      JsonArray array = json.getAsJsonArray("subunit");
24252      for (int i = 0; i < array.size(); i++) {
24253        res.getSubunit().add(parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(array.get(i).getAsJsonObject(), res));
24254      }
24255    };
24256  }
24257
24258  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(JsonObject json, SubstanceNucleicAcid owner) throws IOException, FHIRFormatError {
24259    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent();
24260    parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentProperties(json, owner, res);
24261    return res;
24262  }
24263
24264  protected void parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentProperties(JsonObject json, SubstanceNucleicAcid owner, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent res) throws IOException, FHIRFormatError {
24265    parseBackboneElementProperties(json, res);
24266    if (json.has("subunit"))
24267      res.setSubunitElement(parseInteger(json.get("subunit").getAsLong()));
24268    if (json.has("_subunit"))
24269      parseElementProperties(json.getAsJsonObject("_subunit"), res.getSubunitElement());
24270    if (json.has("sequence"))
24271      res.setSequenceElement(parseString(json.get("sequence").getAsString()));
24272    if (json.has("_sequence"))
24273      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
24274    if (json.has("length"))
24275      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
24276    if (json.has("_length"))
24277      parseElementProperties(json.getAsJsonObject("_length"), res.getLengthElement());
24278    if (json.has("sequenceAttachment"))
24279      res.setSequenceAttachment(parseAttachment(json.getAsJsonObject("sequenceAttachment")));
24280    if (json.has("fivePrime"))
24281      res.setFivePrime(parseCodeableConcept(json.getAsJsonObject("fivePrime")));
24282    if (json.has("threePrime"))
24283      res.setThreePrime(parseCodeableConcept(json.getAsJsonObject("threePrime")));
24284    if (json.has("linkage")) {
24285      JsonArray array = json.getAsJsonArray("linkage");
24286      for (int i = 0; i < array.size(); i++) {
24287        res.getLinkage().add(parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(array.get(i).getAsJsonObject(), owner));
24288      }
24289    };
24290    if (json.has("sugar")) {
24291      JsonArray array = json.getAsJsonArray("sugar");
24292      for (int i = 0; i < array.size(); i++) {
24293        res.getSugar().add(parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(array.get(i).getAsJsonObject(), owner));
24294      }
24295    };
24296  }
24297
24298  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(JsonObject json, SubstanceNucleicAcid owner) throws IOException, FHIRFormatError {
24299    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent();
24300    parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentProperties(json, owner, res);
24301    return res;
24302  }
24303
24304  protected void parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentProperties(JsonObject json, SubstanceNucleicAcid owner, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent res) throws IOException, FHIRFormatError {
24305    parseBackboneElementProperties(json, res);
24306    if (json.has("connectivity"))
24307      res.setConnectivityElement(parseString(json.get("connectivity").getAsString()));
24308    if (json.has("_connectivity"))
24309      parseElementProperties(json.getAsJsonObject("_connectivity"), res.getConnectivityElement());
24310    if (json.has("identifier"))
24311      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
24312    if (json.has("name"))
24313      res.setNameElement(parseString(json.get("name").getAsString()));
24314    if (json.has("_name"))
24315      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24316    if (json.has("residueSite"))
24317      res.setResidueSiteElement(parseString(json.get("residueSite").getAsString()));
24318    if (json.has("_residueSite"))
24319      parseElementProperties(json.getAsJsonObject("_residueSite"), res.getResidueSiteElement());
24320  }
24321
24322  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(JsonObject json, SubstanceNucleicAcid owner) throws IOException, FHIRFormatError {
24323    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent();
24324    parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentProperties(json, owner, res);
24325    return res;
24326  }
24327
24328  protected void parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentProperties(JsonObject json, SubstanceNucleicAcid owner, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent res) throws IOException, FHIRFormatError {
24329    parseBackboneElementProperties(json, res);
24330    if (json.has("identifier"))
24331      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
24332    if (json.has("name"))
24333      res.setNameElement(parseString(json.get("name").getAsString()));
24334    if (json.has("_name"))
24335      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24336    if (json.has("residueSite"))
24337      res.setResidueSiteElement(parseString(json.get("residueSite").getAsString()));
24338    if (json.has("_residueSite"))
24339      parseElementProperties(json.getAsJsonObject("_residueSite"), res.getResidueSiteElement());
24340  }
24341
24342  protected SubstancePolymer parseSubstancePolymer(JsonObject json) throws IOException, FHIRFormatError {
24343    SubstancePolymer res = new SubstancePolymer();
24344    parseSubstancePolymerProperties(json, res);
24345    return res;
24346  }
24347
24348  protected void parseSubstancePolymerProperties(JsonObject json, SubstancePolymer res) throws IOException, FHIRFormatError {
24349    parseDomainResourceProperties(json, res);
24350    if (json.has("class"))
24351      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
24352    if (json.has("geometry"))
24353      res.setGeometry(parseCodeableConcept(json.getAsJsonObject("geometry")));
24354    if (json.has("copolymerConnectivity")) {
24355      JsonArray array = json.getAsJsonArray("copolymerConnectivity");
24356      for (int i = 0; i < array.size(); i++) {
24357        res.getCopolymerConnectivity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24358      }
24359    };
24360    if (json.has("modification")) {
24361      JsonArray array = json.getAsJsonArray("modification");
24362      for (int i = 0; i < array.size(); i++) {
24363        res.getModification().add(parseString(array.get(i).getAsString()));
24364      }
24365    };
24366    if (json.has("_modification")) {
24367      JsonArray array = json.getAsJsonArray("_modification");
24368      for (int i = 0; i < array.size(); i++) {
24369        if (i == res.getModification().size())
24370          res.getModification().add(parseString(null));
24371        if (array.get(i) instanceof JsonObject) 
24372          parseElementProperties(array.get(i).getAsJsonObject(), res.getModification().get(i));
24373      }
24374    };
24375    if (json.has("monomerSet")) {
24376      JsonArray array = json.getAsJsonArray("monomerSet");
24377      for (int i = 0; i < array.size(); i++) {
24378        res.getMonomerSet().add(parseSubstancePolymerSubstancePolymerMonomerSetComponent(array.get(i).getAsJsonObject(), res));
24379      }
24380    };
24381    if (json.has("repeat")) {
24382      JsonArray array = json.getAsJsonArray("repeat");
24383      for (int i = 0; i < array.size(); i++) {
24384        res.getRepeat().add(parseSubstancePolymerSubstancePolymerRepeatComponent(array.get(i).getAsJsonObject(), res));
24385      }
24386    };
24387  }
24388
24389  protected SubstancePolymer.SubstancePolymerMonomerSetComponent parseSubstancePolymerSubstancePolymerMonomerSetComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
24390    SubstancePolymer.SubstancePolymerMonomerSetComponent res = new SubstancePolymer.SubstancePolymerMonomerSetComponent();
24391    parseSubstancePolymerSubstancePolymerMonomerSetComponentProperties(json, owner, res);
24392    return res;
24393  }
24394
24395  protected void parseSubstancePolymerSubstancePolymerMonomerSetComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerMonomerSetComponent res) throws IOException, FHIRFormatError {
24396    parseBackboneElementProperties(json, res);
24397    if (json.has("ratioType"))
24398      res.setRatioType(parseCodeableConcept(json.getAsJsonObject("ratioType")));
24399    if (json.has("startingMaterial")) {
24400      JsonArray array = json.getAsJsonArray("startingMaterial");
24401      for (int i = 0; i < array.size(); i++) {
24402        res.getStartingMaterial().add(parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(array.get(i).getAsJsonObject(), owner));
24403      }
24404    };
24405  }
24406
24407  protected SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
24408    SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res = new SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent();
24409    parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentProperties(json, owner, res);
24410    return res;
24411  }
24412
24413  protected void parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res) throws IOException, FHIRFormatError {
24414    parseBackboneElementProperties(json, res);
24415    if (json.has("material"))
24416      res.setMaterial(parseCodeableConcept(json.getAsJsonObject("material")));
24417    if (json.has("type"))
24418      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
24419    if (json.has("isDefining"))
24420      res.setIsDefiningElement(parseBoolean(json.get("isDefining").getAsBoolean()));
24421    if (json.has("_isDefining"))
24422      parseElementProperties(json.getAsJsonObject("_isDefining"), res.getIsDefiningElement());
24423    if (json.has("amount"))
24424      res.setAmount(parseSubstanceAmount(json.getAsJsonObject("amount")));
24425  }
24426
24427  protected SubstancePolymer.SubstancePolymerRepeatComponent parseSubstancePolymerSubstancePolymerRepeatComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
24428    SubstancePolymer.SubstancePolymerRepeatComponent res = new SubstancePolymer.SubstancePolymerRepeatComponent();
24429    parseSubstancePolymerSubstancePolymerRepeatComponentProperties(json, owner, res);
24430    return res;
24431  }
24432
24433  protected void parseSubstancePolymerSubstancePolymerRepeatComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatComponent res) throws IOException, FHIRFormatError {
24434    parseBackboneElementProperties(json, res);
24435    if (json.has("numberOfUnits"))
24436      res.setNumberOfUnitsElement(parseInteger(json.get("numberOfUnits").getAsLong()));
24437    if (json.has("_numberOfUnits"))
24438      parseElementProperties(json.getAsJsonObject("_numberOfUnits"), res.getNumberOfUnitsElement());
24439    if (json.has("averageMolecularFormula"))
24440      res.setAverageMolecularFormulaElement(parseString(json.get("averageMolecularFormula").getAsString()));
24441    if (json.has("_averageMolecularFormula"))
24442      parseElementProperties(json.getAsJsonObject("_averageMolecularFormula"), res.getAverageMolecularFormulaElement());
24443    if (json.has("repeatUnitAmountType"))
24444      res.setRepeatUnitAmountType(parseCodeableConcept(json.getAsJsonObject("repeatUnitAmountType")));
24445    if (json.has("repeatUnit")) {
24446      JsonArray array = json.getAsJsonArray("repeatUnit");
24447      for (int i = 0; i < array.size(); i++) {
24448        res.getRepeatUnit().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(array.get(i).getAsJsonObject(), owner));
24449      }
24450    };
24451  }
24452
24453  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
24454    SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent();
24455    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentProperties(json, owner, res);
24456    return res;
24457  }
24458
24459  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res) throws IOException, FHIRFormatError {
24460    parseBackboneElementProperties(json, res);
24461    if (json.has("orientationOfPolymerisation"))
24462      res.setOrientationOfPolymerisation(parseCodeableConcept(json.getAsJsonObject("orientationOfPolymerisation")));
24463    if (json.has("repeatUnit"))
24464      res.setRepeatUnitElement(parseString(json.get("repeatUnit").getAsString()));
24465    if (json.has("_repeatUnit"))
24466      parseElementProperties(json.getAsJsonObject("_repeatUnit"), res.getRepeatUnitElement());
24467    if (json.has("amount"))
24468      res.setAmount(parseSubstanceAmount(json.getAsJsonObject("amount")));
24469    if (json.has("degreeOfPolymerisation")) {
24470      JsonArray array = json.getAsJsonArray("degreeOfPolymerisation");
24471      for (int i = 0; i < array.size(); i++) {
24472        res.getDegreeOfPolymerisation().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(array.get(i).getAsJsonObject(), owner));
24473      }
24474    };
24475    if (json.has("structuralRepresentation")) {
24476      JsonArray array = json.getAsJsonArray("structuralRepresentation");
24477      for (int i = 0; i < array.size(); i++) {
24478        res.getStructuralRepresentation().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(array.get(i).getAsJsonObject(), owner));
24479      }
24480    };
24481  }
24482
24483  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
24484    SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent();
24485    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(json, owner, res);
24486    return res;
24487  }
24488
24489  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res) throws IOException, FHIRFormatError {
24490    parseBackboneElementProperties(json, res);
24491    if (json.has("degree"))
24492      res.setDegree(parseCodeableConcept(json.getAsJsonObject("degree")));
24493    if (json.has("amount"))
24494      res.setAmount(parseSubstanceAmount(json.getAsJsonObject("amount")));
24495  }
24496
24497  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
24498    SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent();
24499    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(json, owner, res);
24500    return res;
24501  }
24502
24503  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res) throws IOException, FHIRFormatError {
24504    parseBackboneElementProperties(json, res);
24505    if (json.has("type"))
24506      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
24507    if (json.has("representation"))
24508      res.setRepresentationElement(parseString(json.get("representation").getAsString()));
24509    if (json.has("_representation"))
24510      parseElementProperties(json.getAsJsonObject("_representation"), res.getRepresentationElement());
24511    if (json.has("attachment"))
24512      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
24513  }
24514
24515  protected SubstanceProtein parseSubstanceProtein(JsonObject json) throws IOException, FHIRFormatError {
24516    SubstanceProtein res = new SubstanceProtein();
24517    parseSubstanceProteinProperties(json, res);
24518    return res;
24519  }
24520
24521  protected void parseSubstanceProteinProperties(JsonObject json, SubstanceProtein res) throws IOException, FHIRFormatError {
24522    parseDomainResourceProperties(json, res);
24523    if (json.has("sequenceType"))
24524      res.setSequenceType(parseCodeableConcept(json.getAsJsonObject("sequenceType")));
24525    if (json.has("numberOfSubunits"))
24526      res.setNumberOfSubunitsElement(parseInteger(json.get("numberOfSubunits").getAsLong()));
24527    if (json.has("_numberOfSubunits"))
24528      parseElementProperties(json.getAsJsonObject("_numberOfSubunits"), res.getNumberOfSubunitsElement());
24529    if (json.has("disulfideLinkage")) {
24530      JsonArray array = json.getAsJsonArray("disulfideLinkage");
24531      for (int i = 0; i < array.size(); i++) {
24532        res.getDisulfideLinkage().add(parseString(array.get(i).getAsString()));
24533      }
24534    };
24535    if (json.has("_disulfideLinkage")) {
24536      JsonArray array = json.getAsJsonArray("_disulfideLinkage");
24537      for (int i = 0; i < array.size(); i++) {
24538        if (i == res.getDisulfideLinkage().size())
24539          res.getDisulfideLinkage().add(parseString(null));
24540        if (array.get(i) instanceof JsonObject) 
24541          parseElementProperties(array.get(i).getAsJsonObject(), res.getDisulfideLinkage().get(i));
24542      }
24543    };
24544    if (json.has("subunit")) {
24545      JsonArray array = json.getAsJsonArray("subunit");
24546      for (int i = 0; i < array.size(); i++) {
24547        res.getSubunit().add(parseSubstanceProteinSubstanceProteinSubunitComponent(array.get(i).getAsJsonObject(), res));
24548      }
24549    };
24550  }
24551
24552  protected SubstanceProtein.SubstanceProteinSubunitComponent parseSubstanceProteinSubstanceProteinSubunitComponent(JsonObject json, SubstanceProtein owner) throws IOException, FHIRFormatError {
24553    SubstanceProtein.SubstanceProteinSubunitComponent res = new SubstanceProtein.SubstanceProteinSubunitComponent();
24554    parseSubstanceProteinSubstanceProteinSubunitComponentProperties(json, owner, res);
24555    return res;
24556  }
24557
24558  protected void parseSubstanceProteinSubstanceProteinSubunitComponentProperties(JsonObject json, SubstanceProtein owner, SubstanceProtein.SubstanceProteinSubunitComponent res) throws IOException, FHIRFormatError {
24559    parseBackboneElementProperties(json, res);
24560    if (json.has("subunit"))
24561      res.setSubunitElement(parseInteger(json.get("subunit").getAsLong()));
24562    if (json.has("_subunit"))
24563      parseElementProperties(json.getAsJsonObject("_subunit"), res.getSubunitElement());
24564    if (json.has("sequence"))
24565      res.setSequenceElement(parseString(json.get("sequence").getAsString()));
24566    if (json.has("_sequence"))
24567      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
24568    if (json.has("length"))
24569      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
24570    if (json.has("_length"))
24571      parseElementProperties(json.getAsJsonObject("_length"), res.getLengthElement());
24572    if (json.has("sequenceAttachment"))
24573      res.setSequenceAttachment(parseAttachment(json.getAsJsonObject("sequenceAttachment")));
24574    if (json.has("nTerminalModificationId"))
24575      res.setNTerminalModificationId(parseIdentifier(json.getAsJsonObject("nTerminalModificationId")));
24576    if (json.has("nTerminalModification"))
24577      res.setNTerminalModificationElement(parseString(json.get("nTerminalModification").getAsString()));
24578    if (json.has("_nTerminalModification"))
24579      parseElementProperties(json.getAsJsonObject("_nTerminalModification"), res.getNTerminalModificationElement());
24580    if (json.has("cTerminalModificationId"))
24581      res.setCTerminalModificationId(parseIdentifier(json.getAsJsonObject("cTerminalModificationId")));
24582    if (json.has("cTerminalModification"))
24583      res.setCTerminalModificationElement(parseString(json.get("cTerminalModification").getAsString()));
24584    if (json.has("_cTerminalModification"))
24585      parseElementProperties(json.getAsJsonObject("_cTerminalModification"), res.getCTerminalModificationElement());
24586  }
24587
24588  protected SubstanceReferenceInformation parseSubstanceReferenceInformation(JsonObject json) throws IOException, FHIRFormatError {
24589    SubstanceReferenceInformation res = new SubstanceReferenceInformation();
24590    parseSubstanceReferenceInformationProperties(json, res);
24591    return res;
24592  }
24593
24594  protected void parseSubstanceReferenceInformationProperties(JsonObject json, SubstanceReferenceInformation res) throws IOException, FHIRFormatError {
24595    parseDomainResourceProperties(json, res);
24596    if (json.has("comment"))
24597      res.setCommentElement(parseString(json.get("comment").getAsString()));
24598    if (json.has("_comment"))
24599      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
24600    if (json.has("gene")) {
24601      JsonArray array = json.getAsJsonArray("gene");
24602      for (int i = 0; i < array.size(); i++) {
24603        res.getGene().add(parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(array.get(i).getAsJsonObject(), res));
24604      }
24605    };
24606    if (json.has("geneElement")) {
24607      JsonArray array = json.getAsJsonArray("geneElement");
24608      for (int i = 0; i < array.size(); i++) {
24609        res.getGeneElement().add(parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(array.get(i).getAsJsonObject(), res));
24610      }
24611    };
24612    if (json.has("classification")) {
24613      JsonArray array = json.getAsJsonArray("classification");
24614      for (int i = 0; i < array.size(); i++) {
24615        res.getClassification().add(parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(array.get(i).getAsJsonObject(), res));
24616      }
24617    };
24618    if (json.has("target")) {
24619      JsonArray array = json.getAsJsonArray("target");
24620      for (int i = 0; i < array.size(); i++) {
24621        res.getTarget().add(parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(array.get(i).getAsJsonObject(), res));
24622      }
24623    };
24624  }
24625
24626  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
24627    SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent();
24628    parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentProperties(json, owner, res);
24629    return res;
24630  }
24631
24632  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res) throws IOException, FHIRFormatError {
24633    parseBackboneElementProperties(json, res);
24634    if (json.has("geneSequenceOrigin"))
24635      res.setGeneSequenceOrigin(parseCodeableConcept(json.getAsJsonObject("geneSequenceOrigin")));
24636    if (json.has("gene"))
24637      res.setGene(parseCodeableConcept(json.getAsJsonObject("gene")));
24638    if (json.has("source")) {
24639      JsonArray array = json.getAsJsonArray("source");
24640      for (int i = 0; i < array.size(); i++) {
24641        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
24642      }
24643    };
24644  }
24645
24646  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
24647    SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent();
24648    parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentProperties(json, owner, res);
24649    return res;
24650  }
24651
24652  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res) throws IOException, FHIRFormatError {
24653    parseBackboneElementProperties(json, res);
24654    if (json.has("type"))
24655      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
24656    if (json.has("element"))
24657      res.setElement(parseIdentifier(json.getAsJsonObject("element")));
24658    if (json.has("source")) {
24659      JsonArray array = json.getAsJsonArray("source");
24660      for (int i = 0; i < array.size(); i++) {
24661        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
24662      }
24663    };
24664  }
24665
24666  protected SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
24667    SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent();
24668    parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentProperties(json, owner, res);
24669    return res;
24670  }
24671
24672  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent res) throws IOException, FHIRFormatError {
24673    parseBackboneElementProperties(json, res);
24674    if (json.has("domain"))
24675      res.setDomain(parseCodeableConcept(json.getAsJsonObject("domain")));
24676    if (json.has("classification"))
24677      res.setClassification(parseCodeableConcept(json.getAsJsonObject("classification")));
24678    if (json.has("subtype")) {
24679      JsonArray array = json.getAsJsonArray("subtype");
24680      for (int i = 0; i < array.size(); i++) {
24681        res.getSubtype().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24682      }
24683    };
24684    if (json.has("source")) {
24685      JsonArray array = json.getAsJsonArray("source");
24686      for (int i = 0; i < array.size(); i++) {
24687        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
24688      }
24689    };
24690  }
24691
24692  protected SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
24693    SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent();
24694    parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentProperties(json, owner, res);
24695    return res;
24696  }
24697
24698  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res) throws IOException, FHIRFormatError {
24699    parseBackboneElementProperties(json, res);
24700    if (json.has("target"))
24701      res.setTarget(parseIdentifier(json.getAsJsonObject("target")));
24702    if (json.has("type"))
24703      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
24704    if (json.has("interaction"))
24705      res.setInteraction(parseCodeableConcept(json.getAsJsonObject("interaction")));
24706    if (json.has("organism"))
24707      res.setOrganism(parseCodeableConcept(json.getAsJsonObject("organism")));
24708    if (json.has("organismType"))
24709      res.setOrganismType(parseCodeableConcept(json.getAsJsonObject("organismType")));
24710    Type amount = parseType("amount", json);
24711    if (amount != null)
24712      res.setAmount(amount);
24713    if (json.has("amountType"))
24714      res.setAmountType(parseCodeableConcept(json.getAsJsonObject("amountType")));
24715    if (json.has("source")) {
24716      JsonArray array = json.getAsJsonArray("source");
24717      for (int i = 0; i < array.size(); i++) {
24718        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
24719      }
24720    };
24721  }
24722
24723  protected SubstanceSourceMaterial parseSubstanceSourceMaterial(JsonObject json) throws IOException, FHIRFormatError {
24724    SubstanceSourceMaterial res = new SubstanceSourceMaterial();
24725    parseSubstanceSourceMaterialProperties(json, res);
24726    return res;
24727  }
24728
24729  protected void parseSubstanceSourceMaterialProperties(JsonObject json, SubstanceSourceMaterial res) throws IOException, FHIRFormatError {
24730    parseDomainResourceProperties(json, res);
24731    if (json.has("sourceMaterialClass"))
24732      res.setSourceMaterialClass(parseCodeableConcept(json.getAsJsonObject("sourceMaterialClass")));
24733    if (json.has("sourceMaterialType"))
24734      res.setSourceMaterialType(parseCodeableConcept(json.getAsJsonObject("sourceMaterialType")));
24735    if (json.has("sourceMaterialState"))
24736      res.setSourceMaterialState(parseCodeableConcept(json.getAsJsonObject("sourceMaterialState")));
24737    if (json.has("organismId"))
24738      res.setOrganismId(parseIdentifier(json.getAsJsonObject("organismId")));
24739    if (json.has("organismName"))
24740      res.setOrganismNameElement(parseString(json.get("organismName").getAsString()));
24741    if (json.has("_organismName"))
24742      parseElementProperties(json.getAsJsonObject("_organismName"), res.getOrganismNameElement());
24743    if (json.has("parentSubstanceId")) {
24744      JsonArray array = json.getAsJsonArray("parentSubstanceId");
24745      for (int i = 0; i < array.size(); i++) {
24746        res.getParentSubstanceId().add(parseIdentifier(array.get(i).getAsJsonObject()));
24747      }
24748    };
24749    if (json.has("parentSubstanceName")) {
24750      JsonArray array = json.getAsJsonArray("parentSubstanceName");
24751      for (int i = 0; i < array.size(); i++) {
24752        res.getParentSubstanceName().add(parseString(array.get(i).getAsString()));
24753      }
24754    };
24755    if (json.has("_parentSubstanceName")) {
24756      JsonArray array = json.getAsJsonArray("_parentSubstanceName");
24757      for (int i = 0; i < array.size(); i++) {
24758        if (i == res.getParentSubstanceName().size())
24759          res.getParentSubstanceName().add(parseString(null));
24760        if (array.get(i) instanceof JsonObject) 
24761          parseElementProperties(array.get(i).getAsJsonObject(), res.getParentSubstanceName().get(i));
24762      }
24763    };
24764    if (json.has("countryOfOrigin")) {
24765      JsonArray array = json.getAsJsonArray("countryOfOrigin");
24766      for (int i = 0; i < array.size(); i++) {
24767        res.getCountryOfOrigin().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24768      }
24769    };
24770    if (json.has("geographicalLocation")) {
24771      JsonArray array = json.getAsJsonArray("geographicalLocation");
24772      for (int i = 0; i < array.size(); i++) {
24773        res.getGeographicalLocation().add(parseString(array.get(i).getAsString()));
24774      }
24775    };
24776    if (json.has("_geographicalLocation")) {
24777      JsonArray array = json.getAsJsonArray("_geographicalLocation");
24778      for (int i = 0; i < array.size(); i++) {
24779        if (i == res.getGeographicalLocation().size())
24780          res.getGeographicalLocation().add(parseString(null));
24781        if (array.get(i) instanceof JsonObject) 
24782          parseElementProperties(array.get(i).getAsJsonObject(), res.getGeographicalLocation().get(i));
24783      }
24784    };
24785    if (json.has("developmentStage"))
24786      res.setDevelopmentStage(parseCodeableConcept(json.getAsJsonObject("developmentStage")));
24787    if (json.has("fractionDescription")) {
24788      JsonArray array = json.getAsJsonArray("fractionDescription");
24789      for (int i = 0; i < array.size(); i++) {
24790        res.getFractionDescription().add(parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(array.get(i).getAsJsonObject(), res));
24791      }
24792    };
24793    if (json.has("organism"))
24794      res.setOrganism(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent(json.getAsJsonObject("organism"), res));
24795    if (json.has("partDescription")) {
24796      JsonArray array = json.getAsJsonArray("partDescription");
24797      for (int i = 0; i < array.size(); i++) {
24798        res.getPartDescription().add(parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(array.get(i).getAsJsonObject(), res));
24799      }
24800    };
24801  }
24802
24803  protected SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
24804    SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent();
24805    parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentProperties(json, owner, res);
24806    return res;
24807  }
24808
24809  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent res) throws IOException, FHIRFormatError {
24810    parseBackboneElementProperties(json, res);
24811    if (json.has("fraction"))
24812      res.setFractionElement(parseString(json.get("fraction").getAsString()));
24813    if (json.has("_fraction"))
24814      parseElementProperties(json.getAsJsonObject("_fraction"), res.getFractionElement());
24815    if (json.has("materialType"))
24816      res.setMaterialType(parseCodeableConcept(json.getAsJsonObject("materialType")));
24817  }
24818
24819  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
24820    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent();
24821    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentProperties(json, owner, res);
24822    return res;
24823  }
24824
24825  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent res) throws IOException, FHIRFormatError {
24826    parseBackboneElementProperties(json, res);
24827    if (json.has("family"))
24828      res.setFamily(parseCodeableConcept(json.getAsJsonObject("family")));
24829    if (json.has("genus"))
24830      res.setGenus(parseCodeableConcept(json.getAsJsonObject("genus")));
24831    if (json.has("species"))
24832      res.setSpecies(parseCodeableConcept(json.getAsJsonObject("species")));
24833    if (json.has("intraspecificType"))
24834      res.setIntraspecificType(parseCodeableConcept(json.getAsJsonObject("intraspecificType")));
24835    if (json.has("intraspecificDescription"))
24836      res.setIntraspecificDescriptionElement(parseString(json.get("intraspecificDescription").getAsString()));
24837    if (json.has("_intraspecificDescription"))
24838      parseElementProperties(json.getAsJsonObject("_intraspecificDescription"), res.getIntraspecificDescriptionElement());
24839    if (json.has("author")) {
24840      JsonArray array = json.getAsJsonArray("author");
24841      for (int i = 0; i < array.size(); i++) {
24842        res.getAuthor().add(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(array.get(i).getAsJsonObject(), owner));
24843      }
24844    };
24845    if (json.has("hybrid"))
24846      res.setHybrid(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent(json.getAsJsonObject("hybrid"), owner));
24847    if (json.has("organismGeneral"))
24848      res.setOrganismGeneral(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent(json.getAsJsonObject("organismGeneral"), owner));
24849  }
24850
24851  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
24852    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent();
24853    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentProperties(json, owner, res);
24854    return res;
24855  }
24856
24857  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent res) throws IOException, FHIRFormatError {
24858    parseBackboneElementProperties(json, res);
24859    if (json.has("authorType"))
24860      res.setAuthorType(parseCodeableConcept(json.getAsJsonObject("authorType")));
24861    if (json.has("authorDescription"))
24862      res.setAuthorDescriptionElement(parseString(json.get("authorDescription").getAsString()));
24863    if (json.has("_authorDescription"))
24864      parseElementProperties(json.getAsJsonObject("_authorDescription"), res.getAuthorDescriptionElement());
24865  }
24866
24867  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
24868    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent();
24869    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentProperties(json, owner, res);
24870    return res;
24871  }
24872
24873  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent res) throws IOException, FHIRFormatError {
24874    parseBackboneElementProperties(json, res);
24875    if (json.has("maternalOrganismId"))
24876      res.setMaternalOrganismIdElement(parseString(json.get("maternalOrganismId").getAsString()));
24877    if (json.has("_maternalOrganismId"))
24878      parseElementProperties(json.getAsJsonObject("_maternalOrganismId"), res.getMaternalOrganismIdElement());
24879    if (json.has("maternalOrganismName"))
24880      res.setMaternalOrganismNameElement(parseString(json.get("maternalOrganismName").getAsString()));
24881    if (json.has("_maternalOrganismName"))
24882      parseElementProperties(json.getAsJsonObject("_maternalOrganismName"), res.getMaternalOrganismNameElement());
24883    if (json.has("paternalOrganismId"))
24884      res.setPaternalOrganismIdElement(parseString(json.get("paternalOrganismId").getAsString()));
24885    if (json.has("_paternalOrganismId"))
24886      parseElementProperties(json.getAsJsonObject("_paternalOrganismId"), res.getPaternalOrganismIdElement());
24887    if (json.has("paternalOrganismName"))
24888      res.setPaternalOrganismNameElement(parseString(json.get("paternalOrganismName").getAsString()));
24889    if (json.has("_paternalOrganismName"))
24890      parseElementProperties(json.getAsJsonObject("_paternalOrganismName"), res.getPaternalOrganismNameElement());
24891    if (json.has("hybridType"))
24892      res.setHybridType(parseCodeableConcept(json.getAsJsonObject("hybridType")));
24893  }
24894
24895  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
24896    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent();
24897    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(json, owner, res);
24898    return res;
24899  }
24900
24901  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent res) throws IOException, FHIRFormatError {
24902    parseBackboneElementProperties(json, res);
24903    if (json.has("kingdom"))
24904      res.setKingdom(parseCodeableConcept(json.getAsJsonObject("kingdom")));
24905    if (json.has("phylum"))
24906      res.setPhylum(parseCodeableConcept(json.getAsJsonObject("phylum")));
24907    if (json.has("class"))
24908      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
24909    if (json.has("order"))
24910      res.setOrder(parseCodeableConcept(json.getAsJsonObject("order")));
24911  }
24912
24913  protected SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
24914    SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent();
24915    parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentProperties(json, owner, res);
24916    return res;
24917  }
24918
24919  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent res) throws IOException, FHIRFormatError {
24920    parseBackboneElementProperties(json, res);
24921    if (json.has("part"))
24922      res.setPart(parseCodeableConcept(json.getAsJsonObject("part")));
24923    if (json.has("partLocation"))
24924      res.setPartLocation(parseCodeableConcept(json.getAsJsonObject("partLocation")));
24925  }
24926
24927  protected SubstanceSpecification parseSubstanceSpecification(JsonObject json) throws IOException, FHIRFormatError {
24928    SubstanceSpecification res = new SubstanceSpecification();
24929    parseSubstanceSpecificationProperties(json, res);
24930    return res;
24931  }
24932
24933  protected void parseSubstanceSpecificationProperties(JsonObject json, SubstanceSpecification res) throws IOException, FHIRFormatError {
24934    parseDomainResourceProperties(json, res);
24935    if (json.has("identifier"))
24936      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
24937    if (json.has("type"))
24938      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
24939    if (json.has("status"))
24940      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
24941    if (json.has("domain"))
24942      res.setDomain(parseCodeableConcept(json.getAsJsonObject("domain")));
24943    if (json.has("description"))
24944      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24945    if (json.has("_description"))
24946      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
24947    if (json.has("source")) {
24948      JsonArray array = json.getAsJsonArray("source");
24949      for (int i = 0; i < array.size(); i++) {
24950        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
24951      }
24952    };
24953    if (json.has("comment"))
24954      res.setCommentElement(parseString(json.get("comment").getAsString()));
24955    if (json.has("_comment"))
24956      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
24957    if (json.has("moiety")) {
24958      JsonArray array = json.getAsJsonArray("moiety");
24959      for (int i = 0; i < array.size(); i++) {
24960        res.getMoiety().add(parseSubstanceSpecificationSubstanceSpecificationMoietyComponent(array.get(i).getAsJsonObject(), res));
24961      }
24962    };
24963    if (json.has("property")) {
24964      JsonArray array = json.getAsJsonArray("property");
24965      for (int i = 0; i < array.size(); i++) {
24966        res.getProperty().add(parseSubstanceSpecificationSubstanceSpecificationPropertyComponent(array.get(i).getAsJsonObject(), res));
24967      }
24968    };
24969    if (json.has("referenceInformation"))
24970      res.setReferenceInformation(parseReference(json.getAsJsonObject("referenceInformation")));
24971    if (json.has("structure"))
24972      res.setStructure(parseSubstanceSpecificationSubstanceSpecificationStructureComponent(json.getAsJsonObject("structure"), res));
24973    if (json.has("code")) {
24974      JsonArray array = json.getAsJsonArray("code");
24975      for (int i = 0; i < array.size(); i++) {
24976        res.getCode().add(parseSubstanceSpecificationSubstanceSpecificationCodeComponent(array.get(i).getAsJsonObject(), res));
24977      }
24978    };
24979    if (json.has("name")) {
24980      JsonArray array = json.getAsJsonArray("name");
24981      for (int i = 0; i < array.size(); i++) {
24982        res.getName().add(parseSubstanceSpecificationSubstanceSpecificationNameComponent(array.get(i).getAsJsonObject(), res));
24983      }
24984    };
24985    if (json.has("molecularWeight")) {
24986      JsonArray array = json.getAsJsonArray("molecularWeight");
24987      for (int i = 0; i < array.size(); i++) {
24988        res.getMolecularWeight().add(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(array.get(i).getAsJsonObject(), res));
24989      }
24990    };
24991    if (json.has("relationship")) {
24992      JsonArray array = json.getAsJsonArray("relationship");
24993      for (int i = 0; i < array.size(); i++) {
24994        res.getRelationship().add(parseSubstanceSpecificationSubstanceSpecificationRelationshipComponent(array.get(i).getAsJsonObject(), res));
24995      }
24996    };
24997    if (json.has("nucleicAcid"))
24998      res.setNucleicAcid(parseReference(json.getAsJsonObject("nucleicAcid")));
24999    if (json.has("polymer"))
25000      res.setPolymer(parseReference(json.getAsJsonObject("polymer")));
25001    if (json.has("protein"))
25002      res.setProtein(parseReference(json.getAsJsonObject("protein")));
25003    if (json.has("sourceMaterial"))
25004      res.setSourceMaterial(parseReference(json.getAsJsonObject("sourceMaterial")));
25005  }
25006
25007  protected SubstanceSpecification.SubstanceSpecificationMoietyComponent parseSubstanceSpecificationSubstanceSpecificationMoietyComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25008    SubstanceSpecification.SubstanceSpecificationMoietyComponent res = new SubstanceSpecification.SubstanceSpecificationMoietyComponent();
25009    parseSubstanceSpecificationSubstanceSpecificationMoietyComponentProperties(json, owner, res);
25010    return res;
25011  }
25012
25013  protected void parseSubstanceSpecificationSubstanceSpecificationMoietyComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationMoietyComponent res) throws IOException, FHIRFormatError {
25014    parseBackboneElementProperties(json, res);
25015    if (json.has("role"))
25016      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
25017    if (json.has("identifier"))
25018      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
25019    if (json.has("name"))
25020      res.setNameElement(parseString(json.get("name").getAsString()));
25021    if (json.has("_name"))
25022      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25023    if (json.has("stereochemistry"))
25024      res.setStereochemistry(parseCodeableConcept(json.getAsJsonObject("stereochemistry")));
25025    if (json.has("opticalActivity"))
25026      res.setOpticalActivity(parseCodeableConcept(json.getAsJsonObject("opticalActivity")));
25027    if (json.has("molecularFormula"))
25028      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
25029    if (json.has("_molecularFormula"))
25030      parseElementProperties(json.getAsJsonObject("_molecularFormula"), res.getMolecularFormulaElement());
25031    Type amount = parseType("amount", json);
25032    if (amount != null)
25033      res.setAmount(amount);
25034  }
25035
25036  protected SubstanceSpecification.SubstanceSpecificationPropertyComponent parseSubstanceSpecificationSubstanceSpecificationPropertyComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25037    SubstanceSpecification.SubstanceSpecificationPropertyComponent res = new SubstanceSpecification.SubstanceSpecificationPropertyComponent();
25038    parseSubstanceSpecificationSubstanceSpecificationPropertyComponentProperties(json, owner, res);
25039    return res;
25040  }
25041
25042  protected void parseSubstanceSpecificationSubstanceSpecificationPropertyComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationPropertyComponent res) throws IOException, FHIRFormatError {
25043    parseBackboneElementProperties(json, res);
25044    if (json.has("category"))
25045      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
25046    if (json.has("code"))
25047      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
25048    if (json.has("parameters"))
25049      res.setParametersElement(parseString(json.get("parameters").getAsString()));
25050    if (json.has("_parameters"))
25051      parseElementProperties(json.getAsJsonObject("_parameters"), res.getParametersElement());
25052    Type definingSubstance = parseType("definingSubstance", json);
25053    if (definingSubstance != null)
25054      res.setDefiningSubstance(definingSubstance);
25055    Type amount = parseType("amount", json);
25056    if (amount != null)
25057      res.setAmount(amount);
25058  }
25059
25060  protected SubstanceSpecification.SubstanceSpecificationStructureComponent parseSubstanceSpecificationSubstanceSpecificationStructureComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25061    SubstanceSpecification.SubstanceSpecificationStructureComponent res = new SubstanceSpecification.SubstanceSpecificationStructureComponent();
25062    parseSubstanceSpecificationSubstanceSpecificationStructureComponentProperties(json, owner, res);
25063    return res;
25064  }
25065
25066  protected void parseSubstanceSpecificationSubstanceSpecificationStructureComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureComponent res) throws IOException, FHIRFormatError {
25067    parseBackboneElementProperties(json, res);
25068    if (json.has("stereochemistry"))
25069      res.setStereochemistry(parseCodeableConcept(json.getAsJsonObject("stereochemistry")));
25070    if (json.has("opticalActivity"))
25071      res.setOpticalActivity(parseCodeableConcept(json.getAsJsonObject("opticalActivity")));
25072    if (json.has("molecularFormula"))
25073      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
25074    if (json.has("_molecularFormula"))
25075      parseElementProperties(json.getAsJsonObject("_molecularFormula"), res.getMolecularFormulaElement());
25076    if (json.has("molecularFormulaByMoiety"))
25077      res.setMolecularFormulaByMoietyElement(parseString(json.get("molecularFormulaByMoiety").getAsString()));
25078    if (json.has("_molecularFormulaByMoiety"))
25079      parseElementProperties(json.getAsJsonObject("_molecularFormulaByMoiety"), res.getMolecularFormulaByMoietyElement());
25080    if (json.has("isotope")) {
25081      JsonArray array = json.getAsJsonArray("isotope");
25082      for (int i = 0; i < array.size(); i++) {
25083        res.getIsotope().add(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(array.get(i).getAsJsonObject(), owner));
25084      }
25085    };
25086    if (json.has("molecularWeight"))
25087      res.setMolecularWeight(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(json.getAsJsonObject("molecularWeight"), owner));
25088    if (json.has("source")) {
25089      JsonArray array = json.getAsJsonArray("source");
25090      for (int i = 0; i < array.size(); i++) {
25091        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25092      }
25093    };
25094    if (json.has("representation")) {
25095      JsonArray array = json.getAsJsonArray("representation");
25096      for (int i = 0; i < array.size(); i++) {
25097        res.getRepresentation().add(parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(array.get(i).getAsJsonObject(), owner));
25098      }
25099    };
25100  }
25101
25102  protected SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25103    SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent res = new SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent();
25104    parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentProperties(json, owner, res);
25105    return res;
25106  }
25107
25108  protected void parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent res) throws IOException, FHIRFormatError {
25109    parseBackboneElementProperties(json, res);
25110    if (json.has("identifier"))
25111      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
25112    if (json.has("name"))
25113      res.setName(parseCodeableConcept(json.getAsJsonObject("name")));
25114    if (json.has("substitution"))
25115      res.setSubstitution(parseCodeableConcept(json.getAsJsonObject("substitution")));
25116    if (json.has("halfLife"))
25117      res.setHalfLife(parseQuantity(json.getAsJsonObject("halfLife")));
25118    if (json.has("molecularWeight"))
25119      res.setMolecularWeight(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(json.getAsJsonObject("molecularWeight"), owner));
25120  }
25121
25122  protected SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25123    SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent res = new SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent();
25124    parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentProperties(json, owner, res);
25125    return res;
25126  }
25127
25128  protected void parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent res) throws IOException, FHIRFormatError {
25129    parseBackboneElementProperties(json, res);
25130    if (json.has("method"))
25131      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
25132    if (json.has("type"))
25133      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25134    if (json.has("amount"))
25135      res.setAmount(parseQuantity(json.getAsJsonObject("amount")));
25136  }
25137
25138  protected SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25139    SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent res = new SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent();
25140    parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentProperties(json, owner, res);
25141    return res;
25142  }
25143
25144  protected void parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent res) throws IOException, FHIRFormatError {
25145    parseBackboneElementProperties(json, res);
25146    if (json.has("type"))
25147      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25148    if (json.has("representation"))
25149      res.setRepresentationElement(parseString(json.get("representation").getAsString()));
25150    if (json.has("_representation"))
25151      parseElementProperties(json.getAsJsonObject("_representation"), res.getRepresentationElement());
25152    if (json.has("attachment"))
25153      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
25154  }
25155
25156  protected SubstanceSpecification.SubstanceSpecificationCodeComponent parseSubstanceSpecificationSubstanceSpecificationCodeComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25157    SubstanceSpecification.SubstanceSpecificationCodeComponent res = new SubstanceSpecification.SubstanceSpecificationCodeComponent();
25158    parseSubstanceSpecificationSubstanceSpecificationCodeComponentProperties(json, owner, res);
25159    return res;
25160  }
25161
25162  protected void parseSubstanceSpecificationSubstanceSpecificationCodeComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationCodeComponent res) throws IOException, FHIRFormatError {
25163    parseBackboneElementProperties(json, res);
25164    if (json.has("code"))
25165      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
25166    if (json.has("status"))
25167      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
25168    if (json.has("statusDate"))
25169      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
25170    if (json.has("_statusDate"))
25171      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
25172    if (json.has("comment"))
25173      res.setCommentElement(parseString(json.get("comment").getAsString()));
25174    if (json.has("_comment"))
25175      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
25176    if (json.has("source")) {
25177      JsonArray array = json.getAsJsonArray("source");
25178      for (int i = 0; i < array.size(); i++) {
25179        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25180      }
25181    };
25182  }
25183
25184  protected SubstanceSpecification.SubstanceSpecificationNameComponent parseSubstanceSpecificationSubstanceSpecificationNameComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25185    SubstanceSpecification.SubstanceSpecificationNameComponent res = new SubstanceSpecification.SubstanceSpecificationNameComponent();
25186    parseSubstanceSpecificationSubstanceSpecificationNameComponentProperties(json, owner, res);
25187    return res;
25188  }
25189
25190  protected void parseSubstanceSpecificationSubstanceSpecificationNameComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationNameComponent res) throws IOException, FHIRFormatError {
25191    parseBackboneElementProperties(json, res);
25192    if (json.has("name"))
25193      res.setNameElement(parseString(json.get("name").getAsString()));
25194    if (json.has("_name"))
25195      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25196    if (json.has("type"))
25197      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25198    if (json.has("status"))
25199      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
25200    if (json.has("preferred"))
25201      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
25202    if (json.has("_preferred"))
25203      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
25204    if (json.has("language")) {
25205      JsonArray array = json.getAsJsonArray("language");
25206      for (int i = 0; i < array.size(); i++) {
25207        res.getLanguage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25208      }
25209    };
25210    if (json.has("domain")) {
25211      JsonArray array = json.getAsJsonArray("domain");
25212      for (int i = 0; i < array.size(); i++) {
25213        res.getDomain().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25214      }
25215    };
25216    if (json.has("jurisdiction")) {
25217      JsonArray array = json.getAsJsonArray("jurisdiction");
25218      for (int i = 0; i < array.size(); i++) {
25219        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25220      }
25221    };
25222    if (json.has("synonym")) {
25223      JsonArray array = json.getAsJsonArray("synonym");
25224      for (int i = 0; i < array.size(); i++) {
25225        res.getSynonym().add(parseSubstanceSpecificationSubstanceSpecificationNameComponent(array.get(i).getAsJsonObject(), owner));
25226      }
25227    };
25228    if (json.has("translation")) {
25229      JsonArray array = json.getAsJsonArray("translation");
25230      for (int i = 0; i < array.size(); i++) {
25231        res.getTranslation().add(parseSubstanceSpecificationSubstanceSpecificationNameComponent(array.get(i).getAsJsonObject(), owner));
25232      }
25233    };
25234    if (json.has("official")) {
25235      JsonArray array = json.getAsJsonArray("official");
25236      for (int i = 0; i < array.size(); i++) {
25237        res.getOfficial().add(parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(array.get(i).getAsJsonObject(), owner));
25238      }
25239    };
25240    if (json.has("source")) {
25241      JsonArray array = json.getAsJsonArray("source");
25242      for (int i = 0; i < array.size(); i++) {
25243        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25244      }
25245    };
25246  }
25247
25248  protected SubstanceSpecification.SubstanceSpecificationNameOfficialComponent parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25249    SubstanceSpecification.SubstanceSpecificationNameOfficialComponent res = new SubstanceSpecification.SubstanceSpecificationNameOfficialComponent();
25250    parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponentProperties(json, owner, res);
25251    return res;
25252  }
25253
25254  protected void parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationNameOfficialComponent res) throws IOException, FHIRFormatError {
25255    parseBackboneElementProperties(json, res);
25256    if (json.has("authority"))
25257      res.setAuthority(parseCodeableConcept(json.getAsJsonObject("authority")));
25258    if (json.has("status"))
25259      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
25260    if (json.has("date"))
25261      res.setDateElement(parseDateTime(json.get("date").getAsString()));
25262    if (json.has("_date"))
25263      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
25264  }
25265
25266  protected SubstanceSpecification.SubstanceSpecificationRelationshipComponent parseSubstanceSpecificationSubstanceSpecificationRelationshipComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25267    SubstanceSpecification.SubstanceSpecificationRelationshipComponent res = new SubstanceSpecification.SubstanceSpecificationRelationshipComponent();
25268    parseSubstanceSpecificationSubstanceSpecificationRelationshipComponentProperties(json, owner, res);
25269    return res;
25270  }
25271
25272  protected void parseSubstanceSpecificationSubstanceSpecificationRelationshipComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationRelationshipComponent res) throws IOException, FHIRFormatError {
25273    parseBackboneElementProperties(json, res);
25274    Type substance = parseType("substance", json);
25275    if (substance != null)
25276      res.setSubstance(substance);
25277    if (json.has("relationship"))
25278      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
25279    if (json.has("isDefining"))
25280      res.setIsDefiningElement(parseBoolean(json.get("isDefining").getAsBoolean()));
25281    if (json.has("_isDefining"))
25282      parseElementProperties(json.getAsJsonObject("_isDefining"), res.getIsDefiningElement());
25283    Type amount = parseType("amount", json);
25284    if (amount != null)
25285      res.setAmount(amount);
25286    if (json.has("amountRatioLowLimit"))
25287      res.setAmountRatioLowLimit(parseRatio(json.getAsJsonObject("amountRatioLowLimit")));
25288    if (json.has("amountType"))
25289      res.setAmountType(parseCodeableConcept(json.getAsJsonObject("amountType")));
25290    if (json.has("source")) {
25291      JsonArray array = json.getAsJsonArray("source");
25292      for (int i = 0; i < array.size(); i++) {
25293        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25294      }
25295    };
25296  }
25297
25298  protected SupplyDelivery parseSupplyDelivery(JsonObject json) throws IOException, FHIRFormatError {
25299    SupplyDelivery res = new SupplyDelivery();
25300    parseSupplyDeliveryProperties(json, res);
25301    return res;
25302  }
25303
25304  protected void parseSupplyDeliveryProperties(JsonObject json, SupplyDelivery res) throws IOException, FHIRFormatError {
25305    parseDomainResourceProperties(json, res);
25306    if (json.has("identifier")) {
25307      JsonArray array = json.getAsJsonArray("identifier");
25308      for (int i = 0; i < array.size(); i++) {
25309        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25310      }
25311    };
25312    if (json.has("basedOn")) {
25313      JsonArray array = json.getAsJsonArray("basedOn");
25314      for (int i = 0; i < array.size(); i++) {
25315        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
25316      }
25317    };
25318    if (json.has("partOf")) {
25319      JsonArray array = json.getAsJsonArray("partOf");
25320      for (int i = 0; i < array.size(); i++) {
25321        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
25322      }
25323    };
25324    if (json.has("status"))
25325      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyDelivery.SupplyDeliveryStatus.NULL, new SupplyDelivery.SupplyDeliveryStatusEnumFactory()));
25326    if (json.has("_status"))
25327      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
25328    if (json.has("patient"))
25329      res.setPatient(parseReference(json.getAsJsonObject("patient")));
25330    if (json.has("type"))
25331      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25332    if (json.has("suppliedItem"))
25333      res.setSuppliedItem(parseSupplyDeliverySupplyDeliverySuppliedItemComponent(json.getAsJsonObject("suppliedItem"), res));
25334    Type occurrence = parseType("occurrence", json);
25335    if (occurrence != null)
25336      res.setOccurrence(occurrence);
25337    if (json.has("supplier"))
25338      res.setSupplier(parseReference(json.getAsJsonObject("supplier")));
25339    if (json.has("destination"))
25340      res.setDestination(parseReference(json.getAsJsonObject("destination")));
25341    if (json.has("receiver")) {
25342      JsonArray array = json.getAsJsonArray("receiver");
25343      for (int i = 0; i < array.size(); i++) {
25344        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
25345      }
25346    };
25347  }
25348
25349  protected SupplyDelivery.SupplyDeliverySuppliedItemComponent parseSupplyDeliverySupplyDeliverySuppliedItemComponent(JsonObject json, SupplyDelivery owner) throws IOException, FHIRFormatError {
25350    SupplyDelivery.SupplyDeliverySuppliedItemComponent res = new SupplyDelivery.SupplyDeliverySuppliedItemComponent();
25351    parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(json, owner, res);
25352    return res;
25353  }
25354
25355  protected void parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(JsonObject json, SupplyDelivery owner, SupplyDelivery.SupplyDeliverySuppliedItemComponent res) throws IOException, FHIRFormatError {
25356    parseBackboneElementProperties(json, res);
25357    if (json.has("quantity"))
25358      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
25359    Type item = parseType("item", json);
25360    if (item != null)
25361      res.setItem(item);
25362  }
25363
25364  protected SupplyRequest parseSupplyRequest(JsonObject json) throws IOException, FHIRFormatError {
25365    SupplyRequest res = new SupplyRequest();
25366    parseSupplyRequestProperties(json, res);
25367    return res;
25368  }
25369
25370  protected void parseSupplyRequestProperties(JsonObject json, SupplyRequest res) throws IOException, FHIRFormatError {
25371    parseDomainResourceProperties(json, res);
25372    if (json.has("identifier")) {
25373      JsonArray array = json.getAsJsonArray("identifier");
25374      for (int i = 0; i < array.size(); i++) {
25375        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25376      }
25377    };
25378    if (json.has("status"))
25379      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyRequest.SupplyRequestStatus.NULL, new SupplyRequest.SupplyRequestStatusEnumFactory()));
25380    if (json.has("_status"))
25381      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
25382    if (json.has("category"))
25383      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
25384    if (json.has("priority"))
25385      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), SupplyRequest.RequestPriority.NULL, new SupplyRequest.RequestPriorityEnumFactory()));
25386    if (json.has("_priority"))
25387      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
25388    Type item = parseType("item", json);
25389    if (item != null)
25390      res.setItem(item);
25391    if (json.has("quantity"))
25392      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
25393    if (json.has("parameter")) {
25394      JsonArray array = json.getAsJsonArray("parameter");
25395      for (int i = 0; i < array.size(); i++) {
25396        res.getParameter().add(parseSupplyRequestSupplyRequestParameterComponent(array.get(i).getAsJsonObject(), res));
25397      }
25398    };
25399    Type occurrence = parseType("occurrence", json);
25400    if (occurrence != null)
25401      res.setOccurrence(occurrence);
25402    if (json.has("authoredOn"))
25403      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
25404    if (json.has("_authoredOn"))
25405      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
25406    if (json.has("requester"))
25407      res.setRequester(parseReference(json.getAsJsonObject("requester")));
25408    if (json.has("supplier")) {
25409      JsonArray array = json.getAsJsonArray("supplier");
25410      for (int i = 0; i < array.size(); i++) {
25411        res.getSupplier().add(parseReference(array.get(i).getAsJsonObject()));
25412      }
25413    };
25414    if (json.has("reasonCode")) {
25415      JsonArray array = json.getAsJsonArray("reasonCode");
25416      for (int i = 0; i < array.size(); i++) {
25417        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25418      }
25419    };
25420    if (json.has("reasonReference")) {
25421      JsonArray array = json.getAsJsonArray("reasonReference");
25422      for (int i = 0; i < array.size(); i++) {
25423        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
25424      }
25425    };
25426    if (json.has("deliverFrom"))
25427      res.setDeliverFrom(parseReference(json.getAsJsonObject("deliverFrom")));
25428    if (json.has("deliverTo"))
25429      res.setDeliverTo(parseReference(json.getAsJsonObject("deliverTo")));
25430  }
25431
25432  protected SupplyRequest.SupplyRequestParameterComponent parseSupplyRequestSupplyRequestParameterComponent(JsonObject json, SupplyRequest owner) throws IOException, FHIRFormatError {
25433    SupplyRequest.SupplyRequestParameterComponent res = new SupplyRequest.SupplyRequestParameterComponent();
25434    parseSupplyRequestSupplyRequestParameterComponentProperties(json, owner, res);
25435    return res;
25436  }
25437
25438  protected void parseSupplyRequestSupplyRequestParameterComponentProperties(JsonObject json, SupplyRequest owner, SupplyRequest.SupplyRequestParameterComponent res) throws IOException, FHIRFormatError {
25439    parseBackboneElementProperties(json, res);
25440    if (json.has("code"))
25441      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
25442    Type value = parseType("value", json);
25443    if (value != null)
25444      res.setValue(value);
25445  }
25446
25447  protected Task parseTask(JsonObject json) throws IOException, FHIRFormatError {
25448    Task res = new Task();
25449    parseTaskProperties(json, res);
25450    return res;
25451  }
25452
25453  protected void parseTaskProperties(JsonObject json, Task res) throws IOException, FHIRFormatError {
25454    parseDomainResourceProperties(json, res);
25455    if (json.has("identifier")) {
25456      JsonArray array = json.getAsJsonArray("identifier");
25457      for (int i = 0; i < array.size(); i++) {
25458        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25459      }
25460    };
25461    if (json.has("instantiatesCanonical"))
25462      res.setInstantiatesCanonicalElement(parseCanonical(json.get("instantiatesCanonical").getAsString()));
25463    if (json.has("_instantiatesCanonical"))
25464      parseElementProperties(json.getAsJsonObject("_instantiatesCanonical"), res.getInstantiatesCanonicalElement());
25465    if (json.has("instantiatesUri"))
25466      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
25467    if (json.has("_instantiatesUri"))
25468      parseElementProperties(json.getAsJsonObject("_instantiatesUri"), res.getInstantiatesUriElement());
25469    if (json.has("basedOn")) {
25470      JsonArray array = json.getAsJsonArray("basedOn");
25471      for (int i = 0; i < array.size(); i++) {
25472        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
25473      }
25474    };
25475    if (json.has("groupIdentifier"))
25476      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
25477    if (json.has("partOf")) {
25478      JsonArray array = json.getAsJsonArray("partOf");
25479      for (int i = 0; i < array.size(); i++) {
25480        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
25481      }
25482    };
25483    if (json.has("status"))
25484      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Task.TaskStatus.NULL, new Task.TaskStatusEnumFactory()));
25485    if (json.has("_status"))
25486      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
25487    if (json.has("statusReason"))
25488      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
25489    if (json.has("businessStatus"))
25490      res.setBusinessStatus(parseCodeableConcept(json.getAsJsonObject("businessStatus")));
25491    if (json.has("intent"))
25492      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Task.TaskIntent.NULL, new Task.TaskIntentEnumFactory()));
25493    if (json.has("_intent"))
25494      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
25495    if (json.has("priority"))
25496      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Task.TaskPriority.NULL, new Task.TaskPriorityEnumFactory()));
25497    if (json.has("_priority"))
25498      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
25499    if (json.has("code"))
25500      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
25501    if (json.has("description"))
25502      res.setDescriptionElement(parseString(json.get("description").getAsString()));
25503    if (json.has("_description"))
25504      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
25505    if (json.has("focus"))
25506      res.setFocus(parseReference(json.getAsJsonObject("focus")));
25507    if (json.has("for"))
25508      res.setFor(parseReference(json.getAsJsonObject("for")));
25509    if (json.has("encounter"))
25510      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
25511    if (json.has("executionPeriod"))
25512      res.setExecutionPeriod(parsePeriod(json.getAsJsonObject("executionPeriod")));
25513    if (json.has("authoredOn"))
25514      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
25515    if (json.has("_authoredOn"))
25516      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
25517    if (json.has("lastModified"))
25518      res.setLastModifiedElement(parseDateTime(json.get("lastModified").getAsString()));
25519    if (json.has("_lastModified"))
25520      parseElementProperties(json.getAsJsonObject("_lastModified"), res.getLastModifiedElement());
25521    if (json.has("requester"))
25522      res.setRequester(parseReference(json.getAsJsonObject("requester")));
25523    if (json.has("performerType")) {
25524      JsonArray array = json.getAsJsonArray("performerType");
25525      for (int i = 0; i < array.size(); i++) {
25526        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25527      }
25528    };
25529    if (json.has("owner"))
25530      res.setOwner(parseReference(json.getAsJsonObject("owner")));
25531    if (json.has("location"))
25532      res.setLocation(parseReference(json.getAsJsonObject("location")));
25533    if (json.has("reasonCode"))
25534      res.setReasonCode(parseCodeableConcept(json.getAsJsonObject("reasonCode")));
25535    if (json.has("reasonReference"))
25536      res.setReasonReference(parseReference(json.getAsJsonObject("reasonReference")));
25537    if (json.has("insurance")) {
25538      JsonArray array = json.getAsJsonArray("insurance");
25539      for (int i = 0; i < array.size(); i++) {
25540        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
25541      }
25542    };
25543    if (json.has("note")) {
25544      JsonArray array = json.getAsJsonArray("note");
25545      for (int i = 0; i < array.size(); i++) {
25546        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
25547      }
25548    };
25549    if (json.has("relevantHistory")) {
25550      JsonArray array = json.getAsJsonArray("relevantHistory");
25551      for (int i = 0; i < array.size(); i++) {
25552        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
25553      }
25554    };
25555    if (json.has("restriction"))
25556      res.setRestriction(parseTaskTaskRestrictionComponent(json.getAsJsonObject("restriction"), res));
25557    if (json.has("input")) {
25558      JsonArray array = json.getAsJsonArray("input");
25559      for (int i = 0; i < array.size(); i++) {
25560        res.getInput().add(parseTaskParameterComponent(array.get(i).getAsJsonObject(), res));
25561      }
25562    };
25563    if (json.has("output")) {
25564      JsonArray array = json.getAsJsonArray("output");
25565      for (int i = 0; i < array.size(); i++) {
25566        res.getOutput().add(parseTaskTaskOutputComponent(array.get(i).getAsJsonObject(), res));
25567      }
25568    };
25569  }
25570
25571  protected Task.TaskRestrictionComponent parseTaskTaskRestrictionComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
25572    Task.TaskRestrictionComponent res = new Task.TaskRestrictionComponent();
25573    parseTaskTaskRestrictionComponentProperties(json, owner, res);
25574    return res;
25575  }
25576
25577  protected void parseTaskTaskRestrictionComponentProperties(JsonObject json, Task owner, Task.TaskRestrictionComponent res) throws IOException, FHIRFormatError {
25578    parseBackboneElementProperties(json, res);
25579    if (json.has("repetitions"))
25580      res.setRepetitionsElement(parsePositiveInt(json.get("repetitions").getAsString()));
25581    if (json.has("_repetitions"))
25582      parseElementProperties(json.getAsJsonObject("_repetitions"), res.getRepetitionsElement());
25583    if (json.has("period"))
25584      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
25585    if (json.has("recipient")) {
25586      JsonArray array = json.getAsJsonArray("recipient");
25587      for (int i = 0; i < array.size(); i++) {
25588        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
25589      }
25590    };
25591  }
25592
25593  protected Task.ParameterComponent parseTaskParameterComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
25594    Task.ParameterComponent res = new Task.ParameterComponent();
25595    parseTaskParameterComponentProperties(json, owner, res);
25596    return res;
25597  }
25598
25599  protected void parseTaskParameterComponentProperties(JsonObject json, Task owner, Task.ParameterComponent res) throws IOException, FHIRFormatError {
25600    parseBackboneElementProperties(json, res);
25601    if (json.has("type"))
25602      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25603    Type value = parseType("value", json);
25604    if (value != null)
25605      res.setValue(value);
25606  }
25607
25608  protected Task.TaskOutputComponent parseTaskTaskOutputComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
25609    Task.TaskOutputComponent res = new Task.TaskOutputComponent();
25610    parseTaskTaskOutputComponentProperties(json, owner, res);
25611    return res;
25612  }
25613
25614  protected void parseTaskTaskOutputComponentProperties(JsonObject json, Task owner, Task.TaskOutputComponent res) throws IOException, FHIRFormatError {
25615    parseBackboneElementProperties(json, res);
25616    if (json.has("type"))
25617      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25618    Type value = parseType("value", json);
25619    if (value != null)
25620      res.setValue(value);
25621  }
25622
25623  protected TerminologyCapabilities parseTerminologyCapabilities(JsonObject json) throws IOException, FHIRFormatError {
25624    TerminologyCapabilities res = new TerminologyCapabilities();
25625    parseTerminologyCapabilitiesProperties(json, res);
25626    return res;
25627  }
25628
25629  protected void parseTerminologyCapabilitiesProperties(JsonObject json, TerminologyCapabilities res) throws IOException, FHIRFormatError {
25630    parseDomainResourceProperties(json, res);
25631    if (json.has("url"))
25632      res.setUrlElement(parseUri(json.get("url").getAsString()));
25633    if (json.has("_url"))
25634      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
25635    if (json.has("version"))
25636      res.setVersionElement(parseString(json.get("version").getAsString()));
25637    if (json.has("_version"))
25638      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
25639    if (json.has("name"))
25640      res.setNameElement(parseString(json.get("name").getAsString()));
25641    if (json.has("_name"))
25642      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25643    if (json.has("title"))
25644      res.setTitleElement(parseString(json.get("title").getAsString()));
25645    if (json.has("_title"))
25646      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
25647    if (json.has("status"))
25648      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
25649    if (json.has("_status"))
25650      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
25651    if (json.has("experimental"))
25652      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
25653    if (json.has("_experimental"))
25654      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
25655    if (json.has("date"))
25656      res.setDateElement(parseDateTime(json.get("date").getAsString()));
25657    if (json.has("_date"))
25658      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
25659    if (json.has("publisher"))
25660      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
25661    if (json.has("_publisher"))
25662      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
25663    if (json.has("contact")) {
25664      JsonArray array = json.getAsJsonArray("contact");
25665      for (int i = 0; i < array.size(); i++) {
25666        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
25667      }
25668    };
25669    if (json.has("description"))
25670      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
25671    if (json.has("_description"))
25672      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
25673    if (json.has("useContext")) {
25674      JsonArray array = json.getAsJsonArray("useContext");
25675      for (int i = 0; i < array.size(); i++) {
25676        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
25677      }
25678    };
25679    if (json.has("jurisdiction")) {
25680      JsonArray array = json.getAsJsonArray("jurisdiction");
25681      for (int i = 0; i < array.size(); i++) {
25682        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25683      }
25684    };
25685    if (json.has("purpose"))
25686      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
25687    if (json.has("_purpose"))
25688      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
25689    if (json.has("copyright"))
25690      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
25691    if (json.has("_copyright"))
25692      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
25693    if (json.has("kind"))
25694      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), TerminologyCapabilities.CapabilityStatementKind.NULL, new TerminologyCapabilities.CapabilityStatementKindEnumFactory()));
25695    if (json.has("_kind"))
25696      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
25697    if (json.has("software"))
25698      res.setSoftware(parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(json.getAsJsonObject("software"), res));
25699    if (json.has("implementation"))
25700      res.setImplementation(parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(json.getAsJsonObject("implementation"), res));
25701    if (json.has("lockedDate"))
25702      res.setLockedDateElement(parseBoolean(json.get("lockedDate").getAsBoolean()));
25703    if (json.has("_lockedDate"))
25704      parseElementProperties(json.getAsJsonObject("_lockedDate"), res.getLockedDateElement());
25705    if (json.has("codeSystem")) {
25706      JsonArray array = json.getAsJsonArray("codeSystem");
25707      for (int i = 0; i < array.size(); i++) {
25708        res.getCodeSystem().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(array.get(i).getAsJsonObject(), res));
25709      }
25710    };
25711    if (json.has("expansion"))
25712      res.setExpansion(parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(json.getAsJsonObject("expansion"), res));
25713    if (json.has("codeSearch"))
25714      res.setCodeSearchElement(parseEnumeration(json.get("codeSearch").getAsString(), TerminologyCapabilities.CodeSearchSupport.NULL, new TerminologyCapabilities.CodeSearchSupportEnumFactory()));
25715    if (json.has("_codeSearch"))
25716      parseElementProperties(json.getAsJsonObject("_codeSearch"), res.getCodeSearchElement());
25717    if (json.has("validateCode"))
25718      res.setValidateCode(parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(json.getAsJsonObject("validateCode"), res));
25719    if (json.has("translation"))
25720      res.setTranslation(parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(json.getAsJsonObject("translation"), res));
25721    if (json.has("closure"))
25722      res.setClosure(parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(json.getAsJsonObject("closure"), res));
25723  }
25724
25725  protected TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25726    TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent res = new TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent();
25727    parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentProperties(json, owner, res);
25728    return res;
25729  }
25730
25731  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent res) throws IOException, FHIRFormatError {
25732    parseBackboneElementProperties(json, res);
25733    if (json.has("name"))
25734      res.setNameElement(parseString(json.get("name").getAsString()));
25735    if (json.has("_name"))
25736      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25737    if (json.has("version"))
25738      res.setVersionElement(parseString(json.get("version").getAsString()));
25739    if (json.has("_version"))
25740      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
25741  }
25742
25743  protected TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25744    TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent();
25745    parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentProperties(json, owner, res);
25746    return res;
25747  }
25748
25749  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res) throws IOException, FHIRFormatError {
25750    parseBackboneElementProperties(json, res);
25751    if (json.has("description"))
25752      res.setDescriptionElement(parseString(json.get("description").getAsString()));
25753    if (json.has("_description"))
25754      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
25755    if (json.has("url"))
25756      res.setUrlElement(parseUrl(json.get("url").getAsString()));
25757    if (json.has("_url"))
25758      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
25759  }
25760
25761  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25762    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent();
25763    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentProperties(json, owner, res);
25764    return res;
25765  }
25766
25767  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res) throws IOException, FHIRFormatError {
25768    parseBackboneElementProperties(json, res);
25769    if (json.has("uri"))
25770      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
25771    if (json.has("_uri"))
25772      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
25773    if (json.has("version")) {
25774      JsonArray array = json.getAsJsonArray("version");
25775      for (int i = 0; i < array.size(); i++) {
25776        res.getVersion().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(array.get(i).getAsJsonObject(), owner));
25777      }
25778    };
25779    if (json.has("subsumption"))
25780      res.setSubsumptionElement(parseBoolean(json.get("subsumption").getAsBoolean()));
25781    if (json.has("_subsumption"))
25782      parseElementProperties(json.getAsJsonObject("_subsumption"), res.getSubsumptionElement());
25783  }
25784
25785  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25786    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent();
25787    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentProperties(json, owner, res);
25788    return res;
25789  }
25790
25791  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res) throws IOException, FHIRFormatError {
25792    parseBackboneElementProperties(json, res);
25793    if (json.has("code"))
25794      res.setCodeElement(parseString(json.get("code").getAsString()));
25795    if (json.has("_code"))
25796      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
25797    if (json.has("isDefault"))
25798      res.setIsDefaultElement(parseBoolean(json.get("isDefault").getAsBoolean()));
25799    if (json.has("_isDefault"))
25800      parseElementProperties(json.getAsJsonObject("_isDefault"), res.getIsDefaultElement());
25801    if (json.has("compositional"))
25802      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
25803    if (json.has("_compositional"))
25804      parseElementProperties(json.getAsJsonObject("_compositional"), res.getCompositionalElement());
25805    if (json.has("language")) {
25806      JsonArray array = json.getAsJsonArray("language");
25807      for (int i = 0; i < array.size(); i++) {
25808        res.getLanguage().add(parseCode(array.get(i).getAsString()));
25809      }
25810    };
25811    if (json.has("_language")) {
25812      JsonArray array = json.getAsJsonArray("_language");
25813      for (int i = 0; i < array.size(); i++) {
25814        if (i == res.getLanguage().size())
25815          res.getLanguage().add(parseCode(null));
25816        if (array.get(i) instanceof JsonObject) 
25817          parseElementProperties(array.get(i).getAsJsonObject(), res.getLanguage().get(i));
25818      }
25819    };
25820    if (json.has("filter")) {
25821      JsonArray array = json.getAsJsonArray("filter");
25822      for (int i = 0; i < array.size(); i++) {
25823        res.getFilter().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(array.get(i).getAsJsonObject(), owner));
25824      }
25825    };
25826    if (json.has("property")) {
25827      JsonArray array = json.getAsJsonArray("property");
25828      for (int i = 0; i < array.size(); i++) {
25829        res.getProperty().add(parseCode(array.get(i).getAsString()));
25830      }
25831    };
25832    if (json.has("_property")) {
25833      JsonArray array = json.getAsJsonArray("_property");
25834      for (int i = 0; i < array.size(); i++) {
25835        if (i == res.getProperty().size())
25836          res.getProperty().add(parseCode(null));
25837        if (array.get(i) instanceof JsonObject) 
25838          parseElementProperties(array.get(i).getAsJsonObject(), res.getProperty().get(i));
25839      }
25840    };
25841  }
25842
25843  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25844    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent();
25845    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(json, owner, res);
25846    return res;
25847  }
25848
25849  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res) throws IOException, FHIRFormatError {
25850    parseBackboneElementProperties(json, res);
25851    if (json.has("code"))
25852      res.setCodeElement(parseCode(json.get("code").getAsString()));
25853    if (json.has("_code"))
25854      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
25855    if (json.has("op")) {
25856      JsonArray array = json.getAsJsonArray("op");
25857      for (int i = 0; i < array.size(); i++) {
25858        res.getOp().add(parseCode(array.get(i).getAsString()));
25859      }
25860    };
25861    if (json.has("_op")) {
25862      JsonArray array = json.getAsJsonArray("_op");
25863      for (int i = 0; i < array.size(); i++) {
25864        if (i == res.getOp().size())
25865          res.getOp().add(parseCode(null));
25866        if (array.get(i) instanceof JsonObject) 
25867          parseElementProperties(array.get(i).getAsJsonObject(), res.getOp().get(i));
25868      }
25869    };
25870  }
25871
25872  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25873    TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent();
25874    parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentProperties(json, owner, res);
25875    return res;
25876  }
25877
25878  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res) throws IOException, FHIRFormatError {
25879    parseBackboneElementProperties(json, res);
25880    if (json.has("hierarchical"))
25881      res.setHierarchicalElement(parseBoolean(json.get("hierarchical").getAsBoolean()));
25882    if (json.has("_hierarchical"))
25883      parseElementProperties(json.getAsJsonObject("_hierarchical"), res.getHierarchicalElement());
25884    if (json.has("paging"))
25885      res.setPagingElement(parseBoolean(json.get("paging").getAsBoolean()));
25886    if (json.has("_paging"))
25887      parseElementProperties(json.getAsJsonObject("_paging"), res.getPagingElement());
25888    if (json.has("incomplete"))
25889      res.setIncompleteElement(parseBoolean(json.get("incomplete").getAsBoolean()));
25890    if (json.has("_incomplete"))
25891      parseElementProperties(json.getAsJsonObject("_incomplete"), res.getIncompleteElement());
25892    if (json.has("parameter")) {
25893      JsonArray array = json.getAsJsonArray("parameter");
25894      for (int i = 0; i < array.size(); i++) {
25895        res.getParameter().add(parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(array.get(i).getAsJsonObject(), owner));
25896      }
25897    };
25898    if (json.has("textFilter"))
25899      res.setTextFilterElement(parseMarkdown(json.get("textFilter").getAsString()));
25900    if (json.has("_textFilter"))
25901      parseElementProperties(json.getAsJsonObject("_textFilter"), res.getTextFilterElement());
25902  }
25903
25904  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25905    TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent();
25906    parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentProperties(json, owner, res);
25907    return res;
25908  }
25909
25910  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res) throws IOException, FHIRFormatError {
25911    parseBackboneElementProperties(json, res);
25912    if (json.has("name"))
25913      res.setNameElement(parseCode(json.get("name").getAsString()));
25914    if (json.has("_name"))
25915      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25916    if (json.has("documentation"))
25917      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
25918    if (json.has("_documentation"))
25919      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
25920  }
25921
25922  protected TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25923    TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res = new TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent();
25924    parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentProperties(json, owner, res);
25925    return res;
25926  }
25927
25928  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res) throws IOException, FHIRFormatError {
25929    parseBackboneElementProperties(json, res);
25930    if (json.has("translations"))
25931      res.setTranslationsElement(parseBoolean(json.get("translations").getAsBoolean()));
25932    if (json.has("_translations"))
25933      parseElementProperties(json.getAsJsonObject("_translations"), res.getTranslationsElement());
25934  }
25935
25936  protected TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25937    TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent();
25938    parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentProperties(json, owner, res);
25939    return res;
25940  }
25941
25942  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res) throws IOException, FHIRFormatError {
25943    parseBackboneElementProperties(json, res);
25944    if (json.has("needsMap"))
25945      res.setNeedsMapElement(parseBoolean(json.get("needsMap").getAsBoolean()));
25946    if (json.has("_needsMap"))
25947      parseElementProperties(json.getAsJsonObject("_needsMap"), res.getNeedsMapElement());
25948  }
25949
25950  protected TerminologyCapabilities.TerminologyCapabilitiesClosureComponent parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25951    TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res = new TerminologyCapabilities.TerminologyCapabilitiesClosureComponent();
25952    parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentProperties(json, owner, res);
25953    return res;
25954  }
25955
25956  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res) throws IOException, FHIRFormatError {
25957    parseBackboneElementProperties(json, res);
25958    if (json.has("translation"))
25959      res.setTranslationElement(parseBoolean(json.get("translation").getAsBoolean()));
25960    if (json.has("_translation"))
25961      parseElementProperties(json.getAsJsonObject("_translation"), res.getTranslationElement());
25962  }
25963
25964  protected TestReport parseTestReport(JsonObject json) throws IOException, FHIRFormatError {
25965    TestReport res = new TestReport();
25966    parseTestReportProperties(json, res);
25967    return res;
25968  }
25969
25970  protected void parseTestReportProperties(JsonObject json, TestReport res) throws IOException, FHIRFormatError {
25971    parseDomainResourceProperties(json, res);
25972    if (json.has("identifier"))
25973      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
25974    if (json.has("name"))
25975      res.setNameElement(parseString(json.get("name").getAsString()));
25976    if (json.has("_name"))
25977      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25978    if (json.has("status"))
25979      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), TestReport.TestReportStatus.NULL, new TestReport.TestReportStatusEnumFactory()));
25980    if (json.has("_status"))
25981      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
25982    if (json.has("testScript"))
25983      res.setTestScript(parseReference(json.getAsJsonObject("testScript")));
25984    if (json.has("result"))
25985      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportResult.NULL, new TestReport.TestReportResultEnumFactory()));
25986    if (json.has("_result"))
25987      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
25988    if (json.has("score"))
25989      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
25990    if (json.has("_score"))
25991      parseElementProperties(json.getAsJsonObject("_score"), res.getScoreElement());
25992    if (json.has("tester"))
25993      res.setTesterElement(parseString(json.get("tester").getAsString()));
25994    if (json.has("_tester"))
25995      parseElementProperties(json.getAsJsonObject("_tester"), res.getTesterElement());
25996    if (json.has("issued"))
25997      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
25998    if (json.has("_issued"))
25999      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
26000    if (json.has("participant")) {
26001      JsonArray array = json.getAsJsonArray("participant");
26002      for (int i = 0; i < array.size(); i++) {
26003        res.getParticipant().add(parseTestReportTestReportParticipantComponent(array.get(i).getAsJsonObject(), res));
26004      }
26005    };
26006    if (json.has("setup"))
26007      res.setSetup(parseTestReportTestReportSetupComponent(json.getAsJsonObject("setup"), res));
26008    if (json.has("test")) {
26009      JsonArray array = json.getAsJsonArray("test");
26010      for (int i = 0; i < array.size(); i++) {
26011        res.getTest().add(parseTestReportTestReportTestComponent(array.get(i).getAsJsonObject(), res));
26012      }
26013    };
26014    if (json.has("teardown"))
26015      res.setTeardown(parseTestReportTestReportTeardownComponent(json.getAsJsonObject("teardown"), res));
26016  }
26017
26018  protected TestReport.TestReportParticipantComponent parseTestReportTestReportParticipantComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26019    TestReport.TestReportParticipantComponent res = new TestReport.TestReportParticipantComponent();
26020    parseTestReportTestReportParticipantComponentProperties(json, owner, res);
26021    return res;
26022  }
26023
26024  protected void parseTestReportTestReportParticipantComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportParticipantComponent res) throws IOException, FHIRFormatError {
26025    parseBackboneElementProperties(json, res);
26026    if (json.has("type"))
26027      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TestReport.TestReportParticipantType.NULL, new TestReport.TestReportParticipantTypeEnumFactory()));
26028    if (json.has("_type"))
26029      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
26030    if (json.has("uri"))
26031      res.setUriElement(parseUri(json.get("uri").getAsString()));
26032    if (json.has("_uri"))
26033      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
26034    if (json.has("display"))
26035      res.setDisplayElement(parseString(json.get("display").getAsString()));
26036    if (json.has("_display"))
26037      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
26038  }
26039
26040  protected TestReport.TestReportSetupComponent parseTestReportTestReportSetupComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26041    TestReport.TestReportSetupComponent res = new TestReport.TestReportSetupComponent();
26042    parseTestReportTestReportSetupComponentProperties(json, owner, res);
26043    return res;
26044  }
26045
26046  protected void parseTestReportTestReportSetupComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportSetupComponent res) throws IOException, FHIRFormatError {
26047    parseBackboneElementProperties(json, res);
26048    if (json.has("action")) {
26049      JsonArray array = json.getAsJsonArray("action");
26050      for (int i = 0; i < array.size(); i++) {
26051        res.getAction().add(parseTestReportSetupActionComponent(array.get(i).getAsJsonObject(), owner));
26052      }
26053    };
26054  }
26055
26056  protected TestReport.SetupActionComponent parseTestReportSetupActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26057    TestReport.SetupActionComponent res = new TestReport.SetupActionComponent();
26058    parseTestReportSetupActionComponentProperties(json, owner, res);
26059    return res;
26060  }
26061
26062  protected void parseTestReportSetupActionComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionComponent res) throws IOException, FHIRFormatError {
26063    parseBackboneElementProperties(json, res);
26064    if (json.has("operation"))
26065      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
26066    if (json.has("assert"))
26067      res.setAssert(parseTestReportSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
26068  }
26069
26070  protected TestReport.SetupActionOperationComponent parseTestReportSetupActionOperationComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26071    TestReport.SetupActionOperationComponent res = new TestReport.SetupActionOperationComponent();
26072    parseTestReportSetupActionOperationComponentProperties(json, owner, res);
26073    return res;
26074  }
26075
26076  protected void parseTestReportSetupActionOperationComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
26077    parseBackboneElementProperties(json, res);
26078    if (json.has("result"))
26079      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
26080    if (json.has("_result"))
26081      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
26082    if (json.has("message"))
26083      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
26084    if (json.has("_message"))
26085      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
26086    if (json.has("detail"))
26087      res.setDetailElement(parseUri(json.get("detail").getAsString()));
26088    if (json.has("_detail"))
26089      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
26090  }
26091
26092  protected TestReport.SetupActionAssertComponent parseTestReportSetupActionAssertComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26093    TestReport.SetupActionAssertComponent res = new TestReport.SetupActionAssertComponent();
26094    parseTestReportSetupActionAssertComponentProperties(json, owner, res);
26095    return res;
26096  }
26097
26098  protected void parseTestReportSetupActionAssertComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
26099    parseBackboneElementProperties(json, res);
26100    if (json.has("result"))
26101      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
26102    if (json.has("_result"))
26103      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
26104    if (json.has("message"))
26105      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
26106    if (json.has("_message"))
26107      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
26108    if (json.has("detail"))
26109      res.setDetailElement(parseString(json.get("detail").getAsString()));
26110    if (json.has("_detail"))
26111      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
26112  }
26113
26114  protected TestReport.TestReportTestComponent parseTestReportTestReportTestComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26115    TestReport.TestReportTestComponent res = new TestReport.TestReportTestComponent();
26116    parseTestReportTestReportTestComponentProperties(json, owner, res);
26117    return res;
26118  }
26119
26120  protected void parseTestReportTestReportTestComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportTestComponent res) throws IOException, FHIRFormatError {
26121    parseBackboneElementProperties(json, res);
26122    if (json.has("name"))
26123      res.setNameElement(parseString(json.get("name").getAsString()));
26124    if (json.has("_name"))
26125      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
26126    if (json.has("description"))
26127      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26128    if (json.has("_description"))
26129      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26130    if (json.has("action")) {
26131      JsonArray array = json.getAsJsonArray("action");
26132      for (int i = 0; i < array.size(); i++) {
26133        res.getAction().add(parseTestReportTestActionComponent(array.get(i).getAsJsonObject(), owner));
26134      }
26135    };
26136  }
26137
26138  protected TestReport.TestActionComponent parseTestReportTestActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26139    TestReport.TestActionComponent res = new TestReport.TestActionComponent();
26140    parseTestReportTestActionComponentProperties(json, owner, res);
26141    return res;
26142  }
26143
26144  protected void parseTestReportTestActionComponentProperties(JsonObject json, TestReport owner, TestReport.TestActionComponent res) throws IOException, FHIRFormatError {
26145    parseBackboneElementProperties(json, res);
26146    if (json.has("operation"))
26147      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
26148    if (json.has("assert"))
26149      res.setAssert(parseTestReportSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
26150  }
26151
26152  protected TestReport.TestReportTeardownComponent parseTestReportTestReportTeardownComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26153    TestReport.TestReportTeardownComponent res = new TestReport.TestReportTeardownComponent();
26154    parseTestReportTestReportTeardownComponentProperties(json, owner, res);
26155    return res;
26156  }
26157
26158  protected void parseTestReportTestReportTeardownComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportTeardownComponent res) throws IOException, FHIRFormatError {
26159    parseBackboneElementProperties(json, res);
26160    if (json.has("action")) {
26161      JsonArray array = json.getAsJsonArray("action");
26162      for (int i = 0; i < array.size(); i++) {
26163        res.getAction().add(parseTestReportTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
26164      }
26165    };
26166  }
26167
26168  protected TestReport.TeardownActionComponent parseTestReportTeardownActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26169    TestReport.TeardownActionComponent res = new TestReport.TeardownActionComponent();
26170    parseTestReportTeardownActionComponentProperties(json, owner, res);
26171    return res;
26172  }
26173
26174  protected void parseTestReportTeardownActionComponentProperties(JsonObject json, TestReport owner, TestReport.TeardownActionComponent res) throws IOException, FHIRFormatError {
26175    parseBackboneElementProperties(json, res);
26176    if (json.has("operation"))
26177      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
26178  }
26179
26180  protected TestScript parseTestScript(JsonObject json) throws IOException, FHIRFormatError {
26181    TestScript res = new TestScript();
26182    parseTestScriptProperties(json, res);
26183    return res;
26184  }
26185
26186  protected void parseTestScriptProperties(JsonObject json, TestScript res) throws IOException, FHIRFormatError {
26187    parseDomainResourceProperties(json, res);
26188    if (json.has("url"))
26189      res.setUrlElement(parseUri(json.get("url").getAsString()));
26190    if (json.has("_url"))
26191      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
26192    if (json.has("identifier"))
26193      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
26194    if (json.has("version"))
26195      res.setVersionElement(parseString(json.get("version").getAsString()));
26196    if (json.has("_version"))
26197      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
26198    if (json.has("name"))
26199      res.setNameElement(parseString(json.get("name").getAsString()));
26200    if (json.has("_name"))
26201      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
26202    if (json.has("title"))
26203      res.setTitleElement(parseString(json.get("title").getAsString()));
26204    if (json.has("_title"))
26205      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
26206    if (json.has("status"))
26207      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
26208    if (json.has("_status"))
26209      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
26210    if (json.has("experimental"))
26211      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
26212    if (json.has("_experimental"))
26213      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
26214    if (json.has("date"))
26215      res.setDateElement(parseDateTime(json.get("date").getAsString()));
26216    if (json.has("_date"))
26217      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
26218    if (json.has("publisher"))
26219      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
26220    if (json.has("_publisher"))
26221      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
26222    if (json.has("contact")) {
26223      JsonArray array = json.getAsJsonArray("contact");
26224      for (int i = 0; i < array.size(); i++) {
26225        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
26226      }
26227    };
26228    if (json.has("description"))
26229      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
26230    if (json.has("_description"))
26231      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26232    if (json.has("useContext")) {
26233      JsonArray array = json.getAsJsonArray("useContext");
26234      for (int i = 0; i < array.size(); i++) {
26235        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
26236      }
26237    };
26238    if (json.has("jurisdiction")) {
26239      JsonArray array = json.getAsJsonArray("jurisdiction");
26240      for (int i = 0; i < array.size(); i++) {
26241        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26242      }
26243    };
26244    if (json.has("purpose"))
26245      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
26246    if (json.has("_purpose"))
26247      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
26248    if (json.has("copyright"))
26249      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
26250    if (json.has("_copyright"))
26251      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
26252    if (json.has("origin")) {
26253      JsonArray array = json.getAsJsonArray("origin");
26254      for (int i = 0; i < array.size(); i++) {
26255        res.getOrigin().add(parseTestScriptTestScriptOriginComponent(array.get(i).getAsJsonObject(), res));
26256      }
26257    };
26258    if (json.has("destination")) {
26259      JsonArray array = json.getAsJsonArray("destination");
26260      for (int i = 0; i < array.size(); i++) {
26261        res.getDestination().add(parseTestScriptTestScriptDestinationComponent(array.get(i).getAsJsonObject(), res));
26262      }
26263    };
26264    if (json.has("metadata"))
26265      res.setMetadata(parseTestScriptTestScriptMetadataComponent(json.getAsJsonObject("metadata"), res));
26266    if (json.has("fixture")) {
26267      JsonArray array = json.getAsJsonArray("fixture");
26268      for (int i = 0; i < array.size(); i++) {
26269        res.getFixture().add(parseTestScriptTestScriptFixtureComponent(array.get(i).getAsJsonObject(), res));
26270      }
26271    };
26272    if (json.has("profile")) {
26273      JsonArray array = json.getAsJsonArray("profile");
26274      for (int i = 0; i < array.size(); i++) {
26275        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
26276      }
26277    };
26278    if (json.has("variable")) {
26279      JsonArray array = json.getAsJsonArray("variable");
26280      for (int i = 0; i < array.size(); i++) {
26281        res.getVariable().add(parseTestScriptTestScriptVariableComponent(array.get(i).getAsJsonObject(), res));
26282      }
26283    };
26284    if (json.has("setup"))
26285      res.setSetup(parseTestScriptTestScriptSetupComponent(json.getAsJsonObject("setup"), res));
26286    if (json.has("test")) {
26287      JsonArray array = json.getAsJsonArray("test");
26288      for (int i = 0; i < array.size(); i++) {
26289        res.getTest().add(parseTestScriptTestScriptTestComponent(array.get(i).getAsJsonObject(), res));
26290      }
26291    };
26292    if (json.has("teardown"))
26293      res.setTeardown(parseTestScriptTestScriptTeardownComponent(json.getAsJsonObject("teardown"), res));
26294  }
26295
26296  protected TestScript.TestScriptOriginComponent parseTestScriptTestScriptOriginComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26297    TestScript.TestScriptOriginComponent res = new TestScript.TestScriptOriginComponent();
26298    parseTestScriptTestScriptOriginComponentProperties(json, owner, res);
26299    return res;
26300  }
26301
26302  protected void parseTestScriptTestScriptOriginComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptOriginComponent res) throws IOException, FHIRFormatError {
26303    parseBackboneElementProperties(json, res);
26304    if (json.has("index"))
26305      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
26306    if (json.has("_index"))
26307      parseElementProperties(json.getAsJsonObject("_index"), res.getIndexElement());
26308    if (json.has("profile"))
26309      res.setProfile(parseCoding(json.getAsJsonObject("profile")));
26310  }
26311
26312  protected TestScript.TestScriptDestinationComponent parseTestScriptTestScriptDestinationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26313    TestScript.TestScriptDestinationComponent res = new TestScript.TestScriptDestinationComponent();
26314    parseTestScriptTestScriptDestinationComponentProperties(json, owner, res);
26315    return res;
26316  }
26317
26318  protected void parseTestScriptTestScriptDestinationComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptDestinationComponent res) throws IOException, FHIRFormatError {
26319    parseBackboneElementProperties(json, res);
26320    if (json.has("index"))
26321      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
26322    if (json.has("_index"))
26323      parseElementProperties(json.getAsJsonObject("_index"), res.getIndexElement());
26324    if (json.has("profile"))
26325      res.setProfile(parseCoding(json.getAsJsonObject("profile")));
26326  }
26327
26328  protected TestScript.TestScriptMetadataComponent parseTestScriptTestScriptMetadataComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26329    TestScript.TestScriptMetadataComponent res = new TestScript.TestScriptMetadataComponent();
26330    parseTestScriptTestScriptMetadataComponentProperties(json, owner, res);
26331    return res;
26332  }
26333
26334  protected void parseTestScriptTestScriptMetadataComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataComponent res) throws IOException, FHIRFormatError {
26335    parseBackboneElementProperties(json, res);
26336    if (json.has("link")) {
26337      JsonArray array = json.getAsJsonArray("link");
26338      for (int i = 0; i < array.size(); i++) {
26339        res.getLink().add(parseTestScriptTestScriptMetadataLinkComponent(array.get(i).getAsJsonObject(), owner));
26340      }
26341    };
26342    if (json.has("capability")) {
26343      JsonArray array = json.getAsJsonArray("capability");
26344      for (int i = 0; i < array.size(); i++) {
26345        res.getCapability().add(parseTestScriptTestScriptMetadataCapabilityComponent(array.get(i).getAsJsonObject(), owner));
26346      }
26347    };
26348  }
26349
26350  protected TestScript.TestScriptMetadataLinkComponent parseTestScriptTestScriptMetadataLinkComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26351    TestScript.TestScriptMetadataLinkComponent res = new TestScript.TestScriptMetadataLinkComponent();
26352    parseTestScriptTestScriptMetadataLinkComponentProperties(json, owner, res);
26353    return res;
26354  }
26355
26356  protected void parseTestScriptTestScriptMetadataLinkComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataLinkComponent res) throws IOException, FHIRFormatError {
26357    parseBackboneElementProperties(json, res);
26358    if (json.has("url"))
26359      res.setUrlElement(parseUri(json.get("url").getAsString()));
26360    if (json.has("_url"))
26361      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
26362    if (json.has("description"))
26363      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26364    if (json.has("_description"))
26365      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26366  }
26367
26368  protected TestScript.TestScriptMetadataCapabilityComponent parseTestScriptTestScriptMetadataCapabilityComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26369    TestScript.TestScriptMetadataCapabilityComponent res = new TestScript.TestScriptMetadataCapabilityComponent();
26370    parseTestScriptTestScriptMetadataCapabilityComponentProperties(json, owner, res);
26371    return res;
26372  }
26373
26374  protected void parseTestScriptTestScriptMetadataCapabilityComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataCapabilityComponent res) throws IOException, FHIRFormatError {
26375    parseBackboneElementProperties(json, res);
26376    if (json.has("required"))
26377      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
26378    if (json.has("_required"))
26379      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
26380    if (json.has("validated"))
26381      res.setValidatedElement(parseBoolean(json.get("validated").getAsBoolean()));
26382    if (json.has("_validated"))
26383      parseElementProperties(json.getAsJsonObject("_validated"), res.getValidatedElement());
26384    if (json.has("description"))
26385      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26386    if (json.has("_description"))
26387      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26388    if (json.has("origin")) {
26389      JsonArray array = json.getAsJsonArray("origin");
26390      for (int i = 0; i < array.size(); i++) {
26391        res.getOrigin().add(parseInteger(array.get(i).getAsLong()));
26392      }
26393    };
26394    if (json.has("_origin")) {
26395      JsonArray array = json.getAsJsonArray("_origin");
26396      for (int i = 0; i < array.size(); i++) {
26397        if (i == res.getOrigin().size())
26398          res.getOrigin().add(parseInteger(null));
26399        if (array.get(i) instanceof JsonObject) 
26400          parseElementProperties(array.get(i).getAsJsonObject(), res.getOrigin().get(i));
26401      }
26402    };
26403    if (json.has("destination"))
26404      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
26405    if (json.has("_destination"))
26406      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
26407    if (json.has("link")) {
26408      JsonArray array = json.getAsJsonArray("link");
26409      for (int i = 0; i < array.size(); i++) {
26410        res.getLink().add(parseUri(array.get(i).getAsString()));
26411      }
26412    };
26413    if (json.has("_link")) {
26414      JsonArray array = json.getAsJsonArray("_link");
26415      for (int i = 0; i < array.size(); i++) {
26416        if (i == res.getLink().size())
26417          res.getLink().add(parseUri(null));
26418        if (array.get(i) instanceof JsonObject) 
26419          parseElementProperties(array.get(i).getAsJsonObject(), res.getLink().get(i));
26420      }
26421    };
26422    if (json.has("capabilities"))
26423      res.setCapabilitiesElement(parseCanonical(json.get("capabilities").getAsString()));
26424    if (json.has("_capabilities"))
26425      parseElementProperties(json.getAsJsonObject("_capabilities"), res.getCapabilitiesElement());
26426  }
26427
26428  protected TestScript.TestScriptFixtureComponent parseTestScriptTestScriptFixtureComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26429    TestScript.TestScriptFixtureComponent res = new TestScript.TestScriptFixtureComponent();
26430    parseTestScriptTestScriptFixtureComponentProperties(json, owner, res);
26431    return res;
26432  }
26433
26434  protected void parseTestScriptTestScriptFixtureComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptFixtureComponent res) throws IOException, FHIRFormatError {
26435    parseBackboneElementProperties(json, res);
26436    if (json.has("autocreate"))
26437      res.setAutocreateElement(parseBoolean(json.get("autocreate").getAsBoolean()));
26438    if (json.has("_autocreate"))
26439      parseElementProperties(json.getAsJsonObject("_autocreate"), res.getAutocreateElement());
26440    if (json.has("autodelete"))
26441      res.setAutodeleteElement(parseBoolean(json.get("autodelete").getAsBoolean()));
26442    if (json.has("_autodelete"))
26443      parseElementProperties(json.getAsJsonObject("_autodelete"), res.getAutodeleteElement());
26444    if (json.has("resource"))
26445      res.setResource(parseReference(json.getAsJsonObject("resource")));
26446  }
26447
26448  protected TestScript.TestScriptVariableComponent parseTestScriptTestScriptVariableComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26449    TestScript.TestScriptVariableComponent res = new TestScript.TestScriptVariableComponent();
26450    parseTestScriptTestScriptVariableComponentProperties(json, owner, res);
26451    return res;
26452  }
26453
26454  protected void parseTestScriptTestScriptVariableComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptVariableComponent res) throws IOException, FHIRFormatError {
26455    parseBackboneElementProperties(json, res);
26456    if (json.has("name"))
26457      res.setNameElement(parseString(json.get("name").getAsString()));
26458    if (json.has("_name"))
26459      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
26460    if (json.has("defaultValue"))
26461      res.setDefaultValueElement(parseString(json.get("defaultValue").getAsString()));
26462    if (json.has("_defaultValue"))
26463      parseElementProperties(json.getAsJsonObject("_defaultValue"), res.getDefaultValueElement());
26464    if (json.has("description"))
26465      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26466    if (json.has("_description"))
26467      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26468    if (json.has("expression"))
26469      res.setExpressionElement(parseString(json.get("expression").getAsString()));
26470    if (json.has("_expression"))
26471      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
26472    if (json.has("headerField"))
26473      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
26474    if (json.has("_headerField"))
26475      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
26476    if (json.has("hint"))
26477      res.setHintElement(parseString(json.get("hint").getAsString()));
26478    if (json.has("_hint"))
26479      parseElementProperties(json.getAsJsonObject("_hint"), res.getHintElement());
26480    if (json.has("path"))
26481      res.setPathElement(parseString(json.get("path").getAsString()));
26482    if (json.has("_path"))
26483      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
26484    if (json.has("sourceId"))
26485      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
26486    if (json.has("_sourceId"))
26487      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
26488  }
26489
26490  protected TestScript.TestScriptSetupComponent parseTestScriptTestScriptSetupComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26491    TestScript.TestScriptSetupComponent res = new TestScript.TestScriptSetupComponent();
26492    parseTestScriptTestScriptSetupComponentProperties(json, owner, res);
26493    return res;
26494  }
26495
26496  protected void parseTestScriptTestScriptSetupComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptSetupComponent res) throws IOException, FHIRFormatError {
26497    parseBackboneElementProperties(json, res);
26498    if (json.has("action")) {
26499      JsonArray array = json.getAsJsonArray("action");
26500      for (int i = 0; i < array.size(); i++) {
26501        res.getAction().add(parseTestScriptSetupActionComponent(array.get(i).getAsJsonObject(), owner));
26502      }
26503    };
26504  }
26505
26506  protected TestScript.SetupActionComponent parseTestScriptSetupActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26507    TestScript.SetupActionComponent res = new TestScript.SetupActionComponent();
26508    parseTestScriptSetupActionComponentProperties(json, owner, res);
26509    return res;
26510  }
26511
26512  protected void parseTestScriptSetupActionComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionComponent res) throws IOException, FHIRFormatError {
26513    parseBackboneElementProperties(json, res);
26514    if (json.has("operation"))
26515      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
26516    if (json.has("assert"))
26517      res.setAssert(parseTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
26518  }
26519
26520  protected TestScript.SetupActionOperationComponent parseTestScriptSetupActionOperationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26521    TestScript.SetupActionOperationComponent res = new TestScript.SetupActionOperationComponent();
26522    parseTestScriptSetupActionOperationComponentProperties(json, owner, res);
26523    return res;
26524  }
26525
26526  protected void parseTestScriptSetupActionOperationComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
26527    parseBackboneElementProperties(json, res);
26528    if (json.has("type"))
26529      res.setType(parseCoding(json.getAsJsonObject("type")));
26530    if (json.has("resource"))
26531      res.setResourceElement(parseCode(json.get("resource").getAsString()));
26532    if (json.has("_resource"))
26533      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
26534    if (json.has("label"))
26535      res.setLabelElement(parseString(json.get("label").getAsString()));
26536    if (json.has("_label"))
26537      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
26538    if (json.has("description"))
26539      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26540    if (json.has("_description"))
26541      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26542    if (json.has("accept"))
26543      res.setAcceptElement(parseCode(json.get("accept").getAsString()));
26544    if (json.has("_accept"))
26545      parseElementProperties(json.getAsJsonObject("_accept"), res.getAcceptElement());
26546    if (json.has("contentType"))
26547      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
26548    if (json.has("_contentType"))
26549      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
26550    if (json.has("destination"))
26551      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
26552    if (json.has("_destination"))
26553      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
26554    if (json.has("encodeRequestUrl"))
26555      res.setEncodeRequestUrlElement(parseBoolean(json.get("encodeRequestUrl").getAsBoolean()));
26556    if (json.has("_encodeRequestUrl"))
26557      parseElementProperties(json.getAsJsonObject("_encodeRequestUrl"), res.getEncodeRequestUrlElement());
26558    if (json.has("method"))
26559      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
26560    if (json.has("_method"))
26561      parseElementProperties(json.getAsJsonObject("_method"), res.getMethodElement());
26562    if (json.has("origin"))
26563      res.setOriginElement(parseInteger(json.get("origin").getAsLong()));
26564    if (json.has("_origin"))
26565      parseElementProperties(json.getAsJsonObject("_origin"), res.getOriginElement());
26566    if (json.has("params"))
26567      res.setParamsElement(parseString(json.get("params").getAsString()));
26568    if (json.has("_params"))
26569      parseElementProperties(json.getAsJsonObject("_params"), res.getParamsElement());
26570    if (json.has("requestHeader")) {
26571      JsonArray array = json.getAsJsonArray("requestHeader");
26572      for (int i = 0; i < array.size(); i++) {
26573        res.getRequestHeader().add(parseTestScriptSetupActionOperationRequestHeaderComponent(array.get(i).getAsJsonObject(), owner));
26574      }
26575    };
26576    if (json.has("requestId"))
26577      res.setRequestIdElement(parseId(json.get("requestId").getAsString()));
26578    if (json.has("_requestId"))
26579      parseElementProperties(json.getAsJsonObject("_requestId"), res.getRequestIdElement());
26580    if (json.has("responseId"))
26581      res.setResponseIdElement(parseId(json.get("responseId").getAsString()));
26582    if (json.has("_responseId"))
26583      parseElementProperties(json.getAsJsonObject("_responseId"), res.getResponseIdElement());
26584    if (json.has("sourceId"))
26585      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
26586    if (json.has("_sourceId"))
26587      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
26588    if (json.has("targetId"))
26589      res.setTargetIdElement(parseId(json.get("targetId").getAsString()));
26590    if (json.has("_targetId"))
26591      parseElementProperties(json.getAsJsonObject("_targetId"), res.getTargetIdElement());
26592    if (json.has("url"))
26593      res.setUrlElement(parseString(json.get("url").getAsString()));
26594    if (json.has("_url"))
26595      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
26596  }
26597
26598  protected TestScript.SetupActionOperationRequestHeaderComponent parseTestScriptSetupActionOperationRequestHeaderComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26599    TestScript.SetupActionOperationRequestHeaderComponent res = new TestScript.SetupActionOperationRequestHeaderComponent();
26600    parseTestScriptSetupActionOperationRequestHeaderComponentProperties(json, owner, res);
26601    return res;
26602  }
26603
26604  protected void parseTestScriptSetupActionOperationRequestHeaderComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionOperationRequestHeaderComponent res) throws IOException, FHIRFormatError {
26605    parseBackboneElementProperties(json, res);
26606    if (json.has("field"))
26607      res.setFieldElement(parseString(json.get("field").getAsString()));
26608    if (json.has("_field"))
26609      parseElementProperties(json.getAsJsonObject("_field"), res.getFieldElement());
26610    if (json.has("value"))
26611      res.setValueElement(parseString(json.get("value").getAsString()));
26612    if (json.has("_value"))
26613      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
26614  }
26615
26616  protected TestScript.SetupActionAssertComponent parseTestScriptSetupActionAssertComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26617    TestScript.SetupActionAssertComponent res = new TestScript.SetupActionAssertComponent();
26618    parseTestScriptSetupActionAssertComponentProperties(json, owner, res);
26619    return res;
26620  }
26621
26622  protected void parseTestScriptSetupActionAssertComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
26623    parseBackboneElementProperties(json, res);
26624    if (json.has("label"))
26625      res.setLabelElement(parseString(json.get("label").getAsString()));
26626    if (json.has("_label"))
26627      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
26628    if (json.has("description"))
26629      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26630    if (json.has("_description"))
26631      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26632    if (json.has("direction"))
26633      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), TestScript.AssertionDirectionType.NULL, new TestScript.AssertionDirectionTypeEnumFactory()));
26634    if (json.has("_direction"))
26635      parseElementProperties(json.getAsJsonObject("_direction"), res.getDirectionElement());
26636    if (json.has("compareToSourceId"))
26637      res.setCompareToSourceIdElement(parseString(json.get("compareToSourceId").getAsString()));
26638    if (json.has("_compareToSourceId"))
26639      parseElementProperties(json.getAsJsonObject("_compareToSourceId"), res.getCompareToSourceIdElement());
26640    if (json.has("compareToSourceExpression"))
26641      res.setCompareToSourceExpressionElement(parseString(json.get("compareToSourceExpression").getAsString()));
26642    if (json.has("_compareToSourceExpression"))
26643      parseElementProperties(json.getAsJsonObject("_compareToSourceExpression"), res.getCompareToSourceExpressionElement());
26644    if (json.has("compareToSourcePath"))
26645      res.setCompareToSourcePathElement(parseString(json.get("compareToSourcePath").getAsString()));
26646    if (json.has("_compareToSourcePath"))
26647      parseElementProperties(json.getAsJsonObject("_compareToSourcePath"), res.getCompareToSourcePathElement());
26648    if (json.has("contentType"))
26649      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
26650    if (json.has("_contentType"))
26651      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
26652    if (json.has("expression"))
26653      res.setExpressionElement(parseString(json.get("expression").getAsString()));
26654    if (json.has("_expression"))
26655      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
26656    if (json.has("headerField"))
26657      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
26658    if (json.has("_headerField"))
26659      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
26660    if (json.has("minimumId"))
26661      res.setMinimumIdElement(parseString(json.get("minimumId").getAsString()));
26662    if (json.has("_minimumId"))
26663      parseElementProperties(json.getAsJsonObject("_minimumId"), res.getMinimumIdElement());
26664    if (json.has("navigationLinks"))
26665      res.setNavigationLinksElement(parseBoolean(json.get("navigationLinks").getAsBoolean()));
26666    if (json.has("_navigationLinks"))
26667      parseElementProperties(json.getAsJsonObject("_navigationLinks"), res.getNavigationLinksElement());
26668    if (json.has("operator"))
26669      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), TestScript.AssertionOperatorType.NULL, new TestScript.AssertionOperatorTypeEnumFactory()));
26670    if (json.has("_operator"))
26671      parseElementProperties(json.getAsJsonObject("_operator"), res.getOperatorElement());
26672    if (json.has("path"))
26673      res.setPathElement(parseString(json.get("path").getAsString()));
26674    if (json.has("_path"))
26675      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
26676    if (json.has("requestMethod"))
26677      res.setRequestMethodElement(parseEnumeration(json.get("requestMethod").getAsString(), TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
26678    if (json.has("_requestMethod"))
26679      parseElementProperties(json.getAsJsonObject("_requestMethod"), res.getRequestMethodElement());
26680    if (json.has("requestURL"))
26681      res.setRequestURLElement(parseString(json.get("requestURL").getAsString()));
26682    if (json.has("_requestURL"))
26683      parseElementProperties(json.getAsJsonObject("_requestURL"), res.getRequestURLElement());
26684    if (json.has("resource"))
26685      res.setResourceElement(parseCode(json.get("resource").getAsString()));
26686    if (json.has("_resource"))
26687      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
26688    if (json.has("response"))
26689      res.setResponseElement(parseEnumeration(json.get("response").getAsString(), TestScript.AssertionResponseTypes.NULL, new TestScript.AssertionResponseTypesEnumFactory()));
26690    if (json.has("_response"))
26691      parseElementProperties(json.getAsJsonObject("_response"), res.getResponseElement());
26692    if (json.has("responseCode"))
26693      res.setResponseCodeElement(parseString(json.get("responseCode").getAsString()));
26694    if (json.has("_responseCode"))
26695      parseElementProperties(json.getAsJsonObject("_responseCode"), res.getResponseCodeElement());
26696    if (json.has("sourceId"))
26697      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
26698    if (json.has("_sourceId"))
26699      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
26700    if (json.has("validateProfileId"))
26701      res.setValidateProfileIdElement(parseId(json.get("validateProfileId").getAsString()));
26702    if (json.has("_validateProfileId"))
26703      parseElementProperties(json.getAsJsonObject("_validateProfileId"), res.getValidateProfileIdElement());
26704    if (json.has("value"))
26705      res.setValueElement(parseString(json.get("value").getAsString()));
26706    if (json.has("_value"))
26707      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
26708    if (json.has("warningOnly"))
26709      res.setWarningOnlyElement(parseBoolean(json.get("warningOnly").getAsBoolean()));
26710    if (json.has("_warningOnly"))
26711      parseElementProperties(json.getAsJsonObject("_warningOnly"), res.getWarningOnlyElement());
26712  }
26713
26714  protected TestScript.TestScriptTestComponent parseTestScriptTestScriptTestComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26715    TestScript.TestScriptTestComponent res = new TestScript.TestScriptTestComponent();
26716    parseTestScriptTestScriptTestComponentProperties(json, owner, res);
26717    return res;
26718  }
26719
26720  protected void parseTestScriptTestScriptTestComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptTestComponent res) throws IOException, FHIRFormatError {
26721    parseBackboneElementProperties(json, res);
26722    if (json.has("name"))
26723      res.setNameElement(parseString(json.get("name").getAsString()));
26724    if (json.has("_name"))
26725      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
26726    if (json.has("description"))
26727      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26728    if (json.has("_description"))
26729      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26730    if (json.has("action")) {
26731      JsonArray array = json.getAsJsonArray("action");
26732      for (int i = 0; i < array.size(); i++) {
26733        res.getAction().add(parseTestScriptTestActionComponent(array.get(i).getAsJsonObject(), owner));
26734      }
26735    };
26736  }
26737
26738  protected TestScript.TestActionComponent parseTestScriptTestActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26739    TestScript.TestActionComponent res = new TestScript.TestActionComponent();
26740    parseTestScriptTestActionComponentProperties(json, owner, res);
26741    return res;
26742  }
26743
26744  protected void parseTestScriptTestActionComponentProperties(JsonObject json, TestScript owner, TestScript.TestActionComponent res) throws IOException, FHIRFormatError {
26745    parseBackboneElementProperties(json, res);
26746    if (json.has("operation"))
26747      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
26748    if (json.has("assert"))
26749      res.setAssert(parseTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
26750  }
26751
26752  protected TestScript.TestScriptTeardownComponent parseTestScriptTestScriptTeardownComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26753    TestScript.TestScriptTeardownComponent res = new TestScript.TestScriptTeardownComponent();
26754    parseTestScriptTestScriptTeardownComponentProperties(json, owner, res);
26755    return res;
26756  }
26757
26758  protected void parseTestScriptTestScriptTeardownComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptTeardownComponent res) throws IOException, FHIRFormatError {
26759    parseBackboneElementProperties(json, res);
26760    if (json.has("action")) {
26761      JsonArray array = json.getAsJsonArray("action");
26762      for (int i = 0; i < array.size(); i++) {
26763        res.getAction().add(parseTestScriptTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
26764      }
26765    };
26766  }
26767
26768  protected TestScript.TeardownActionComponent parseTestScriptTeardownActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26769    TestScript.TeardownActionComponent res = new TestScript.TeardownActionComponent();
26770    parseTestScriptTeardownActionComponentProperties(json, owner, res);
26771    return res;
26772  }
26773
26774  protected void parseTestScriptTeardownActionComponentProperties(JsonObject json, TestScript owner, TestScript.TeardownActionComponent res) throws IOException, FHIRFormatError {
26775    parseBackboneElementProperties(json, res);
26776    if (json.has("operation"))
26777      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
26778  }
26779
26780  protected ValueSet parseValueSet(JsonObject json) throws IOException, FHIRFormatError {
26781    ValueSet res = new ValueSet();
26782    parseValueSetProperties(json, res);
26783    return res;
26784  }
26785
26786  protected void parseValueSetProperties(JsonObject json, ValueSet res) throws IOException, FHIRFormatError {
26787    parseDomainResourceProperties(json, res);
26788    if (json.has("url"))
26789      res.setUrlElement(parseUri(json.get("url").getAsString()));
26790    if (json.has("_url"))
26791      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
26792    if (json.has("identifier")) {
26793      JsonArray array = json.getAsJsonArray("identifier");
26794      for (int i = 0; i < array.size(); i++) {
26795        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26796      }
26797    };
26798    if (json.has("version"))
26799      res.setVersionElement(parseString(json.get("version").getAsString()));
26800    if (json.has("_version"))
26801      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
26802    if (json.has("name"))
26803      res.setNameElement(parseString(json.get("name").getAsString()));
26804    if (json.has("_name"))
26805      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
26806    if (json.has("title"))
26807      res.setTitleElement(parseString(json.get("title").getAsString()));
26808    if (json.has("_title"))
26809      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
26810    if (json.has("status"))
26811      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
26812    if (json.has("_status"))
26813      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
26814    if (json.has("experimental"))
26815      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
26816    if (json.has("_experimental"))
26817      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
26818    if (json.has("date"))
26819      res.setDateElement(parseDateTime(json.get("date").getAsString()));
26820    if (json.has("_date"))
26821      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
26822    if (json.has("publisher"))
26823      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
26824    if (json.has("_publisher"))
26825      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
26826    if (json.has("contact")) {
26827      JsonArray array = json.getAsJsonArray("contact");
26828      for (int i = 0; i < array.size(); i++) {
26829        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
26830      }
26831    };
26832    if (json.has("description"))
26833      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
26834    if (json.has("_description"))
26835      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26836    if (json.has("useContext")) {
26837      JsonArray array = json.getAsJsonArray("useContext");
26838      for (int i = 0; i < array.size(); i++) {
26839        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
26840      }
26841    };
26842    if (json.has("jurisdiction")) {
26843      JsonArray array = json.getAsJsonArray("jurisdiction");
26844      for (int i = 0; i < array.size(); i++) {
26845        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26846      }
26847    };
26848    if (json.has("immutable"))
26849      res.setImmutableElement(parseBoolean(json.get("immutable").getAsBoolean()));
26850    if (json.has("_immutable"))
26851      parseElementProperties(json.getAsJsonObject("_immutable"), res.getImmutableElement());
26852    if (json.has("purpose"))
26853      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
26854    if (json.has("_purpose"))
26855      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
26856    if (json.has("copyright"))
26857      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
26858    if (json.has("_copyright"))
26859      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
26860    if (json.has("compose"))
26861      res.setCompose(parseValueSetValueSetComposeComponent(json.getAsJsonObject("compose"), res));
26862    if (json.has("expansion"))
26863      res.setExpansion(parseValueSetValueSetExpansionComponent(json.getAsJsonObject("expansion"), res));
26864  }
26865
26866  protected ValueSet.ValueSetComposeComponent parseValueSetValueSetComposeComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
26867    ValueSet.ValueSetComposeComponent res = new ValueSet.ValueSetComposeComponent();
26868    parseValueSetValueSetComposeComponentProperties(json, owner, res);
26869    return res;
26870  }
26871
26872  protected void parseValueSetValueSetComposeComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetComposeComponent res) throws IOException, FHIRFormatError {
26873    parseBackboneElementProperties(json, res);
26874    if (json.has("lockedDate"))
26875      res.setLockedDateElement(parseDate(json.get("lockedDate").getAsString()));
26876    if (json.has("_lockedDate"))
26877      parseElementProperties(json.getAsJsonObject("_lockedDate"), res.getLockedDateElement());
26878    if (json.has("inactive"))
26879      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
26880    if (json.has("_inactive"))
26881      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
26882    if (json.has("include")) {
26883      JsonArray array = json.getAsJsonArray("include");
26884      for (int i = 0; i < array.size(); i++) {
26885        res.getInclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
26886      }
26887    };
26888    if (json.has("exclude")) {
26889      JsonArray array = json.getAsJsonArray("exclude");
26890      for (int i = 0; i < array.size(); i++) {
26891        res.getExclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
26892      }
26893    };
26894  }
26895
26896  protected ValueSet.ConceptSetComponent parseValueSetConceptSetComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
26897    ValueSet.ConceptSetComponent res = new ValueSet.ConceptSetComponent();
26898    parseValueSetConceptSetComponentProperties(json, owner, res);
26899    return res;
26900  }
26901
26902  protected void parseValueSetConceptSetComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptSetComponent res) throws IOException, FHIRFormatError {
26903    parseBackboneElementProperties(json, res);
26904    if (json.has("system"))
26905      res.setSystemElement(parseUri(json.get("system").getAsString()));
26906    if (json.has("_system"))
26907      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
26908    if (json.has("version"))
26909      res.setVersionElement(parseString(json.get("version").getAsString()));
26910    if (json.has("_version"))
26911      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
26912    if (json.has("concept")) {
26913      JsonArray array = json.getAsJsonArray("concept");
26914      for (int i = 0; i < array.size(); i++) {
26915        res.getConcept().add(parseValueSetConceptReferenceComponent(array.get(i).getAsJsonObject(), owner));
26916      }
26917    };
26918    if (json.has("filter")) {
26919      JsonArray array = json.getAsJsonArray("filter");
26920      for (int i = 0; i < array.size(); i++) {
26921        res.getFilter().add(parseValueSetConceptSetFilterComponent(array.get(i).getAsJsonObject(), owner));
26922      }
26923    };
26924    if (json.has("valueSet")) {
26925      JsonArray array = json.getAsJsonArray("valueSet");
26926      for (int i = 0; i < array.size(); i++) {
26927        res.getValueSet().add(parseCanonical(array.get(i).getAsString()));
26928      }
26929    };
26930    if (json.has("_valueSet")) {
26931      JsonArray array = json.getAsJsonArray("_valueSet");
26932      for (int i = 0; i < array.size(); i++) {
26933        if (i == res.getValueSet().size())
26934          res.getValueSet().add(parseCanonical(null));
26935        if (array.get(i) instanceof JsonObject) 
26936          parseElementProperties(array.get(i).getAsJsonObject(), res.getValueSet().get(i));
26937      }
26938    };
26939  }
26940
26941  protected ValueSet.ConceptReferenceComponent parseValueSetConceptReferenceComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
26942    ValueSet.ConceptReferenceComponent res = new ValueSet.ConceptReferenceComponent();
26943    parseValueSetConceptReferenceComponentProperties(json, owner, res);
26944    return res;
26945  }
26946
26947  protected void parseValueSetConceptReferenceComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptReferenceComponent res) throws IOException, FHIRFormatError {
26948    parseBackboneElementProperties(json, res);
26949    if (json.has("code"))
26950      res.setCodeElement(parseCode(json.get("code").getAsString()));
26951    if (json.has("_code"))
26952      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
26953    if (json.has("display"))
26954      res.setDisplayElement(parseString(json.get("display").getAsString()));
26955    if (json.has("_display"))
26956      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
26957    if (json.has("designation")) {
26958      JsonArray array = json.getAsJsonArray("designation");
26959      for (int i = 0; i < array.size(); i++) {
26960        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
26961      }
26962    };
26963  }
26964
26965  protected ValueSet.ConceptReferenceDesignationComponent parseValueSetConceptReferenceDesignationComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
26966    ValueSet.ConceptReferenceDesignationComponent res = new ValueSet.ConceptReferenceDesignationComponent();
26967    parseValueSetConceptReferenceDesignationComponentProperties(json, owner, res);
26968    return res;
26969  }
26970
26971  protected void parseValueSetConceptReferenceDesignationComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptReferenceDesignationComponent res) throws IOException, FHIRFormatError {
26972    parseBackboneElementProperties(json, res);
26973    if (json.has("language"))
26974      res.setLanguageElement(parseCode(json.get("language").getAsString()));
26975    if (json.has("_language"))
26976      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
26977    if (json.has("use"))
26978      res.setUse(parseCoding(json.getAsJsonObject("use")));
26979    if (json.has("value"))
26980      res.setValueElement(parseString(json.get("value").getAsString()));
26981    if (json.has("_value"))
26982      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
26983  }
26984
26985  protected ValueSet.ConceptSetFilterComponent parseValueSetConceptSetFilterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
26986    ValueSet.ConceptSetFilterComponent res = new ValueSet.ConceptSetFilterComponent();
26987    parseValueSetConceptSetFilterComponentProperties(json, owner, res);
26988    return res;
26989  }
26990
26991  protected void parseValueSetConceptSetFilterComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptSetFilterComponent res) throws IOException, FHIRFormatError {
26992    parseBackboneElementProperties(json, res);
26993    if (json.has("property"))
26994      res.setPropertyElement(parseCode(json.get("property").getAsString()));
26995    if (json.has("_property"))
26996      parseElementProperties(json.getAsJsonObject("_property"), res.getPropertyElement());
26997    if (json.has("op"))
26998      res.setOpElement(parseEnumeration(json.get("op").getAsString(), ValueSet.FilterOperator.NULL, new ValueSet.FilterOperatorEnumFactory()));
26999    if (json.has("_op"))
27000      parseElementProperties(json.getAsJsonObject("_op"), res.getOpElement());
27001    if (json.has("value"))
27002      res.setValueElement(parseString(json.get("value").getAsString()));
27003    if (json.has("_value"))
27004      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
27005  }
27006
27007  protected ValueSet.ValueSetExpansionComponent parseValueSetValueSetExpansionComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27008    ValueSet.ValueSetExpansionComponent res = new ValueSet.ValueSetExpansionComponent();
27009    parseValueSetValueSetExpansionComponentProperties(json, owner, res);
27010    return res;
27011  }
27012
27013  protected void parseValueSetValueSetExpansionComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionComponent res) throws IOException, FHIRFormatError {
27014    parseBackboneElementProperties(json, res);
27015    if (json.has("identifier"))
27016      res.setIdentifierElement(parseUri(json.get("identifier").getAsString()));
27017    if (json.has("_identifier"))
27018      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
27019    if (json.has("timestamp"))
27020      res.setTimestampElement(parseDateTime(json.get("timestamp").getAsString()));
27021    if (json.has("_timestamp"))
27022      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
27023    if (json.has("total"))
27024      res.setTotalElement(parseInteger(json.get("total").getAsLong()));
27025    if (json.has("_total"))
27026      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
27027    if (json.has("offset"))
27028      res.setOffsetElement(parseInteger(json.get("offset").getAsLong()));
27029    if (json.has("_offset"))
27030      parseElementProperties(json.getAsJsonObject("_offset"), res.getOffsetElement());
27031    if (json.has("parameter")) {
27032      JsonArray array = json.getAsJsonArray("parameter");
27033      for (int i = 0; i < array.size(); i++) {
27034        res.getParameter().add(parseValueSetValueSetExpansionParameterComponent(array.get(i).getAsJsonObject(), owner));
27035      }
27036    };
27037    if (json.has("contains")) {
27038      JsonArray array = json.getAsJsonArray("contains");
27039      for (int i = 0; i < array.size(); i++) {
27040        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
27041      }
27042    };
27043  }
27044
27045  protected ValueSet.ValueSetExpansionParameterComponent parseValueSetValueSetExpansionParameterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27046    ValueSet.ValueSetExpansionParameterComponent res = new ValueSet.ValueSetExpansionParameterComponent();
27047    parseValueSetValueSetExpansionParameterComponentProperties(json, owner, res);
27048    return res;
27049  }
27050
27051  protected void parseValueSetValueSetExpansionParameterComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionParameterComponent res) throws IOException, FHIRFormatError {
27052    parseBackboneElementProperties(json, res);
27053    if (json.has("name"))
27054      res.setNameElement(parseString(json.get("name").getAsString()));
27055    if (json.has("_name"))
27056      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
27057    Type value = parseType("value", json);
27058    if (value != null)
27059      res.setValue(value);
27060  }
27061
27062  protected ValueSet.ValueSetExpansionContainsComponent parseValueSetValueSetExpansionContainsComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27063    ValueSet.ValueSetExpansionContainsComponent res = new ValueSet.ValueSetExpansionContainsComponent();
27064    parseValueSetValueSetExpansionContainsComponentProperties(json, owner, res);
27065    return res;
27066  }
27067
27068  protected void parseValueSetValueSetExpansionContainsComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionContainsComponent res) throws IOException, FHIRFormatError {
27069    parseBackboneElementProperties(json, res);
27070    if (json.has("system"))
27071      res.setSystemElement(parseUri(json.get("system").getAsString()));
27072    if (json.has("_system"))
27073      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
27074    if (json.has("abstract"))
27075      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
27076    if (json.has("_abstract"))
27077      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
27078    if (json.has("inactive"))
27079      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
27080    if (json.has("_inactive"))
27081      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
27082    if (json.has("version"))
27083      res.setVersionElement(parseString(json.get("version").getAsString()));
27084    if (json.has("_version"))
27085      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
27086    if (json.has("code"))
27087      res.setCodeElement(parseCode(json.get("code").getAsString()));
27088    if (json.has("_code"))
27089      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
27090    if (json.has("display"))
27091      res.setDisplayElement(parseString(json.get("display").getAsString()));
27092    if (json.has("_display"))
27093      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
27094    if (json.has("designation")) {
27095      JsonArray array = json.getAsJsonArray("designation");
27096      for (int i = 0; i < array.size(); i++) {
27097        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
27098      }
27099    };
27100    if (json.has("contains")) {
27101      JsonArray array = json.getAsJsonArray("contains");
27102      for (int i = 0; i < array.size(); i++) {
27103        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
27104      }
27105    };
27106  }
27107
27108  protected VerificationResult parseVerificationResult(JsonObject json) throws IOException, FHIRFormatError {
27109    VerificationResult res = new VerificationResult();
27110    parseVerificationResultProperties(json, res);
27111    return res;
27112  }
27113
27114  protected void parseVerificationResultProperties(JsonObject json, VerificationResult res) throws IOException, FHIRFormatError {
27115    parseDomainResourceProperties(json, res);
27116    if (json.has("target")) {
27117      JsonArray array = json.getAsJsonArray("target");
27118      for (int i = 0; i < array.size(); i++) {
27119        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
27120      }
27121    };
27122    if (json.has("targetLocation")) {
27123      JsonArray array = json.getAsJsonArray("targetLocation");
27124      for (int i = 0; i < array.size(); i++) {
27125        res.getTargetLocation().add(parseString(array.get(i).getAsString()));
27126      }
27127    };
27128    if (json.has("_targetLocation")) {
27129      JsonArray array = json.getAsJsonArray("_targetLocation");
27130      for (int i = 0; i < array.size(); i++) {
27131        if (i == res.getTargetLocation().size())
27132          res.getTargetLocation().add(parseString(null));
27133        if (array.get(i) instanceof JsonObject) 
27134          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetLocation().get(i));
27135      }
27136    };
27137    if (json.has("need"))
27138      res.setNeed(parseCodeableConcept(json.getAsJsonObject("need")));
27139    if (json.has("status"))
27140      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VerificationResult.Status.NULL, new VerificationResult.StatusEnumFactory()));
27141    if (json.has("_status"))
27142      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
27143    if (json.has("statusDate"))
27144      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
27145    if (json.has("_statusDate"))
27146      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
27147    if (json.has("validationType"))
27148      res.setValidationType(parseCodeableConcept(json.getAsJsonObject("validationType")));
27149    if (json.has("validationProcess")) {
27150      JsonArray array = json.getAsJsonArray("validationProcess");
27151      for (int i = 0; i < array.size(); i++) {
27152        res.getValidationProcess().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27153      }
27154    };
27155    if (json.has("frequency"))
27156      res.setFrequency(parseTiming(json.getAsJsonObject("frequency")));
27157    if (json.has("lastPerformed"))
27158      res.setLastPerformedElement(parseDateTime(json.get("lastPerformed").getAsString()));
27159    if (json.has("_lastPerformed"))
27160      parseElementProperties(json.getAsJsonObject("_lastPerformed"), res.getLastPerformedElement());
27161    if (json.has("nextScheduled"))
27162      res.setNextScheduledElement(parseDate(json.get("nextScheduled").getAsString()));
27163    if (json.has("_nextScheduled"))
27164      parseElementProperties(json.getAsJsonObject("_nextScheduled"), res.getNextScheduledElement());
27165    if (json.has("failureAction"))
27166      res.setFailureAction(parseCodeableConcept(json.getAsJsonObject("failureAction")));
27167    if (json.has("primarySource")) {
27168      JsonArray array = json.getAsJsonArray("primarySource");
27169      for (int i = 0; i < array.size(); i++) {
27170        res.getPrimarySource().add(parseVerificationResultVerificationResultPrimarySourceComponent(array.get(i).getAsJsonObject(), res));
27171      }
27172    };
27173    if (json.has("attestation"))
27174      res.setAttestation(parseVerificationResultVerificationResultAttestationComponent(json.getAsJsonObject("attestation"), res));
27175    if (json.has("validator")) {
27176      JsonArray array = json.getAsJsonArray("validator");
27177      for (int i = 0; i < array.size(); i++) {
27178        res.getValidator().add(parseVerificationResultVerificationResultValidatorComponent(array.get(i).getAsJsonObject(), res));
27179      }
27180    };
27181  }
27182
27183  protected VerificationResult.VerificationResultPrimarySourceComponent parseVerificationResultVerificationResultPrimarySourceComponent(JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
27184    VerificationResult.VerificationResultPrimarySourceComponent res = new VerificationResult.VerificationResultPrimarySourceComponent();
27185    parseVerificationResultVerificationResultPrimarySourceComponentProperties(json, owner, res);
27186    return res;
27187  }
27188
27189  protected void parseVerificationResultVerificationResultPrimarySourceComponentProperties(JsonObject json, VerificationResult owner, VerificationResult.VerificationResultPrimarySourceComponent res) throws IOException, FHIRFormatError {
27190    parseBackboneElementProperties(json, res);
27191    if (json.has("who"))
27192      res.setWho(parseReference(json.getAsJsonObject("who")));
27193    if (json.has("type")) {
27194      JsonArray array = json.getAsJsonArray("type");
27195      for (int i = 0; i < array.size(); i++) {
27196        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27197      }
27198    };
27199    if (json.has("communicationMethod")) {
27200      JsonArray array = json.getAsJsonArray("communicationMethod");
27201      for (int i = 0; i < array.size(); i++) {
27202        res.getCommunicationMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27203      }
27204    };
27205    if (json.has("validationStatus"))
27206      res.setValidationStatus(parseCodeableConcept(json.getAsJsonObject("validationStatus")));
27207    if (json.has("validationDate"))
27208      res.setValidationDateElement(parseDateTime(json.get("validationDate").getAsString()));
27209    if (json.has("_validationDate"))
27210      parseElementProperties(json.getAsJsonObject("_validationDate"), res.getValidationDateElement());
27211    if (json.has("canPushUpdates"))
27212      res.setCanPushUpdates(parseCodeableConcept(json.getAsJsonObject("canPushUpdates")));
27213    if (json.has("pushTypeAvailable")) {
27214      JsonArray array = json.getAsJsonArray("pushTypeAvailable");
27215      for (int i = 0; i < array.size(); i++) {
27216        res.getPushTypeAvailable().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27217      }
27218    };
27219  }
27220
27221  protected VerificationResult.VerificationResultAttestationComponent parseVerificationResultVerificationResultAttestationComponent(JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
27222    VerificationResult.VerificationResultAttestationComponent res = new VerificationResult.VerificationResultAttestationComponent();
27223    parseVerificationResultVerificationResultAttestationComponentProperties(json, owner, res);
27224    return res;
27225  }
27226
27227  protected void parseVerificationResultVerificationResultAttestationComponentProperties(JsonObject json, VerificationResult owner, VerificationResult.VerificationResultAttestationComponent res) throws IOException, FHIRFormatError {
27228    parseBackboneElementProperties(json, res);
27229    if (json.has("who"))
27230      res.setWho(parseReference(json.getAsJsonObject("who")));
27231    if (json.has("onBehalfOf"))
27232      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
27233    if (json.has("communicationMethod"))
27234      res.setCommunicationMethod(parseCodeableConcept(json.getAsJsonObject("communicationMethod")));
27235    if (json.has("date"))
27236      res.setDateElement(parseDate(json.get("date").getAsString()));
27237    if (json.has("_date"))
27238      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
27239    if (json.has("sourceIdentityCertificate"))
27240      res.setSourceIdentityCertificateElement(parseString(json.get("sourceIdentityCertificate").getAsString()));
27241    if (json.has("_sourceIdentityCertificate"))
27242      parseElementProperties(json.getAsJsonObject("_sourceIdentityCertificate"), res.getSourceIdentityCertificateElement());
27243    if (json.has("proxyIdentityCertificate"))
27244      res.setProxyIdentityCertificateElement(parseString(json.get("proxyIdentityCertificate").getAsString()));
27245    if (json.has("_proxyIdentityCertificate"))
27246      parseElementProperties(json.getAsJsonObject("_proxyIdentityCertificate"), res.getProxyIdentityCertificateElement());
27247    if (json.has("proxySignature"))
27248      res.setProxySignature(parseSignature(json.getAsJsonObject("proxySignature")));
27249    if (json.has("sourceSignature"))
27250      res.setSourceSignature(parseSignature(json.getAsJsonObject("sourceSignature")));
27251  }
27252
27253  protected VerificationResult.VerificationResultValidatorComponent parseVerificationResultVerificationResultValidatorComponent(JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
27254    VerificationResult.VerificationResultValidatorComponent res = new VerificationResult.VerificationResultValidatorComponent();
27255    parseVerificationResultVerificationResultValidatorComponentProperties(json, owner, res);
27256    return res;
27257  }
27258
27259  protected void parseVerificationResultVerificationResultValidatorComponentProperties(JsonObject json, VerificationResult owner, VerificationResult.VerificationResultValidatorComponent res) throws IOException, FHIRFormatError {
27260    parseBackboneElementProperties(json, res);
27261    if (json.has("organization"))
27262      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
27263    if (json.has("identityCertificate"))
27264      res.setIdentityCertificateElement(parseString(json.get("identityCertificate").getAsString()));
27265    if (json.has("_identityCertificate"))
27266      parseElementProperties(json.getAsJsonObject("_identityCertificate"), res.getIdentityCertificateElement());
27267    if (json.has("attestationSignature"))
27268      res.setAttestationSignature(parseSignature(json.getAsJsonObject("attestationSignature")));
27269  }
27270
27271  protected VisionPrescription parseVisionPrescription(JsonObject json) throws IOException, FHIRFormatError {
27272    VisionPrescription res = new VisionPrescription();
27273    parseVisionPrescriptionProperties(json, res);
27274    return res;
27275  }
27276
27277  protected void parseVisionPrescriptionProperties(JsonObject json, VisionPrescription res) throws IOException, FHIRFormatError {
27278    parseDomainResourceProperties(json, res);
27279    if (json.has("identifier")) {
27280      JsonArray array = json.getAsJsonArray("identifier");
27281      for (int i = 0; i < array.size(); i++) {
27282        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
27283      }
27284    };
27285    if (json.has("status"))
27286      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VisionPrescription.VisionStatus.NULL, new VisionPrescription.VisionStatusEnumFactory()));
27287    if (json.has("_status"))
27288      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
27289    if (json.has("created"))
27290      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
27291    if (json.has("_created"))
27292      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
27293    if (json.has("patient"))
27294      res.setPatient(parseReference(json.getAsJsonObject("patient")));
27295    if (json.has("encounter"))
27296      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
27297    if (json.has("dateWritten"))
27298      res.setDateWrittenElement(parseDateTime(json.get("dateWritten").getAsString()));
27299    if (json.has("_dateWritten"))
27300      parseElementProperties(json.getAsJsonObject("_dateWritten"), res.getDateWrittenElement());
27301    if (json.has("prescriber"))
27302      res.setPrescriber(parseReference(json.getAsJsonObject("prescriber")));
27303    if (json.has("lensSpecification")) {
27304      JsonArray array = json.getAsJsonArray("lensSpecification");
27305      for (int i = 0; i < array.size(); i++) {
27306        res.getLensSpecification().add(parseVisionPrescriptionVisionPrescriptionLensSpecificationComponent(array.get(i).getAsJsonObject(), res));
27307      }
27308    };
27309  }
27310
27311  protected VisionPrescription.VisionPrescriptionLensSpecificationComponent parseVisionPrescriptionVisionPrescriptionLensSpecificationComponent(JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
27312    VisionPrescription.VisionPrescriptionLensSpecificationComponent res = new VisionPrescription.VisionPrescriptionLensSpecificationComponent();
27313    parseVisionPrescriptionVisionPrescriptionLensSpecificationComponentProperties(json, owner, res);
27314    return res;
27315  }
27316
27317  protected void parseVisionPrescriptionVisionPrescriptionLensSpecificationComponentProperties(JsonObject json, VisionPrescription owner, VisionPrescription.VisionPrescriptionLensSpecificationComponent res) throws IOException, FHIRFormatError {
27318    parseBackboneElementProperties(json, res);
27319    if (json.has("product"))
27320      res.setProduct(parseCodeableConcept(json.getAsJsonObject("product")));
27321    if (json.has("eye"))
27322      res.setEyeElement(parseEnumeration(json.get("eye").getAsString(), VisionPrescription.VisionEyes.NULL, new VisionPrescription.VisionEyesEnumFactory()));
27323    if (json.has("_eye"))
27324      parseElementProperties(json.getAsJsonObject("_eye"), res.getEyeElement());
27325    if (json.has("sphere"))
27326      res.setSphereElement(parseDecimal(json.get("sphere").getAsBigDecimal()));
27327    if (json.has("_sphere"))
27328      parseElementProperties(json.getAsJsonObject("_sphere"), res.getSphereElement());
27329    if (json.has("cylinder"))
27330      res.setCylinderElement(parseDecimal(json.get("cylinder").getAsBigDecimal()));
27331    if (json.has("_cylinder"))
27332      parseElementProperties(json.getAsJsonObject("_cylinder"), res.getCylinderElement());
27333    if (json.has("axis"))
27334      res.setAxisElement(parseInteger(json.get("axis").getAsLong()));
27335    if (json.has("_axis"))
27336      parseElementProperties(json.getAsJsonObject("_axis"), res.getAxisElement());
27337    if (json.has("prism")) {
27338      JsonArray array = json.getAsJsonArray("prism");
27339      for (int i = 0; i < array.size(); i++) {
27340        res.getPrism().add(parseVisionPrescriptionPrismComponent(array.get(i).getAsJsonObject(), owner));
27341      }
27342    };
27343    if (json.has("add"))
27344      res.setAddElement(parseDecimal(json.get("add").getAsBigDecimal()));
27345    if (json.has("_add"))
27346      parseElementProperties(json.getAsJsonObject("_add"), res.getAddElement());
27347    if (json.has("power"))
27348      res.setPowerElement(parseDecimal(json.get("power").getAsBigDecimal()));
27349    if (json.has("_power"))
27350      parseElementProperties(json.getAsJsonObject("_power"), res.getPowerElement());
27351    if (json.has("backCurve"))
27352      res.setBackCurveElement(parseDecimal(json.get("backCurve").getAsBigDecimal()));
27353    if (json.has("_backCurve"))
27354      parseElementProperties(json.getAsJsonObject("_backCurve"), res.getBackCurveElement());
27355    if (json.has("diameter"))
27356      res.setDiameterElement(parseDecimal(json.get("diameter").getAsBigDecimal()));
27357    if (json.has("_diameter"))
27358      parseElementProperties(json.getAsJsonObject("_diameter"), res.getDiameterElement());
27359    if (json.has("duration"))
27360      res.setDuration(parseQuantity(json.getAsJsonObject("duration")));
27361    if (json.has("color"))
27362      res.setColorElement(parseString(json.get("color").getAsString()));
27363    if (json.has("_color"))
27364      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
27365    if (json.has("brand"))
27366      res.setBrandElement(parseString(json.get("brand").getAsString()));
27367    if (json.has("_brand"))
27368      parseElementProperties(json.getAsJsonObject("_brand"), res.getBrandElement());
27369    if (json.has("note")) {
27370      JsonArray array = json.getAsJsonArray("note");
27371      for (int i = 0; i < array.size(); i++) {
27372        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
27373      }
27374    };
27375  }
27376
27377  protected VisionPrescription.PrismComponent parseVisionPrescriptionPrismComponent(JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
27378    VisionPrescription.PrismComponent res = new VisionPrescription.PrismComponent();
27379    parseVisionPrescriptionPrismComponentProperties(json, owner, res);
27380    return res;
27381  }
27382
27383  protected void parseVisionPrescriptionPrismComponentProperties(JsonObject json, VisionPrescription owner, VisionPrescription.PrismComponent res) throws IOException, FHIRFormatError {
27384    parseBackboneElementProperties(json, res);
27385    if (json.has("amount"))
27386      res.setAmountElement(parseDecimal(json.get("amount").getAsBigDecimal()));
27387    if (json.has("_amount"))
27388      parseElementProperties(json.getAsJsonObject("_amount"), res.getAmountElement());
27389    if (json.has("base"))
27390      res.setBaseElement(parseEnumeration(json.get("base").getAsString(), VisionPrescription.VisionBase.NULL, new VisionPrescription.VisionBaseEnumFactory()));
27391    if (json.has("_base"))
27392      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
27393  }
27394
27395  @Override
27396  protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
27397    String t = json.get("resourceType").getAsString();
27398    if (Utilities.noString(t))
27399      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
27400    if (t.equals("Parameters"))
27401      return parseParameters(json);
27402    else if (t.equals("Account"))
27403      return parseAccount(json);
27404    else if (t.equals("ActivityDefinition"))
27405      return parseActivityDefinition(json);
27406    else if (t.equals("AdverseEvent"))
27407      return parseAdverseEvent(json);
27408    else if (t.equals("AllergyIntolerance"))
27409      return parseAllergyIntolerance(json);
27410    else if (t.equals("Appointment"))
27411      return parseAppointment(json);
27412    else if (t.equals("AppointmentResponse"))
27413      return parseAppointmentResponse(json);
27414    else if (t.equals("AuditEvent"))
27415      return parseAuditEvent(json);
27416    else if (t.equals("Basic"))
27417      return parseBasic(json);
27418    else if (t.equals("Binary"))
27419      return parseBinary(json);
27420    else if (t.equals("BiologicallyDerivedProduct"))
27421      return parseBiologicallyDerivedProduct(json);
27422    else if (t.equals("BodyStructure"))
27423      return parseBodyStructure(json);
27424    else if (t.equals("Bundle"))
27425      return parseBundle(json);
27426    else if (t.equals("CapabilityStatement"))
27427      return parseCapabilityStatement(json);
27428    else if (t.equals("CarePlan"))
27429      return parseCarePlan(json);
27430    else if (t.equals("CareTeam"))
27431      return parseCareTeam(json);
27432    else if (t.equals("CatalogEntry"))
27433      return parseCatalogEntry(json);
27434    else if (t.equals("ChargeItem"))
27435      return parseChargeItem(json);
27436    else if (t.equals("ChargeItemDefinition"))
27437      return parseChargeItemDefinition(json);
27438    else if (t.equals("Claim"))
27439      return parseClaim(json);
27440    else if (t.equals("ClaimResponse"))
27441      return parseClaimResponse(json);
27442    else if (t.equals("ClinicalImpression"))
27443      return parseClinicalImpression(json);
27444    else if (t.equals("CodeSystem"))
27445      return parseCodeSystem(json);
27446    else if (t.equals("Communication"))
27447      return parseCommunication(json);
27448    else if (t.equals("CommunicationRequest"))
27449      return parseCommunicationRequest(json);
27450    else if (t.equals("CompartmentDefinition"))
27451      return parseCompartmentDefinition(json);
27452    else if (t.equals("Composition"))
27453      return parseComposition(json);
27454    else if (t.equals("ConceptMap"))
27455      return parseConceptMap(json);
27456    else if (t.equals("Condition"))
27457      return parseCondition(json);
27458    else if (t.equals("Consent"))
27459      return parseConsent(json);
27460    else if (t.equals("Contract"))
27461      return parseContract(json);
27462    else if (t.equals("Coverage"))
27463      return parseCoverage(json);
27464    else if (t.equals("CoverageEligibilityRequest"))
27465      return parseCoverageEligibilityRequest(json);
27466    else if (t.equals("CoverageEligibilityResponse"))
27467      return parseCoverageEligibilityResponse(json);
27468    else if (t.equals("DetectedIssue"))
27469      return parseDetectedIssue(json);
27470    else if (t.equals("Device"))
27471      return parseDevice(json);
27472    else if (t.equals("DeviceDefinition"))
27473      return parseDeviceDefinition(json);
27474    else if (t.equals("DeviceMetric"))
27475      return parseDeviceMetric(json);
27476    else if (t.equals("DeviceRequest"))
27477      return parseDeviceRequest(json);
27478    else if (t.equals("DeviceUseStatement"))
27479      return parseDeviceUseStatement(json);
27480    else if (t.equals("DiagnosticReport"))
27481      return parseDiagnosticReport(json);
27482    else if (t.equals("DocumentManifest"))
27483      return parseDocumentManifest(json);
27484    else if (t.equals("DocumentReference"))
27485      return parseDocumentReference(json);
27486    else if (t.equals("EffectEvidenceSynthesis"))
27487      return parseEffectEvidenceSynthesis(json);
27488    else if (t.equals("Encounter"))
27489      return parseEncounter(json);
27490    else if (t.equals("Endpoint"))
27491      return parseEndpoint(json);
27492    else if (t.equals("EnrollmentRequest"))
27493      return parseEnrollmentRequest(json);
27494    else if (t.equals("EnrollmentResponse"))
27495      return parseEnrollmentResponse(json);
27496    else if (t.equals("EpisodeOfCare"))
27497      return parseEpisodeOfCare(json);
27498    else if (t.equals("EventDefinition"))
27499      return parseEventDefinition(json);
27500    else if (t.equals("Evidence"))
27501      return parseEvidence(json);
27502    else if (t.equals("EvidenceVariable"))
27503      return parseEvidenceVariable(json);
27504    else if (t.equals("ExampleScenario"))
27505      return parseExampleScenario(json);
27506    else if (t.equals("ExplanationOfBenefit"))
27507      return parseExplanationOfBenefit(json);
27508    else if (t.equals("FamilyMemberHistory"))
27509      return parseFamilyMemberHistory(json);
27510    else if (t.equals("Flag"))
27511      return parseFlag(json);
27512    else if (t.equals("Goal"))
27513      return parseGoal(json);
27514    else if (t.equals("GraphDefinition"))
27515      return parseGraphDefinition(json);
27516    else if (t.equals("Group"))
27517      return parseGroup(json);
27518    else if (t.equals("GuidanceResponse"))
27519      return parseGuidanceResponse(json);
27520    else if (t.equals("HealthcareService"))
27521      return parseHealthcareService(json);
27522    else if (t.equals("ImagingStudy"))
27523      return parseImagingStudy(json);
27524    else if (t.equals("Immunization"))
27525      return parseImmunization(json);
27526    else if (t.equals("ImmunizationEvaluation"))
27527      return parseImmunizationEvaluation(json);
27528    else if (t.equals("ImmunizationRecommendation"))
27529      return parseImmunizationRecommendation(json);
27530    else if (t.equals("ImplementationGuide"))
27531      return parseImplementationGuide(json);
27532    else if (t.equals("InsurancePlan"))
27533      return parseInsurancePlan(json);
27534    else if (t.equals("Invoice"))
27535      return parseInvoice(json);
27536    else if (t.equals("Library"))
27537      return parseLibrary(json);
27538    else if (t.equals("Linkage"))
27539      return parseLinkage(json);
27540    else if (t.equals("List"))
27541      return parseListResource(json);
27542    else if (t.equals("Location"))
27543      return parseLocation(json);
27544    else if (t.equals("Measure"))
27545      return parseMeasure(json);
27546    else if (t.equals("MeasureReport"))
27547      return parseMeasureReport(json);
27548    else if (t.equals("Media"))
27549      return parseMedia(json);
27550    else if (t.equals("Medication"))
27551      return parseMedication(json);
27552    else if (t.equals("MedicationAdministration"))
27553      return parseMedicationAdministration(json);
27554    else if (t.equals("MedicationDispense"))
27555      return parseMedicationDispense(json);
27556    else if (t.equals("MedicationKnowledge"))
27557      return parseMedicationKnowledge(json);
27558    else if (t.equals("MedicationRequest"))
27559      return parseMedicationRequest(json);
27560    else if (t.equals("MedicationStatement"))
27561      return parseMedicationStatement(json);
27562    else if (t.equals("MedicinalProduct"))
27563      return parseMedicinalProduct(json);
27564    else if (t.equals("MedicinalProductAuthorization"))
27565      return parseMedicinalProductAuthorization(json);
27566    else if (t.equals("MedicinalProductContraindication"))
27567      return parseMedicinalProductContraindication(json);
27568    else if (t.equals("MedicinalProductIndication"))
27569      return parseMedicinalProductIndication(json);
27570    else if (t.equals("MedicinalProductIngredient"))
27571      return parseMedicinalProductIngredient(json);
27572    else if (t.equals("MedicinalProductInteraction"))
27573      return parseMedicinalProductInteraction(json);
27574    else if (t.equals("MedicinalProductManufactured"))
27575      return parseMedicinalProductManufactured(json);
27576    else if (t.equals("MedicinalProductPackaged"))
27577      return parseMedicinalProductPackaged(json);
27578    else if (t.equals("MedicinalProductPharmaceutical"))
27579      return parseMedicinalProductPharmaceutical(json);
27580    else if (t.equals("MedicinalProductUndesirableEffect"))
27581      return parseMedicinalProductUndesirableEffect(json);
27582    else if (t.equals("MessageDefinition"))
27583      return parseMessageDefinition(json);
27584    else if (t.equals("MessageHeader"))
27585      return parseMessageHeader(json);
27586    else if (t.equals("MolecularSequence"))
27587      return parseMolecularSequence(json);
27588    else if (t.equals("NamingSystem"))
27589      return parseNamingSystem(json);
27590    else if (t.equals("NutritionOrder"))
27591      return parseNutritionOrder(json);
27592    else if (t.equals("Observation"))
27593      return parseObservation(json);
27594    else if (t.equals("ObservationDefinition"))
27595      return parseObservationDefinition(json);
27596    else if (t.equals("OperationDefinition"))
27597      return parseOperationDefinition(json);
27598    else if (t.equals("OperationOutcome"))
27599      return parseOperationOutcome(json);
27600    else if (t.equals("Organization"))
27601      return parseOrganization(json);
27602    else if (t.equals("OrganizationAffiliation"))
27603      return parseOrganizationAffiliation(json);
27604    else if (t.equals("Patient"))
27605      return parsePatient(json);
27606    else if (t.equals("PaymentNotice"))
27607      return parsePaymentNotice(json);
27608    else if (t.equals("PaymentReconciliation"))
27609      return parsePaymentReconciliation(json);
27610    else if (t.equals("Person"))
27611      return parsePerson(json);
27612    else if (t.equals("PlanDefinition"))
27613      return parsePlanDefinition(json);
27614    else if (t.equals("Practitioner"))
27615      return parsePractitioner(json);
27616    else if (t.equals("PractitionerRole"))
27617      return parsePractitionerRole(json);
27618    else if (t.equals("Procedure"))
27619      return parseProcedure(json);
27620    else if (t.equals("Provenance"))
27621      return parseProvenance(json);
27622    else if (t.equals("Questionnaire"))
27623      return parseQuestionnaire(json);
27624    else if (t.equals("QuestionnaireResponse"))
27625      return parseQuestionnaireResponse(json);
27626    else if (t.equals("RelatedPerson"))
27627      return parseRelatedPerson(json);
27628    else if (t.equals("RequestGroup"))
27629      return parseRequestGroup(json);
27630    else if (t.equals("ResearchDefinition"))
27631      return parseResearchDefinition(json);
27632    else if (t.equals("ResearchElementDefinition"))
27633      return parseResearchElementDefinition(json);
27634    else if (t.equals("ResearchStudy"))
27635      return parseResearchStudy(json);
27636    else if (t.equals("ResearchSubject"))
27637      return parseResearchSubject(json);
27638    else if (t.equals("RiskAssessment"))
27639      return parseRiskAssessment(json);
27640    else if (t.equals("RiskEvidenceSynthesis"))
27641      return parseRiskEvidenceSynthesis(json);
27642    else if (t.equals("Schedule"))
27643      return parseSchedule(json);
27644    else if (t.equals("SearchParameter"))
27645      return parseSearchParameter(json);
27646    else if (t.equals("ServiceRequest"))
27647      return parseServiceRequest(json);
27648    else if (t.equals("Slot"))
27649      return parseSlot(json);
27650    else if (t.equals("Specimen"))
27651      return parseSpecimen(json);
27652    else if (t.equals("SpecimenDefinition"))
27653      return parseSpecimenDefinition(json);
27654    else if (t.equals("StructureDefinition"))
27655      return parseStructureDefinition(json);
27656    else if (t.equals("StructureMap"))
27657      return parseStructureMap(json);
27658    else if (t.equals("Subscription"))
27659      return parseSubscription(json);
27660    else if (t.equals("Substance"))
27661      return parseSubstance(json);
27662    else if (t.equals("SubstanceNucleicAcid"))
27663      return parseSubstanceNucleicAcid(json);
27664    else if (t.equals("SubstancePolymer"))
27665      return parseSubstancePolymer(json);
27666    else if (t.equals("SubstanceProtein"))
27667      return parseSubstanceProtein(json);
27668    else if (t.equals("SubstanceReferenceInformation"))
27669      return parseSubstanceReferenceInformation(json);
27670    else if (t.equals("SubstanceSourceMaterial"))
27671      return parseSubstanceSourceMaterial(json);
27672    else if (t.equals("SubstanceSpecification"))
27673      return parseSubstanceSpecification(json);
27674    else if (t.equals("SupplyDelivery"))
27675      return parseSupplyDelivery(json);
27676    else if (t.equals("SupplyRequest"))
27677      return parseSupplyRequest(json);
27678    else if (t.equals("Task"))
27679      return parseTask(json);
27680    else if (t.equals("TerminologyCapabilities"))
27681      return parseTerminologyCapabilities(json);
27682    else if (t.equals("TestReport"))
27683      return parseTestReport(json);
27684    else if (t.equals("TestScript"))
27685      return parseTestScript(json);
27686    else if (t.equals("ValueSet"))
27687      return parseValueSet(json);
27688    else if (t.equals("VerificationResult"))
27689      return parseVerificationResult(json);
27690    else if (t.equals("VisionPrescription"))
27691      return parseVisionPrescription(json);
27692    else if (t.equals("Binary"))
27693      return parseBinary(json);
27694    throw new FHIRFormatError("Unknown.Unrecognised resource type '"+t+"' (in property 'resourceType')");
27695  }
27696
27697  protected Type parseType(String prefix, JsonObject json) throws IOException, FHIRFormatError {
27698    if (json.has(prefix+"Extension"))
27699      return parseExtension(json.getAsJsonObject(prefix+"Extension"));
27700    else if (json.has(prefix+"Narrative"))
27701      return parseNarrative(json.getAsJsonObject(prefix+"Narrative"));
27702    else if (json.has(prefix+"Meta"))
27703      return parseMeta(json.getAsJsonObject(prefix+"Meta"));
27704    else if (json.has(prefix+"Address"))
27705      return parseAddress(json.getAsJsonObject(prefix+"Address"));
27706    else if (json.has(prefix+"Contributor"))
27707      return parseContributor(json.getAsJsonObject(prefix+"Contributor"));
27708    else if (json.has(prefix+"Attachment"))
27709      return parseAttachment(json.getAsJsonObject(prefix+"Attachment"));
27710    else if (json.has(prefix+"Count"))
27711      return parseCount(json.getAsJsonObject(prefix+"Count"));
27712    else if (json.has(prefix+"DataRequirement"))
27713      return parseDataRequirement(json.getAsJsonObject(prefix+"DataRequirement"));
27714    else if (json.has(prefix+"Dosage"))
27715      return parseDosage(json.getAsJsonObject(prefix+"Dosage"));
27716    else if (json.has(prefix+"Money"))
27717      return parseMoney(json.getAsJsonObject(prefix+"Money"));
27718    else if (json.has(prefix+"HumanName"))
27719      return parseHumanName(json.getAsJsonObject(prefix+"HumanName"));
27720    else if (json.has(prefix+"ContactPoint"))
27721      return parseContactPoint(json.getAsJsonObject(prefix+"ContactPoint"));
27722    else if (json.has(prefix+"MarketingStatus"))
27723      return parseMarketingStatus(json.getAsJsonObject(prefix+"MarketingStatus"));
27724    else if (json.has(prefix+"Identifier"))
27725      return parseIdentifier(json.getAsJsonObject(prefix+"Identifier"));
27726    else if (json.has(prefix+"SubstanceAmount"))
27727      return parseSubstanceAmount(json.getAsJsonObject(prefix+"SubstanceAmount"));
27728    else if (json.has(prefix+"Coding"))
27729      return parseCoding(json.getAsJsonObject(prefix+"Coding"));
27730    else if (json.has(prefix+"SampledData"))
27731      return parseSampledData(json.getAsJsonObject(prefix+"SampledData"));
27732    else if (json.has(prefix+"Population"))
27733      return parsePopulation(json.getAsJsonObject(prefix+"Population"));
27734    else if (json.has(prefix+"Ratio"))
27735      return parseRatio(json.getAsJsonObject(prefix+"Ratio"));
27736    else if (json.has(prefix+"Distance"))
27737      return parseDistance(json.getAsJsonObject(prefix+"Distance"));
27738    else if (json.has(prefix+"Age"))
27739      return parseAge(json.getAsJsonObject(prefix+"Age"));
27740    else if (json.has(prefix+"Reference"))
27741      return parseReference(json.getAsJsonObject(prefix+"Reference"));
27742    else if (json.has(prefix+"TriggerDefinition"))
27743      return parseTriggerDefinition(json.getAsJsonObject(prefix+"TriggerDefinition"));
27744    else if (json.has(prefix+"Quantity"))
27745      return parseQuantity(json.getAsJsonObject(prefix+"Quantity"));
27746    else if (json.has(prefix+"Period"))
27747      return parsePeriod(json.getAsJsonObject(prefix+"Period"));
27748    else if (json.has(prefix+"Duration"))
27749      return parseDuration(json.getAsJsonObject(prefix+"Duration"));
27750    else if (json.has(prefix+"Range"))
27751      return parseRange(json.getAsJsonObject(prefix+"Range"));
27752    else if (json.has(prefix+"RelatedArtifact"))
27753      return parseRelatedArtifact(json.getAsJsonObject(prefix+"RelatedArtifact"));
27754    else if (json.has(prefix+"Annotation"))
27755      return parseAnnotation(json.getAsJsonObject(prefix+"Annotation"));
27756    else if (json.has(prefix+"ProductShelfLife"))
27757      return parseProductShelfLife(json.getAsJsonObject(prefix+"ProductShelfLife"));
27758    else if (json.has(prefix+"ContactDetail"))
27759      return parseContactDetail(json.getAsJsonObject(prefix+"ContactDetail"));
27760    else if (json.has(prefix+"UsageContext"))
27761      return parseUsageContext(json.getAsJsonObject(prefix+"UsageContext"));
27762    else if (json.has(prefix+"Expression"))
27763      return parseExpression(json.getAsJsonObject(prefix+"Expression"));
27764    else if (json.has(prefix+"Signature"))
27765      return parseSignature(json.getAsJsonObject(prefix+"Signature"));
27766    else if (json.has(prefix+"Timing"))
27767      return parseTiming(json.getAsJsonObject(prefix+"Timing"));
27768    else if (json.has(prefix+"ProdCharacteristic"))
27769      return parseProdCharacteristic(json.getAsJsonObject(prefix+"ProdCharacteristic"));
27770    else if (json.has(prefix+"CodeableConcept"))
27771      return parseCodeableConcept(json.getAsJsonObject(prefix+"CodeableConcept"));
27772    else if (json.has(prefix+"ParameterDefinition"))
27773      return parseParameterDefinition(json.getAsJsonObject(prefix+"ParameterDefinition"));
27774    else if (json.has(prefix+"Date") || json.has("_"+prefix+"Date")) {
27775      Type t = json.has(prefix+"Date") ? parseDate(json.get(prefix+"Date").getAsString()) : new DateType();
27776      if (json.has("_"+prefix+"Date"))
27777        parseElementProperties(json.getAsJsonObject("_"+prefix+"Date"), t);
27778      return t;
27779    }
27780    else if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime")) {
27781      Type t = json.has(prefix+"DateTime") ? parseDateTime(json.get(prefix+"DateTime").getAsString()) : new DateTimeType();
27782      if (json.has("_"+prefix+"DateTime"))
27783        parseElementProperties(json.getAsJsonObject("_"+prefix+"DateTime"), t);
27784      return t;
27785    }
27786    else if (json.has(prefix+"Code") || json.has("_"+prefix+"Code")) {
27787      Type t = json.has(prefix+"Code") ? parseCode(json.get(prefix+"Code").getAsString()) : new CodeType();
27788      if (json.has("_"+prefix+"Code"))
27789        parseElementProperties(json.getAsJsonObject("_"+prefix+"Code"), t);
27790      return t;
27791    }
27792    else if (json.has(prefix+"String") || json.has("_"+prefix+"String")) {
27793      Type t = json.has(prefix+"String") ? parseString(json.get(prefix+"String").getAsString()) : new StringType();
27794      if (json.has("_"+prefix+"String"))
27795        parseElementProperties(json.getAsJsonObject("_"+prefix+"String"), t);
27796      return t;
27797    }
27798    else if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer")) {
27799      Type t = json.has(prefix+"Integer") ? parseInteger(json.get(prefix+"Integer").getAsLong()) : new IntegerType();
27800      if (json.has("_"+prefix+"Integer"))
27801        parseElementProperties(json.getAsJsonObject("_"+prefix+"Integer"), t);
27802      return t;
27803    }
27804    else if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid")) {
27805      Type t = json.has(prefix+"Oid") ? parseOid(json.get(prefix+"Oid").getAsString()) : new OidType();
27806      if (json.has("_"+prefix+"Oid"))
27807        parseElementProperties(json.getAsJsonObject("_"+prefix+"Oid"), t);
27808      return t;
27809    }
27810    else if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical")) {
27811      Type t = json.has(prefix+"Canonical") ? parseCanonical(json.get(prefix+"Canonical").getAsString()) : new CanonicalType();
27812      if (json.has("_"+prefix+"Canonical"))
27813        parseElementProperties(json.getAsJsonObject("_"+prefix+"Canonical"), t);
27814      return t;
27815    }
27816    else if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri")) {
27817      Type t = json.has(prefix+"Uri") ? parseUri(json.get(prefix+"Uri").getAsString()) : new UriType();
27818      if (json.has("_"+prefix+"Uri"))
27819        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uri"), t);
27820      return t;
27821    }
27822    else if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid")) {
27823      Type t = json.has(prefix+"Uuid") ? parseUuid(json.get(prefix+"Uuid").getAsString()) : new UuidType();
27824      if (json.has("_"+prefix+"Uuid"))
27825        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uuid"), t);
27826      return t;
27827    }
27828    else if (json.has(prefix+"Url") || json.has("_"+prefix+"Url")) {
27829      Type t = json.has(prefix+"Url") ? parseUrl(json.get(prefix+"Url").getAsString()) : new UrlType();
27830      if (json.has("_"+prefix+"Url"))
27831        parseElementProperties(json.getAsJsonObject("_"+prefix+"Url"), t);
27832      return t;
27833    }
27834    else if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant")) {
27835      Type t = json.has(prefix+"Instant") ? parseInstant(json.get(prefix+"Instant").getAsString()) : new InstantType();
27836      if (json.has("_"+prefix+"Instant"))
27837        parseElementProperties(json.getAsJsonObject("_"+prefix+"Instant"), t);
27838      return t;
27839    }
27840    else if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean")) {
27841      Type t = json.has(prefix+"Boolean") ? parseBoolean(json.get(prefix+"Boolean").getAsBoolean()) : new BooleanType();
27842      if (json.has("_"+prefix+"Boolean"))
27843        parseElementProperties(json.getAsJsonObject("_"+prefix+"Boolean"), t);
27844      return t;
27845    }
27846    else if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary")) {
27847      Type t = json.has(prefix+"Base64Binary") ? parseBase64Binary(json.get(prefix+"Base64Binary").getAsString()) : new Base64BinaryType();
27848      if (json.has("_"+prefix+"Base64Binary"))
27849        parseElementProperties(json.getAsJsonObject("_"+prefix+"Base64Binary"), t);
27850      return t;
27851    }
27852    else if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt")) {
27853      Type t = json.has(prefix+"UnsignedInt") ? parseUnsignedInt(json.get(prefix+"UnsignedInt").getAsString()) : new UnsignedIntType();
27854      if (json.has("_"+prefix+"UnsignedInt"))
27855        parseElementProperties(json.getAsJsonObject("_"+prefix+"UnsignedInt"), t);
27856      return t;
27857    }
27858    else if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown")) {
27859      Type t = json.has(prefix+"Markdown") ? parseMarkdown(json.get(prefix+"Markdown").getAsString()) : new MarkdownType();
27860      if (json.has("_"+prefix+"Markdown"))
27861        parseElementProperties(json.getAsJsonObject("_"+prefix+"Markdown"), t);
27862      return t;
27863    }
27864    else if (json.has(prefix+"Time") || json.has("_"+prefix+"Time")) {
27865      Type t = json.has(prefix+"Time") ? parseTime(json.get(prefix+"Time").getAsString()) : new TimeType();
27866      if (json.has("_"+prefix+"Time"))
27867        parseElementProperties(json.getAsJsonObject("_"+prefix+"Time"), t);
27868      return t;
27869    }
27870    else if (json.has(prefix+"Id") || json.has("_"+prefix+"Id")) {
27871      Type t = json.has(prefix+"Id") ? parseId(json.get(prefix+"Id").getAsString()) : new IdType();
27872      if (json.has("_"+prefix+"Id"))
27873        parseElementProperties(json.getAsJsonObject("_"+prefix+"Id"), t);
27874      return t;
27875    }
27876    else if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt")) {
27877      Type t = json.has(prefix+"PositiveInt") ? parsePositiveInt(json.get(prefix+"PositiveInt").getAsString()) : new PositiveIntType();
27878      if (json.has("_"+prefix+"PositiveInt"))
27879        parseElementProperties(json.getAsJsonObject("_"+prefix+"PositiveInt"), t);
27880      return t;
27881    }
27882    else if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal")) {
27883      Type t = json.has(prefix+"Decimal") ? parseDecimal(json.get(prefix+"Decimal").getAsBigDecimal()) : new DecimalType();
27884      if (json.has("_"+prefix+"Decimal"))
27885        parseElementProperties(json.getAsJsonObject("_"+prefix+"Decimal"), t);
27886      return t;
27887    }
27888    return null;
27889  }
27890
27891  protected Type parseType(JsonObject json, String type) throws IOException, FHIRFormatError {
27892    if (type.equals("Extension"))
27893      return parseExtension(json);
27894    else if (type.equals("Narrative"))
27895      return parseNarrative(json);
27896    else if (type.equals("Meta"))
27897      return parseMeta(json);
27898    else if (type.equals("Address"))
27899      return parseAddress(json);
27900    else if (type.equals("Contributor"))
27901      return parseContributor(json);
27902    else if (type.equals("Attachment"))
27903      return parseAttachment(json);
27904    else if (type.equals("Count"))
27905      return parseCount(json);
27906    else if (type.equals("DataRequirement"))
27907      return parseDataRequirement(json);
27908    else if (type.equals("Dosage"))
27909      return parseDosage(json);
27910    else if (type.equals("Money"))
27911      return parseMoney(json);
27912    else if (type.equals("HumanName"))
27913      return parseHumanName(json);
27914    else if (type.equals("ContactPoint"))
27915      return parseContactPoint(json);
27916    else if (type.equals("MarketingStatus"))
27917      return parseMarketingStatus(json);
27918    else if (type.equals("Identifier"))
27919      return parseIdentifier(json);
27920    else if (type.equals("SubstanceAmount"))
27921      return parseSubstanceAmount(json);
27922    else if (type.equals("Coding"))
27923      return parseCoding(json);
27924    else if (type.equals("SampledData"))
27925      return parseSampledData(json);
27926    else if (type.equals("Population"))
27927      return parsePopulation(json);
27928    else if (type.equals("Ratio"))
27929      return parseRatio(json);
27930    else if (type.equals("Distance"))
27931      return parseDistance(json);
27932    else if (type.equals("Age"))
27933      return parseAge(json);
27934    else if (type.equals("Reference"))
27935      return parseReference(json);
27936    else if (type.equals("TriggerDefinition"))
27937      return parseTriggerDefinition(json);
27938    else if (type.equals("Quantity"))
27939      return parseQuantity(json);
27940    else if (type.equals("Period"))
27941      return parsePeriod(json);
27942    else if (type.equals("Duration"))
27943      return parseDuration(json);
27944    else if (type.equals("Range"))
27945      return parseRange(json);
27946    else if (type.equals("RelatedArtifact"))
27947      return parseRelatedArtifact(json);
27948    else if (type.equals("Annotation"))
27949      return parseAnnotation(json);
27950    else if (type.equals("ProductShelfLife"))
27951      return parseProductShelfLife(json);
27952    else if (type.equals("ContactDetail"))
27953      return parseContactDetail(json);
27954    else if (type.equals("UsageContext"))
27955      return parseUsageContext(json);
27956    else if (type.equals("Expression"))
27957      return parseExpression(json);
27958    else if (type.equals("Signature"))
27959      return parseSignature(json);
27960    else if (type.equals("Timing"))
27961      return parseTiming(json);
27962    else if (type.equals("ProdCharacteristic"))
27963      return parseProdCharacteristic(json);
27964    else if (type.equals("CodeableConcept"))
27965      return parseCodeableConcept(json);
27966    else if (type.equals("ParameterDefinition"))
27967      return parseParameterDefinition(json);
27968    throw new FHIRFormatError("Unknown Type "+type);
27969  }
27970
27971  protected boolean hasTypeName(JsonObject json, String prefix) {
27972        if (json.has(prefix+"Extension"))
27973      return true;
27974    if (json.has(prefix+"Narrative"))
27975      return true;
27976    if (json.has(prefix+"Meta"))
27977      return true;
27978    if (json.has(prefix+"Address"))
27979      return true;
27980    if (json.has(prefix+"Contributor"))
27981      return true;
27982    if (json.has(prefix+"Attachment"))
27983      return true;
27984    if (json.has(prefix+"Count"))
27985      return true;
27986    if (json.has(prefix+"DataRequirement"))
27987      return true;
27988    if (json.has(prefix+"Dosage"))
27989      return true;
27990    if (json.has(prefix+"Money"))
27991      return true;
27992    if (json.has(prefix+"HumanName"))
27993      return true;
27994    if (json.has(prefix+"ContactPoint"))
27995      return true;
27996    if (json.has(prefix+"MarketingStatus"))
27997      return true;
27998    if (json.has(prefix+"Identifier"))
27999      return true;
28000    if (json.has(prefix+"SubstanceAmount"))
28001      return true;
28002    if (json.has(prefix+"Coding"))
28003      return true;
28004    if (json.has(prefix+"SampledData"))
28005      return true;
28006    if (json.has(prefix+"Population"))
28007      return true;
28008    if (json.has(prefix+"Ratio"))
28009      return true;
28010    if (json.has(prefix+"Distance"))
28011      return true;
28012    if (json.has(prefix+"Age"))
28013      return true;
28014    if (json.has(prefix+"Reference"))
28015      return true;
28016    if (json.has(prefix+"TriggerDefinition"))
28017      return true;
28018    if (json.has(prefix+"Quantity"))
28019      return true;
28020    if (json.has(prefix+"Period"))
28021      return true;
28022    if (json.has(prefix+"Duration"))
28023      return true;
28024    if (json.has(prefix+"Range"))
28025      return true;
28026    if (json.has(prefix+"RelatedArtifact"))
28027      return true;
28028    if (json.has(prefix+"Annotation"))
28029      return true;
28030    if (json.has(prefix+"ProductShelfLife"))
28031      return true;
28032    if (json.has(prefix+"ContactDetail"))
28033      return true;
28034    if (json.has(prefix+"UsageContext"))
28035      return true;
28036    if (json.has(prefix+"Expression"))
28037      return true;
28038    if (json.has(prefix+"Signature"))
28039      return true;
28040    if (json.has(prefix+"Timing"))
28041      return true;
28042    if (json.has(prefix+"ProdCharacteristic"))
28043      return true;
28044    if (json.has(prefix+"CodeableConcept"))
28045      return true;
28046    if (json.has(prefix+"ParameterDefinition"))
28047      return true;
28048    if (json.has(prefix+"Parameters"))
28049      return true;
28050    if (json.has(prefix+"Account"))
28051      return true;
28052    if (json.has(prefix+"ActivityDefinition"))
28053      return true;
28054    if (json.has(prefix+"AdverseEvent"))
28055      return true;
28056    if (json.has(prefix+"AllergyIntolerance"))
28057      return true;
28058    if (json.has(prefix+"Appointment"))
28059      return true;
28060    if (json.has(prefix+"AppointmentResponse"))
28061      return true;
28062    if (json.has(prefix+"AuditEvent"))
28063      return true;
28064    if (json.has(prefix+"Basic"))
28065      return true;
28066    if (json.has(prefix+"Binary"))
28067      return true;
28068    if (json.has(prefix+"BiologicallyDerivedProduct"))
28069      return true;
28070    if (json.has(prefix+"BodyStructure"))
28071      return true;
28072    if (json.has(prefix+"Bundle"))
28073      return true;
28074    if (json.has(prefix+"CapabilityStatement"))
28075      return true;
28076    if (json.has(prefix+"CarePlan"))
28077      return true;
28078    if (json.has(prefix+"CareTeam"))
28079      return true;
28080    if (json.has(prefix+"CatalogEntry"))
28081      return true;
28082    if (json.has(prefix+"ChargeItem"))
28083      return true;
28084    if (json.has(prefix+"ChargeItemDefinition"))
28085      return true;
28086    if (json.has(prefix+"Claim"))
28087      return true;
28088    if (json.has(prefix+"ClaimResponse"))
28089      return true;
28090    if (json.has(prefix+"ClinicalImpression"))
28091      return true;
28092    if (json.has(prefix+"CodeSystem"))
28093      return true;
28094    if (json.has(prefix+"Communication"))
28095      return true;
28096    if (json.has(prefix+"CommunicationRequest"))
28097      return true;
28098    if (json.has(prefix+"CompartmentDefinition"))
28099      return true;
28100    if (json.has(prefix+"Composition"))
28101      return true;
28102    if (json.has(prefix+"ConceptMap"))
28103      return true;
28104    if (json.has(prefix+"Condition"))
28105      return true;
28106    if (json.has(prefix+"Consent"))
28107      return true;
28108    if (json.has(prefix+"Contract"))
28109      return true;
28110    if (json.has(prefix+"Coverage"))
28111      return true;
28112    if (json.has(prefix+"CoverageEligibilityRequest"))
28113      return true;
28114    if (json.has(prefix+"CoverageEligibilityResponse"))
28115      return true;
28116    if (json.has(prefix+"DetectedIssue"))
28117      return true;
28118    if (json.has(prefix+"Device"))
28119      return true;
28120    if (json.has(prefix+"DeviceDefinition"))
28121      return true;
28122    if (json.has(prefix+"DeviceMetric"))
28123      return true;
28124    if (json.has(prefix+"DeviceRequest"))
28125      return true;
28126    if (json.has(prefix+"DeviceUseStatement"))
28127      return true;
28128    if (json.has(prefix+"DiagnosticReport"))
28129      return true;
28130    if (json.has(prefix+"DocumentManifest"))
28131      return true;
28132    if (json.has(prefix+"DocumentReference"))
28133      return true;
28134    if (json.has(prefix+"EffectEvidenceSynthesis"))
28135      return true;
28136    if (json.has(prefix+"Encounter"))
28137      return true;
28138    if (json.has(prefix+"Endpoint"))
28139      return true;
28140    if (json.has(prefix+"EnrollmentRequest"))
28141      return true;
28142    if (json.has(prefix+"EnrollmentResponse"))
28143      return true;
28144    if (json.has(prefix+"EpisodeOfCare"))
28145      return true;
28146    if (json.has(prefix+"EventDefinition"))
28147      return true;
28148    if (json.has(prefix+"Evidence"))
28149      return true;
28150    if (json.has(prefix+"EvidenceVariable"))
28151      return true;
28152    if (json.has(prefix+"ExampleScenario"))
28153      return true;
28154    if (json.has(prefix+"ExplanationOfBenefit"))
28155      return true;
28156    if (json.has(prefix+"FamilyMemberHistory"))
28157      return true;
28158    if (json.has(prefix+"Flag"))
28159      return true;
28160    if (json.has(prefix+"Goal"))
28161      return true;
28162    if (json.has(prefix+"GraphDefinition"))
28163      return true;
28164    if (json.has(prefix+"Group"))
28165      return true;
28166    if (json.has(prefix+"GuidanceResponse"))
28167      return true;
28168    if (json.has(prefix+"HealthcareService"))
28169      return true;
28170    if (json.has(prefix+"ImagingStudy"))
28171      return true;
28172    if (json.has(prefix+"Immunization"))
28173      return true;
28174    if (json.has(prefix+"ImmunizationEvaluation"))
28175      return true;
28176    if (json.has(prefix+"ImmunizationRecommendation"))
28177      return true;
28178    if (json.has(prefix+"ImplementationGuide"))
28179      return true;
28180    if (json.has(prefix+"InsurancePlan"))
28181      return true;
28182    if (json.has(prefix+"Invoice"))
28183      return true;
28184    if (json.has(prefix+"Library"))
28185      return true;
28186    if (json.has(prefix+"Linkage"))
28187      return true;
28188    if (json.has(prefix+"List"))
28189      return true;
28190    if (json.has(prefix+"Location"))
28191      return true;
28192    if (json.has(prefix+"Measure"))
28193      return true;
28194    if (json.has(prefix+"MeasureReport"))
28195      return true;
28196    if (json.has(prefix+"Media"))
28197      return true;
28198    if (json.has(prefix+"Medication"))
28199      return true;
28200    if (json.has(prefix+"MedicationAdministration"))
28201      return true;
28202    if (json.has(prefix+"MedicationDispense"))
28203      return true;
28204    if (json.has(prefix+"MedicationKnowledge"))
28205      return true;
28206    if (json.has(prefix+"MedicationRequest"))
28207      return true;
28208    if (json.has(prefix+"MedicationStatement"))
28209      return true;
28210    if (json.has(prefix+"MedicinalProduct"))
28211      return true;
28212    if (json.has(prefix+"MedicinalProductAuthorization"))
28213      return true;
28214    if (json.has(prefix+"MedicinalProductContraindication"))
28215      return true;
28216    if (json.has(prefix+"MedicinalProductIndication"))
28217      return true;
28218    if (json.has(prefix+"MedicinalProductIngredient"))
28219      return true;
28220    if (json.has(prefix+"MedicinalProductInteraction"))
28221      return true;
28222    if (json.has(prefix+"MedicinalProductManufactured"))
28223      return true;
28224    if (json.has(prefix+"MedicinalProductPackaged"))
28225      return true;
28226    if (json.has(prefix+"MedicinalProductPharmaceutical"))
28227      return true;
28228    if (json.has(prefix+"MedicinalProductUndesirableEffect"))
28229      return true;
28230    if (json.has(prefix+"MessageDefinition"))
28231      return true;
28232    if (json.has(prefix+"MessageHeader"))
28233      return true;
28234    if (json.has(prefix+"MolecularSequence"))
28235      return true;
28236    if (json.has(prefix+"NamingSystem"))
28237      return true;
28238    if (json.has(prefix+"NutritionOrder"))
28239      return true;
28240    if (json.has(prefix+"Observation"))
28241      return true;
28242    if (json.has(prefix+"ObservationDefinition"))
28243      return true;
28244    if (json.has(prefix+"OperationDefinition"))
28245      return true;
28246    if (json.has(prefix+"OperationOutcome"))
28247      return true;
28248    if (json.has(prefix+"Organization"))
28249      return true;
28250    if (json.has(prefix+"OrganizationAffiliation"))
28251      return true;
28252    if (json.has(prefix+"Patient"))
28253      return true;
28254    if (json.has(prefix+"PaymentNotice"))
28255      return true;
28256    if (json.has(prefix+"PaymentReconciliation"))
28257      return true;
28258    if (json.has(prefix+"Person"))
28259      return true;
28260    if (json.has(prefix+"PlanDefinition"))
28261      return true;
28262    if (json.has(prefix+"Practitioner"))
28263      return true;
28264    if (json.has(prefix+"PractitionerRole"))
28265      return true;
28266    if (json.has(prefix+"Procedure"))
28267      return true;
28268    if (json.has(prefix+"Provenance"))
28269      return true;
28270    if (json.has(prefix+"Questionnaire"))
28271      return true;
28272    if (json.has(prefix+"QuestionnaireResponse"))
28273      return true;
28274    if (json.has(prefix+"RelatedPerson"))
28275      return true;
28276    if (json.has(prefix+"RequestGroup"))
28277      return true;
28278    if (json.has(prefix+"ResearchDefinition"))
28279      return true;
28280    if (json.has(prefix+"ResearchElementDefinition"))
28281      return true;
28282    if (json.has(prefix+"ResearchStudy"))
28283      return true;
28284    if (json.has(prefix+"ResearchSubject"))
28285      return true;
28286    if (json.has(prefix+"RiskAssessment"))
28287      return true;
28288    if (json.has(prefix+"RiskEvidenceSynthesis"))
28289      return true;
28290    if (json.has(prefix+"Schedule"))
28291      return true;
28292    if (json.has(prefix+"SearchParameter"))
28293      return true;
28294    if (json.has(prefix+"ServiceRequest"))
28295      return true;
28296    if (json.has(prefix+"Slot"))
28297      return true;
28298    if (json.has(prefix+"Specimen"))
28299      return true;
28300    if (json.has(prefix+"SpecimenDefinition"))
28301      return true;
28302    if (json.has(prefix+"StructureDefinition"))
28303      return true;
28304    if (json.has(prefix+"StructureMap"))
28305      return true;
28306    if (json.has(prefix+"Subscription"))
28307      return true;
28308    if (json.has(prefix+"Substance"))
28309      return true;
28310    if (json.has(prefix+"SubstanceNucleicAcid"))
28311      return true;
28312    if (json.has(prefix+"SubstancePolymer"))
28313      return true;
28314    if (json.has(prefix+"SubstanceProtein"))
28315      return true;
28316    if (json.has(prefix+"SubstanceReferenceInformation"))
28317      return true;
28318    if (json.has(prefix+"SubstanceSourceMaterial"))
28319      return true;
28320    if (json.has(prefix+"SubstanceSpecification"))
28321      return true;
28322    if (json.has(prefix+"SupplyDelivery"))
28323      return true;
28324    if (json.has(prefix+"SupplyRequest"))
28325      return true;
28326    if (json.has(prefix+"Task"))
28327      return true;
28328    if (json.has(prefix+"TerminologyCapabilities"))
28329      return true;
28330    if (json.has(prefix+"TestReport"))
28331      return true;
28332    if (json.has(prefix+"TestScript"))
28333      return true;
28334    if (json.has(prefix+"ValueSet"))
28335      return true;
28336    if (json.has(prefix+"VerificationResult"))
28337      return true;
28338    if (json.has(prefix+"VisionPrescription"))
28339      return true;
28340    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date"))
28341      return true;
28342    if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime"))
28343      return true;
28344    if (json.has(prefix+"Code") || json.has("_"+prefix+"Code"))
28345      return true;
28346    if (json.has(prefix+"String") || json.has("_"+prefix+"String"))
28347      return true;
28348    if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer"))
28349      return true;
28350    if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid"))
28351      return true;
28352    if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical"))
28353      return true;
28354    if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri"))
28355      return true;
28356    if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid"))
28357      return true;
28358    if (json.has(prefix+"Url") || json.has("_"+prefix+"Url"))
28359      return true;
28360    if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant"))
28361      return true;
28362    if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean"))
28363      return true;
28364    if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary"))
28365      return true;
28366    if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt"))
28367      return true;
28368    if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown"))
28369      return true;
28370    if (json.has(prefix+"Time") || json.has("_"+prefix+"Time"))
28371      return true;
28372    if (json.has(prefix+"Id") || json.has("_"+prefix+"Id"))
28373      return true;
28374    if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt"))
28375      return true;
28376    if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal"))
28377      return true;
28378    return false;
28379  }
28380
28381  protected Type parseAnyType(JsonObject json, String type) throws IOException, FHIRFormatError {
28382    if (type.equals("ElementDefinition"))
28383      return parseElementDefinition(json);
28384    else if (type.equals("DataRequirement"))
28385      return parseDataRequirement(json);
28386    else
28387      return parseType(json, type);
28388  }
28389
28390  protected void composeElement(Element element) throws IOException {
28391    if (element.hasId())
28392      prop("id", element.getId());
28393      if (makeComments(element)) {
28394        openArray("fhir_comments");
28395        for (String s : element.getFormatCommentsPre())
28396          prop(null,  s);
28397        for (String s : element.getFormatCommentsPost())
28398          prop(null,  s);
28399         closeArray();
28400      }
28401    if (element.hasExtension()) {
28402      openArray("extension");
28403      for (Extension e : element.getExtension())
28404        composeExtension(null, e);
28405      closeArray();
28406    }
28407  }
28408
28409  protected void composeBackboneElementInner(BackboneElement element) throws IOException {
28410    composeBackbone(element);
28411  }
28412
28413  protected void composeBackbone(BackboneElement element) throws IOException {
28414    composeElement(element);
28415    if (element.hasModifierExtension()) {
28416      openArray("modifierExtension");
28417      for (Extension e : element.getModifierExtension())
28418        composeExtension(null, e);
28419      closeArray();
28420    }
28421  }
28422
28423  protected void composeBackbone(BackboneType element) throws IOException {
28424    composeElement(element);
28425    if (element.hasModifierExtension()) {
28426      openArray("modifierExtension");
28427      for (Extension e : element.getModifierExtension())
28428        composeExtension(null, e);
28429      closeArray();
28430    }
28431  }
28432
28433  protected <E extends Enum<E>> void composeEnumerationCore(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
28434    if (value != null && value.getValue() != null) {
28435      prop(name, e.toCode(value.getValue()));
28436    } else if (inArray)   
28437      writeNull(name);
28438  }    
28439
28440  protected <E extends Enum<E>> void composeEnumerationExtras(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
28441    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28442      open(inArray ? null : "_"+name);
28443      composeElement(value);
28444      close();
28445    } else if (inArray)   
28446      writeNull(name);
28447  }    
28448
28449  protected void composeDateCore(String name, DateType value, boolean inArray) throws IOException {
28450    if (value != null && value.hasValue()) {
28451        prop(name, value.asStringValue());
28452    }    
28453    else if (inArray) 
28454      writeNull(name); 
28455  }    
28456
28457  protected void composeDateExtras(String name, DateType value, boolean inArray) throws IOException {
28458    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28459      open(inArray ? null : "_"+name);
28460      composeElement(value);
28461      close();
28462    }
28463    else if (inArray) 
28464      writeNull(name); 
28465  }
28466
28467  protected void composeDateTimeCore(String name, DateTimeType value, boolean inArray) throws IOException {
28468    if (value != null && value.hasValue()) {
28469        prop(name, value.asStringValue());
28470    }    
28471    else if (inArray) 
28472      writeNull(name); 
28473  }    
28474
28475  protected void composeDateTimeExtras(String name, DateTimeType value, boolean inArray) throws IOException {
28476    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28477      open(inArray ? null : "_"+name);
28478      composeElement(value);
28479      close();
28480    }
28481    else if (inArray) 
28482      writeNull(name); 
28483  }
28484
28485  protected void composeCodeCore(String name, CodeType value, boolean inArray) throws IOException {
28486    if (value != null && value.hasValue()) {
28487        prop(name, toString(value.getValue()));
28488    }    
28489    else if (inArray) 
28490      writeNull(name); 
28491  }    
28492
28493  protected void composeCodeExtras(String name, CodeType value, boolean inArray) throws IOException {
28494    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28495      open(inArray ? null : "_"+name);
28496      composeElement(value);
28497      close();
28498    }
28499    else if (inArray) 
28500      writeNull(name); 
28501  }
28502
28503  protected void composeStringCore(String name, StringType value, boolean inArray) throws IOException {
28504    if (value != null && value.hasValue()) {
28505        prop(name, toString(value.getValue()));
28506    }    
28507    else if (inArray) 
28508      writeNull(name); 
28509  }    
28510
28511  protected void composeStringExtras(String name, StringType value, boolean inArray) throws IOException {
28512    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28513      open(inArray ? null : "_"+name);
28514      composeElement(value);
28515      close();
28516    }
28517    else if (inArray) 
28518      writeNull(name); 
28519  }
28520
28521  protected void composeIntegerCore(String name, IntegerType value, boolean inArray) throws IOException {
28522    if (value != null && value.hasValue()) {
28523        prop(name, Integer.valueOf(value.getValue()));
28524    }    
28525    else if (inArray) 
28526      writeNull(name); 
28527  }    
28528
28529  protected void composeIntegerExtras(String name, IntegerType value, boolean inArray) throws IOException {
28530    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28531      open(inArray ? null : "_"+name);
28532      composeElement(value);
28533      close();
28534    }
28535    else if (inArray) 
28536      writeNull(name); 
28537  }
28538
28539  protected void composeOidCore(String name, OidType value, boolean inArray) throws IOException {
28540    if (value != null && value.hasValue()) {
28541        prop(name, toString(value.getValue()));
28542    }    
28543    else if (inArray) 
28544      writeNull(name); 
28545  }    
28546
28547  protected void composeOidExtras(String name, OidType value, boolean inArray) throws IOException {
28548    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28549      open(inArray ? null : "_"+name);
28550      composeElement(value);
28551      close();
28552    }
28553    else if (inArray) 
28554      writeNull(name); 
28555  }
28556
28557  protected void composeCanonicalCore(String name, CanonicalType value, boolean inArray) throws IOException {
28558    if (value != null && value.hasValue()) {
28559        prop(name, toString(value.getValue()));
28560    }    
28561    else if (inArray) 
28562      writeNull(name); 
28563  }    
28564
28565  protected void composeCanonicalExtras(String name, CanonicalType value, boolean inArray) throws IOException {
28566    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28567      open(inArray ? null : "_"+name);
28568      composeElement(value);
28569      close();
28570    }
28571    else if (inArray) 
28572      writeNull(name); 
28573  }
28574
28575  protected void composeUriCore(String name, UriType value, boolean inArray) throws IOException {
28576    if (value != null && value.hasValue()) {
28577        prop(name, toString(value.getValue()));
28578    }    
28579    else if (inArray) 
28580      writeNull(name); 
28581  }    
28582
28583  protected void composeUriExtras(String name, UriType value, boolean inArray) throws IOException {
28584    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28585      open(inArray ? null : "_"+name);
28586      composeElement(value);
28587      close();
28588    }
28589    else if (inArray) 
28590      writeNull(name); 
28591  }
28592
28593  protected void composeUuidCore(String name, UuidType value, boolean inArray) throws IOException {
28594    if (value != null && value.hasValue()) {
28595        prop(name, toString(value.getValue()));
28596    }    
28597    else if (inArray) 
28598      writeNull(name); 
28599  }    
28600
28601  protected void composeUuidExtras(String name, UuidType value, boolean inArray) throws IOException {
28602    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28603      open(inArray ? null : "_"+name);
28604      composeElement(value);
28605      close();
28606    }
28607    else if (inArray) 
28608      writeNull(name); 
28609  }
28610
28611  protected void composeUrlCore(String name, UrlType value, boolean inArray) throws IOException {
28612    if (value != null && value.hasValue()) {
28613        prop(name, toString(value.getValue()));
28614    }    
28615    else if (inArray) 
28616      writeNull(name); 
28617  }    
28618
28619  protected void composeUrlExtras(String name, UrlType value, boolean inArray) throws IOException {
28620    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28621      open(inArray ? null : "_"+name);
28622      composeElement(value);
28623      close();
28624    }
28625    else if (inArray) 
28626      writeNull(name); 
28627  }
28628
28629  protected void composeInstantCore(String name, InstantType value, boolean inArray) throws IOException {
28630    if (value != null && value.hasValue()) {
28631        prop(name, value.asStringValue());
28632    }    
28633    else if (inArray) 
28634      writeNull(name); 
28635  }    
28636
28637  protected void composeInstantExtras(String name, InstantType value, boolean inArray) throws IOException {
28638    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28639      open(inArray ? null : "_"+name);
28640      composeElement(value);
28641      close();
28642    }
28643    else if (inArray) 
28644      writeNull(name); 
28645  }
28646
28647  protected void composeBooleanCore(String name, BooleanType value, boolean inArray) throws IOException {
28648    if (value != null && value.hasValue()) {
28649        prop(name, value.getValue());
28650    }    
28651    else if (inArray) 
28652      writeNull(name); 
28653  }    
28654
28655  protected void composeBooleanExtras(String name, BooleanType value, boolean inArray) throws IOException {
28656    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28657      open(inArray ? null : "_"+name);
28658      composeElement(value);
28659      close();
28660    }
28661    else if (inArray) 
28662      writeNull(name); 
28663  }
28664
28665  protected void composeBase64BinaryCore(String name, Base64BinaryType value, boolean inArray) throws IOException {
28666    if (value != null && value.hasValue()) {
28667        prop(name, toString(value.getValue()));
28668    }    
28669    else if (inArray) 
28670      writeNull(name); 
28671  }    
28672
28673  protected void composeBase64BinaryExtras(String name, Base64BinaryType value, boolean inArray) throws IOException {
28674    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28675      open(inArray ? null : "_"+name);
28676      composeElement(value);
28677      close();
28678    }
28679    else if (inArray) 
28680      writeNull(name); 
28681  }
28682
28683  protected void composeUnsignedIntCore(String name, UnsignedIntType value, boolean inArray) throws IOException {
28684    if (value != null && value.hasValue()) {
28685        prop(name, Integer.valueOf(value.getValue()));
28686    }    
28687    else if (inArray) 
28688      writeNull(name); 
28689  }    
28690
28691  protected void composeUnsignedIntExtras(String name, UnsignedIntType value, boolean inArray) throws IOException {
28692    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28693      open(inArray ? null : "_"+name);
28694      composeElement(value);
28695      close();
28696    }
28697    else if (inArray) 
28698      writeNull(name); 
28699  }
28700
28701  protected void composeMarkdownCore(String name, MarkdownType value, boolean inArray) throws IOException {
28702    if (value != null && value.hasValue()) {
28703        prop(name, toString(value.getValue()));
28704    }    
28705    else if (inArray) 
28706      writeNull(name); 
28707  }    
28708
28709  protected void composeMarkdownExtras(String name, MarkdownType value, boolean inArray) throws IOException {
28710    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28711      open(inArray ? null : "_"+name);
28712      composeElement(value);
28713      close();
28714    }
28715    else if (inArray) 
28716      writeNull(name); 
28717  }
28718
28719  protected void composeTimeCore(String name, TimeType value, boolean inArray) throws IOException {
28720    if (value != null && value.hasValue()) {
28721        prop(name, value.asStringValue());
28722    }    
28723    else if (inArray) 
28724      writeNull(name); 
28725  }    
28726
28727  protected void composeTimeExtras(String name, TimeType value, boolean inArray) throws IOException {
28728    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28729      open(inArray ? null : "_"+name);
28730      composeElement(value);
28731      close();
28732    }
28733    else if (inArray) 
28734      writeNull(name); 
28735  }
28736
28737  protected void composeIdCore(String name, IdType value, boolean inArray) throws IOException {
28738    if (value != null && value.hasValue()) {
28739        prop(name, toString(value.getValue()));
28740    }    
28741    else if (inArray) 
28742      writeNull(name); 
28743  }    
28744
28745  protected void composeIdExtras(String name, IdType value, boolean inArray) throws IOException {
28746    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28747      open(inArray ? null : "_"+name);
28748      composeElement(value);
28749      close();
28750    }
28751    else if (inArray) 
28752      writeNull(name); 
28753  }
28754
28755  protected void composePositiveIntCore(String name, PositiveIntType value, boolean inArray) throws IOException {
28756    if (value != null && value.hasValue()) {
28757        prop(name, Integer.valueOf(value.getValue()));
28758    }    
28759    else if (inArray) 
28760      writeNull(name); 
28761  }    
28762
28763  protected void composePositiveIntExtras(String name, PositiveIntType value, boolean inArray) throws IOException {
28764    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28765      open(inArray ? null : "_"+name);
28766      composeElement(value);
28767      close();
28768    }
28769    else if (inArray) 
28770      writeNull(name); 
28771  }
28772
28773  protected void composeDecimalCore(String name, DecimalType value, boolean inArray) throws IOException {
28774    if (value != null && value.hasValue()) {
28775        prop(name, value.getValue());
28776    }    
28777    else if (inArray) 
28778      writeNull(name); 
28779  }    
28780
28781  protected void composeDecimalExtras(String name, DecimalType value, boolean inArray) throws IOException {
28782    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28783      open(inArray ? null : "_"+name);
28784      composeElement(value);
28785      close();
28786    }
28787    else if (inArray) 
28788      writeNull(name); 
28789  }
28790
28791  protected void composeExtension(String name, Extension element) throws IOException {
28792    if (element != null) {
28793      open(name);
28794      composeExtensionInner(element);
28795      close();
28796    }
28797  }
28798
28799  protected void composeExtensionInner(Extension element) throws IOException {
28800      composeElement(element);
28801      if (element.hasUrlElement()) {
28802        composeUriCore("url", element.getUrlElement(), false);
28803        composeUriExtras("url", element.getUrlElement(), false);
28804      }
28805      if (element.hasValue()) {
28806        composeType("value", element.getValue());
28807      }
28808  }
28809
28810  protected void composeNarrative(String name, Narrative element) throws IOException {
28811    if (element != null) {
28812      open(name);
28813      composeNarrativeInner(element);
28814      close();
28815    }
28816  }
28817
28818  protected void composeNarrativeInner(Narrative element) throws IOException {
28819      composeElement(element);
28820      if (element.hasStatusElement()) {
28821        composeEnumerationCore("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
28822        composeEnumerationExtras("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
28823      }
28824      if (element.hasDiv()) {
28825        XhtmlNode node = element.getDiv();
28826        if (node.getNsDecl() == null) {
28827          node.attribute("xmlns", XHTML_NS);
28828        }
28829        composeXhtml("div", node);
28830      }
28831  }
28832
28833  protected void composeCount(String name, Count element) throws IOException {
28834    if (element != null) {
28835      open(name);
28836      composeCountInner(element);
28837      close();
28838    }
28839  }
28840
28841  protected void composeCountInner(Count element) throws IOException {
28842      composeQuantityInner(element);
28843  }
28844
28845  protected void composeDosage(String name, Dosage element) throws IOException {
28846    if (element != null) {
28847      open(name);
28848      composeDosageInner(element);
28849      close();
28850    }
28851  }
28852
28853  protected void composeDosageInner(Dosage element) throws IOException {
28854      composeBackbone(element);
28855      if (element.hasSequenceElement()) {
28856        composeIntegerCore("sequence", element.getSequenceElement(), false);
28857        composeIntegerExtras("sequence", element.getSequenceElement(), false);
28858      }
28859      if (element.hasTextElement()) {
28860        composeStringCore("text", element.getTextElement(), false);
28861        composeStringExtras("text", element.getTextElement(), false);
28862      }
28863      if (element.hasAdditionalInstruction()) {
28864        openArray("additionalInstruction");
28865        for (CodeableConcept e : element.getAdditionalInstruction()) 
28866          composeCodeableConcept(null, e);
28867        closeArray();
28868      };
28869      if (element.hasPatientInstructionElement()) {
28870        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
28871        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
28872      }
28873      if (element.hasTiming()) {
28874        composeTiming("timing", element.getTiming());
28875      }
28876      if (element.hasAsNeeded()) {
28877        composeType("asNeeded", element.getAsNeeded());
28878      }
28879      if (element.hasSite()) {
28880        composeCodeableConcept("site", element.getSite());
28881      }
28882      if (element.hasRoute()) {
28883        composeCodeableConcept("route", element.getRoute());
28884      }
28885      if (element.hasMethod()) {
28886        composeCodeableConcept("method", element.getMethod());
28887      }
28888      if (element.hasDoseAndRate()) {
28889        openArray("doseAndRate");
28890        for (Dosage.DosageDoseAndRateComponent e : element.getDoseAndRate()) 
28891          composeDosageDosageDoseAndRateComponent(null, e);
28892        closeArray();
28893      };
28894      if (element.hasMaxDosePerPeriod()) {
28895        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
28896      }
28897      if (element.hasMaxDosePerAdministration()) {
28898        composeQuantity("maxDosePerAdministration", element.getMaxDosePerAdministration());
28899      }
28900      if (element.hasMaxDosePerLifetime()) {
28901        composeQuantity("maxDosePerLifetime", element.getMaxDosePerLifetime());
28902      }
28903  }
28904
28905  protected void composeDosageDosageDoseAndRateComponent(String name, Dosage.DosageDoseAndRateComponent element) throws IOException {
28906    if (element != null) {
28907      open(name);
28908      composeDosageDosageDoseAndRateComponentInner(element);
28909      close();
28910    }
28911  }
28912
28913  protected void composeDosageDosageDoseAndRateComponentInner(Dosage.DosageDoseAndRateComponent element) throws IOException {
28914      composeElement(element);
28915      if (element.hasType()) {
28916        composeCodeableConcept("type", element.getType());
28917      }
28918      if (element.hasDose()) {
28919        composeType("dose", element.getDose());
28920      }
28921      if (element.hasRate()) {
28922        composeType("rate", element.getRate());
28923      }
28924  }
28925
28926  protected void composeMarketingStatus(String name, MarketingStatus element) throws IOException {
28927    if (element != null) {
28928      open(name);
28929      composeMarketingStatusInner(element);
28930      close();
28931    }
28932  }
28933
28934  protected void composeMarketingStatusInner(MarketingStatus element) throws IOException {
28935      composeBackbone(element);
28936      if (element.hasCountry()) {
28937        composeCodeableConcept("country", element.getCountry());
28938      }
28939      if (element.hasJurisdiction()) {
28940        composeCodeableConcept("jurisdiction", element.getJurisdiction());
28941      }
28942      if (element.hasStatus()) {
28943        composeCodeableConcept("status", element.getStatus());
28944      }
28945      if (element.hasDateRange()) {
28946        composePeriod("dateRange", element.getDateRange());
28947      }
28948      if (element.hasRestoreDateElement()) {
28949        composeDateTimeCore("restoreDate", element.getRestoreDateElement(), false);
28950        composeDateTimeExtras("restoreDate", element.getRestoreDateElement(), false);
28951      }
28952  }
28953
28954  protected void composeSubstanceAmount(String name, SubstanceAmount element) throws IOException {
28955    if (element != null) {
28956      open(name);
28957      composeSubstanceAmountInner(element);
28958      close();
28959    }
28960  }
28961
28962  protected void composeSubstanceAmountInner(SubstanceAmount element) throws IOException {
28963      composeBackbone(element);
28964      if (element.hasAmount()) {
28965        composeType("amount", element.getAmount());
28966      }
28967      if (element.hasAmountType()) {
28968        composeCodeableConcept("amountType", element.getAmountType());
28969      }
28970      if (element.hasAmountTextElement()) {
28971        composeStringCore("amountText", element.getAmountTextElement(), false);
28972        composeStringExtras("amountText", element.getAmountTextElement(), false);
28973      }
28974      if (element.hasReferenceRange()) {
28975        composeSubstanceAmountSubstanceAmountReferenceRangeComponent("referenceRange", element.getReferenceRange());
28976      }
28977  }
28978
28979  protected void composeSubstanceAmountSubstanceAmountReferenceRangeComponent(String name, SubstanceAmount.SubstanceAmountReferenceRangeComponent element) throws IOException {
28980    if (element != null) {
28981      open(name);
28982      composeSubstanceAmountSubstanceAmountReferenceRangeComponentInner(element);
28983      close();
28984    }
28985  }
28986
28987  protected void composeSubstanceAmountSubstanceAmountReferenceRangeComponentInner(SubstanceAmount.SubstanceAmountReferenceRangeComponent element) throws IOException {
28988      composeElement(element);
28989      if (element.hasLowLimit()) {
28990        composeQuantity("lowLimit", element.getLowLimit());
28991      }
28992      if (element.hasHighLimit()) {
28993        composeQuantity("highLimit", element.getHighLimit());
28994      }
28995  }
28996
28997  protected void composePopulation(String name, Population element) throws IOException {
28998    if (element != null) {
28999      open(name);
29000      composePopulationInner(element);
29001      close();
29002    }
29003  }
29004
29005  protected void composePopulationInner(Population element) throws IOException {
29006      composeBackbone(element);
29007      if (element.hasAge()) {
29008        composeType("age", element.getAge());
29009      }
29010      if (element.hasGender()) {
29011        composeCodeableConcept("gender", element.getGender());
29012      }
29013      if (element.hasRace()) {
29014        composeCodeableConcept("race", element.getRace());
29015      }
29016      if (element.hasPhysiologicalCondition()) {
29017        composeCodeableConcept("physiologicalCondition", element.getPhysiologicalCondition());
29018      }
29019  }
29020
29021  protected void composeDistance(String name, Distance element) throws IOException {
29022    if (element != null) {
29023      open(name);
29024      composeDistanceInner(element);
29025      close();
29026    }
29027  }
29028
29029  protected void composeDistanceInner(Distance element) throws IOException {
29030      composeQuantityInner(element);
29031  }
29032
29033  protected void composeAge(String name, Age element) throws IOException {
29034    if (element != null) {
29035      open(name);
29036      composeAgeInner(element);
29037      close();
29038    }
29039  }
29040
29041  protected void composeAgeInner(Age element) throws IOException {
29042      composeQuantityInner(element);
29043  }
29044
29045  protected void composeDuration(String name, Duration element) throws IOException {
29046    if (element != null) {
29047      open(name);
29048      composeDurationInner(element);
29049      close();
29050    }
29051  }
29052
29053  protected void composeDurationInner(Duration element) throws IOException {
29054      composeQuantityInner(element);
29055  }
29056
29057  protected void composeProductShelfLife(String name, ProductShelfLife element) throws IOException {
29058    if (element != null) {
29059      open(name);
29060      composeProductShelfLifeInner(element);
29061      close();
29062    }
29063  }
29064
29065  protected void composeProductShelfLifeInner(ProductShelfLife element) throws IOException {
29066      composeBackbone(element);
29067      if (element.hasIdentifier()) {
29068        composeIdentifier("identifier", element.getIdentifier());
29069      }
29070      if (element.hasType()) {
29071        composeCodeableConcept("type", element.getType());
29072      }
29073      if (element.hasPeriod()) {
29074        composeQuantity("period", element.getPeriod());
29075      }
29076      if (element.hasSpecialPrecautionsForStorage()) {
29077        openArray("specialPrecautionsForStorage");
29078        for (CodeableConcept e : element.getSpecialPrecautionsForStorage()) 
29079          composeCodeableConcept(null, e);
29080        closeArray();
29081      };
29082  }
29083
29084  protected void composeTiming(String name, Timing element) throws IOException {
29085    if (element != null) {
29086      open(name);
29087      composeTimingInner(element);
29088      close();
29089    }
29090  }
29091
29092  protected void composeTimingInner(Timing element) throws IOException {
29093      composeBackbone(element);
29094      if (element.hasEvent()) {
29095        openArray("event");
29096        for (DateTimeType e : element.getEvent()) 
29097          composeDateTimeCore(null, e, true);
29098        closeArray();
29099        if (anyHasExtras(element.getEvent())) {
29100          openArray("_event");
29101          for (DateTimeType e : element.getEvent()) 
29102            composeDateTimeExtras(null, e, true);
29103          closeArray();
29104        }
29105      };
29106      if (element.hasRepeat()) {
29107        composeTimingTimingRepeatComponent("repeat", element.getRepeat());
29108      }
29109      if (element.hasCode()) {
29110        composeCodeableConcept("code", element.getCode());
29111      }
29112  }
29113
29114  protected void composeTimingTimingRepeatComponent(String name, Timing.TimingRepeatComponent element) throws IOException {
29115    if (element != null) {
29116      open(name);
29117      composeTimingTimingRepeatComponentInner(element);
29118      close();
29119    }
29120  }
29121
29122  protected void composeTimingTimingRepeatComponentInner(Timing.TimingRepeatComponent element) throws IOException {
29123      composeElement(element);
29124      if (element.hasBounds()) {
29125        composeType("bounds", element.getBounds());
29126      }
29127      if (element.hasCountElement()) {
29128        composePositiveIntCore("count", element.getCountElement(), false);
29129        composePositiveIntExtras("count", element.getCountElement(), false);
29130      }
29131      if (element.hasCountMaxElement()) {
29132        composePositiveIntCore("countMax", element.getCountMaxElement(), false);
29133        composePositiveIntExtras("countMax", element.getCountMaxElement(), false);
29134      }
29135      if (element.hasDurationElement()) {
29136        composeDecimalCore("duration", element.getDurationElement(), false);
29137        composeDecimalExtras("duration", element.getDurationElement(), false);
29138      }
29139      if (element.hasDurationMaxElement()) {
29140        composeDecimalCore("durationMax", element.getDurationMaxElement(), false);
29141        composeDecimalExtras("durationMax", element.getDurationMaxElement(), false);
29142      }
29143      if (element.hasDurationUnitElement()) {
29144        composeEnumerationCore("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
29145        composeEnumerationExtras("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
29146      }
29147      if (element.hasFrequencyElement()) {
29148        composePositiveIntCore("frequency", element.getFrequencyElement(), false);
29149        composePositiveIntExtras("frequency", element.getFrequencyElement(), false);
29150      }
29151      if (element.hasFrequencyMaxElement()) {
29152        composePositiveIntCore("frequencyMax", element.getFrequencyMaxElement(), false);
29153        composePositiveIntExtras("frequencyMax", element.getFrequencyMaxElement(), false);
29154      }
29155      if (element.hasPeriodElement()) {
29156        composeDecimalCore("period", element.getPeriodElement(), false);
29157        composeDecimalExtras("period", element.getPeriodElement(), false);
29158      }
29159      if (element.hasPeriodMaxElement()) {
29160        composeDecimalCore("periodMax", element.getPeriodMaxElement(), false);
29161        composeDecimalExtras("periodMax", element.getPeriodMaxElement(), false);
29162      }
29163      if (element.hasPeriodUnitElement()) {
29164        composeEnumerationCore("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
29165        composeEnumerationExtras("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
29166      }
29167      if (element.hasDayOfWeek()) {
29168        openArray("dayOfWeek");
29169        for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek()) 
29170          composeEnumerationCore(null, e, new Timing.DayOfWeekEnumFactory(), true);
29171        closeArray();
29172        if (anyHasExtras(element.getDayOfWeek())) {
29173          openArray("_dayOfWeek");
29174          for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek()) 
29175            composeEnumerationExtras(null, e, new Timing.DayOfWeekEnumFactory(), true);
29176          closeArray();
29177        }
29178      };
29179      if (element.hasTimeOfDay()) {
29180        openArray("timeOfDay");
29181        for (TimeType e : element.getTimeOfDay()) 
29182          composeTimeCore(null, e, true);
29183        closeArray();
29184        if (anyHasExtras(element.getTimeOfDay())) {
29185          openArray("_timeOfDay");
29186          for (TimeType e : element.getTimeOfDay()) 
29187            composeTimeExtras(null, e, true);
29188          closeArray();
29189        }
29190      };
29191      if (element.hasWhen()) {
29192        openArray("when");
29193        for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
29194          composeEnumerationCore(null, e, new Timing.EventTimingEnumFactory(), true);
29195        closeArray();
29196        if (anyHasExtras(element.getWhen())) {
29197          openArray("_when");
29198          for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
29199            composeEnumerationExtras(null, e, new Timing.EventTimingEnumFactory(), true);
29200          closeArray();
29201        }
29202      };
29203      if (element.hasOffsetElement()) {
29204        composeUnsignedIntCore("offset", element.getOffsetElement(), false);
29205        composeUnsignedIntExtras("offset", element.getOffsetElement(), false);
29206      }
29207  }
29208
29209  protected void composeProdCharacteristic(String name, ProdCharacteristic element) throws IOException {
29210    if (element != null) {
29211      open(name);
29212      composeProdCharacteristicInner(element);
29213      close();
29214    }
29215  }
29216
29217  protected void composeProdCharacteristicInner(ProdCharacteristic element) throws IOException {
29218      composeBackbone(element);
29219      if (element.hasHeight()) {
29220        composeQuantity("height", element.getHeight());
29221      }
29222      if (element.hasWidth()) {
29223        composeQuantity("width", element.getWidth());
29224      }
29225      if (element.hasDepth()) {
29226        composeQuantity("depth", element.getDepth());
29227      }
29228      if (element.hasWeight()) {
29229        composeQuantity("weight", element.getWeight());
29230      }
29231      if (element.hasNominalVolume()) {
29232        composeQuantity("nominalVolume", element.getNominalVolume());
29233      }
29234      if (element.hasExternalDiameter()) {
29235        composeQuantity("externalDiameter", element.getExternalDiameter());
29236      }
29237      if (element.hasShapeElement()) {
29238        composeStringCore("shape", element.getShapeElement(), false);
29239        composeStringExtras("shape", element.getShapeElement(), false);
29240      }
29241      if (element.hasColor()) {
29242        openArray("color");
29243        for (StringType e : element.getColor()) 
29244          composeStringCore(null, e, true);
29245        closeArray();
29246        if (anyHasExtras(element.getColor())) {
29247          openArray("_color");
29248          for (StringType e : element.getColor()) 
29249            composeStringExtras(null, e, true);
29250          closeArray();
29251        }
29252      };
29253      if (element.hasImprint()) {
29254        openArray("imprint");
29255        for (StringType e : element.getImprint()) 
29256          composeStringCore(null, e, true);
29257        closeArray();
29258        if (anyHasExtras(element.getImprint())) {
29259          openArray("_imprint");
29260          for (StringType e : element.getImprint()) 
29261            composeStringExtras(null, e, true);
29262          closeArray();
29263        }
29264      };
29265      if (element.hasImage()) {
29266        openArray("image");
29267        for (Attachment e : element.getImage()) 
29268          composeAttachment(null, e);
29269        closeArray();
29270      };
29271      if (element.hasScoring()) {
29272        composeCodeableConcept("scoring", element.getScoring());
29273      }
29274  }
29275
29276  protected void composeMeta(String name, Meta element) throws IOException {
29277    if (element != null) {
29278      open(name);
29279      composeMetaInner(element);
29280      close();
29281    }
29282  }
29283
29284  protected void composeMetaInner(Meta element) throws IOException {
29285      composeElement(element);
29286      if (element.hasVersionIdElement()) {
29287        composeIdCore("versionId", element.getVersionIdElement(), false);
29288        composeIdExtras("versionId", element.getVersionIdElement(), false);
29289      }
29290      if (element.hasLastUpdatedElement()) {
29291        composeInstantCore("lastUpdated", element.getLastUpdatedElement(), false);
29292        composeInstantExtras("lastUpdated", element.getLastUpdatedElement(), false);
29293      }
29294      if (element.hasSourceElement()) {
29295        composeUriCore("source", element.getSourceElement(), false);
29296        composeUriExtras("source", element.getSourceElement(), false);
29297      }
29298      if (element.hasProfile()) {
29299        openArray("profile");
29300        for (CanonicalType e : element.getProfile()) 
29301          composeCanonicalCore(null, e, true);
29302        closeArray();
29303        if (anyHasExtras(element.getProfile())) {
29304          openArray("_profile");
29305          for (CanonicalType e : element.getProfile()) 
29306            composeCanonicalExtras(null, e, true);
29307          closeArray();
29308        }
29309      };
29310      if (element.hasSecurity()) {
29311        openArray("security");
29312        for (Coding e : element.getSecurity()) 
29313          composeCoding(null, e);
29314        closeArray();
29315      };
29316      if (element.hasTag()) {
29317        openArray("tag");
29318        for (Coding e : element.getTag()) 
29319          composeCoding(null, e);
29320        closeArray();
29321      };
29322  }
29323
29324  protected void composeAddress(String name, Address element) throws IOException {
29325    if (element != null) {
29326      open(name);
29327      composeAddressInner(element);
29328      close();
29329    }
29330  }
29331
29332  protected void composeAddressInner(Address element) throws IOException {
29333      composeElement(element);
29334      if (element.hasUseElement()) {
29335        composeEnumerationCore("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
29336        composeEnumerationExtras("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
29337      }
29338      if (element.hasTypeElement()) {
29339        composeEnumerationCore("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
29340        composeEnumerationExtras("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
29341      }
29342      if (element.hasTextElement()) {
29343        composeStringCore("text", element.getTextElement(), false);
29344        composeStringExtras("text", element.getTextElement(), false);
29345      }
29346      if (element.hasLine()) {
29347        openArray("line");
29348        for (StringType e : element.getLine()) 
29349          composeStringCore(null, e, true);
29350        closeArray();
29351        if (anyHasExtras(element.getLine())) {
29352          openArray("_line");
29353          for (StringType e : element.getLine()) 
29354            composeStringExtras(null, e, true);
29355          closeArray();
29356        }
29357      };
29358      if (element.hasCityElement()) {
29359        composeStringCore("city", element.getCityElement(), false);
29360        composeStringExtras("city", element.getCityElement(), false);
29361      }
29362      if (element.hasDistrictElement()) {
29363        composeStringCore("district", element.getDistrictElement(), false);
29364        composeStringExtras("district", element.getDistrictElement(), false);
29365      }
29366      if (element.hasStateElement()) {
29367        composeStringCore("state", element.getStateElement(), false);
29368        composeStringExtras("state", element.getStateElement(), false);
29369      }
29370      if (element.hasPostalCodeElement()) {
29371        composeStringCore("postalCode", element.getPostalCodeElement(), false);
29372        composeStringExtras("postalCode", element.getPostalCodeElement(), false);
29373      }
29374      if (element.hasCountryElement()) {
29375        composeStringCore("country", element.getCountryElement(), false);
29376        composeStringExtras("country", element.getCountryElement(), false);
29377      }
29378      if (element.hasPeriod()) {
29379        composePeriod("period", element.getPeriod());
29380      }
29381  }
29382
29383  protected void composeContributor(String name, Contributor element) throws IOException {
29384    if (element != null) {
29385      open(name);
29386      composeContributorInner(element);
29387      close();
29388    }
29389  }
29390
29391  protected void composeContributorInner(Contributor element) throws IOException {
29392      composeElement(element);
29393      if (element.hasTypeElement()) {
29394        composeEnumerationCore("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
29395        composeEnumerationExtras("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
29396      }
29397      if (element.hasNameElement()) {
29398        composeStringCore("name", element.getNameElement(), false);
29399        composeStringExtras("name", element.getNameElement(), false);
29400      }
29401      if (element.hasContact()) {
29402        openArray("contact");
29403        for (ContactDetail e : element.getContact()) 
29404          composeContactDetail(null, e);
29405        closeArray();
29406      };
29407  }
29408
29409  protected void composeAttachment(String name, Attachment element) throws IOException {
29410    if (element != null) {
29411      open(name);
29412      composeAttachmentInner(element);
29413      close();
29414    }
29415  }
29416
29417  protected void composeAttachmentInner(Attachment element) throws IOException {
29418      composeElement(element);
29419      if (element.hasContentTypeElement()) {
29420        composeCodeCore("contentType", element.getContentTypeElement(), false);
29421        composeCodeExtras("contentType", element.getContentTypeElement(), false);
29422      }
29423      if (element.hasLanguageElement()) {
29424        composeCodeCore("language", element.getLanguageElement(), false);
29425        composeCodeExtras("language", element.getLanguageElement(), false);
29426      }
29427      if (element.hasDataElement()) {
29428        composeBase64BinaryCore("data", element.getDataElement(), false);
29429        composeBase64BinaryExtras("data", element.getDataElement(), false);
29430      }
29431      if (element.hasUrlElement()) {
29432        composeUrlCore("url", element.getUrlElement(), false);
29433        composeUrlExtras("url", element.getUrlElement(), false);
29434      }
29435      if (element.hasSizeElement()) {
29436        composeUnsignedIntCore("size", element.getSizeElement(), false);
29437        composeUnsignedIntExtras("size", element.getSizeElement(), false);
29438      }
29439      if (element.hasHashElement()) {
29440        composeBase64BinaryCore("hash", element.getHashElement(), false);
29441        composeBase64BinaryExtras("hash", element.getHashElement(), false);
29442      }
29443      if (element.hasTitleElement()) {
29444        composeStringCore("title", element.getTitleElement(), false);
29445        composeStringExtras("title", element.getTitleElement(), false);
29446      }
29447      if (element.hasCreationElement()) {
29448        composeDateTimeCore("creation", element.getCreationElement(), false);
29449        composeDateTimeExtras("creation", element.getCreationElement(), false);
29450      }
29451  }
29452
29453  protected void composeDataRequirement(String name, DataRequirement element) throws IOException {
29454    if (element != null) {
29455      open(name);
29456      composeDataRequirementInner(element);
29457      close();
29458    }
29459  }
29460
29461  protected void composeDataRequirementInner(DataRequirement element) throws IOException {
29462      composeElement(element);
29463      if (element.hasTypeElement()) {
29464        composeCodeCore("type", element.getTypeElement(), false);
29465        composeCodeExtras("type", element.getTypeElement(), false);
29466      }
29467      if (element.hasProfile()) {
29468        openArray("profile");
29469        for (CanonicalType e : element.getProfile()) 
29470          composeCanonicalCore(null, e, true);
29471        closeArray();
29472        if (anyHasExtras(element.getProfile())) {
29473          openArray("_profile");
29474          for (CanonicalType e : element.getProfile()) 
29475            composeCanonicalExtras(null, e, true);
29476          closeArray();
29477        }
29478      };
29479      if (element.hasSubject()) {
29480        composeType("subject", element.getSubject());
29481      }
29482      if (element.hasMustSupport()) {
29483        openArray("mustSupport");
29484        for (StringType e : element.getMustSupport()) 
29485          composeStringCore(null, e, true);
29486        closeArray();
29487        if (anyHasExtras(element.getMustSupport())) {
29488          openArray("_mustSupport");
29489          for (StringType e : element.getMustSupport()) 
29490            composeStringExtras(null, e, true);
29491          closeArray();
29492        }
29493      };
29494      if (element.hasCodeFilter()) {
29495        openArray("codeFilter");
29496        for (DataRequirement.DataRequirementCodeFilterComponent e : element.getCodeFilter()) 
29497          composeDataRequirementDataRequirementCodeFilterComponent(null, e);
29498        closeArray();
29499      };
29500      if (element.hasDateFilter()) {
29501        openArray("dateFilter");
29502        for (DataRequirement.DataRequirementDateFilterComponent e : element.getDateFilter()) 
29503          composeDataRequirementDataRequirementDateFilterComponent(null, e);
29504        closeArray();
29505      };
29506      if (element.hasLimitElement()) {
29507        composePositiveIntCore("limit", element.getLimitElement(), false);
29508        composePositiveIntExtras("limit", element.getLimitElement(), false);
29509      }
29510      if (element.hasSort()) {
29511        openArray("sort");
29512        for (DataRequirement.DataRequirementSortComponent e : element.getSort()) 
29513          composeDataRequirementDataRequirementSortComponent(null, e);
29514        closeArray();
29515      };
29516  }
29517
29518  protected void composeDataRequirementDataRequirementCodeFilterComponent(String name, DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
29519    if (element != null) {
29520      open(name);
29521      composeDataRequirementDataRequirementCodeFilterComponentInner(element);
29522      close();
29523    }
29524  }
29525
29526  protected void composeDataRequirementDataRequirementCodeFilterComponentInner(DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
29527      composeElement(element);
29528      if (element.hasPathElement()) {
29529        composeStringCore("path", element.getPathElement(), false);
29530        composeStringExtras("path", element.getPathElement(), false);
29531      }
29532      if (element.hasSearchParamElement()) {
29533        composeStringCore("searchParam", element.getSearchParamElement(), false);
29534        composeStringExtras("searchParam", element.getSearchParamElement(), false);
29535      }
29536      if (element.hasValueSetElement()) {
29537        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
29538        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
29539      }
29540      if (element.hasCode()) {
29541        openArray("code");
29542        for (Coding e : element.getCode()) 
29543          composeCoding(null, e);
29544        closeArray();
29545      };
29546  }
29547
29548  protected void composeDataRequirementDataRequirementDateFilterComponent(String name, DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
29549    if (element != null) {
29550      open(name);
29551      composeDataRequirementDataRequirementDateFilterComponentInner(element);
29552      close();
29553    }
29554  }
29555
29556  protected void composeDataRequirementDataRequirementDateFilterComponentInner(DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
29557      composeElement(element);
29558      if (element.hasPathElement()) {
29559        composeStringCore("path", element.getPathElement(), false);
29560        composeStringExtras("path", element.getPathElement(), false);
29561      }
29562      if (element.hasSearchParamElement()) {
29563        composeStringCore("searchParam", element.getSearchParamElement(), false);
29564        composeStringExtras("searchParam", element.getSearchParamElement(), false);
29565      }
29566      if (element.hasValue()) {
29567        composeType("value", element.getValue());
29568      }
29569  }
29570
29571  protected void composeDataRequirementDataRequirementSortComponent(String name, DataRequirement.DataRequirementSortComponent element) throws IOException {
29572    if (element != null) {
29573      open(name);
29574      composeDataRequirementDataRequirementSortComponentInner(element);
29575      close();
29576    }
29577  }
29578
29579  protected void composeDataRequirementDataRequirementSortComponentInner(DataRequirement.DataRequirementSortComponent element) throws IOException {
29580      composeElement(element);
29581      if (element.hasPathElement()) {
29582        composeStringCore("path", element.getPathElement(), false);
29583        composeStringExtras("path", element.getPathElement(), false);
29584      }
29585      if (element.hasDirectionElement()) {
29586        composeEnumerationCore("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
29587        composeEnumerationExtras("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
29588      }
29589  }
29590
29591  protected void composeMoney(String name, Money element) throws IOException {
29592    if (element != null) {
29593      open(name);
29594      composeMoneyInner(element);
29595      close();
29596    }
29597  }
29598
29599  protected void composeMoneyInner(Money element) throws IOException {
29600      composeElement(element);
29601      if (element.hasValueElement()) {
29602        composeDecimalCore("value", element.getValueElement(), false);
29603        composeDecimalExtras("value", element.getValueElement(), false);
29604      }
29605      if (element.hasCurrencyElement()) {
29606        composeCodeCore("currency", element.getCurrencyElement(), false);
29607        composeCodeExtras("currency", element.getCurrencyElement(), false);
29608      }
29609  }
29610
29611  protected void composeHumanName(String name, HumanName element) throws IOException {
29612    if (element != null) {
29613      open(name);
29614      composeHumanNameInner(element);
29615      close();
29616    }
29617  }
29618
29619  protected void composeHumanNameInner(HumanName element) throws IOException {
29620      composeElement(element);
29621      if (element.hasUseElement()) {
29622        composeEnumerationCore("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
29623        composeEnumerationExtras("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
29624      }
29625      if (element.hasTextElement()) {
29626        composeStringCore("text", element.getTextElement(), false);
29627        composeStringExtras("text", element.getTextElement(), false);
29628      }
29629      if (element.hasFamilyElement()) {
29630        composeStringCore("family", element.getFamilyElement(), false);
29631        composeStringExtras("family", element.getFamilyElement(), false);
29632      }
29633      if (element.hasGiven()) {
29634        openArray("given");
29635        for (StringType e : element.getGiven()) 
29636          composeStringCore(null, e, true);
29637        closeArray();
29638        if (anyHasExtras(element.getGiven())) {
29639          openArray("_given");
29640          for (StringType e : element.getGiven()) 
29641            composeStringExtras(null, e, true);
29642          closeArray();
29643        }
29644      };
29645      if (element.hasPrefix()) {
29646        openArray("prefix");
29647        for (StringType e : element.getPrefix()) 
29648          composeStringCore(null, e, true);
29649        closeArray();
29650        if (anyHasExtras(element.getPrefix())) {
29651          openArray("_prefix");
29652          for (StringType e : element.getPrefix()) 
29653            composeStringExtras(null, e, true);
29654          closeArray();
29655        }
29656      };
29657      if (element.hasSuffix()) {
29658        openArray("suffix");
29659        for (StringType e : element.getSuffix()) 
29660          composeStringCore(null, e, true);
29661        closeArray();
29662        if (anyHasExtras(element.getSuffix())) {
29663          openArray("_suffix");
29664          for (StringType e : element.getSuffix()) 
29665            composeStringExtras(null, e, true);
29666          closeArray();
29667        }
29668      };
29669      if (element.hasPeriod()) {
29670        composePeriod("period", element.getPeriod());
29671      }
29672  }
29673
29674  protected void composeContactPoint(String name, ContactPoint element) throws IOException {
29675    if (element != null) {
29676      open(name);
29677      composeContactPointInner(element);
29678      close();
29679    }
29680  }
29681
29682  protected void composeContactPointInner(ContactPoint element) throws IOException {
29683      composeElement(element);
29684      if (element.hasSystemElement()) {
29685        composeEnumerationCore("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
29686        composeEnumerationExtras("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
29687      }
29688      if (element.hasValueElement()) {
29689        composeStringCore("value", element.getValueElement(), false);
29690        composeStringExtras("value", element.getValueElement(), false);
29691      }
29692      if (element.hasUseElement()) {
29693        composeEnumerationCore("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
29694        composeEnumerationExtras("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
29695      }
29696      if (element.hasRankElement()) {
29697        composePositiveIntCore("rank", element.getRankElement(), false);
29698        composePositiveIntExtras("rank", element.getRankElement(), false);
29699      }
29700      if (element.hasPeriod()) {
29701        composePeriod("period", element.getPeriod());
29702      }
29703  }
29704
29705  protected void composeIdentifier(String name, Identifier element) throws IOException {
29706    if (element != null) {
29707      open(name);
29708      composeIdentifierInner(element);
29709      close();
29710    }
29711  }
29712
29713  protected void composeIdentifierInner(Identifier element) throws IOException {
29714      composeElement(element);
29715      if (element.hasUseElement()) {
29716        composeEnumerationCore("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
29717        composeEnumerationExtras("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
29718      }
29719      if (element.hasType()) {
29720        composeCodeableConcept("type", element.getType());
29721      }
29722      if (element.hasSystemElement()) {
29723        composeUriCore("system", element.getSystemElement(), false);
29724        composeUriExtras("system", element.getSystemElement(), false);
29725      }
29726      if (element.hasValueElement()) {
29727        composeStringCore("value", element.getValueElement(), false);
29728        composeStringExtras("value", element.getValueElement(), false);
29729      }
29730      if (element.hasPeriod()) {
29731        composePeriod("period", element.getPeriod());
29732      }
29733      if (element.hasAssigner()) {
29734        composeReference("assigner", element.getAssigner());
29735      }
29736  }
29737
29738  protected void composeCoding(String name, Coding element) throws IOException {
29739    if (element != null) {
29740      open(name);
29741      composeCodingInner(element);
29742      close();
29743    }
29744  }
29745
29746  protected void composeCodingInner(Coding element) throws IOException {
29747      composeElement(element);
29748      if (element.hasSystemElement()) {
29749        composeUriCore("system", element.getSystemElement(), false);
29750        composeUriExtras("system", element.getSystemElement(), false);
29751      }
29752      if (element.hasVersionElement()) {
29753        composeStringCore("version", element.getVersionElement(), false);
29754        composeStringExtras("version", element.getVersionElement(), false);
29755      }
29756      if (element.hasCodeElement()) {
29757        composeCodeCore("code", element.getCodeElement(), false);
29758        composeCodeExtras("code", element.getCodeElement(), false);
29759      }
29760      if (element.hasDisplayElement()) {
29761        composeStringCore("display", element.getDisplayElement(), false);
29762        composeStringExtras("display", element.getDisplayElement(), false);
29763      }
29764      if (element.hasUserSelectedElement()) {
29765        composeBooleanCore("userSelected", element.getUserSelectedElement(), false);
29766        composeBooleanExtras("userSelected", element.getUserSelectedElement(), false);
29767      }
29768  }
29769
29770  protected void composeSampledData(String name, SampledData element) throws IOException {
29771    if (element != null) {
29772      open(name);
29773      composeSampledDataInner(element);
29774      close();
29775    }
29776  }
29777
29778  protected void composeSampledDataInner(SampledData element) throws IOException {
29779      composeElement(element);
29780      if (element.hasOrigin()) {
29781        composeQuantity("origin", element.getOrigin());
29782      }
29783      if (element.hasPeriodElement()) {
29784        composeDecimalCore("period", element.getPeriodElement(), false);
29785        composeDecimalExtras("period", element.getPeriodElement(), false);
29786      }
29787      if (element.hasFactorElement()) {
29788        composeDecimalCore("factor", element.getFactorElement(), false);
29789        composeDecimalExtras("factor", element.getFactorElement(), false);
29790      }
29791      if (element.hasLowerLimitElement()) {
29792        composeDecimalCore("lowerLimit", element.getLowerLimitElement(), false);
29793        composeDecimalExtras("lowerLimit", element.getLowerLimitElement(), false);
29794      }
29795      if (element.hasUpperLimitElement()) {
29796        composeDecimalCore("upperLimit", element.getUpperLimitElement(), false);
29797        composeDecimalExtras("upperLimit", element.getUpperLimitElement(), false);
29798      }
29799      if (element.hasDimensionsElement()) {
29800        composePositiveIntCore("dimensions", element.getDimensionsElement(), false);
29801        composePositiveIntExtras("dimensions", element.getDimensionsElement(), false);
29802      }
29803      if (element.hasDataElement()) {
29804        composeStringCore("data", element.getDataElement(), false);
29805        composeStringExtras("data", element.getDataElement(), false);
29806      }
29807  }
29808
29809  protected void composeRatio(String name, Ratio element) throws IOException {
29810    if (element != null) {
29811      open(name);
29812      composeRatioInner(element);
29813      close();
29814    }
29815  }
29816
29817  protected void composeRatioInner(Ratio element) throws IOException {
29818      composeElement(element);
29819      if (element.hasNumerator()) {
29820        composeQuantity("numerator", element.getNumerator());
29821      }
29822      if (element.hasDenominator()) {
29823        composeQuantity("denominator", element.getDenominator());
29824      }
29825  }
29826
29827  protected void composeReference(String name, Reference element) throws IOException {
29828    if (element != null) {
29829      open(name);
29830      composeReferenceInner(element);
29831      close();
29832    }
29833  }
29834
29835  protected void composeReferenceInner(Reference element) throws IOException {
29836      composeElement(element);
29837      if (element.hasReferenceElement()) {
29838        composeStringCore("reference", element.getReferenceElement(), false);
29839        composeStringExtras("reference", element.getReferenceElement(), false);
29840      }
29841      if (element.hasTypeElement()) {
29842        composeUriCore("type", element.getTypeElement(), false);
29843        composeUriExtras("type", element.getTypeElement(), false);
29844      }
29845      if (element.hasIdentifier()) {
29846        composeIdentifier("identifier", element.getIdentifier());
29847      }
29848      if (element.hasDisplayElement()) {
29849        composeStringCore("display", element.getDisplayElement(), false);
29850        composeStringExtras("display", element.getDisplayElement(), false);
29851      }
29852  }
29853
29854  protected void composeTriggerDefinition(String name, TriggerDefinition element) throws IOException {
29855    if (element != null) {
29856      open(name);
29857      composeTriggerDefinitionInner(element);
29858      close();
29859    }
29860  }
29861
29862  protected void composeTriggerDefinitionInner(TriggerDefinition element) throws IOException {
29863      composeElement(element);
29864      if (element.hasTypeElement()) {
29865        composeEnumerationCore("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
29866        composeEnumerationExtras("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
29867      }
29868      if (element.hasNameElement()) {
29869        composeStringCore("name", element.getNameElement(), false);
29870        composeStringExtras("name", element.getNameElement(), false);
29871      }
29872      if (element.hasTiming()) {
29873        composeType("timing", element.getTiming());
29874      }
29875      if (element.hasData()) {
29876        openArray("data");
29877        for (DataRequirement e : element.getData()) 
29878          composeDataRequirement(null, e);
29879        closeArray();
29880      };
29881      if (element.hasCondition()) {
29882        composeExpression("condition", element.getCondition());
29883      }
29884  }
29885
29886  protected void composeQuantity(String name, Quantity element) throws IOException {
29887    if (element != null) {
29888      open(name);
29889      composeQuantityInner(element);
29890      close();
29891    }
29892  }
29893
29894  protected void composeQuantityInner(Quantity element) throws IOException {
29895      composeElement(element);
29896      if (element.hasValueElement()) {
29897        composeDecimalCore("value", element.getValueElement(), false);
29898        composeDecimalExtras("value", element.getValueElement(), false);
29899      }
29900      if (element.hasComparatorElement()) {
29901        composeEnumerationCore("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
29902        composeEnumerationExtras("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
29903      }
29904      if (element.hasUnitElement()) {
29905        composeStringCore("unit", element.getUnitElement(), false);
29906        composeStringExtras("unit", element.getUnitElement(), false);
29907      }
29908      if (element.hasSystemElement()) {
29909        composeUriCore("system", element.getSystemElement(), false);
29910        composeUriExtras("system", element.getSystemElement(), false);
29911      }
29912      if (element.hasCodeElement()) {
29913        composeCodeCore("code", element.getCodeElement(), false);
29914        composeCodeExtras("code", element.getCodeElement(), false);
29915      }
29916  }
29917
29918  protected void composePeriod(String name, Period element) throws IOException {
29919    if (element != null) {
29920      open(name);
29921      composePeriodInner(element);
29922      close();
29923    }
29924  }
29925
29926  protected void composePeriodInner(Period element) throws IOException {
29927      composeElement(element);
29928      if (element.hasStartElement()) {
29929        composeDateTimeCore("start", element.getStartElement(), false);
29930        composeDateTimeExtras("start", element.getStartElement(), false);
29931      }
29932      if (element.hasEndElement()) {
29933        composeDateTimeCore("end", element.getEndElement(), false);
29934        composeDateTimeExtras("end", element.getEndElement(), false);
29935      }
29936  }
29937
29938  protected void composeRange(String name, Range element) throws IOException {
29939    if (element != null) {
29940      open(name);
29941      composeRangeInner(element);
29942      close();
29943    }
29944  }
29945
29946  protected void composeRangeInner(Range element) throws IOException {
29947      composeElement(element);
29948      if (element.hasLow()) {
29949        composeQuantity("low", element.getLow());
29950      }
29951      if (element.hasHigh()) {
29952        composeQuantity("high", element.getHigh());
29953      }
29954  }
29955
29956  protected void composeRelatedArtifact(String name, RelatedArtifact element) throws IOException {
29957    if (element != null) {
29958      open(name);
29959      composeRelatedArtifactInner(element);
29960      close();
29961    }
29962  }
29963
29964  protected void composeRelatedArtifactInner(RelatedArtifact element) throws IOException {
29965      composeElement(element);
29966      if (element.hasTypeElement()) {
29967        composeEnumerationCore("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
29968        composeEnumerationExtras("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
29969      }
29970      if (element.hasLabelElement()) {
29971        composeStringCore("label", element.getLabelElement(), false);
29972        composeStringExtras("label", element.getLabelElement(), false);
29973      }
29974      if (element.hasDisplayElement()) {
29975        composeStringCore("display", element.getDisplayElement(), false);
29976        composeStringExtras("display", element.getDisplayElement(), false);
29977      }
29978      if (element.hasCitationElement()) {
29979        composeMarkdownCore("citation", element.getCitationElement(), false);
29980        composeMarkdownExtras("citation", element.getCitationElement(), false);
29981      }
29982      if (element.hasUrlElement()) {
29983        composeUrlCore("url", element.getUrlElement(), false);
29984        composeUrlExtras("url", element.getUrlElement(), false);
29985      }
29986      if (element.hasDocument()) {
29987        composeAttachment("document", element.getDocument());
29988      }
29989      if (element.hasResourceElement()) {
29990        composeCanonicalCore("resource", element.getResourceElement(), false);
29991        composeCanonicalExtras("resource", element.getResourceElement(), false);
29992      }
29993  }
29994
29995  protected void composeAnnotation(String name, Annotation element) throws IOException {
29996    if (element != null) {
29997      open(name);
29998      composeAnnotationInner(element);
29999      close();
30000    }
30001  }
30002
30003  protected void composeAnnotationInner(Annotation element) throws IOException {
30004      composeElement(element);
30005      if (element.hasAuthor()) {
30006        composeType("author", element.getAuthor());
30007      }
30008      if (element.hasTimeElement()) {
30009        composeDateTimeCore("time", element.getTimeElement(), false);
30010        composeDateTimeExtras("time", element.getTimeElement(), false);
30011      }
30012      if (element.hasTextElement()) {
30013        composeMarkdownCore("text", element.getTextElement(), false);
30014        composeMarkdownExtras("text", element.getTextElement(), false);
30015      }
30016  }
30017
30018  protected void composeContactDetail(String name, ContactDetail element) throws IOException {
30019    if (element != null) {
30020      open(name);
30021      composeContactDetailInner(element);
30022      close();
30023    }
30024  }
30025
30026  protected void composeContactDetailInner(ContactDetail element) throws IOException {
30027      composeElement(element);
30028      if (element.hasNameElement()) {
30029        composeStringCore("name", element.getNameElement(), false);
30030        composeStringExtras("name", element.getNameElement(), false);
30031      }
30032      if (element.hasTelecom()) {
30033        openArray("telecom");
30034        for (ContactPoint e : element.getTelecom()) 
30035          composeContactPoint(null, e);
30036        closeArray();
30037      };
30038  }
30039
30040  protected void composeUsageContext(String name, UsageContext element) throws IOException {
30041    if (element != null) {
30042      open(name);
30043      composeUsageContextInner(element);
30044      close();
30045    }
30046  }
30047
30048  protected void composeUsageContextInner(UsageContext element) throws IOException {
30049      composeElement(element);
30050      if (element.hasCode()) {
30051        composeCoding("code", element.getCode());
30052      }
30053      if (element.hasValue()) {
30054        composeType("value", element.getValue());
30055      }
30056  }
30057
30058  protected void composeExpression(String name, Expression element) throws IOException {
30059    if (element != null) {
30060      open(name);
30061      composeExpressionInner(element);
30062      close();
30063    }
30064  }
30065
30066  protected void composeExpressionInner(Expression element) throws IOException {
30067      composeElement(element);
30068      if (element.hasDescriptionElement()) {
30069        composeStringCore("description", element.getDescriptionElement(), false);
30070        composeStringExtras("description", element.getDescriptionElement(), false);
30071      }
30072      if (element.hasNameElement()) {
30073        composeIdCore("name", element.getNameElement(), false);
30074        composeIdExtras("name", element.getNameElement(), false);
30075      }
30076      if (element.hasLanguageElement()) {
30077        composeEnumerationCore("language", element.getLanguageElement(), new Expression.ExpressionLanguageEnumFactory(), false);
30078        composeEnumerationExtras("language", element.getLanguageElement(), new Expression.ExpressionLanguageEnumFactory(), false);
30079      }
30080      if (element.hasExpressionElement()) {
30081        composeStringCore("expression", element.getExpressionElement(), false);
30082        composeStringExtras("expression", element.getExpressionElement(), false);
30083      }
30084      if (element.hasReferenceElement()) {
30085        composeUriCore("reference", element.getReferenceElement(), false);
30086        composeUriExtras("reference", element.getReferenceElement(), false);
30087      }
30088  }
30089
30090  protected void composeSignature(String name, Signature element) throws IOException {
30091    if (element != null) {
30092      open(name);
30093      composeSignatureInner(element);
30094      close();
30095    }
30096  }
30097
30098  protected void composeSignatureInner(Signature element) throws IOException {
30099      composeElement(element);
30100      if (element.hasType()) {
30101        openArray("type");
30102        for (Coding e : element.getType()) 
30103          composeCoding(null, e);
30104        closeArray();
30105      };
30106      if (element.hasWhenElement()) {
30107        composeInstantCore("when", element.getWhenElement(), false);
30108        composeInstantExtras("when", element.getWhenElement(), false);
30109      }
30110      if (element.hasWho()) {
30111        composeReference("who", element.getWho());
30112      }
30113      if (element.hasOnBehalfOf()) {
30114        composeReference("onBehalfOf", element.getOnBehalfOf());
30115      }
30116      if (element.hasTargetFormatElement()) {
30117        composeCodeCore("targetFormat", element.getTargetFormatElement(), false);
30118        composeCodeExtras("targetFormat", element.getTargetFormatElement(), false);
30119      }
30120      if (element.hasSigFormatElement()) {
30121        composeCodeCore("sigFormat", element.getSigFormatElement(), false);
30122        composeCodeExtras("sigFormat", element.getSigFormatElement(), false);
30123      }
30124      if (element.hasDataElement()) {
30125        composeBase64BinaryCore("data", element.getDataElement(), false);
30126        composeBase64BinaryExtras("data", element.getDataElement(), false);
30127      }
30128  }
30129
30130  protected void composeCodeableConcept(String name, CodeableConcept element) throws IOException {
30131    if (element != null) {
30132      open(name);
30133      composeCodeableConceptInner(element);
30134      close();
30135    }
30136  }
30137
30138  protected void composeCodeableConceptInner(CodeableConcept element) throws IOException {
30139      composeElement(element);
30140      if (element.hasCoding()) {
30141        openArray("coding");
30142        for (Coding e : element.getCoding()) 
30143          composeCoding(null, e);
30144        closeArray();
30145      };
30146      if (element.hasTextElement()) {
30147        composeStringCore("text", element.getTextElement(), false);
30148        composeStringExtras("text", element.getTextElement(), false);
30149      }
30150  }
30151
30152  protected void composeParameterDefinition(String name, ParameterDefinition element) throws IOException {
30153    if (element != null) {
30154      open(name);
30155      composeParameterDefinitionInner(element);
30156      close();
30157    }
30158  }
30159
30160  protected void composeParameterDefinitionInner(ParameterDefinition element) throws IOException {
30161      composeElement(element);
30162      if (element.hasNameElement()) {
30163        composeCodeCore("name", element.getNameElement(), false);
30164        composeCodeExtras("name", element.getNameElement(), false);
30165      }
30166      if (element.hasUseElement()) {
30167        composeEnumerationCore("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(), false);
30168        composeEnumerationExtras("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(), false);
30169      }
30170      if (element.hasMinElement()) {
30171        composeIntegerCore("min", element.getMinElement(), false);
30172        composeIntegerExtras("min", element.getMinElement(), false);
30173      }
30174      if (element.hasMaxElement()) {
30175        composeStringCore("max", element.getMaxElement(), false);
30176        composeStringExtras("max", element.getMaxElement(), false);
30177      }
30178      if (element.hasDocumentationElement()) {
30179        composeStringCore("documentation", element.getDocumentationElement(), false);
30180        composeStringExtras("documentation", element.getDocumentationElement(), false);
30181      }
30182      if (element.hasTypeElement()) {
30183        composeCodeCore("type", element.getTypeElement(), false);
30184        composeCodeExtras("type", element.getTypeElement(), false);
30185      }
30186      if (element.hasProfileElement()) {
30187        composeCanonicalCore("profile", element.getProfileElement(), false);
30188        composeCanonicalExtras("profile", element.getProfileElement(), false);
30189      }
30190  }
30191
30192  protected void composeElementDefinition(String name, ElementDefinition element) throws IOException {
30193    if (element != null) {
30194      open(name);
30195      composeElementDefinitionInner(element);
30196      close();
30197    }
30198  }
30199
30200  protected void composeElementDefinitionInner(ElementDefinition element) throws IOException {
30201      composeBackbone(element);
30202      if (element.hasPathElement()) {
30203        composeStringCore("path", element.getPathElement(), false);
30204        composeStringExtras("path", element.getPathElement(), false);
30205      }
30206      if (element.hasRepresentation()) {
30207        openArray("representation");
30208        for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
30209          composeEnumerationCore(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
30210        closeArray();
30211        if (anyHasExtras(element.getRepresentation())) {
30212          openArray("_representation");
30213          for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
30214            composeEnumerationExtras(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
30215          closeArray();
30216        }
30217      };
30218      if (element.hasSliceNameElement()) {
30219        composeStringCore("sliceName", element.getSliceNameElement(), false);
30220        composeStringExtras("sliceName", element.getSliceNameElement(), false);
30221      }
30222      if (element.hasSliceIsConstrainingElement()) {
30223        composeBooleanCore("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
30224        composeBooleanExtras("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
30225      }
30226      if (element.hasLabelElement()) {
30227        composeStringCore("label", element.getLabelElement(), false);
30228        composeStringExtras("label", element.getLabelElement(), false);
30229      }
30230      if (element.hasCode()) {
30231        openArray("code");
30232        for (Coding e : element.getCode()) 
30233          composeCoding(null, e);
30234        closeArray();
30235      };
30236      if (element.hasSlicing()) {
30237        composeElementDefinitionElementDefinitionSlicingComponent("slicing", element.getSlicing());
30238      }
30239      if (element.hasShortElement()) {
30240        composeStringCore("short", element.getShortElement(), false);
30241        composeStringExtras("short", element.getShortElement(), false);
30242      }
30243      if (element.hasDefinitionElement()) {
30244        composeMarkdownCore("definition", element.getDefinitionElement(), false);
30245        composeMarkdownExtras("definition", element.getDefinitionElement(), false);
30246      }
30247      if (element.hasCommentElement()) {
30248        composeMarkdownCore("comment", element.getCommentElement(), false);
30249        composeMarkdownExtras("comment", element.getCommentElement(), false);
30250      }
30251      if (element.hasRequirementsElement()) {
30252        composeMarkdownCore("requirements", element.getRequirementsElement(), false);
30253        composeMarkdownExtras("requirements", element.getRequirementsElement(), false);
30254      }
30255      if (element.hasAlias()) {
30256        openArray("alias");
30257        for (StringType e : element.getAlias()) 
30258          composeStringCore(null, e, true);
30259        closeArray();
30260        if (anyHasExtras(element.getAlias())) {
30261          openArray("_alias");
30262          for (StringType e : element.getAlias()) 
30263            composeStringExtras(null, e, true);
30264          closeArray();
30265        }
30266      };
30267      if (element.hasMinElement()) {
30268        composeUnsignedIntCore("min", element.getMinElement(), false);
30269        composeUnsignedIntExtras("min", element.getMinElement(), false);
30270      }
30271      if (element.hasMaxElement()) {
30272        composeStringCore("max", element.getMaxElement(), false);
30273        composeStringExtras("max", element.getMaxElement(), false);
30274      }
30275      if (element.hasBase()) {
30276        composeElementDefinitionElementDefinitionBaseComponent("base", element.getBase());
30277      }
30278      if (element.hasContentReferenceElement()) {
30279        composeUriCore("contentReference", element.getContentReferenceElement(), false);
30280        composeUriExtras("contentReference", element.getContentReferenceElement(), false);
30281      }
30282      if (element.hasType()) {
30283        openArray("type");
30284        for (ElementDefinition.TypeRefComponent e : element.getType()) 
30285          composeElementDefinitionTypeRefComponent(null, e);
30286        closeArray();
30287      };
30288      if (element.hasDefaultValue()) {
30289        composeType("defaultValue", element.getDefaultValue());
30290      }
30291      if (element.hasMeaningWhenMissingElement()) {
30292        composeMarkdownCore("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
30293        composeMarkdownExtras("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
30294      }
30295      if (element.hasOrderMeaningElement()) {
30296        composeStringCore("orderMeaning", element.getOrderMeaningElement(), false);
30297        composeStringExtras("orderMeaning", element.getOrderMeaningElement(), false);
30298      }
30299      if (element.hasFixed()) {
30300        composeType("fixed", element.getFixed());
30301      }
30302      if (element.hasPattern()) {
30303        composeType("pattern", element.getPattern());
30304      }
30305      if (element.hasExample()) {
30306        openArray("example");
30307        for (ElementDefinition.ElementDefinitionExampleComponent e : element.getExample()) 
30308          composeElementDefinitionElementDefinitionExampleComponent(null, e);
30309        closeArray();
30310      };
30311      if (element.hasMinValue()) {
30312        composeType("minValue", element.getMinValue());
30313      }
30314      if (element.hasMaxValue()) {
30315        composeType("maxValue", element.getMaxValue());
30316      }
30317      if (element.hasMaxLengthElement()) {
30318        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
30319        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
30320      }
30321      if (element.hasCondition()) {
30322        openArray("condition");
30323        for (IdType e : element.getCondition()) 
30324          composeIdCore(null, e, true);
30325        closeArray();
30326        if (anyHasExtras(element.getCondition())) {
30327          openArray("_condition");
30328          for (IdType e : element.getCondition()) 
30329            composeIdExtras(null, e, true);
30330          closeArray();
30331        }
30332      };
30333      if (element.hasConstraint()) {
30334        openArray("constraint");
30335        for (ElementDefinition.ElementDefinitionConstraintComponent e : element.getConstraint()) 
30336          composeElementDefinitionElementDefinitionConstraintComponent(null, e);
30337        closeArray();
30338      };
30339      if (element.hasMustSupportElement()) {
30340        composeBooleanCore("mustSupport", element.getMustSupportElement(), false);
30341        composeBooleanExtras("mustSupport", element.getMustSupportElement(), false);
30342      }
30343      if (element.hasIsModifierElement()) {
30344        composeBooleanCore("isModifier", element.getIsModifierElement(), false);
30345        composeBooleanExtras("isModifier", element.getIsModifierElement(), false);
30346      }
30347      if (element.hasIsModifierReasonElement()) {
30348        composeStringCore("isModifierReason", element.getIsModifierReasonElement(), false);
30349        composeStringExtras("isModifierReason", element.getIsModifierReasonElement(), false);
30350      }
30351      if (element.hasIsSummaryElement()) {
30352        composeBooleanCore("isSummary", element.getIsSummaryElement(), false);
30353        composeBooleanExtras("isSummary", element.getIsSummaryElement(), false);
30354      }
30355      if (element.hasBinding()) {
30356        composeElementDefinitionElementDefinitionBindingComponent("binding", element.getBinding());
30357      }
30358      if (element.hasMapping()) {
30359        openArray("mapping");
30360        for (ElementDefinition.ElementDefinitionMappingComponent e : element.getMapping()) 
30361          composeElementDefinitionElementDefinitionMappingComponent(null, e);
30362        closeArray();
30363      };
30364  }
30365
30366  protected void composeElementDefinitionElementDefinitionSlicingComponent(String name, ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
30367    if (element != null) {
30368      open(name);
30369      composeElementDefinitionElementDefinitionSlicingComponentInner(element);
30370      close();
30371    }
30372  }
30373
30374  protected void composeElementDefinitionElementDefinitionSlicingComponentInner(ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
30375      composeElement(element);
30376      if (element.hasDiscriminator()) {
30377        openArray("discriminator");
30378        for (ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent e : element.getDiscriminator()) 
30379          composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(null, e);
30380        closeArray();
30381      };
30382      if (element.hasDescriptionElement()) {
30383        composeStringCore("description", element.getDescriptionElement(), false);
30384        composeStringExtras("description", element.getDescriptionElement(), false);
30385      }
30386      if (element.hasOrderedElement()) {
30387        composeBooleanCore("ordered", element.getOrderedElement(), false);
30388        composeBooleanExtras("ordered", element.getOrderedElement(), false);
30389      }
30390      if (element.hasRulesElement()) {
30391        composeEnumerationCore("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
30392        composeEnumerationExtras("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
30393      }
30394  }
30395
30396  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(String name, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
30397    if (element != null) {
30398      open(name);
30399      composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(element);
30400      close();
30401    }
30402  }
30403
30404  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
30405      composeElement(element);
30406      if (element.hasTypeElement()) {
30407        composeEnumerationCore("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
30408        composeEnumerationExtras("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
30409      }
30410      if (element.hasPathElement()) {
30411        composeStringCore("path", element.getPathElement(), false);
30412        composeStringExtras("path", element.getPathElement(), false);
30413      }
30414  }
30415
30416  protected void composeElementDefinitionElementDefinitionBaseComponent(String name, ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
30417    if (element != null) {
30418      open(name);
30419      composeElementDefinitionElementDefinitionBaseComponentInner(element);
30420      close();
30421    }
30422  }
30423
30424  protected void composeElementDefinitionElementDefinitionBaseComponentInner(ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
30425      composeElement(element);
30426      if (element.hasPathElement()) {
30427        composeStringCore("path", element.getPathElement(), false);
30428        composeStringExtras("path", element.getPathElement(), false);
30429      }
30430      if (element.hasMinElement()) {
30431        composeUnsignedIntCore("min", element.getMinElement(), false);
30432        composeUnsignedIntExtras("min", element.getMinElement(), false);
30433      }
30434      if (element.hasMaxElement()) {
30435        composeStringCore("max", element.getMaxElement(), false);
30436        composeStringExtras("max", element.getMaxElement(), false);
30437      }
30438  }
30439
30440  protected void composeElementDefinitionTypeRefComponent(String name, ElementDefinition.TypeRefComponent element) throws IOException {
30441    if (element != null) {
30442      open(name);
30443      composeElementDefinitionTypeRefComponentInner(element);
30444      close();
30445    }
30446  }
30447
30448  protected void composeElementDefinitionTypeRefComponentInner(ElementDefinition.TypeRefComponent element) throws IOException {
30449      composeElement(element);
30450      if (element.hasCodeElement()) {
30451        composeUriCore("code", element.getCodeElement(), false);
30452        composeUriExtras("code", element.getCodeElement(), false);
30453      }
30454      if (element.hasProfile()) {
30455        openArray("profile");
30456        for (CanonicalType e : element.getProfile()) 
30457          composeCanonicalCore(null, e, true);
30458        closeArray();
30459        if (anyHasExtras(element.getProfile())) {
30460          openArray("_profile");
30461          for (CanonicalType e : element.getProfile()) 
30462            composeCanonicalExtras(null, e, true);
30463          closeArray();
30464        }
30465      };
30466      if (element.hasTargetProfile()) {
30467        openArray("targetProfile");
30468        for (CanonicalType e : element.getTargetProfile()) 
30469          composeCanonicalCore(null, e, true);
30470        closeArray();
30471        if (anyHasExtras(element.getTargetProfile())) {
30472          openArray("_targetProfile");
30473          for (CanonicalType e : element.getTargetProfile()) 
30474            composeCanonicalExtras(null, e, true);
30475          closeArray();
30476        }
30477      };
30478      if (element.hasAggregation()) {
30479        openArray("aggregation");
30480        for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
30481          composeEnumerationCore(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
30482        closeArray();
30483        if (anyHasExtras(element.getAggregation())) {
30484          openArray("_aggregation");
30485          for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
30486            composeEnumerationExtras(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
30487          closeArray();
30488        }
30489      };
30490      if (element.hasVersioningElement()) {
30491        composeEnumerationCore("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
30492        composeEnumerationExtras("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
30493      }
30494  }
30495
30496  protected void composeElementDefinitionElementDefinitionExampleComponent(String name, ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
30497    if (element != null) {
30498      open(name);
30499      composeElementDefinitionElementDefinitionExampleComponentInner(element);
30500      close();
30501    }
30502  }
30503
30504  protected void composeElementDefinitionElementDefinitionExampleComponentInner(ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
30505      composeElement(element);
30506      if (element.hasLabelElement()) {
30507        composeStringCore("label", element.getLabelElement(), false);
30508        composeStringExtras("label", element.getLabelElement(), false);
30509      }
30510      if (element.hasValue()) {
30511        composeType("value", element.getValue());
30512      }
30513  }
30514
30515  protected void composeElementDefinitionElementDefinitionConstraintComponent(String name, ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
30516    if (element != null) {
30517      open(name);
30518      composeElementDefinitionElementDefinitionConstraintComponentInner(element);
30519      close();
30520    }
30521  }
30522
30523  protected void composeElementDefinitionElementDefinitionConstraintComponentInner(ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
30524      composeElement(element);
30525      if (element.hasKeyElement()) {
30526        composeIdCore("key", element.getKeyElement(), false);
30527        composeIdExtras("key", element.getKeyElement(), false);
30528      }
30529      if (element.hasRequirementsElement()) {
30530        composeStringCore("requirements", element.getRequirementsElement(), false);
30531        composeStringExtras("requirements", element.getRequirementsElement(), false);
30532      }
30533      if (element.hasSeverityElement()) {
30534        composeEnumerationCore("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
30535        composeEnumerationExtras("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
30536      }
30537      if (element.hasHumanElement()) {
30538        composeStringCore("human", element.getHumanElement(), false);
30539        composeStringExtras("human", element.getHumanElement(), false);
30540      }
30541      if (element.hasExpressionElement()) {
30542        composeStringCore("expression", element.getExpressionElement(), false);
30543        composeStringExtras("expression", element.getExpressionElement(), false);
30544      }
30545      if (element.hasXpathElement()) {
30546        composeStringCore("xpath", element.getXpathElement(), false);
30547        composeStringExtras("xpath", element.getXpathElement(), false);
30548      }
30549      if (element.hasSourceElement()) {
30550        composeCanonicalCore("source", element.getSourceElement(), false);
30551        composeCanonicalExtras("source", element.getSourceElement(), false);
30552      }
30553  }
30554
30555  protected void composeElementDefinitionElementDefinitionBindingComponent(String name, ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
30556    if (element != null) {
30557      open(name);
30558      composeElementDefinitionElementDefinitionBindingComponentInner(element);
30559      close();
30560    }
30561  }
30562
30563  protected void composeElementDefinitionElementDefinitionBindingComponentInner(ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
30564      composeElement(element);
30565      if (element.hasStrengthElement()) {
30566        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
30567        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
30568      }
30569      if (element.hasDescriptionElement()) {
30570        composeStringCore("description", element.getDescriptionElement(), false);
30571        composeStringExtras("description", element.getDescriptionElement(), false);
30572      }
30573      if (element.hasValueSetElement()) {
30574        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
30575        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
30576      }
30577  }
30578
30579  protected void composeElementDefinitionElementDefinitionMappingComponent(String name, ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
30580    if (element != null) {
30581      open(name);
30582      composeElementDefinitionElementDefinitionMappingComponentInner(element);
30583      close();
30584    }
30585  }
30586
30587  protected void composeElementDefinitionElementDefinitionMappingComponentInner(ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
30588      composeElement(element);
30589      if (element.hasIdentityElement()) {
30590        composeIdCore("identity", element.getIdentityElement(), false);
30591        composeIdExtras("identity", element.getIdentityElement(), false);
30592      }
30593      if (element.hasLanguageElement()) {
30594        composeCodeCore("language", element.getLanguageElement(), false);
30595        composeCodeExtras("language", element.getLanguageElement(), false);
30596      }
30597      if (element.hasMapElement()) {
30598        composeStringCore("map", element.getMapElement(), false);
30599        composeStringExtras("map", element.getMapElement(), false);
30600      }
30601      if (element.hasCommentElement()) {
30602        composeStringCore("comment", element.getCommentElement(), false);
30603        composeStringExtras("comment", element.getCommentElement(), false);
30604      }
30605  }
30606
30607  protected void composeDomainResourceElements(DomainResource element) throws IOException {
30608      composeResourceElements(element);
30609      if (element.hasText()) {
30610        composeNarrative("text", element.getText());
30611      }
30612      if (element.hasContained()) {
30613        openArray("contained");
30614        for (Resource e : element.getContained()) {
30615          open(null);
30616          composeResource(e);
30617          close();
30618        }
30619        closeArray();
30620      };
30621      if (element.hasExtension()) {
30622        openArray("extension");
30623        for (Extension e : element.getExtension()) 
30624          composeExtension(null, e);
30625        closeArray();
30626      };
30627      if (element.hasModifierExtension()) {
30628        openArray("modifierExtension");
30629        for (Extension e : element.getModifierExtension()) 
30630          composeExtension(null, e);
30631        closeArray();
30632      };
30633  }
30634
30635  protected void composeParameters(String name, Parameters element) throws IOException {
30636    if (element != null) {
30637      prop("resourceType", name);
30638      composeParametersInner(element);
30639    }
30640  }
30641
30642  protected void composeParametersInner(Parameters element) throws IOException {
30643      composeResourceElements(element);
30644      if (element.hasParameter()) {
30645        openArray("parameter");
30646        for (Parameters.ParametersParameterComponent e : element.getParameter()) 
30647          composeParametersParametersParameterComponent(null, e);
30648        closeArray();
30649      };
30650  }
30651
30652  protected void composeParametersParametersParameterComponent(String name, Parameters.ParametersParameterComponent element) throws IOException {
30653    if (element != null) {
30654      open(name);
30655      composeParametersParametersParameterComponentInner(element);
30656      close();
30657    }
30658  }
30659
30660  protected void composeParametersParametersParameterComponentInner(Parameters.ParametersParameterComponent element) throws IOException {
30661      composeBackbone(element);
30662      if (element.hasNameElement()) {
30663        composeStringCore("name", element.getNameElement(), false);
30664        composeStringExtras("name", element.getNameElement(), false);
30665      }
30666      if (element.hasValue()) {
30667        composeType("value", element.getValue());
30668      }
30669        if (element.hasResource()) {
30670          open("resource");
30671          composeResource(element.getResource());
30672          close();
30673        }
30674      if (element.hasPart()) {
30675        openArray("part");
30676        for (Parameters.ParametersParameterComponent e : element.getPart()) 
30677          composeParametersParametersParameterComponent(null, e);
30678        closeArray();
30679      };
30680  }
30681
30682  protected void composeResourceElements(Resource element) throws IOException {
30683      if (element.hasIdElement()) {
30684        composeIdCore("id", element.getIdElement(), false);
30685        composeIdExtras("id", element.getIdElement(), false);
30686      }
30687      if (element.hasMeta()) {
30688        composeMeta("meta", element.getMeta());
30689      }
30690      if (element.hasImplicitRulesElement()) {
30691        composeUriCore("implicitRules", element.getImplicitRulesElement(), false);
30692        composeUriExtras("implicitRules", element.getImplicitRulesElement(), false);
30693      }
30694      if (element.hasLanguageElement()) {
30695        composeCodeCore("language", element.getLanguageElement(), false);
30696        composeCodeExtras("language", element.getLanguageElement(), false);
30697      }
30698  }
30699
30700  protected void composeAccount(String name, Account element) throws IOException {
30701    if (element != null) {
30702      prop("resourceType", name);
30703      composeAccountInner(element);
30704    }
30705  }
30706
30707  protected void composeAccountInner(Account element) throws IOException {
30708      composeDomainResourceElements(element);
30709      if (element.hasIdentifier()) {
30710        openArray("identifier");
30711        for (Identifier e : element.getIdentifier()) 
30712          composeIdentifier(null, e);
30713        closeArray();
30714      };
30715      if (element.hasStatusElement()) {
30716        composeEnumerationCore("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
30717        composeEnumerationExtras("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
30718      }
30719      if (element.hasType()) {
30720        composeCodeableConcept("type", element.getType());
30721      }
30722      if (element.hasNameElement()) {
30723        composeStringCore("name", element.getNameElement(), false);
30724        composeStringExtras("name", element.getNameElement(), false);
30725      }
30726      if (element.hasSubject()) {
30727        openArray("subject");
30728        for (Reference e : element.getSubject()) 
30729          composeReference(null, e);
30730        closeArray();
30731      };
30732      if (element.hasServicePeriod()) {
30733        composePeriod("servicePeriod", element.getServicePeriod());
30734      }
30735      if (element.hasCoverage()) {
30736        openArray("coverage");
30737        for (Account.CoverageComponent e : element.getCoverage()) 
30738          composeAccountCoverageComponent(null, e);
30739        closeArray();
30740      };
30741      if (element.hasOwner()) {
30742        composeReference("owner", element.getOwner());
30743      }
30744      if (element.hasDescriptionElement()) {
30745        composeStringCore("description", element.getDescriptionElement(), false);
30746        composeStringExtras("description", element.getDescriptionElement(), false);
30747      }
30748      if (element.hasGuarantor()) {
30749        openArray("guarantor");
30750        for (Account.GuarantorComponent e : element.getGuarantor()) 
30751          composeAccountGuarantorComponent(null, e);
30752        closeArray();
30753      };
30754      if (element.hasPartOf()) {
30755        composeReference("partOf", element.getPartOf());
30756      }
30757  }
30758
30759  protected void composeAccountCoverageComponent(String name, Account.CoverageComponent element) throws IOException {
30760    if (element != null) {
30761      open(name);
30762      composeAccountCoverageComponentInner(element);
30763      close();
30764    }
30765  }
30766
30767  protected void composeAccountCoverageComponentInner(Account.CoverageComponent element) throws IOException {
30768      composeBackbone(element);
30769      if (element.hasCoverage()) {
30770        composeReference("coverage", element.getCoverage());
30771      }
30772      if (element.hasPriorityElement()) {
30773        composePositiveIntCore("priority", element.getPriorityElement(), false);
30774        composePositiveIntExtras("priority", element.getPriorityElement(), false);
30775      }
30776  }
30777
30778  protected void composeAccountGuarantorComponent(String name, Account.GuarantorComponent element) throws IOException {
30779    if (element != null) {
30780      open(name);
30781      composeAccountGuarantorComponentInner(element);
30782      close();
30783    }
30784  }
30785
30786  protected void composeAccountGuarantorComponentInner(Account.GuarantorComponent element) throws IOException {
30787      composeBackbone(element);
30788      if (element.hasParty()) {
30789        composeReference("party", element.getParty());
30790      }
30791      if (element.hasOnHoldElement()) {
30792        composeBooleanCore("onHold", element.getOnHoldElement(), false);
30793        composeBooleanExtras("onHold", element.getOnHoldElement(), false);
30794      }
30795      if (element.hasPeriod()) {
30796        composePeriod("period", element.getPeriod());
30797      }
30798  }
30799
30800  protected void composeActivityDefinition(String name, ActivityDefinition element) throws IOException {
30801    if (element != null) {
30802      prop("resourceType", name);
30803      composeActivityDefinitionInner(element);
30804    }
30805  }
30806
30807  protected void composeActivityDefinitionInner(ActivityDefinition element) throws IOException {
30808      composeDomainResourceElements(element);
30809      if (element.hasUrlElement()) {
30810        composeUriCore("url", element.getUrlElement(), false);
30811        composeUriExtras("url", element.getUrlElement(), false);
30812      }
30813      if (element.hasIdentifier()) {
30814        openArray("identifier");
30815        for (Identifier e : element.getIdentifier()) 
30816          composeIdentifier(null, e);
30817        closeArray();
30818      };
30819      if (element.hasVersionElement()) {
30820        composeStringCore("version", element.getVersionElement(), false);
30821        composeStringExtras("version", element.getVersionElement(), false);
30822      }
30823      if (element.hasNameElement()) {
30824        composeStringCore("name", element.getNameElement(), false);
30825        composeStringExtras("name", element.getNameElement(), false);
30826      }
30827      if (element.hasTitleElement()) {
30828        composeStringCore("title", element.getTitleElement(), false);
30829        composeStringExtras("title", element.getTitleElement(), false);
30830      }
30831      if (element.hasSubtitleElement()) {
30832        composeStringCore("subtitle", element.getSubtitleElement(), false);
30833        composeStringExtras("subtitle", element.getSubtitleElement(), false);
30834      }
30835      if (element.hasStatusElement()) {
30836        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
30837        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
30838      }
30839      if (element.hasExperimentalElement()) {
30840        composeBooleanCore("experimental", element.getExperimentalElement(), false);
30841        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
30842      }
30843      if (element.hasSubject()) {
30844        composeType("subject", element.getSubject());
30845      }
30846      if (element.hasDateElement()) {
30847        composeDateTimeCore("date", element.getDateElement(), false);
30848        composeDateTimeExtras("date", element.getDateElement(), false);
30849      }
30850      if (element.hasPublisherElement()) {
30851        composeStringCore("publisher", element.getPublisherElement(), false);
30852        composeStringExtras("publisher", element.getPublisherElement(), false);
30853      }
30854      if (element.hasContact()) {
30855        openArray("contact");
30856        for (ContactDetail e : element.getContact()) 
30857          composeContactDetail(null, e);
30858        closeArray();
30859      };
30860      if (element.hasDescriptionElement()) {
30861        composeMarkdownCore("description", element.getDescriptionElement(), false);
30862        composeMarkdownExtras("description", element.getDescriptionElement(), false);
30863      }
30864      if (element.hasUseContext()) {
30865        openArray("useContext");
30866        for (UsageContext e : element.getUseContext()) 
30867          composeUsageContext(null, e);
30868        closeArray();
30869      };
30870      if (element.hasJurisdiction()) {
30871        openArray("jurisdiction");
30872        for (CodeableConcept e : element.getJurisdiction()) 
30873          composeCodeableConcept(null, e);
30874        closeArray();
30875      };
30876      if (element.hasPurposeElement()) {
30877        composeMarkdownCore("purpose", element.getPurposeElement(), false);
30878        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
30879      }
30880      if (element.hasUsageElement()) {
30881        composeStringCore("usage", element.getUsageElement(), false);
30882        composeStringExtras("usage", element.getUsageElement(), false);
30883      }
30884      if (element.hasCopyrightElement()) {
30885        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
30886        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
30887      }
30888      if (element.hasApprovalDateElement()) {
30889        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
30890        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
30891      }
30892      if (element.hasLastReviewDateElement()) {
30893        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
30894        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
30895      }
30896      if (element.hasEffectivePeriod()) {
30897        composePeriod("effectivePeriod", element.getEffectivePeriod());
30898      }
30899      if (element.hasTopic()) {
30900        openArray("topic");
30901        for (CodeableConcept e : element.getTopic()) 
30902          composeCodeableConcept(null, e);
30903        closeArray();
30904      };
30905      if (element.hasAuthor()) {
30906        openArray("author");
30907        for (ContactDetail e : element.getAuthor()) 
30908          composeContactDetail(null, e);
30909        closeArray();
30910      };
30911      if (element.hasEditor()) {
30912        openArray("editor");
30913        for (ContactDetail e : element.getEditor()) 
30914          composeContactDetail(null, e);
30915        closeArray();
30916      };
30917      if (element.hasReviewer()) {
30918        openArray("reviewer");
30919        for (ContactDetail e : element.getReviewer()) 
30920          composeContactDetail(null, e);
30921        closeArray();
30922      };
30923      if (element.hasEndorser()) {
30924        openArray("endorser");
30925        for (ContactDetail e : element.getEndorser()) 
30926          composeContactDetail(null, e);
30927        closeArray();
30928      };
30929      if (element.hasRelatedArtifact()) {
30930        openArray("relatedArtifact");
30931        for (RelatedArtifact e : element.getRelatedArtifact()) 
30932          composeRelatedArtifact(null, e);
30933        closeArray();
30934      };
30935      if (element.hasLibrary()) {
30936        openArray("library");
30937        for (CanonicalType e : element.getLibrary()) 
30938          composeCanonicalCore(null, e, true);
30939        closeArray();
30940        if (anyHasExtras(element.getLibrary())) {
30941          openArray("_library");
30942          for (CanonicalType e : element.getLibrary()) 
30943            composeCanonicalExtras(null, e, true);
30944          closeArray();
30945        }
30946      };
30947      if (element.hasKindElement()) {
30948        composeEnumerationCore("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
30949        composeEnumerationExtras("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
30950      }
30951      if (element.hasProfileElement()) {
30952        composeCanonicalCore("profile", element.getProfileElement(), false);
30953        composeCanonicalExtras("profile", element.getProfileElement(), false);
30954      }
30955      if (element.hasCode()) {
30956        composeCodeableConcept("code", element.getCode());
30957      }
30958      if (element.hasIntentElement()) {
30959        composeEnumerationCore("intent", element.getIntentElement(), new ActivityDefinition.RequestIntentEnumFactory(), false);
30960        composeEnumerationExtras("intent", element.getIntentElement(), new ActivityDefinition.RequestIntentEnumFactory(), false);
30961      }
30962      if (element.hasPriorityElement()) {
30963        composeEnumerationCore("priority", element.getPriorityElement(), new ActivityDefinition.RequestPriorityEnumFactory(), false);
30964        composeEnumerationExtras("priority", element.getPriorityElement(), new ActivityDefinition.RequestPriorityEnumFactory(), false);
30965      }
30966      if (element.hasDoNotPerformElement()) {
30967        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
30968        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
30969      }
30970      if (element.hasTiming()) {
30971        composeType("timing", element.getTiming());
30972      }
30973      if (element.hasLocation()) {
30974        composeReference("location", element.getLocation());
30975      }
30976      if (element.hasParticipant()) {
30977        openArray("participant");
30978        for (ActivityDefinition.ActivityDefinitionParticipantComponent e : element.getParticipant()) 
30979          composeActivityDefinitionActivityDefinitionParticipantComponent(null, e);
30980        closeArray();
30981      };
30982      if (element.hasProduct()) {
30983        composeType("product", element.getProduct());
30984      }
30985      if (element.hasQuantity()) {
30986        composeQuantity("quantity", element.getQuantity());
30987      }
30988      if (element.hasDosage()) {
30989        openArray("dosage");
30990        for (Dosage e : element.getDosage()) 
30991          composeDosage(null, e);
30992        closeArray();
30993      };
30994      if (element.hasBodySite()) {
30995        openArray("bodySite");
30996        for (CodeableConcept e : element.getBodySite()) 
30997          composeCodeableConcept(null, e);
30998        closeArray();
30999      };
31000      if (element.hasSpecimenRequirement()) {
31001        openArray("specimenRequirement");
31002        for (Reference e : element.getSpecimenRequirement()) 
31003          composeReference(null, e);
31004        closeArray();
31005      };
31006      if (element.hasObservationRequirement()) {
31007        openArray("observationRequirement");
31008        for (Reference e : element.getObservationRequirement()) 
31009          composeReference(null, e);
31010        closeArray();
31011      };
31012      if (element.hasObservationResultRequirement()) {
31013        openArray("observationResultRequirement");
31014        for (Reference e : element.getObservationResultRequirement()) 
31015          composeReference(null, e);
31016        closeArray();
31017      };
31018      if (element.hasTransformElement()) {
31019        composeCanonicalCore("transform", element.getTransformElement(), false);
31020        composeCanonicalExtras("transform", element.getTransformElement(), false);
31021      }
31022      if (element.hasDynamicValue()) {
31023        openArray("dynamicValue");
31024        for (ActivityDefinition.ActivityDefinitionDynamicValueComponent e : element.getDynamicValue()) 
31025          composeActivityDefinitionActivityDefinitionDynamicValueComponent(null, e);
31026        closeArray();
31027      };
31028  }
31029
31030  protected void composeActivityDefinitionActivityDefinitionParticipantComponent(String name, ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
31031    if (element != null) {
31032      open(name);
31033      composeActivityDefinitionActivityDefinitionParticipantComponentInner(element);
31034      close();
31035    }
31036  }
31037
31038  protected void composeActivityDefinitionActivityDefinitionParticipantComponentInner(ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
31039      composeBackbone(element);
31040      if (element.hasTypeElement()) {
31041        composeEnumerationCore("type", element.getTypeElement(), new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
31042        composeEnumerationExtras("type", element.getTypeElement(), new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
31043      }
31044      if (element.hasRole()) {
31045        composeCodeableConcept("role", element.getRole());
31046      }
31047  }
31048
31049  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponent(String name, ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
31050    if (element != null) {
31051      open(name);
31052      composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(element);
31053      close();
31054    }
31055  }
31056
31057  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
31058      composeBackbone(element);
31059      if (element.hasPathElement()) {
31060        composeStringCore("path", element.getPathElement(), false);
31061        composeStringExtras("path", element.getPathElement(), false);
31062      }
31063      if (element.hasExpression()) {
31064        composeExpression("expression", element.getExpression());
31065      }
31066  }
31067
31068  protected void composeAdverseEvent(String name, AdverseEvent element) throws IOException {
31069    if (element != null) {
31070      prop("resourceType", name);
31071      composeAdverseEventInner(element);
31072    }
31073  }
31074
31075  protected void composeAdverseEventInner(AdverseEvent element) throws IOException {
31076      composeDomainResourceElements(element);
31077      if (element.hasIdentifier()) {
31078        composeIdentifier("identifier", element.getIdentifier());
31079      }
31080      if (element.hasActualityElement()) {
31081        composeEnumerationCore("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
31082        composeEnumerationExtras("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
31083      }
31084      if (element.hasCategory()) {
31085        openArray("category");
31086        for (CodeableConcept e : element.getCategory()) 
31087          composeCodeableConcept(null, e);
31088        closeArray();
31089      };
31090      if (element.hasEvent()) {
31091        composeCodeableConcept("event", element.getEvent());
31092      }
31093      if (element.hasSubject()) {
31094        composeReference("subject", element.getSubject());
31095      }
31096      if (element.hasEncounter()) {
31097        composeReference("encounter", element.getEncounter());
31098      }
31099      if (element.hasDateElement()) {
31100        composeDateTimeCore("date", element.getDateElement(), false);
31101        composeDateTimeExtras("date", element.getDateElement(), false);
31102      }
31103      if (element.hasDetectedElement()) {
31104        composeDateTimeCore("detected", element.getDetectedElement(), false);
31105        composeDateTimeExtras("detected", element.getDetectedElement(), false);
31106      }
31107      if (element.hasRecordedDateElement()) {
31108        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
31109        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
31110      }
31111      if (element.hasResultingCondition()) {
31112        openArray("resultingCondition");
31113        for (Reference e : element.getResultingCondition()) 
31114          composeReference(null, e);
31115        closeArray();
31116      };
31117      if (element.hasLocation()) {
31118        composeReference("location", element.getLocation());
31119      }
31120      if (element.hasSeriousness()) {
31121        composeCodeableConcept("seriousness", element.getSeriousness());
31122      }
31123      if (element.hasSeverity()) {
31124        composeCodeableConcept("severity", element.getSeverity());
31125      }
31126      if (element.hasOutcome()) {
31127        composeCodeableConcept("outcome", element.getOutcome());
31128      }
31129      if (element.hasRecorder()) {
31130        composeReference("recorder", element.getRecorder());
31131      }
31132      if (element.hasContributor()) {
31133        openArray("contributor");
31134        for (Reference e : element.getContributor()) 
31135          composeReference(null, e);
31136        closeArray();
31137      };
31138      if (element.hasSuspectEntity()) {
31139        openArray("suspectEntity");
31140        for (AdverseEvent.AdverseEventSuspectEntityComponent e : element.getSuspectEntity()) 
31141          composeAdverseEventAdverseEventSuspectEntityComponent(null, e);
31142        closeArray();
31143      };
31144      if (element.hasSubjectMedicalHistory()) {
31145        openArray("subjectMedicalHistory");
31146        for (Reference e : element.getSubjectMedicalHistory()) 
31147          composeReference(null, e);
31148        closeArray();
31149      };
31150      if (element.hasReferenceDocument()) {
31151        openArray("referenceDocument");
31152        for (Reference e : element.getReferenceDocument()) 
31153          composeReference(null, e);
31154        closeArray();
31155      };
31156      if (element.hasStudy()) {
31157        openArray("study");
31158        for (Reference e : element.getStudy()) 
31159          composeReference(null, e);
31160        closeArray();
31161      };
31162  }
31163
31164  protected void composeAdverseEventAdverseEventSuspectEntityComponent(String name, AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
31165    if (element != null) {
31166      open(name);
31167      composeAdverseEventAdverseEventSuspectEntityComponentInner(element);
31168      close();
31169    }
31170  }
31171
31172  protected void composeAdverseEventAdverseEventSuspectEntityComponentInner(AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
31173      composeBackbone(element);
31174      if (element.hasInstance()) {
31175        composeReference("instance", element.getInstance());
31176      }
31177      if (element.hasCausality()) {
31178        openArray("causality");
31179        for (AdverseEvent.AdverseEventSuspectEntityCausalityComponent e : element.getCausality()) 
31180          composeAdverseEventAdverseEventSuspectEntityCausalityComponent(null, e);
31181        closeArray();
31182      };
31183  }
31184
31185  protected void composeAdverseEventAdverseEventSuspectEntityCausalityComponent(String name, AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
31186    if (element != null) {
31187      open(name);
31188      composeAdverseEventAdverseEventSuspectEntityCausalityComponentInner(element);
31189      close();
31190    }
31191  }
31192
31193  protected void composeAdverseEventAdverseEventSuspectEntityCausalityComponentInner(AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
31194      composeBackbone(element);
31195      if (element.hasAssessment()) {
31196        composeCodeableConcept("assessment", element.getAssessment());
31197      }
31198      if (element.hasProductRelatednessElement()) {
31199        composeStringCore("productRelatedness", element.getProductRelatednessElement(), false);
31200        composeStringExtras("productRelatedness", element.getProductRelatednessElement(), false);
31201      }
31202      if (element.hasAuthor()) {
31203        composeReference("author", element.getAuthor());
31204      }
31205      if (element.hasMethod()) {
31206        composeCodeableConcept("method", element.getMethod());
31207      }
31208  }
31209
31210  protected void composeAllergyIntolerance(String name, AllergyIntolerance element) throws IOException {
31211    if (element != null) {
31212      prop("resourceType", name);
31213      composeAllergyIntoleranceInner(element);
31214    }
31215  }
31216
31217  protected void composeAllergyIntoleranceInner(AllergyIntolerance element) throws IOException {
31218      composeDomainResourceElements(element);
31219      if (element.hasIdentifier()) {
31220        openArray("identifier");
31221        for (Identifier e : element.getIdentifier()) 
31222          composeIdentifier(null, e);
31223        closeArray();
31224      };
31225      if (element.hasClinicalStatus()) {
31226        composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
31227      }
31228      if (element.hasVerificationStatus()) {
31229        composeCodeableConcept("verificationStatus", element.getVerificationStatus());
31230      }
31231      if (element.hasTypeElement()) {
31232        composeEnumerationCore("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
31233        composeEnumerationExtras("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
31234      }
31235      if (element.hasCategory()) {
31236        openArray("category");
31237        for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
31238          composeEnumerationCore(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
31239        closeArray();
31240        if (anyHasExtras(element.getCategory())) {
31241          openArray("_category");
31242          for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
31243            composeEnumerationExtras(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
31244          closeArray();
31245        }
31246      };
31247      if (element.hasCriticalityElement()) {
31248        composeEnumerationCore("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
31249        composeEnumerationExtras("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
31250      }
31251      if (element.hasCode()) {
31252        composeCodeableConcept("code", element.getCode());
31253      }
31254      if (element.hasPatient()) {
31255        composeReference("patient", element.getPatient());
31256      }
31257      if (element.hasEncounter()) {
31258        composeReference("encounter", element.getEncounter());
31259      }
31260      if (element.hasOnset()) {
31261        composeType("onset", element.getOnset());
31262      }
31263      if (element.hasRecordedDateElement()) {
31264        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
31265        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
31266      }
31267      if (element.hasRecorder()) {
31268        composeReference("recorder", element.getRecorder());
31269      }
31270      if (element.hasAsserter()) {
31271        composeReference("asserter", element.getAsserter());
31272      }
31273      if (element.hasLastOccurrenceElement()) {
31274        composeDateTimeCore("lastOccurrence", element.getLastOccurrenceElement(), false);
31275        composeDateTimeExtras("lastOccurrence", element.getLastOccurrenceElement(), false);
31276      }
31277      if (element.hasNote()) {
31278        openArray("note");
31279        for (Annotation e : element.getNote()) 
31280          composeAnnotation(null, e);
31281        closeArray();
31282      };
31283      if (element.hasReaction()) {
31284        openArray("reaction");
31285        for (AllergyIntolerance.AllergyIntoleranceReactionComponent e : element.getReaction()) 
31286          composeAllergyIntoleranceAllergyIntoleranceReactionComponent(null, e);
31287        closeArray();
31288      };
31289  }
31290
31291  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponent(String name, AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
31292    if (element != null) {
31293      open(name);
31294      composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(element);
31295      close();
31296    }
31297  }
31298
31299  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
31300      composeBackbone(element);
31301      if (element.hasSubstance()) {
31302        composeCodeableConcept("substance", element.getSubstance());
31303      }
31304      if (element.hasManifestation()) {
31305        openArray("manifestation");
31306        for (CodeableConcept e : element.getManifestation()) 
31307          composeCodeableConcept(null, e);
31308        closeArray();
31309      };
31310      if (element.hasDescriptionElement()) {
31311        composeStringCore("description", element.getDescriptionElement(), false);
31312        composeStringExtras("description", element.getDescriptionElement(), false);
31313      }
31314      if (element.hasOnsetElement()) {
31315        composeDateTimeCore("onset", element.getOnsetElement(), false);
31316        composeDateTimeExtras("onset", element.getOnsetElement(), false);
31317      }
31318      if (element.hasSeverityElement()) {
31319        composeEnumerationCore("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
31320        composeEnumerationExtras("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
31321      }
31322      if (element.hasExposureRoute()) {
31323        composeCodeableConcept("exposureRoute", element.getExposureRoute());
31324      }
31325      if (element.hasNote()) {
31326        openArray("note");
31327        for (Annotation e : element.getNote()) 
31328          composeAnnotation(null, e);
31329        closeArray();
31330      };
31331  }
31332
31333  protected void composeAppointment(String name, Appointment element) throws IOException {
31334    if (element != null) {
31335      prop("resourceType", name);
31336      composeAppointmentInner(element);
31337    }
31338  }
31339
31340  protected void composeAppointmentInner(Appointment element) throws IOException {
31341      composeDomainResourceElements(element);
31342      if (element.hasIdentifier()) {
31343        openArray("identifier");
31344        for (Identifier e : element.getIdentifier()) 
31345          composeIdentifier(null, e);
31346        closeArray();
31347      };
31348      if (element.hasStatusElement()) {
31349        composeEnumerationCore("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
31350        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
31351      }
31352      if (element.hasCancelationReason()) {
31353        composeCodeableConcept("cancelationReason", element.getCancelationReason());
31354      }
31355      if (element.hasServiceCategory()) {
31356        openArray("serviceCategory");
31357        for (CodeableConcept e : element.getServiceCategory()) 
31358          composeCodeableConcept(null, e);
31359        closeArray();
31360      };
31361      if (element.hasServiceType()) {
31362        openArray("serviceType");
31363        for (CodeableConcept e : element.getServiceType()) 
31364          composeCodeableConcept(null, e);
31365        closeArray();
31366      };
31367      if (element.hasSpecialty()) {
31368        openArray("specialty");
31369        for (CodeableConcept e : element.getSpecialty()) 
31370          composeCodeableConcept(null, e);
31371        closeArray();
31372      };
31373      if (element.hasAppointmentType()) {
31374        composeCodeableConcept("appointmentType", element.getAppointmentType());
31375      }
31376      if (element.hasReasonCode()) {
31377        openArray("reasonCode");
31378        for (CodeableConcept e : element.getReasonCode()) 
31379          composeCodeableConcept(null, e);
31380        closeArray();
31381      };
31382      if (element.hasReasonReference()) {
31383        openArray("reasonReference");
31384        for (Reference e : element.getReasonReference()) 
31385          composeReference(null, e);
31386        closeArray();
31387      };
31388      if (element.hasPriorityElement()) {
31389        composeUnsignedIntCore("priority", element.getPriorityElement(), false);
31390        composeUnsignedIntExtras("priority", element.getPriorityElement(), false);
31391      }
31392      if (element.hasDescriptionElement()) {
31393        composeStringCore("description", element.getDescriptionElement(), false);
31394        composeStringExtras("description", element.getDescriptionElement(), false);
31395      }
31396      if (element.hasSupportingInformation()) {
31397        openArray("supportingInformation");
31398        for (Reference e : element.getSupportingInformation()) 
31399          composeReference(null, e);
31400        closeArray();
31401      };
31402      if (element.hasStartElement()) {
31403        composeInstantCore("start", element.getStartElement(), false);
31404        composeInstantExtras("start", element.getStartElement(), false);
31405      }
31406      if (element.hasEndElement()) {
31407        composeInstantCore("end", element.getEndElement(), false);
31408        composeInstantExtras("end", element.getEndElement(), false);
31409      }
31410      if (element.hasMinutesDurationElement()) {
31411        composePositiveIntCore("minutesDuration", element.getMinutesDurationElement(), false);
31412        composePositiveIntExtras("minutesDuration", element.getMinutesDurationElement(), false);
31413      }
31414      if (element.hasSlot()) {
31415        openArray("slot");
31416        for (Reference e : element.getSlot()) 
31417          composeReference(null, e);
31418        closeArray();
31419      };
31420      if (element.hasCreatedElement()) {
31421        composeDateTimeCore("created", element.getCreatedElement(), false);
31422        composeDateTimeExtras("created", element.getCreatedElement(), false);
31423      }
31424      if (element.hasCommentElement()) {
31425        composeStringCore("comment", element.getCommentElement(), false);
31426        composeStringExtras("comment", element.getCommentElement(), false);
31427      }
31428      if (element.hasPatientInstructionElement()) {
31429        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
31430        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
31431      }
31432      if (element.hasBasedOn()) {
31433        openArray("basedOn");
31434        for (Reference e : element.getBasedOn()) 
31435          composeReference(null, e);
31436        closeArray();
31437      };
31438      if (element.hasParticipant()) {
31439        openArray("participant");
31440        for (Appointment.AppointmentParticipantComponent e : element.getParticipant()) 
31441          composeAppointmentAppointmentParticipantComponent(null, e);
31442        closeArray();
31443      };
31444      if (element.hasRequestedPeriod()) {
31445        openArray("requestedPeriod");
31446        for (Period e : element.getRequestedPeriod()) 
31447          composePeriod(null, e);
31448        closeArray();
31449      };
31450  }
31451
31452  protected void composeAppointmentAppointmentParticipantComponent(String name, Appointment.AppointmentParticipantComponent element) throws IOException {
31453    if (element != null) {
31454      open(name);
31455      composeAppointmentAppointmentParticipantComponentInner(element);
31456      close();
31457    }
31458  }
31459
31460  protected void composeAppointmentAppointmentParticipantComponentInner(Appointment.AppointmentParticipantComponent element) throws IOException {
31461      composeBackbone(element);
31462      if (element.hasType()) {
31463        openArray("type");
31464        for (CodeableConcept e : element.getType()) 
31465          composeCodeableConcept(null, e);
31466        closeArray();
31467      };
31468      if (element.hasActor()) {
31469        composeReference("actor", element.getActor());
31470      }
31471      if (element.hasRequiredElement()) {
31472        composeEnumerationCore("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
31473        composeEnumerationExtras("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
31474      }
31475      if (element.hasStatusElement()) {
31476        composeEnumerationCore("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
31477        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
31478      }
31479      if (element.hasPeriod()) {
31480        composePeriod("period", element.getPeriod());
31481      }
31482  }
31483
31484  protected void composeAppointmentResponse(String name, AppointmentResponse element) throws IOException {
31485    if (element != null) {
31486      prop("resourceType", name);
31487      composeAppointmentResponseInner(element);
31488    }
31489  }
31490
31491  protected void composeAppointmentResponseInner(AppointmentResponse element) throws IOException {
31492      composeDomainResourceElements(element);
31493      if (element.hasIdentifier()) {
31494        openArray("identifier");
31495        for (Identifier e : element.getIdentifier()) 
31496          composeIdentifier(null, e);
31497        closeArray();
31498      };
31499      if (element.hasAppointment()) {
31500        composeReference("appointment", element.getAppointment());
31501      }
31502      if (element.hasStartElement()) {
31503        composeInstantCore("start", element.getStartElement(), false);
31504        composeInstantExtras("start", element.getStartElement(), false);
31505      }
31506      if (element.hasEndElement()) {
31507        composeInstantCore("end", element.getEndElement(), false);
31508        composeInstantExtras("end", element.getEndElement(), false);
31509      }
31510      if (element.hasParticipantType()) {
31511        openArray("participantType");
31512        for (CodeableConcept e : element.getParticipantType()) 
31513          composeCodeableConcept(null, e);
31514        closeArray();
31515      };
31516      if (element.hasActor()) {
31517        composeReference("actor", element.getActor());
31518      }
31519      if (element.hasParticipantStatusElement()) {
31520        composeEnumerationCore("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
31521        composeEnumerationExtras("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
31522      }
31523      if (element.hasCommentElement()) {
31524        composeStringCore("comment", element.getCommentElement(), false);
31525        composeStringExtras("comment", element.getCommentElement(), false);
31526      }
31527  }
31528
31529  protected void composeAuditEvent(String name, AuditEvent element) throws IOException {
31530    if (element != null) {
31531      prop("resourceType", name);
31532      composeAuditEventInner(element);
31533    }
31534  }
31535
31536  protected void composeAuditEventInner(AuditEvent element) throws IOException {
31537      composeDomainResourceElements(element);
31538      if (element.hasType()) {
31539        composeCoding("type", element.getType());
31540      }
31541      if (element.hasSubtype()) {
31542        openArray("subtype");
31543        for (Coding e : element.getSubtype()) 
31544          composeCoding(null, e);
31545        closeArray();
31546      };
31547      if (element.hasActionElement()) {
31548        composeEnumerationCore("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
31549        composeEnumerationExtras("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
31550      }
31551      if (element.hasPeriod()) {
31552        composePeriod("period", element.getPeriod());
31553      }
31554      if (element.hasRecordedElement()) {
31555        composeInstantCore("recorded", element.getRecordedElement(), false);
31556        composeInstantExtras("recorded", element.getRecordedElement(), false);
31557      }
31558      if (element.hasOutcomeElement()) {
31559        composeEnumerationCore("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
31560        composeEnumerationExtras("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
31561      }
31562      if (element.hasOutcomeDescElement()) {
31563        composeStringCore("outcomeDesc", element.getOutcomeDescElement(), false);
31564        composeStringExtras("outcomeDesc", element.getOutcomeDescElement(), false);
31565      }
31566      if (element.hasPurposeOfEvent()) {
31567        openArray("purposeOfEvent");
31568        for (CodeableConcept e : element.getPurposeOfEvent()) 
31569          composeCodeableConcept(null, e);
31570        closeArray();
31571      };
31572      if (element.hasAgent()) {
31573        openArray("agent");
31574        for (AuditEvent.AuditEventAgentComponent e : element.getAgent()) 
31575          composeAuditEventAuditEventAgentComponent(null, e);
31576        closeArray();
31577      };
31578      if (element.hasSource()) {
31579        composeAuditEventAuditEventSourceComponent("source", element.getSource());
31580      }
31581      if (element.hasEntity()) {
31582        openArray("entity");
31583        for (AuditEvent.AuditEventEntityComponent e : element.getEntity()) 
31584          composeAuditEventAuditEventEntityComponent(null, e);
31585        closeArray();
31586      };
31587  }
31588
31589  protected void composeAuditEventAuditEventAgentComponent(String name, AuditEvent.AuditEventAgentComponent element) throws IOException {
31590    if (element != null) {
31591      open(name);
31592      composeAuditEventAuditEventAgentComponentInner(element);
31593      close();
31594    }
31595  }
31596
31597  protected void composeAuditEventAuditEventAgentComponentInner(AuditEvent.AuditEventAgentComponent element) throws IOException {
31598      composeBackbone(element);
31599      if (element.hasType()) {
31600        composeCodeableConcept("type", element.getType());
31601      }
31602      if (element.hasRole()) {
31603        openArray("role");
31604        for (CodeableConcept e : element.getRole()) 
31605          composeCodeableConcept(null, e);
31606        closeArray();
31607      };
31608      if (element.hasWho()) {
31609        composeReference("who", element.getWho());
31610      }
31611      if (element.hasAltIdElement()) {
31612        composeStringCore("altId", element.getAltIdElement(), false);
31613        composeStringExtras("altId", element.getAltIdElement(), false);
31614      }
31615      if (element.hasNameElement()) {
31616        composeStringCore("name", element.getNameElement(), false);
31617        composeStringExtras("name", element.getNameElement(), false);
31618      }
31619      if (element.hasRequestorElement()) {
31620        composeBooleanCore("requestor", element.getRequestorElement(), false);
31621        composeBooleanExtras("requestor", element.getRequestorElement(), false);
31622      }
31623      if (element.hasLocation()) {
31624        composeReference("location", element.getLocation());
31625      }
31626      if (element.hasPolicy()) {
31627        openArray("policy");
31628        for (UriType e : element.getPolicy()) 
31629          composeUriCore(null, e, true);
31630        closeArray();
31631        if (anyHasExtras(element.getPolicy())) {
31632          openArray("_policy");
31633          for (UriType e : element.getPolicy()) 
31634            composeUriExtras(null, e, true);
31635          closeArray();
31636        }
31637      };
31638      if (element.hasMedia()) {
31639        composeCoding("media", element.getMedia());
31640      }
31641      if (element.hasNetwork()) {
31642        composeAuditEventAuditEventAgentNetworkComponent("network", element.getNetwork());
31643      }
31644      if (element.hasPurposeOfUse()) {
31645        openArray("purposeOfUse");
31646        for (CodeableConcept e : element.getPurposeOfUse()) 
31647          composeCodeableConcept(null, e);
31648        closeArray();
31649      };
31650  }
31651
31652  protected void composeAuditEventAuditEventAgentNetworkComponent(String name, AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
31653    if (element != null) {
31654      open(name);
31655      composeAuditEventAuditEventAgentNetworkComponentInner(element);
31656      close();
31657    }
31658  }
31659
31660  protected void composeAuditEventAuditEventAgentNetworkComponentInner(AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
31661      composeBackbone(element);
31662      if (element.hasAddressElement()) {
31663        composeStringCore("address", element.getAddressElement(), false);
31664        composeStringExtras("address", element.getAddressElement(), false);
31665      }
31666      if (element.hasTypeElement()) {
31667        composeEnumerationCore("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
31668        composeEnumerationExtras("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
31669      }
31670  }
31671
31672  protected void composeAuditEventAuditEventSourceComponent(String name, AuditEvent.AuditEventSourceComponent element) throws IOException {
31673    if (element != null) {
31674      open(name);
31675      composeAuditEventAuditEventSourceComponentInner(element);
31676      close();
31677    }
31678  }
31679
31680  protected void composeAuditEventAuditEventSourceComponentInner(AuditEvent.AuditEventSourceComponent element) throws IOException {
31681      composeBackbone(element);
31682      if (element.hasSiteElement()) {
31683        composeStringCore("site", element.getSiteElement(), false);
31684        composeStringExtras("site", element.getSiteElement(), false);
31685      }
31686      if (element.hasObserver()) {
31687        composeReference("observer", element.getObserver());
31688      }
31689      if (element.hasType()) {
31690        openArray("type");
31691        for (Coding e : element.getType()) 
31692          composeCoding(null, e);
31693        closeArray();
31694      };
31695  }
31696
31697  protected void composeAuditEventAuditEventEntityComponent(String name, AuditEvent.AuditEventEntityComponent element) throws IOException {
31698    if (element != null) {
31699      open(name);
31700      composeAuditEventAuditEventEntityComponentInner(element);
31701      close();
31702    }
31703  }
31704
31705  protected void composeAuditEventAuditEventEntityComponentInner(AuditEvent.AuditEventEntityComponent element) throws IOException {
31706      composeBackbone(element);
31707      if (element.hasWhat()) {
31708        composeReference("what", element.getWhat());
31709      }
31710      if (element.hasType()) {
31711        composeCoding("type", element.getType());
31712      }
31713      if (element.hasRole()) {
31714        composeCoding("role", element.getRole());
31715      }
31716      if (element.hasLifecycle()) {
31717        composeCoding("lifecycle", element.getLifecycle());
31718      }
31719      if (element.hasSecurityLabel()) {
31720        openArray("securityLabel");
31721        for (Coding e : element.getSecurityLabel()) 
31722          composeCoding(null, e);
31723        closeArray();
31724      };
31725      if (element.hasNameElement()) {
31726        composeStringCore("name", element.getNameElement(), false);
31727        composeStringExtras("name", element.getNameElement(), false);
31728      }
31729      if (element.hasDescriptionElement()) {
31730        composeStringCore("description", element.getDescriptionElement(), false);
31731        composeStringExtras("description", element.getDescriptionElement(), false);
31732      }
31733      if (element.hasQueryElement()) {
31734        composeBase64BinaryCore("query", element.getQueryElement(), false);
31735        composeBase64BinaryExtras("query", element.getQueryElement(), false);
31736      }
31737      if (element.hasDetail()) {
31738        openArray("detail");
31739        for (AuditEvent.AuditEventEntityDetailComponent e : element.getDetail()) 
31740          composeAuditEventAuditEventEntityDetailComponent(null, e);
31741        closeArray();
31742      };
31743  }
31744
31745  protected void composeAuditEventAuditEventEntityDetailComponent(String name, AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
31746    if (element != null) {
31747      open(name);
31748      composeAuditEventAuditEventEntityDetailComponentInner(element);
31749      close();
31750    }
31751  }
31752
31753  protected void composeAuditEventAuditEventEntityDetailComponentInner(AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
31754      composeBackbone(element);
31755      if (element.hasTypeElement()) {
31756        composeStringCore("type", element.getTypeElement(), false);
31757        composeStringExtras("type", element.getTypeElement(), false);
31758      }
31759      if (element.hasValue()) {
31760        composeType("value", element.getValue());
31761      }
31762  }
31763
31764  protected void composeBasic(String name, Basic element) throws IOException {
31765    if (element != null) {
31766      prop("resourceType", name);
31767      composeBasicInner(element);
31768    }
31769  }
31770
31771  protected void composeBasicInner(Basic element) throws IOException {
31772      composeDomainResourceElements(element);
31773      if (element.hasIdentifier()) {
31774        openArray("identifier");
31775        for (Identifier e : element.getIdentifier()) 
31776          composeIdentifier(null, e);
31777        closeArray();
31778      };
31779      if (element.hasCode()) {
31780        composeCodeableConcept("code", element.getCode());
31781      }
31782      if (element.hasSubject()) {
31783        composeReference("subject", element.getSubject());
31784      }
31785      if (element.hasCreatedElement()) {
31786        composeDateCore("created", element.getCreatedElement(), false);
31787        composeDateExtras("created", element.getCreatedElement(), false);
31788      }
31789      if (element.hasAuthor()) {
31790        composeReference("author", element.getAuthor());
31791      }
31792  }
31793
31794  protected void composeBinary(String name, Binary element) throws IOException {
31795    if (element != null) {
31796      prop("resourceType", name);
31797      composeBinaryInner(element);
31798    }
31799  }
31800
31801  protected void composeBinaryInner(Binary element) throws IOException {
31802      composeResourceElements(element);
31803      if (element.hasContentTypeElement()) {
31804        composeCodeCore("contentType", element.getContentTypeElement(), false);
31805        composeCodeExtras("contentType", element.getContentTypeElement(), false);
31806      }
31807      if (element.hasSecurityContext()) {
31808        composeReference("securityContext", element.getSecurityContext());
31809      }
31810      if (element.hasDataElement()) {
31811        composeBase64BinaryCore("data", element.getDataElement(), false);
31812        composeBase64BinaryExtras("data", element.getDataElement(), false);
31813      }
31814  }
31815
31816  protected void composeBiologicallyDerivedProduct(String name, BiologicallyDerivedProduct element) throws IOException {
31817    if (element != null) {
31818      prop("resourceType", name);
31819      composeBiologicallyDerivedProductInner(element);
31820    }
31821  }
31822
31823  protected void composeBiologicallyDerivedProductInner(BiologicallyDerivedProduct element) throws IOException {
31824      composeDomainResourceElements(element);
31825      if (element.hasIdentifier()) {
31826        openArray("identifier");
31827        for (Identifier e : element.getIdentifier()) 
31828          composeIdentifier(null, e);
31829        closeArray();
31830      };
31831      if (element.hasProductCategoryElement()) {
31832        composeEnumerationCore("productCategory", element.getProductCategoryElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory(), false);
31833        composeEnumerationExtras("productCategory", element.getProductCategoryElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory(), false);
31834      }
31835      if (element.hasProductCode()) {
31836        composeCodeableConcept("productCode", element.getProductCode());
31837      }
31838      if (element.hasStatusElement()) {
31839        composeEnumerationCore("status", element.getStatusElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory(), false);
31840        composeEnumerationExtras("status", element.getStatusElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory(), false);
31841      }
31842      if (element.hasRequest()) {
31843        openArray("request");
31844        for (Reference e : element.getRequest()) 
31845          composeReference(null, e);
31846        closeArray();
31847      };
31848      if (element.hasQuantityElement()) {
31849        composeIntegerCore("quantity", element.getQuantityElement(), false);
31850        composeIntegerExtras("quantity", element.getQuantityElement(), false);
31851      }
31852      if (element.hasParent()) {
31853        openArray("parent");
31854        for (Reference e : element.getParent()) 
31855          composeReference(null, e);
31856        closeArray();
31857      };
31858      if (element.hasCollection()) {
31859        composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent("collection", element.getCollection());
31860      }
31861      if (element.hasProcessing()) {
31862        openArray("processing");
31863        for (BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent e : element.getProcessing()) 
31864          composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(null, e);
31865        closeArray();
31866      };
31867      if (element.hasManipulation()) {
31868        composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent("manipulation", element.getManipulation());
31869      }
31870      if (element.hasStorage()) {
31871        openArray("storage");
31872        for (BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent e : element.getStorage()) 
31873          composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(null, e);
31874        closeArray();
31875      };
31876  }
31877
31878  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
31879    if (element != null) {
31880      open(name);
31881      composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentInner(element);
31882      close();
31883    }
31884  }
31885
31886  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
31887      composeBackbone(element);
31888      if (element.hasCollector()) {
31889        composeReference("collector", element.getCollector());
31890      }
31891      if (element.hasSource()) {
31892        composeReference("source", element.getSource());
31893      }
31894      if (element.hasCollected()) {
31895        composeType("collected", element.getCollected());
31896      }
31897  }
31898
31899  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
31900    if (element != null) {
31901      open(name);
31902      composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentInner(element);
31903      close();
31904    }
31905  }
31906
31907  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
31908      composeBackbone(element);
31909      if (element.hasDescriptionElement()) {
31910        composeStringCore("description", element.getDescriptionElement(), false);
31911        composeStringExtras("description", element.getDescriptionElement(), false);
31912      }
31913      if (element.hasProcedure()) {
31914        composeCodeableConcept("procedure", element.getProcedure());
31915      }
31916      if (element.hasAdditive()) {
31917        composeReference("additive", element.getAdditive());
31918      }
31919      if (element.hasTime()) {
31920        composeType("time", element.getTime());
31921      }
31922  }
31923
31924  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
31925    if (element != null) {
31926      open(name);
31927      composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentInner(element);
31928      close();
31929    }
31930  }
31931
31932  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
31933      composeBackbone(element);
31934      if (element.hasDescriptionElement()) {
31935        composeStringCore("description", element.getDescriptionElement(), false);
31936        composeStringExtras("description", element.getDescriptionElement(), false);
31937      }
31938      if (element.hasTime()) {
31939        composeType("time", element.getTime());
31940      }
31941  }
31942
31943  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
31944    if (element != null) {
31945      open(name);
31946      composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentInner(element);
31947      close();
31948    }
31949  }
31950
31951  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
31952      composeBackbone(element);
31953      if (element.hasDescriptionElement()) {
31954        composeStringCore("description", element.getDescriptionElement(), false);
31955        composeStringExtras("description", element.getDescriptionElement(), false);
31956      }
31957      if (element.hasTemperatureElement()) {
31958        composeDecimalCore("temperature", element.getTemperatureElement(), false);
31959        composeDecimalExtras("temperature", element.getTemperatureElement(), false);
31960      }
31961      if (element.hasScaleElement()) {
31962        composeEnumerationCore("scale", element.getScaleElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory(), false);
31963        composeEnumerationExtras("scale", element.getScaleElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory(), false);
31964      }
31965      if (element.hasDuration()) {
31966        composePeriod("duration", element.getDuration());
31967      }
31968  }
31969
31970  protected void composeBodyStructure(String name, BodyStructure element) throws IOException {
31971    if (element != null) {
31972      prop("resourceType", name);
31973      composeBodyStructureInner(element);
31974    }
31975  }
31976
31977  protected void composeBodyStructureInner(BodyStructure element) throws IOException {
31978      composeDomainResourceElements(element);
31979      if (element.hasIdentifier()) {
31980        openArray("identifier");
31981        for (Identifier e : element.getIdentifier()) 
31982          composeIdentifier(null, e);
31983        closeArray();
31984      };
31985      if (element.hasActiveElement()) {
31986        composeBooleanCore("active", element.getActiveElement(), false);
31987        composeBooleanExtras("active", element.getActiveElement(), false);
31988      }
31989      if (element.hasMorphology()) {
31990        composeCodeableConcept("morphology", element.getMorphology());
31991      }
31992      if (element.hasLocation()) {
31993        composeCodeableConcept("location", element.getLocation());
31994      }
31995      if (element.hasLocationQualifier()) {
31996        openArray("locationQualifier");
31997        for (CodeableConcept e : element.getLocationQualifier()) 
31998          composeCodeableConcept(null, e);
31999        closeArray();
32000      };
32001      if (element.hasDescriptionElement()) {
32002        composeStringCore("description", element.getDescriptionElement(), false);
32003        composeStringExtras("description", element.getDescriptionElement(), false);
32004      }
32005      if (element.hasImage()) {
32006        openArray("image");
32007        for (Attachment e : element.getImage()) 
32008          composeAttachment(null, e);
32009        closeArray();
32010      };
32011      if (element.hasPatient()) {
32012        composeReference("patient", element.getPatient());
32013      }
32014  }
32015
32016  protected void composeBundle(String name, Bundle element) throws IOException {
32017    if (element != null) {
32018      prop("resourceType", name);
32019      composeBundleInner(element);
32020    }
32021  }
32022
32023  protected void composeBundleInner(Bundle element) throws IOException {
32024      composeResourceElements(element);
32025      if (element.hasIdentifier()) {
32026        composeIdentifier("identifier", element.getIdentifier());
32027      }
32028      if (element.hasTypeElement()) {
32029        composeEnumerationCore("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
32030        composeEnumerationExtras("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
32031      }
32032      if (element.hasTimestampElement()) {
32033        composeInstantCore("timestamp", element.getTimestampElement(), false);
32034        composeInstantExtras("timestamp", element.getTimestampElement(), false);
32035      }
32036      if (element.hasTotalElement()) {
32037        composeUnsignedIntCore("total", element.getTotalElement(), false);
32038        composeUnsignedIntExtras("total", element.getTotalElement(), false);
32039      }
32040      if (element.hasLink()) {
32041        openArray("link");
32042        for (Bundle.BundleLinkComponent e : element.getLink()) 
32043          composeBundleBundleLinkComponent(null, e);
32044        closeArray();
32045      };
32046      if (element.hasEntry()) {
32047        openArray("entry");
32048        for (Bundle.BundleEntryComponent e : element.getEntry()) 
32049          composeBundleBundleEntryComponent(null, e);
32050        closeArray();
32051      };
32052      if (element.hasSignature()) {
32053        composeSignature("signature", element.getSignature());
32054      }
32055  }
32056
32057  protected void composeBundleBundleLinkComponent(String name, Bundle.BundleLinkComponent element) throws IOException {
32058    if (element != null) {
32059      open(name);
32060      composeBundleBundleLinkComponentInner(element);
32061      close();
32062    }
32063  }
32064
32065  protected void composeBundleBundleLinkComponentInner(Bundle.BundleLinkComponent element) throws IOException {
32066      composeBackbone(element);
32067      if (element.hasRelationElement()) {
32068        composeStringCore("relation", element.getRelationElement(), false);
32069        composeStringExtras("relation", element.getRelationElement(), false);
32070      }
32071      if (element.hasUrlElement()) {
32072        composeUriCore("url", element.getUrlElement(), false);
32073        composeUriExtras("url", element.getUrlElement(), false);
32074      }
32075  }
32076
32077  protected void composeBundleBundleEntryComponent(String name, Bundle.BundleEntryComponent element) throws IOException {
32078    if (element != null) {
32079      open(name);
32080      composeBundleBundleEntryComponentInner(element);
32081      close();
32082    }
32083  }
32084
32085  protected void composeBundleBundleEntryComponentInner(Bundle.BundleEntryComponent element) throws IOException {
32086      composeBackbone(element);
32087      if (element.hasLink()) {
32088        openArray("link");
32089        for (Bundle.BundleLinkComponent e : element.getLink()) 
32090          composeBundleBundleLinkComponent(null, e);
32091        closeArray();
32092      };
32093      if (element.hasFullUrlElement()) {
32094        composeUriCore("fullUrl", element.getFullUrlElement(), false);
32095        composeUriExtras("fullUrl", element.getFullUrlElement(), false);
32096      }
32097        if (element.hasResource()) {
32098          open("resource");
32099          composeResource(element.getResource());
32100          close();
32101        }
32102      if (element.hasSearch()) {
32103        composeBundleBundleEntrySearchComponent("search", element.getSearch());
32104      }
32105      if (element.hasRequest()) {
32106        composeBundleBundleEntryRequestComponent("request", element.getRequest());
32107      }
32108      if (element.hasResponse()) {
32109        composeBundleBundleEntryResponseComponent("response", element.getResponse());
32110      }
32111  }
32112
32113  protected void composeBundleBundleEntrySearchComponent(String name, Bundle.BundleEntrySearchComponent element) throws IOException {
32114    if (element != null) {
32115      open(name);
32116      composeBundleBundleEntrySearchComponentInner(element);
32117      close();
32118    }
32119  }
32120
32121  protected void composeBundleBundleEntrySearchComponentInner(Bundle.BundleEntrySearchComponent element) throws IOException {
32122      composeBackbone(element);
32123      if (element.hasModeElement()) {
32124        composeEnumerationCore("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
32125        composeEnumerationExtras("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
32126      }
32127      if (element.hasScoreElement()) {
32128        composeDecimalCore("score", element.getScoreElement(), false);
32129        composeDecimalExtras("score", element.getScoreElement(), false);
32130      }
32131  }
32132
32133  protected void composeBundleBundleEntryRequestComponent(String name, Bundle.BundleEntryRequestComponent element) throws IOException {
32134    if (element != null) {
32135      open(name);
32136      composeBundleBundleEntryRequestComponentInner(element);
32137      close();
32138    }
32139  }
32140
32141  protected void composeBundleBundleEntryRequestComponentInner(Bundle.BundleEntryRequestComponent element) throws IOException {
32142      composeBackbone(element);
32143      if (element.hasMethodElement()) {
32144        composeEnumerationCore("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
32145        composeEnumerationExtras("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
32146      }
32147      if (element.hasUrlElement()) {
32148        composeUriCore("url", element.getUrlElement(), false);
32149        composeUriExtras("url", element.getUrlElement(), false);
32150      }
32151      if (element.hasIfNoneMatchElement()) {
32152        composeStringCore("ifNoneMatch", element.getIfNoneMatchElement(), false);
32153        composeStringExtras("ifNoneMatch", element.getIfNoneMatchElement(), false);
32154      }
32155      if (element.hasIfModifiedSinceElement()) {
32156        composeInstantCore("ifModifiedSince", element.getIfModifiedSinceElement(), false);
32157        composeInstantExtras("ifModifiedSince", element.getIfModifiedSinceElement(), false);
32158      }
32159      if (element.hasIfMatchElement()) {
32160        composeStringCore("ifMatch", element.getIfMatchElement(), false);
32161        composeStringExtras("ifMatch", element.getIfMatchElement(), false);
32162      }
32163      if (element.hasIfNoneExistElement()) {
32164        composeStringCore("ifNoneExist", element.getIfNoneExistElement(), false);
32165        composeStringExtras("ifNoneExist", element.getIfNoneExistElement(), false);
32166      }
32167  }
32168
32169  protected void composeBundleBundleEntryResponseComponent(String name, Bundle.BundleEntryResponseComponent element) throws IOException {
32170    if (element != null) {
32171      open(name);
32172      composeBundleBundleEntryResponseComponentInner(element);
32173      close();
32174    }
32175  }
32176
32177  protected void composeBundleBundleEntryResponseComponentInner(Bundle.BundleEntryResponseComponent element) throws IOException {
32178      composeBackbone(element);
32179      if (element.hasStatusElement()) {
32180        composeStringCore("status", element.getStatusElement(), false);
32181        composeStringExtras("status", element.getStatusElement(), false);
32182      }
32183      if (element.hasLocationElement()) {
32184        composeUriCore("location", element.getLocationElement(), false);
32185        composeUriExtras("location", element.getLocationElement(), false);
32186      }
32187      if (element.hasEtagElement()) {
32188        composeStringCore("etag", element.getEtagElement(), false);
32189        composeStringExtras("etag", element.getEtagElement(), false);
32190      }
32191      if (element.hasLastModifiedElement()) {
32192        composeInstantCore("lastModified", element.getLastModifiedElement(), false);
32193        composeInstantExtras("lastModified", element.getLastModifiedElement(), false);
32194      }
32195        if (element.hasOutcome()) {
32196          open("outcome");
32197          composeResource(element.getOutcome());
32198          close();
32199        }
32200  }
32201
32202  protected void composeCapabilityStatement(String name, CapabilityStatement element) throws IOException {
32203    if (element != null) {
32204      prop("resourceType", name);
32205      composeCapabilityStatementInner(element);
32206    }
32207  }
32208
32209  protected void composeCapabilityStatementInner(CapabilityStatement element) throws IOException {
32210      composeDomainResourceElements(element);
32211      if (element.hasUrlElement()) {
32212        composeUriCore("url", element.getUrlElement(), false);
32213        composeUriExtras("url", element.getUrlElement(), false);
32214      }
32215      if (element.hasVersionElement()) {
32216        composeStringCore("version", element.getVersionElement(), false);
32217        composeStringExtras("version", element.getVersionElement(), false);
32218      }
32219      if (element.hasNameElement()) {
32220        composeStringCore("name", element.getNameElement(), false);
32221        composeStringExtras("name", element.getNameElement(), false);
32222      }
32223      if (element.hasTitleElement()) {
32224        composeStringCore("title", element.getTitleElement(), false);
32225        composeStringExtras("title", element.getTitleElement(), false);
32226      }
32227      if (element.hasStatusElement()) {
32228        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32229        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32230      }
32231      if (element.hasExperimentalElement()) {
32232        composeBooleanCore("experimental", element.getExperimentalElement(), false);
32233        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
32234      }
32235      if (element.hasDateElement()) {
32236        composeDateTimeCore("date", element.getDateElement(), false);
32237        composeDateTimeExtras("date", element.getDateElement(), false);
32238      }
32239      if (element.hasPublisherElement()) {
32240        composeStringCore("publisher", element.getPublisherElement(), false);
32241        composeStringExtras("publisher", element.getPublisherElement(), false);
32242      }
32243      if (element.hasContact()) {
32244        openArray("contact");
32245        for (ContactDetail e : element.getContact()) 
32246          composeContactDetail(null, e);
32247        closeArray();
32248      };
32249      if (element.hasDescriptionElement()) {
32250        composeMarkdownCore("description", element.getDescriptionElement(), false);
32251        composeMarkdownExtras("description", element.getDescriptionElement(), false);
32252      }
32253      if (element.hasUseContext()) {
32254        openArray("useContext");
32255        for (UsageContext e : element.getUseContext()) 
32256          composeUsageContext(null, e);
32257        closeArray();
32258      };
32259      if (element.hasJurisdiction()) {
32260        openArray("jurisdiction");
32261        for (CodeableConcept e : element.getJurisdiction()) 
32262          composeCodeableConcept(null, e);
32263        closeArray();
32264      };
32265      if (element.hasPurposeElement()) {
32266        composeMarkdownCore("purpose", element.getPurposeElement(), false);
32267        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
32268      }
32269      if (element.hasCopyrightElement()) {
32270        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
32271        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
32272      }
32273      if (element.hasKindElement()) {
32274        composeEnumerationCore("kind", element.getKindElement(), new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
32275        composeEnumerationExtras("kind", element.getKindElement(), new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
32276      }
32277      if (element.hasInstantiates()) {
32278        openArray("instantiates");
32279        for (CanonicalType e : element.getInstantiates()) 
32280          composeCanonicalCore(null, e, true);
32281        closeArray();
32282        if (anyHasExtras(element.getInstantiates())) {
32283          openArray("_instantiates");
32284          for (CanonicalType e : element.getInstantiates()) 
32285            composeCanonicalExtras(null, e, true);
32286          closeArray();
32287        }
32288      };
32289      if (element.hasImports()) {
32290        openArray("imports");
32291        for (CanonicalType e : element.getImports()) 
32292          composeCanonicalCore(null, e, true);
32293        closeArray();
32294        if (anyHasExtras(element.getImports())) {
32295          openArray("_imports");
32296          for (CanonicalType e : element.getImports()) 
32297            composeCanonicalExtras(null, e, true);
32298          closeArray();
32299        }
32300      };
32301      if (element.hasSoftware()) {
32302        composeCapabilityStatementCapabilityStatementSoftwareComponent("software", element.getSoftware());
32303      }
32304      if (element.hasImplementation()) {
32305        composeCapabilityStatementCapabilityStatementImplementationComponent("implementation", element.getImplementation());
32306      }
32307      if (element.hasFhirVersionElement()) {
32308        composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
32309        composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
32310      }
32311      if (element.hasFormat()) {
32312        openArray("format");
32313        for (CodeType e : element.getFormat()) 
32314          composeCodeCore(null, e, true);
32315        closeArray();
32316        if (anyHasExtras(element.getFormat())) {
32317          openArray("_format");
32318          for (CodeType e : element.getFormat()) 
32319            composeCodeExtras(null, e, true);
32320          closeArray();
32321        }
32322      };
32323      if (element.hasPatchFormat()) {
32324        openArray("patchFormat");
32325        for (CodeType e : element.getPatchFormat()) 
32326          composeCodeCore(null, e, true);
32327        closeArray();
32328        if (anyHasExtras(element.getPatchFormat())) {
32329          openArray("_patchFormat");
32330          for (CodeType e : element.getPatchFormat()) 
32331            composeCodeExtras(null, e, true);
32332          closeArray();
32333        }
32334      };
32335      if (element.hasImplementationGuide()) {
32336        openArray("implementationGuide");
32337        for (CanonicalType e : element.getImplementationGuide()) 
32338          composeCanonicalCore(null, e, true);
32339        closeArray();
32340        if (anyHasExtras(element.getImplementationGuide())) {
32341          openArray("_implementationGuide");
32342          for (CanonicalType e : element.getImplementationGuide()) 
32343            composeCanonicalExtras(null, e, true);
32344          closeArray();
32345        }
32346      };
32347      if (element.hasRest()) {
32348        openArray("rest");
32349        for (CapabilityStatement.CapabilityStatementRestComponent e : element.getRest()) 
32350          composeCapabilityStatementCapabilityStatementRestComponent(null, e);
32351        closeArray();
32352      };
32353      if (element.hasMessaging()) {
32354        openArray("messaging");
32355        for (CapabilityStatement.CapabilityStatementMessagingComponent e : element.getMessaging()) 
32356          composeCapabilityStatementCapabilityStatementMessagingComponent(null, e);
32357        closeArray();
32358      };
32359      if (element.hasDocument()) {
32360        openArray("document");
32361        for (CapabilityStatement.CapabilityStatementDocumentComponent e : element.getDocument()) 
32362          composeCapabilityStatementCapabilityStatementDocumentComponent(null, e);
32363        closeArray();
32364      };
32365  }
32366
32367  protected void composeCapabilityStatementCapabilityStatementSoftwareComponent(String name, CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
32368    if (element != null) {
32369      open(name);
32370      composeCapabilityStatementCapabilityStatementSoftwareComponentInner(element);
32371      close();
32372    }
32373  }
32374
32375  protected void composeCapabilityStatementCapabilityStatementSoftwareComponentInner(CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
32376      composeBackbone(element);
32377      if (element.hasNameElement()) {
32378        composeStringCore("name", element.getNameElement(), false);
32379        composeStringExtras("name", element.getNameElement(), false);
32380      }
32381      if (element.hasVersionElement()) {
32382        composeStringCore("version", element.getVersionElement(), false);
32383        composeStringExtras("version", element.getVersionElement(), false);
32384      }
32385      if (element.hasReleaseDateElement()) {
32386        composeDateTimeCore("releaseDate", element.getReleaseDateElement(), false);
32387        composeDateTimeExtras("releaseDate", element.getReleaseDateElement(), false);
32388      }
32389  }
32390
32391  protected void composeCapabilityStatementCapabilityStatementImplementationComponent(String name, CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
32392    if (element != null) {
32393      open(name);
32394      composeCapabilityStatementCapabilityStatementImplementationComponentInner(element);
32395      close();
32396    }
32397  }
32398
32399  protected void composeCapabilityStatementCapabilityStatementImplementationComponentInner(CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
32400      composeBackbone(element);
32401      if (element.hasDescriptionElement()) {
32402        composeStringCore("description", element.getDescriptionElement(), false);
32403        composeStringExtras("description", element.getDescriptionElement(), false);
32404      }
32405      if (element.hasUrlElement()) {
32406        composeUrlCore("url", element.getUrlElement(), false);
32407        composeUrlExtras("url", element.getUrlElement(), false);
32408      }
32409      if (element.hasCustodian()) {
32410        composeReference("custodian", element.getCustodian());
32411      }
32412  }
32413
32414  protected void composeCapabilityStatementCapabilityStatementRestComponent(String name, CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
32415    if (element != null) {
32416      open(name);
32417      composeCapabilityStatementCapabilityStatementRestComponentInner(element);
32418      close();
32419    }
32420  }
32421
32422  protected void composeCapabilityStatementCapabilityStatementRestComponentInner(CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
32423      composeBackbone(element);
32424      if (element.hasModeElement()) {
32425        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
32426        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
32427      }
32428      if (element.hasDocumentationElement()) {
32429        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32430        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32431      }
32432      if (element.hasSecurity()) {
32433        composeCapabilityStatementCapabilityStatementRestSecurityComponent("security", element.getSecurity());
32434      }
32435      if (element.hasResource()) {
32436        openArray("resource");
32437        for (CapabilityStatement.CapabilityStatementRestResourceComponent e : element.getResource()) 
32438          composeCapabilityStatementCapabilityStatementRestResourceComponent(null, e);
32439        closeArray();
32440      };
32441      if (element.hasInteraction()) {
32442        openArray("interaction");
32443        for (CapabilityStatement.SystemInteractionComponent e : element.getInteraction()) 
32444          composeCapabilityStatementSystemInteractionComponent(null, e);
32445        closeArray();
32446      };
32447      if (element.hasSearchParam()) {
32448        openArray("searchParam");
32449        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
32450          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
32451        closeArray();
32452      };
32453      if (element.hasOperation()) {
32454        openArray("operation");
32455        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
32456          composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(null, e);
32457        closeArray();
32458      };
32459      if (element.hasCompartment()) {
32460        openArray("compartment");
32461        for (CanonicalType e : element.getCompartment()) 
32462          composeCanonicalCore(null, e, true);
32463        closeArray();
32464        if (anyHasExtras(element.getCompartment())) {
32465          openArray("_compartment");
32466          for (CanonicalType e : element.getCompartment()) 
32467            composeCanonicalExtras(null, e, true);
32468          closeArray();
32469        }
32470      };
32471  }
32472
32473  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponent(String name, CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
32474    if (element != null) {
32475      open(name);
32476      composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(element);
32477      close();
32478    }
32479  }
32480
32481  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
32482      composeBackbone(element);
32483      if (element.hasCorsElement()) {
32484        composeBooleanCore("cors", element.getCorsElement(), false);
32485        composeBooleanExtras("cors", element.getCorsElement(), false);
32486      }
32487      if (element.hasService()) {
32488        openArray("service");
32489        for (CodeableConcept e : element.getService()) 
32490          composeCodeableConcept(null, e);
32491        closeArray();
32492      };
32493      if (element.hasDescriptionElement()) {
32494        composeMarkdownCore("description", element.getDescriptionElement(), false);
32495        composeMarkdownExtras("description", element.getDescriptionElement(), false);
32496      }
32497  }
32498
32499  protected void composeCapabilityStatementCapabilityStatementRestResourceComponent(String name, CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
32500    if (element != null) {
32501      open(name);
32502      composeCapabilityStatementCapabilityStatementRestResourceComponentInner(element);
32503      close();
32504    }
32505  }
32506
32507  protected void composeCapabilityStatementCapabilityStatementRestResourceComponentInner(CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
32508      composeBackbone(element);
32509      if (element.hasTypeElement()) {
32510        composeCodeCore("type", element.getTypeElement(), false);
32511        composeCodeExtras("type", element.getTypeElement(), false);
32512      }
32513      if (element.hasProfileElement()) {
32514        composeCanonicalCore("profile", element.getProfileElement(), false);
32515        composeCanonicalExtras("profile", element.getProfileElement(), false);
32516      }
32517      if (element.hasSupportedProfile()) {
32518        openArray("supportedProfile");
32519        for (CanonicalType e : element.getSupportedProfile()) 
32520          composeCanonicalCore(null, e, true);
32521        closeArray();
32522        if (anyHasExtras(element.getSupportedProfile())) {
32523          openArray("_supportedProfile");
32524          for (CanonicalType e : element.getSupportedProfile()) 
32525            composeCanonicalExtras(null, e, true);
32526          closeArray();
32527        }
32528      };
32529      if (element.hasDocumentationElement()) {
32530        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32531        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32532      }
32533      if (element.hasInteraction()) {
32534        openArray("interaction");
32535        for (CapabilityStatement.ResourceInteractionComponent e : element.getInteraction()) 
32536          composeCapabilityStatementResourceInteractionComponent(null, e);
32537        closeArray();
32538      };
32539      if (element.hasVersioningElement()) {
32540        composeEnumerationCore("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
32541        composeEnumerationExtras("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
32542      }
32543      if (element.hasReadHistoryElement()) {
32544        composeBooleanCore("readHistory", element.getReadHistoryElement(), false);
32545        composeBooleanExtras("readHistory", element.getReadHistoryElement(), false);
32546      }
32547      if (element.hasUpdateCreateElement()) {
32548        composeBooleanCore("updateCreate", element.getUpdateCreateElement(), false);
32549        composeBooleanExtras("updateCreate", element.getUpdateCreateElement(), false);
32550      }
32551      if (element.hasConditionalCreateElement()) {
32552        composeBooleanCore("conditionalCreate", element.getConditionalCreateElement(), false);
32553        composeBooleanExtras("conditionalCreate", element.getConditionalCreateElement(), false);
32554      }
32555      if (element.hasConditionalReadElement()) {
32556        composeEnumerationCore("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
32557        composeEnumerationExtras("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
32558      }
32559      if (element.hasConditionalUpdateElement()) {
32560        composeBooleanCore("conditionalUpdate", element.getConditionalUpdateElement(), false);
32561        composeBooleanExtras("conditionalUpdate", element.getConditionalUpdateElement(), false);
32562      }
32563      if (element.hasConditionalDeleteElement()) {
32564        composeEnumerationCore("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
32565        composeEnumerationExtras("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
32566      }
32567      if (element.hasReferencePolicy()) {
32568        openArray("referencePolicy");
32569        for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
32570          composeEnumerationCore(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
32571        closeArray();
32572        if (anyHasExtras(element.getReferencePolicy())) {
32573          openArray("_referencePolicy");
32574          for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
32575            composeEnumerationExtras(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
32576          closeArray();
32577        }
32578      };
32579      if (element.hasSearchInclude()) {
32580        openArray("searchInclude");
32581        for (StringType e : element.getSearchInclude()) 
32582          composeStringCore(null, e, true);
32583        closeArray();
32584        if (anyHasExtras(element.getSearchInclude())) {
32585          openArray("_searchInclude");
32586          for (StringType e : element.getSearchInclude()) 
32587            composeStringExtras(null, e, true);
32588          closeArray();
32589        }
32590      };
32591      if (element.hasSearchRevInclude()) {
32592        openArray("searchRevInclude");
32593        for (StringType e : element.getSearchRevInclude()) 
32594          composeStringCore(null, e, true);
32595        closeArray();
32596        if (anyHasExtras(element.getSearchRevInclude())) {
32597          openArray("_searchRevInclude");
32598          for (StringType e : element.getSearchRevInclude()) 
32599            composeStringExtras(null, e, true);
32600          closeArray();
32601        }
32602      };
32603      if (element.hasSearchParam()) {
32604        openArray("searchParam");
32605        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
32606          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
32607        closeArray();
32608      };
32609      if (element.hasOperation()) {
32610        openArray("operation");
32611        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
32612          composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(null, e);
32613        closeArray();
32614      };
32615  }
32616
32617  protected void composeCapabilityStatementResourceInteractionComponent(String name, CapabilityStatement.ResourceInteractionComponent element) throws IOException {
32618    if (element != null) {
32619      open(name);
32620      composeCapabilityStatementResourceInteractionComponentInner(element);
32621      close();
32622    }
32623  }
32624
32625  protected void composeCapabilityStatementResourceInteractionComponentInner(CapabilityStatement.ResourceInteractionComponent element) throws IOException {
32626      composeBackbone(element);
32627      if (element.hasCodeElement()) {
32628        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
32629        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
32630      }
32631      if (element.hasDocumentationElement()) {
32632        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32633        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32634      }
32635  }
32636
32637  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(String name, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
32638    if (element != null) {
32639      open(name);
32640      composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(element);
32641      close();
32642    }
32643  }
32644
32645  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
32646      composeBackbone(element);
32647      if (element.hasNameElement()) {
32648        composeStringCore("name", element.getNameElement(), false);
32649        composeStringExtras("name", element.getNameElement(), false);
32650      }
32651      if (element.hasDefinitionElement()) {
32652        composeCanonicalCore("definition", element.getDefinitionElement(), false);
32653        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
32654      }
32655      if (element.hasTypeElement()) {
32656        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
32657        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
32658      }
32659      if (element.hasDocumentationElement()) {
32660        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32661        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32662      }
32663  }
32664
32665  protected void composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(String name, CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
32666    if (element != null) {
32667      open(name);
32668      composeCapabilityStatementCapabilityStatementRestResourceOperationComponentInner(element);
32669      close();
32670    }
32671  }
32672
32673  protected void composeCapabilityStatementCapabilityStatementRestResourceOperationComponentInner(CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
32674      composeBackbone(element);
32675      if (element.hasNameElement()) {
32676        composeStringCore("name", element.getNameElement(), false);
32677        composeStringExtras("name", element.getNameElement(), false);
32678      }
32679      if (element.hasDefinitionElement()) {
32680        composeCanonicalCore("definition", element.getDefinitionElement(), false);
32681        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
32682      }
32683      if (element.hasDocumentationElement()) {
32684        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32685        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32686      }
32687  }
32688
32689  protected void composeCapabilityStatementSystemInteractionComponent(String name, CapabilityStatement.SystemInteractionComponent element) throws IOException {
32690    if (element != null) {
32691      open(name);
32692      composeCapabilityStatementSystemInteractionComponentInner(element);
32693      close();
32694    }
32695  }
32696
32697  protected void composeCapabilityStatementSystemInteractionComponentInner(CapabilityStatement.SystemInteractionComponent element) throws IOException {
32698      composeBackbone(element);
32699      if (element.hasCodeElement()) {
32700        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
32701        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
32702      }
32703      if (element.hasDocumentationElement()) {
32704        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32705        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32706      }
32707  }
32708
32709  protected void composeCapabilityStatementCapabilityStatementMessagingComponent(String name, CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
32710    if (element != null) {
32711      open(name);
32712      composeCapabilityStatementCapabilityStatementMessagingComponentInner(element);
32713      close();
32714    }
32715  }
32716
32717  protected void composeCapabilityStatementCapabilityStatementMessagingComponentInner(CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
32718      composeBackbone(element);
32719      if (element.hasEndpoint()) {
32720        openArray("endpoint");
32721        for (CapabilityStatement.CapabilityStatementMessagingEndpointComponent e : element.getEndpoint()) 
32722          composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(null, e);
32723        closeArray();
32724      };
32725      if (element.hasReliableCacheElement()) {
32726        composeUnsignedIntCore("reliableCache", element.getReliableCacheElement(), false);
32727        composeUnsignedIntExtras("reliableCache", element.getReliableCacheElement(), false);
32728      }
32729      if (element.hasDocumentationElement()) {
32730        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32731        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32732      }
32733      if (element.hasSupportedMessage()) {
32734        openArray("supportedMessage");
32735        for (CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent e : element.getSupportedMessage()) 
32736          composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(null, e);
32737        closeArray();
32738      };
32739  }
32740
32741  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(String name, CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
32742    if (element != null) {
32743      open(name);
32744      composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(element);
32745      close();
32746    }
32747  }
32748
32749  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
32750      composeBackbone(element);
32751      if (element.hasProtocol()) {
32752        composeCoding("protocol", element.getProtocol());
32753      }
32754      if (element.hasAddressElement()) {
32755        composeUrlCore("address", element.getAddressElement(), false);
32756        composeUrlExtras("address", element.getAddressElement(), false);
32757      }
32758  }
32759
32760  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(String name, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
32761    if (element != null) {
32762      open(name);
32763      composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(element);
32764      close();
32765    }
32766  }
32767
32768  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
32769      composeBackbone(element);
32770      if (element.hasModeElement()) {
32771        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
32772        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
32773      }
32774      if (element.hasDefinitionElement()) {
32775        composeCanonicalCore("definition", element.getDefinitionElement(), false);
32776        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
32777      }
32778  }
32779
32780  protected void composeCapabilityStatementCapabilityStatementDocumentComponent(String name, CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
32781    if (element != null) {
32782      open(name);
32783      composeCapabilityStatementCapabilityStatementDocumentComponentInner(element);
32784      close();
32785    }
32786  }
32787
32788  protected void composeCapabilityStatementCapabilityStatementDocumentComponentInner(CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
32789      composeBackbone(element);
32790      if (element.hasModeElement()) {
32791        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
32792        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
32793      }
32794      if (element.hasDocumentationElement()) {
32795        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32796        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32797      }
32798      if (element.hasProfileElement()) {
32799        composeCanonicalCore("profile", element.getProfileElement(), false);
32800        composeCanonicalExtras("profile", element.getProfileElement(), false);
32801      }
32802  }
32803
32804  protected void composeCarePlan(String name, CarePlan element) throws IOException {
32805    if (element != null) {
32806      prop("resourceType", name);
32807      composeCarePlanInner(element);
32808    }
32809  }
32810
32811  protected void composeCarePlanInner(CarePlan element) throws IOException {
32812      composeDomainResourceElements(element);
32813      if (element.hasIdentifier()) {
32814        openArray("identifier");
32815        for (Identifier e : element.getIdentifier()) 
32816          composeIdentifier(null, e);
32817        closeArray();
32818      };
32819      if (element.hasInstantiatesCanonical()) {
32820        openArray("instantiatesCanonical");
32821        for (CanonicalType e : element.getInstantiatesCanonical()) 
32822          composeCanonicalCore(null, e, true);
32823        closeArray();
32824        if (anyHasExtras(element.getInstantiatesCanonical())) {
32825          openArray("_instantiatesCanonical");
32826          for (CanonicalType e : element.getInstantiatesCanonical()) 
32827            composeCanonicalExtras(null, e, true);
32828          closeArray();
32829        }
32830      };
32831      if (element.hasInstantiatesUri()) {
32832        openArray("instantiatesUri");
32833        for (UriType e : element.getInstantiatesUri()) 
32834          composeUriCore(null, e, true);
32835        closeArray();
32836        if (anyHasExtras(element.getInstantiatesUri())) {
32837          openArray("_instantiatesUri");
32838          for (UriType e : element.getInstantiatesUri()) 
32839            composeUriExtras(null, e, true);
32840          closeArray();
32841        }
32842      };
32843      if (element.hasBasedOn()) {
32844        openArray("basedOn");
32845        for (Reference e : element.getBasedOn()) 
32846          composeReference(null, e);
32847        closeArray();
32848      };
32849      if (element.hasReplaces()) {
32850        openArray("replaces");
32851        for (Reference e : element.getReplaces()) 
32852          composeReference(null, e);
32853        closeArray();
32854      };
32855      if (element.hasPartOf()) {
32856        openArray("partOf");
32857        for (Reference e : element.getPartOf()) 
32858          composeReference(null, e);
32859        closeArray();
32860      };
32861      if (element.hasStatusElement()) {
32862        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
32863        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
32864      }
32865      if (element.hasIntentElement()) {
32866        composeEnumerationCore("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
32867        composeEnumerationExtras("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
32868      }
32869      if (element.hasCategory()) {
32870        openArray("category");
32871        for (CodeableConcept e : element.getCategory()) 
32872          composeCodeableConcept(null, e);
32873        closeArray();
32874      };
32875      if (element.hasTitleElement()) {
32876        composeStringCore("title", element.getTitleElement(), false);
32877        composeStringExtras("title", element.getTitleElement(), false);
32878      }
32879      if (element.hasDescriptionElement()) {
32880        composeStringCore("description", element.getDescriptionElement(), false);
32881        composeStringExtras("description", element.getDescriptionElement(), false);
32882      }
32883      if (element.hasSubject()) {
32884        composeReference("subject", element.getSubject());
32885      }
32886      if (element.hasEncounter()) {
32887        composeReference("encounter", element.getEncounter());
32888      }
32889      if (element.hasPeriod()) {
32890        composePeriod("period", element.getPeriod());
32891      }
32892      if (element.hasCreatedElement()) {
32893        composeDateTimeCore("created", element.getCreatedElement(), false);
32894        composeDateTimeExtras("created", element.getCreatedElement(), false);
32895      }
32896      if (element.hasAuthor()) {
32897        composeReference("author", element.getAuthor());
32898      }
32899      if (element.hasContributor()) {
32900        openArray("contributor");
32901        for (Reference e : element.getContributor()) 
32902          composeReference(null, e);
32903        closeArray();
32904      };
32905      if (element.hasCareTeam()) {
32906        openArray("careTeam");
32907        for (Reference e : element.getCareTeam()) 
32908          composeReference(null, e);
32909        closeArray();
32910      };
32911      if (element.hasAddresses()) {
32912        openArray("addresses");
32913        for (Reference e : element.getAddresses()) 
32914          composeReference(null, e);
32915        closeArray();
32916      };
32917      if (element.hasSupportingInfo()) {
32918        openArray("supportingInfo");
32919        for (Reference e : element.getSupportingInfo()) 
32920          composeReference(null, e);
32921        closeArray();
32922      };
32923      if (element.hasGoal()) {
32924        openArray("goal");
32925        for (Reference e : element.getGoal()) 
32926          composeReference(null, e);
32927        closeArray();
32928      };
32929      if (element.hasActivity()) {
32930        openArray("activity");
32931        for (CarePlan.CarePlanActivityComponent e : element.getActivity()) 
32932          composeCarePlanCarePlanActivityComponent(null, e);
32933        closeArray();
32934      };
32935      if (element.hasNote()) {
32936        openArray("note");
32937        for (Annotation e : element.getNote()) 
32938          composeAnnotation(null, e);
32939        closeArray();
32940      };
32941  }
32942
32943  protected void composeCarePlanCarePlanActivityComponent(String name, CarePlan.CarePlanActivityComponent element) throws IOException {
32944    if (element != null) {
32945      open(name);
32946      composeCarePlanCarePlanActivityComponentInner(element);
32947      close();
32948    }
32949  }
32950
32951  protected void composeCarePlanCarePlanActivityComponentInner(CarePlan.CarePlanActivityComponent element) throws IOException {
32952      composeBackbone(element);
32953      if (element.hasOutcomeCodeableConcept()) {
32954        openArray("outcomeCodeableConcept");
32955        for (CodeableConcept e : element.getOutcomeCodeableConcept()) 
32956          composeCodeableConcept(null, e);
32957        closeArray();
32958      };
32959      if (element.hasOutcomeReference()) {
32960        openArray("outcomeReference");
32961        for (Reference e : element.getOutcomeReference()) 
32962          composeReference(null, e);
32963        closeArray();
32964      };
32965      if (element.hasProgress()) {
32966        openArray("progress");
32967        for (Annotation e : element.getProgress()) 
32968          composeAnnotation(null, e);
32969        closeArray();
32970      };
32971      if (element.hasReference()) {
32972        composeReference("reference", element.getReference());
32973      }
32974      if (element.hasDetail()) {
32975        composeCarePlanCarePlanActivityDetailComponent("detail", element.getDetail());
32976      }
32977  }
32978
32979  protected void composeCarePlanCarePlanActivityDetailComponent(String name, CarePlan.CarePlanActivityDetailComponent element) throws IOException {
32980    if (element != null) {
32981      open(name);
32982      composeCarePlanCarePlanActivityDetailComponentInner(element);
32983      close();
32984    }
32985  }
32986
32987  protected void composeCarePlanCarePlanActivityDetailComponentInner(CarePlan.CarePlanActivityDetailComponent element) throws IOException {
32988      composeBackbone(element);
32989      if (element.hasKindElement()) {
32990        composeEnumerationCore("kind", element.getKindElement(), new CarePlan.CarePlanActivityKindEnumFactory(), false);
32991        composeEnumerationExtras("kind", element.getKindElement(), new CarePlan.CarePlanActivityKindEnumFactory(), false);
32992      }
32993      if (element.hasInstantiatesCanonical()) {
32994        openArray("instantiatesCanonical");
32995        for (CanonicalType e : element.getInstantiatesCanonical()) 
32996          composeCanonicalCore(null, e, true);
32997        closeArray();
32998        if (anyHasExtras(element.getInstantiatesCanonical())) {
32999          openArray("_instantiatesCanonical");
33000          for (CanonicalType e : element.getInstantiatesCanonical()) 
33001            composeCanonicalExtras(null, e, true);
33002          closeArray();
33003        }
33004      };
33005      if (element.hasInstantiatesUri()) {
33006        openArray("instantiatesUri");
33007        for (UriType e : element.getInstantiatesUri()) 
33008          composeUriCore(null, e, true);
33009        closeArray();
33010        if (anyHasExtras(element.getInstantiatesUri())) {
33011          openArray("_instantiatesUri");
33012          for (UriType e : element.getInstantiatesUri()) 
33013            composeUriExtras(null, e, true);
33014          closeArray();
33015        }
33016      };
33017      if (element.hasCode()) {
33018        composeCodeableConcept("code", element.getCode());
33019      }
33020      if (element.hasReasonCode()) {
33021        openArray("reasonCode");
33022        for (CodeableConcept e : element.getReasonCode()) 
33023          composeCodeableConcept(null, e);
33024        closeArray();
33025      };
33026      if (element.hasReasonReference()) {
33027        openArray("reasonReference");
33028        for (Reference e : element.getReasonReference()) 
33029          composeReference(null, e);
33030        closeArray();
33031      };
33032      if (element.hasGoal()) {
33033        openArray("goal");
33034        for (Reference e : element.getGoal()) 
33035          composeReference(null, e);
33036        closeArray();
33037      };
33038      if (element.hasStatusElement()) {
33039        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
33040        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
33041      }
33042      if (element.hasStatusReason()) {
33043        composeCodeableConcept("statusReason", element.getStatusReason());
33044      }
33045      if (element.hasDoNotPerformElement()) {
33046        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
33047        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
33048      }
33049      if (element.hasScheduled()) {
33050        composeType("scheduled", element.getScheduled());
33051      }
33052      if (element.hasLocation()) {
33053        composeReference("location", element.getLocation());
33054      }
33055      if (element.hasPerformer()) {
33056        openArray("performer");
33057        for (Reference e : element.getPerformer()) 
33058          composeReference(null, e);
33059        closeArray();
33060      };
33061      if (element.hasProduct()) {
33062        composeType("product", element.getProduct());
33063      }
33064      if (element.hasDailyAmount()) {
33065        composeQuantity("dailyAmount", element.getDailyAmount());
33066      }
33067      if (element.hasQuantity()) {
33068        composeQuantity("quantity", element.getQuantity());
33069      }
33070      if (element.hasDescriptionElement()) {
33071        composeStringCore("description", element.getDescriptionElement(), false);
33072        composeStringExtras("description", element.getDescriptionElement(), false);
33073      }
33074  }
33075
33076  protected void composeCareTeam(String name, CareTeam element) throws IOException {
33077    if (element != null) {
33078      prop("resourceType", name);
33079      composeCareTeamInner(element);
33080    }
33081  }
33082
33083  protected void composeCareTeamInner(CareTeam element) throws IOException {
33084      composeDomainResourceElements(element);
33085      if (element.hasIdentifier()) {
33086        openArray("identifier");
33087        for (Identifier e : element.getIdentifier()) 
33088          composeIdentifier(null, e);
33089        closeArray();
33090      };
33091      if (element.hasStatusElement()) {
33092        composeEnumerationCore("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
33093        composeEnumerationExtras("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
33094      }
33095      if (element.hasCategory()) {
33096        openArray("category");
33097        for (CodeableConcept e : element.getCategory()) 
33098          composeCodeableConcept(null, e);
33099        closeArray();
33100      };
33101      if (element.hasNameElement()) {
33102        composeStringCore("name", element.getNameElement(), false);
33103        composeStringExtras("name", element.getNameElement(), false);
33104      }
33105      if (element.hasSubject()) {
33106        composeReference("subject", element.getSubject());
33107      }
33108      if (element.hasEncounter()) {
33109        composeReference("encounter", element.getEncounter());
33110      }
33111      if (element.hasPeriod()) {
33112        composePeriod("period", element.getPeriod());
33113      }
33114      if (element.hasParticipant()) {
33115        openArray("participant");
33116        for (CareTeam.CareTeamParticipantComponent e : element.getParticipant()) 
33117          composeCareTeamCareTeamParticipantComponent(null, e);
33118        closeArray();
33119      };
33120      if (element.hasReasonCode()) {
33121        openArray("reasonCode");
33122        for (CodeableConcept e : element.getReasonCode()) 
33123          composeCodeableConcept(null, e);
33124        closeArray();
33125      };
33126      if (element.hasReasonReference()) {
33127        openArray("reasonReference");
33128        for (Reference e : element.getReasonReference()) 
33129          composeReference(null, e);
33130        closeArray();
33131      };
33132      if (element.hasManagingOrganization()) {
33133        openArray("managingOrganization");
33134        for (Reference e : element.getManagingOrganization()) 
33135          composeReference(null, e);
33136        closeArray();
33137      };
33138      if (element.hasTelecom()) {
33139        openArray("telecom");
33140        for (ContactPoint e : element.getTelecom()) 
33141          composeContactPoint(null, e);
33142        closeArray();
33143      };
33144      if (element.hasNote()) {
33145        openArray("note");
33146        for (Annotation e : element.getNote()) 
33147          composeAnnotation(null, e);
33148        closeArray();
33149      };
33150  }
33151
33152  protected void composeCareTeamCareTeamParticipantComponent(String name, CareTeam.CareTeamParticipantComponent element) throws IOException {
33153    if (element != null) {
33154      open(name);
33155      composeCareTeamCareTeamParticipantComponentInner(element);
33156      close();
33157    }
33158  }
33159
33160  protected void composeCareTeamCareTeamParticipantComponentInner(CareTeam.CareTeamParticipantComponent element) throws IOException {
33161      composeBackbone(element);
33162      if (element.hasRole()) {
33163        openArray("role");
33164        for (CodeableConcept e : element.getRole()) 
33165          composeCodeableConcept(null, e);
33166        closeArray();
33167      };
33168      if (element.hasMember()) {
33169        composeReference("member", element.getMember());
33170      }
33171      if (element.hasOnBehalfOf()) {
33172        composeReference("onBehalfOf", element.getOnBehalfOf());
33173      }
33174      if (element.hasPeriod()) {
33175        composePeriod("period", element.getPeriod());
33176      }
33177  }
33178
33179  protected void composeCatalogEntry(String name, CatalogEntry element) throws IOException {
33180    if (element != null) {
33181      prop("resourceType", name);
33182      composeCatalogEntryInner(element);
33183    }
33184  }
33185
33186  protected void composeCatalogEntryInner(CatalogEntry element) throws IOException {
33187      composeDomainResourceElements(element);
33188      if (element.hasIdentifier()) {
33189        openArray("identifier");
33190        for (Identifier e : element.getIdentifier()) 
33191          composeIdentifier(null, e);
33192        closeArray();
33193      };
33194      if (element.hasType()) {
33195        composeCodeableConcept("type", element.getType());
33196      }
33197      if (element.hasOrderableElement()) {
33198        composeBooleanCore("orderable", element.getOrderableElement(), false);
33199        composeBooleanExtras("orderable", element.getOrderableElement(), false);
33200      }
33201      if (element.hasReferencedItem()) {
33202        composeReference("referencedItem", element.getReferencedItem());
33203      }
33204      if (element.hasAdditionalIdentifier()) {
33205        openArray("additionalIdentifier");
33206        for (Identifier e : element.getAdditionalIdentifier()) 
33207          composeIdentifier(null, e);
33208        closeArray();
33209      };
33210      if (element.hasClassification()) {
33211        openArray("classification");
33212        for (CodeableConcept e : element.getClassification()) 
33213          composeCodeableConcept(null, e);
33214        closeArray();
33215      };
33216      if (element.hasStatusElement()) {
33217        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33218        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33219      }
33220      if (element.hasValidityPeriod()) {
33221        composePeriod("validityPeriod", element.getValidityPeriod());
33222      }
33223      if (element.hasValidToElement()) {
33224        composeDateTimeCore("validTo", element.getValidToElement(), false);
33225        composeDateTimeExtras("validTo", element.getValidToElement(), false);
33226      }
33227      if (element.hasLastUpdatedElement()) {
33228        composeDateTimeCore("lastUpdated", element.getLastUpdatedElement(), false);
33229        composeDateTimeExtras("lastUpdated", element.getLastUpdatedElement(), false);
33230      }
33231      if (element.hasAdditionalCharacteristic()) {
33232        openArray("additionalCharacteristic");
33233        for (CodeableConcept e : element.getAdditionalCharacteristic()) 
33234          composeCodeableConcept(null, e);
33235        closeArray();
33236      };
33237      if (element.hasAdditionalClassification()) {
33238        openArray("additionalClassification");
33239        for (CodeableConcept e : element.getAdditionalClassification()) 
33240          composeCodeableConcept(null, e);
33241        closeArray();
33242      };
33243      if (element.hasRelatedEntry()) {
33244        openArray("relatedEntry");
33245        for (CatalogEntry.CatalogEntryRelatedEntryComponent e : element.getRelatedEntry()) 
33246          composeCatalogEntryCatalogEntryRelatedEntryComponent(null, e);
33247        closeArray();
33248      };
33249  }
33250
33251  protected void composeCatalogEntryCatalogEntryRelatedEntryComponent(String name, CatalogEntry.CatalogEntryRelatedEntryComponent element) throws IOException {
33252    if (element != null) {
33253      open(name);
33254      composeCatalogEntryCatalogEntryRelatedEntryComponentInner(element);
33255      close();
33256    }
33257  }
33258
33259  protected void composeCatalogEntryCatalogEntryRelatedEntryComponentInner(CatalogEntry.CatalogEntryRelatedEntryComponent element) throws IOException {
33260      composeBackbone(element);
33261      if (element.hasRelationtypeElement()) {
33262        composeEnumerationCore("relationtype", element.getRelationtypeElement(), new CatalogEntry.CatalogEntryRelationTypeEnumFactory(), false);
33263        composeEnumerationExtras("relationtype", element.getRelationtypeElement(), new CatalogEntry.CatalogEntryRelationTypeEnumFactory(), false);
33264      }
33265      if (element.hasItem()) {
33266        composeReference("item", element.getItem());
33267      }
33268  }
33269
33270  protected void composeChargeItem(String name, ChargeItem element) throws IOException {
33271    if (element != null) {
33272      prop("resourceType", name);
33273      composeChargeItemInner(element);
33274    }
33275  }
33276
33277  protected void composeChargeItemInner(ChargeItem element) throws IOException {
33278      composeDomainResourceElements(element);
33279      if (element.hasIdentifier()) {
33280        openArray("identifier");
33281        for (Identifier e : element.getIdentifier()) 
33282          composeIdentifier(null, e);
33283        closeArray();
33284      };
33285      if (element.hasDefinitionUri()) {
33286        openArray("definitionUri");
33287        for (UriType e : element.getDefinitionUri()) 
33288          composeUriCore(null, e, true);
33289        closeArray();
33290        if (anyHasExtras(element.getDefinitionUri())) {
33291          openArray("_definitionUri");
33292          for (UriType e : element.getDefinitionUri()) 
33293            composeUriExtras(null, e, true);
33294          closeArray();
33295        }
33296      };
33297      if (element.hasDefinitionCanonical()) {
33298        openArray("definitionCanonical");
33299        for (CanonicalType e : element.getDefinitionCanonical()) 
33300          composeCanonicalCore(null, e, true);
33301        closeArray();
33302        if (anyHasExtras(element.getDefinitionCanonical())) {
33303          openArray("_definitionCanonical");
33304          for (CanonicalType e : element.getDefinitionCanonical()) 
33305            composeCanonicalExtras(null, e, true);
33306          closeArray();
33307        }
33308      };
33309      if (element.hasStatusElement()) {
33310        composeEnumerationCore("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
33311        composeEnumerationExtras("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
33312      }
33313      if (element.hasPartOf()) {
33314        openArray("partOf");
33315        for (Reference e : element.getPartOf()) 
33316          composeReference(null, e);
33317        closeArray();
33318      };
33319      if (element.hasCode()) {
33320        composeCodeableConcept("code", element.getCode());
33321      }
33322      if (element.hasSubject()) {
33323        composeReference("subject", element.getSubject());
33324      }
33325      if (element.hasContext()) {
33326        composeReference("context", element.getContext());
33327      }
33328      if (element.hasOccurrence()) {
33329        composeType("occurrence", element.getOccurrence());
33330      }
33331      if (element.hasPerformer()) {
33332        openArray("performer");
33333        for (ChargeItem.ChargeItemPerformerComponent e : element.getPerformer()) 
33334          composeChargeItemChargeItemPerformerComponent(null, e);
33335        closeArray();
33336      };
33337      if (element.hasPerformingOrganization()) {
33338        composeReference("performingOrganization", element.getPerformingOrganization());
33339      }
33340      if (element.hasRequestingOrganization()) {
33341        composeReference("requestingOrganization", element.getRequestingOrganization());
33342      }
33343      if (element.hasCostCenter()) {
33344        composeReference("costCenter", element.getCostCenter());
33345      }
33346      if (element.hasQuantity()) {
33347        composeQuantity("quantity", element.getQuantity());
33348      }
33349      if (element.hasBodysite()) {
33350        openArray("bodysite");
33351        for (CodeableConcept e : element.getBodysite()) 
33352          composeCodeableConcept(null, e);
33353        closeArray();
33354      };
33355      if (element.hasFactorOverrideElement()) {
33356        composeDecimalCore("factorOverride", element.getFactorOverrideElement(), false);
33357        composeDecimalExtras("factorOverride", element.getFactorOverrideElement(), false);
33358      }
33359      if (element.hasPriceOverride()) {
33360        composeMoney("priceOverride", element.getPriceOverride());
33361      }
33362      if (element.hasOverrideReasonElement()) {
33363        composeStringCore("overrideReason", element.getOverrideReasonElement(), false);
33364        composeStringExtras("overrideReason", element.getOverrideReasonElement(), false);
33365      }
33366      if (element.hasEnterer()) {
33367        composeReference("enterer", element.getEnterer());
33368      }
33369      if (element.hasEnteredDateElement()) {
33370        composeDateTimeCore("enteredDate", element.getEnteredDateElement(), false);
33371        composeDateTimeExtras("enteredDate", element.getEnteredDateElement(), false);
33372      }
33373      if (element.hasReason()) {
33374        openArray("reason");
33375        for (CodeableConcept e : element.getReason()) 
33376          composeCodeableConcept(null, e);
33377        closeArray();
33378      };
33379      if (element.hasService()) {
33380        openArray("service");
33381        for (Reference e : element.getService()) 
33382          composeReference(null, e);
33383        closeArray();
33384      };
33385      if (element.hasProduct()) {
33386        composeType("product", element.getProduct());
33387      }
33388      if (element.hasAccount()) {
33389        openArray("account");
33390        for (Reference e : element.getAccount()) 
33391          composeReference(null, e);
33392        closeArray();
33393      };
33394      if (element.hasNote()) {
33395        openArray("note");
33396        for (Annotation e : element.getNote()) 
33397          composeAnnotation(null, e);
33398        closeArray();
33399      };
33400      if (element.hasSupportingInformation()) {
33401        openArray("supportingInformation");
33402        for (Reference e : element.getSupportingInformation()) 
33403          composeReference(null, e);
33404        closeArray();
33405      };
33406  }
33407
33408  protected void composeChargeItemChargeItemPerformerComponent(String name, ChargeItem.ChargeItemPerformerComponent element) throws IOException {
33409    if (element != null) {
33410      open(name);
33411      composeChargeItemChargeItemPerformerComponentInner(element);
33412      close();
33413    }
33414  }
33415
33416  protected void composeChargeItemChargeItemPerformerComponentInner(ChargeItem.ChargeItemPerformerComponent element) throws IOException {
33417      composeBackbone(element);
33418      if (element.hasFunction()) {
33419        composeCodeableConcept("function", element.getFunction());
33420      }
33421      if (element.hasActor()) {
33422        composeReference("actor", element.getActor());
33423      }
33424  }
33425
33426  protected void composeChargeItemDefinition(String name, ChargeItemDefinition element) throws IOException {
33427    if (element != null) {
33428      prop("resourceType", name);
33429      composeChargeItemDefinitionInner(element);
33430    }
33431  }
33432
33433  protected void composeChargeItemDefinitionInner(ChargeItemDefinition element) throws IOException {
33434      composeDomainResourceElements(element);
33435      if (element.hasUrlElement()) {
33436        composeUriCore("url", element.getUrlElement(), false);
33437        composeUriExtras("url", element.getUrlElement(), false);
33438      }
33439      if (element.hasIdentifier()) {
33440        openArray("identifier");
33441        for (Identifier e : element.getIdentifier()) 
33442          composeIdentifier(null, e);
33443        closeArray();
33444      };
33445      if (element.hasVersionElement()) {
33446        composeStringCore("version", element.getVersionElement(), false);
33447        composeStringExtras("version", element.getVersionElement(), false);
33448      }
33449      if (element.hasTitleElement()) {
33450        composeStringCore("title", element.getTitleElement(), false);
33451        composeStringExtras("title", element.getTitleElement(), false);
33452      }
33453      if (element.hasDerivedFromUri()) {
33454        openArray("derivedFromUri");
33455        for (UriType e : element.getDerivedFromUri()) 
33456          composeUriCore(null, e, true);
33457        closeArray();
33458        if (anyHasExtras(element.getDerivedFromUri())) {
33459          openArray("_derivedFromUri");
33460          for (UriType e : element.getDerivedFromUri()) 
33461            composeUriExtras(null, e, true);
33462          closeArray();
33463        }
33464      };
33465      if (element.hasPartOf()) {
33466        openArray("partOf");
33467        for (CanonicalType e : element.getPartOf()) 
33468          composeCanonicalCore(null, e, true);
33469        closeArray();
33470        if (anyHasExtras(element.getPartOf())) {
33471          openArray("_partOf");
33472          for (CanonicalType e : element.getPartOf()) 
33473            composeCanonicalExtras(null, e, true);
33474          closeArray();
33475        }
33476      };
33477      if (element.hasReplaces()) {
33478        openArray("replaces");
33479        for (CanonicalType e : element.getReplaces()) 
33480          composeCanonicalCore(null, e, true);
33481        closeArray();
33482        if (anyHasExtras(element.getReplaces())) {
33483          openArray("_replaces");
33484          for (CanonicalType e : element.getReplaces()) 
33485            composeCanonicalExtras(null, e, true);
33486          closeArray();
33487        }
33488      };
33489      if (element.hasStatusElement()) {
33490        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33491        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33492      }
33493      if (element.hasExperimentalElement()) {
33494        composeBooleanCore("experimental", element.getExperimentalElement(), false);
33495        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
33496      }
33497      if (element.hasDateElement()) {
33498        composeDateTimeCore("date", element.getDateElement(), false);
33499        composeDateTimeExtras("date", element.getDateElement(), false);
33500      }
33501      if (element.hasPublisherElement()) {
33502        composeStringCore("publisher", element.getPublisherElement(), false);
33503        composeStringExtras("publisher", element.getPublisherElement(), false);
33504      }
33505      if (element.hasContact()) {
33506        openArray("contact");
33507        for (ContactDetail e : element.getContact()) 
33508          composeContactDetail(null, e);
33509        closeArray();
33510      };
33511      if (element.hasDescriptionElement()) {
33512        composeMarkdownCore("description", element.getDescriptionElement(), false);
33513        composeMarkdownExtras("description", element.getDescriptionElement(), false);
33514      }
33515      if (element.hasUseContext()) {
33516        openArray("useContext");
33517        for (UsageContext e : element.getUseContext()) 
33518          composeUsageContext(null, e);
33519        closeArray();
33520      };
33521      if (element.hasJurisdiction()) {
33522        openArray("jurisdiction");
33523        for (CodeableConcept e : element.getJurisdiction()) 
33524          composeCodeableConcept(null, e);
33525        closeArray();
33526      };
33527      if (element.hasCopyrightElement()) {
33528        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
33529        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
33530      }
33531      if (element.hasApprovalDateElement()) {
33532        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
33533        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
33534      }
33535      if (element.hasLastReviewDateElement()) {
33536        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
33537        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
33538      }
33539      if (element.hasEffectivePeriod()) {
33540        composePeriod("effectivePeriod", element.getEffectivePeriod());
33541      }
33542      if (element.hasCode()) {
33543        composeCodeableConcept("code", element.getCode());
33544      }
33545      if (element.hasInstance()) {
33546        openArray("instance");
33547        for (Reference e : element.getInstance()) 
33548          composeReference(null, e);
33549        closeArray();
33550      };
33551      if (element.hasApplicability()) {
33552        openArray("applicability");
33553        for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability()) 
33554          composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(null, e);
33555        closeArray();
33556      };
33557      if (element.hasPropertyGroup()) {
33558        openArray("propertyGroup");
33559        for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent e : element.getPropertyGroup()) 
33560          composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(null, e);
33561        closeArray();
33562      };
33563  }
33564
33565  protected void composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(String name, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
33566    if (element != null) {
33567      open(name);
33568      composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponentInner(element);
33569      close();
33570    }
33571  }
33572
33573  protected void composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponentInner(ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
33574      composeBackbone(element);
33575      if (element.hasDescriptionElement()) {
33576        composeStringCore("description", element.getDescriptionElement(), false);
33577        composeStringExtras("description", element.getDescriptionElement(), false);
33578      }
33579      if (element.hasLanguageElement()) {
33580        composeStringCore("language", element.getLanguageElement(), false);
33581        composeStringExtras("language", element.getLanguageElement(), false);
33582      }
33583      if (element.hasExpressionElement()) {
33584        composeStringCore("expression", element.getExpressionElement(), false);
33585        composeStringExtras("expression", element.getExpressionElement(), false);
33586      }
33587  }
33588
33589  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(String name, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
33590    if (element != null) {
33591      open(name);
33592      composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentInner(element);
33593      close();
33594    }
33595  }
33596
33597  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentInner(ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
33598      composeBackbone(element);
33599      if (element.hasApplicability()) {
33600        openArray("applicability");
33601        for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability()) 
33602          composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(null, e);
33603        closeArray();
33604      };
33605      if (element.hasPriceComponent()) {
33606        openArray("priceComponent");
33607        for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent e : element.getPriceComponent()) 
33608          composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(null, e);
33609        closeArray();
33610      };
33611  }
33612
33613  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(String name, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent element) throws IOException {
33614    if (element != null) {
33615      open(name);
33616      composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentInner(element);
33617      close();
33618    }
33619  }
33620
33621  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentInner(ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent element) throws IOException {
33622      composeBackbone(element);
33623      if (element.hasTypeElement()) {
33624        composeEnumerationCore("type", element.getTypeElement(), new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory(), false);
33625        composeEnumerationExtras("type", element.getTypeElement(), new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory(), false);
33626      }
33627      if (element.hasCode()) {
33628        composeCodeableConcept("code", element.getCode());
33629      }
33630      if (element.hasFactorElement()) {
33631        composeDecimalCore("factor", element.getFactorElement(), false);
33632        composeDecimalExtras("factor", element.getFactorElement(), false);
33633      }
33634      if (element.hasAmount()) {
33635        composeMoney("amount", element.getAmount());
33636      }
33637  }
33638
33639  protected void composeClaim(String name, Claim element) throws IOException {
33640    if (element != null) {
33641      prop("resourceType", name);
33642      composeClaimInner(element);
33643    }
33644  }
33645
33646  protected void composeClaimInner(Claim element) throws IOException {
33647      composeDomainResourceElements(element);
33648      if (element.hasIdentifier()) {
33649        openArray("identifier");
33650        for (Identifier e : element.getIdentifier()) 
33651          composeIdentifier(null, e);
33652        closeArray();
33653      };
33654      if (element.hasStatusElement()) {
33655        composeEnumerationCore("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
33656        composeEnumerationExtras("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
33657      }
33658      if (element.hasType()) {
33659        composeCodeableConcept("type", element.getType());
33660      }
33661      if (element.hasSubType()) {
33662        composeCodeableConcept("subType", element.getSubType());
33663      }
33664      if (element.hasUseElement()) {
33665        composeEnumerationCore("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
33666        composeEnumerationExtras("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
33667      }
33668      if (element.hasPatient()) {
33669        composeReference("patient", element.getPatient());
33670      }
33671      if (element.hasBillablePeriod()) {
33672        composePeriod("billablePeriod", element.getBillablePeriod());
33673      }
33674      if (element.hasCreatedElement()) {
33675        composeDateTimeCore("created", element.getCreatedElement(), false);
33676        composeDateTimeExtras("created", element.getCreatedElement(), false);
33677      }
33678      if (element.hasEnterer()) {
33679        composeReference("enterer", element.getEnterer());
33680      }
33681      if (element.hasInsurer()) {
33682        composeReference("insurer", element.getInsurer());
33683      }
33684      if (element.hasProvider()) {
33685        composeReference("provider", element.getProvider());
33686      }
33687      if (element.hasPriority()) {
33688        composeCodeableConcept("priority", element.getPriority());
33689      }
33690      if (element.hasFundsReserve()) {
33691        composeCodeableConcept("fundsReserve", element.getFundsReserve());
33692      }
33693      if (element.hasRelated()) {
33694        openArray("related");
33695        for (Claim.RelatedClaimComponent e : element.getRelated()) 
33696          composeClaimRelatedClaimComponent(null, e);
33697        closeArray();
33698      };
33699      if (element.hasPrescription()) {
33700        composeReference("prescription", element.getPrescription());
33701      }
33702      if (element.hasOriginalPrescription()) {
33703        composeReference("originalPrescription", element.getOriginalPrescription());
33704      }
33705      if (element.hasPayee()) {
33706        composeClaimPayeeComponent("payee", element.getPayee());
33707      }
33708      if (element.hasReferral()) {
33709        composeReference("referral", element.getReferral());
33710      }
33711      if (element.hasFacility()) {
33712        composeReference("facility", element.getFacility());
33713      }
33714      if (element.hasCareTeam()) {
33715        openArray("careTeam");
33716        for (Claim.CareTeamComponent e : element.getCareTeam()) 
33717          composeClaimCareTeamComponent(null, e);
33718        closeArray();
33719      };
33720      if (element.hasSupportingInfo()) {
33721        openArray("supportingInfo");
33722        for (Claim.SupportingInformationComponent e : element.getSupportingInfo()) 
33723          composeClaimSupportingInformationComponent(null, e);
33724        closeArray();
33725      };
33726      if (element.hasDiagnosis()) {
33727        openArray("diagnosis");
33728        for (Claim.DiagnosisComponent e : element.getDiagnosis()) 
33729          composeClaimDiagnosisComponent(null, e);
33730        closeArray();
33731      };
33732      if (element.hasProcedure()) {
33733        openArray("procedure");
33734        for (Claim.ProcedureComponent e : element.getProcedure()) 
33735          composeClaimProcedureComponent(null, e);
33736        closeArray();
33737      };
33738      if (element.hasInsurance()) {
33739        openArray("insurance");
33740        for (Claim.InsuranceComponent e : element.getInsurance()) 
33741          composeClaimInsuranceComponent(null, e);
33742        closeArray();
33743      };
33744      if (element.hasAccident()) {
33745        composeClaimAccidentComponent("accident", element.getAccident());
33746      }
33747      if (element.hasItem()) {
33748        openArray("item");
33749        for (Claim.ItemComponent e : element.getItem()) 
33750          composeClaimItemComponent(null, e);
33751        closeArray();
33752      };
33753      if (element.hasTotal()) {
33754        composeMoney("total", element.getTotal());
33755      }
33756  }
33757
33758  protected void composeClaimRelatedClaimComponent(String name, Claim.RelatedClaimComponent element) throws IOException {
33759    if (element != null) {
33760      open(name);
33761      composeClaimRelatedClaimComponentInner(element);
33762      close();
33763    }
33764  }
33765
33766  protected void composeClaimRelatedClaimComponentInner(Claim.RelatedClaimComponent element) throws IOException {
33767      composeBackbone(element);
33768      if (element.hasClaim()) {
33769        composeReference("claim", element.getClaim());
33770      }
33771      if (element.hasRelationship()) {
33772        composeCodeableConcept("relationship", element.getRelationship());
33773      }
33774      if (element.hasReference()) {
33775        composeIdentifier("reference", element.getReference());
33776      }
33777  }
33778
33779  protected void composeClaimPayeeComponent(String name, Claim.PayeeComponent element) throws IOException {
33780    if (element != null) {
33781      open(name);
33782      composeClaimPayeeComponentInner(element);
33783      close();
33784    }
33785  }
33786
33787  protected void composeClaimPayeeComponentInner(Claim.PayeeComponent element) throws IOException {
33788      composeBackbone(element);
33789      if (element.hasType()) {
33790        composeCodeableConcept("type", element.getType());
33791      }
33792      if (element.hasParty()) {
33793        composeReference("party", element.getParty());
33794      }
33795  }
33796
33797  protected void composeClaimCareTeamComponent(String name, Claim.CareTeamComponent element) throws IOException {
33798    if (element != null) {
33799      open(name);
33800      composeClaimCareTeamComponentInner(element);
33801      close();
33802    }
33803  }
33804
33805  protected void composeClaimCareTeamComponentInner(Claim.CareTeamComponent element) throws IOException {
33806      composeBackbone(element);
33807      if (element.hasSequenceElement()) {
33808        composePositiveIntCore("sequence", element.getSequenceElement(), false);
33809        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
33810      }
33811      if (element.hasProvider()) {
33812        composeReference("provider", element.getProvider());
33813      }
33814      if (element.hasResponsibleElement()) {
33815        composeBooleanCore("responsible", element.getResponsibleElement(), false);
33816        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
33817      }
33818      if (element.hasRole()) {
33819        composeCodeableConcept("role", element.getRole());
33820      }
33821      if (element.hasQualification()) {
33822        composeCodeableConcept("qualification", element.getQualification());
33823      }
33824  }
33825
33826  protected void composeClaimSupportingInformationComponent(String name, Claim.SupportingInformationComponent element) throws IOException {
33827    if (element != null) {
33828      open(name);
33829      composeClaimSupportingInformationComponentInner(element);
33830      close();
33831    }
33832  }
33833
33834  protected void composeClaimSupportingInformationComponentInner(Claim.SupportingInformationComponent element) throws IOException {
33835      composeBackbone(element);
33836      if (element.hasSequenceElement()) {
33837        composePositiveIntCore("sequence", element.getSequenceElement(), false);
33838        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
33839      }
33840      if (element.hasCategory()) {
33841        composeCodeableConcept("category", element.getCategory());
33842      }
33843      if (element.hasCode()) {
33844        composeCodeableConcept("code", element.getCode());
33845      }
33846      if (element.hasTiming()) {
33847        composeType("timing", element.getTiming());
33848      }
33849      if (element.hasValue()) {
33850        composeType("value", element.getValue());
33851      }
33852      if (element.hasReason()) {
33853        composeCodeableConcept("reason", element.getReason());
33854      }
33855  }
33856
33857  protected void composeClaimDiagnosisComponent(String name, Claim.DiagnosisComponent element) throws IOException {
33858    if (element != null) {
33859      open(name);
33860      composeClaimDiagnosisComponentInner(element);
33861      close();
33862    }
33863  }
33864
33865  protected void composeClaimDiagnosisComponentInner(Claim.DiagnosisComponent element) throws IOException {
33866      composeBackbone(element);
33867      if (element.hasSequenceElement()) {
33868        composePositiveIntCore("sequence", element.getSequenceElement(), false);
33869        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
33870      }
33871      if (element.hasDiagnosis()) {
33872        composeType("diagnosis", element.getDiagnosis());
33873      }
33874      if (element.hasType()) {
33875        openArray("type");
33876        for (CodeableConcept e : element.getType()) 
33877          composeCodeableConcept(null, e);
33878        closeArray();
33879      };
33880      if (element.hasOnAdmission()) {
33881        composeCodeableConcept("onAdmission", element.getOnAdmission());
33882      }
33883      if (element.hasPackageCode()) {
33884        composeCodeableConcept("packageCode", element.getPackageCode());
33885      }
33886  }
33887
33888  protected void composeClaimProcedureComponent(String name, Claim.ProcedureComponent element) throws IOException {
33889    if (element != null) {
33890      open(name);
33891      composeClaimProcedureComponentInner(element);
33892      close();
33893    }
33894  }
33895
33896  protected void composeClaimProcedureComponentInner(Claim.ProcedureComponent element) throws IOException {
33897      composeBackbone(element);
33898      if (element.hasSequenceElement()) {
33899        composePositiveIntCore("sequence", element.getSequenceElement(), false);
33900        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
33901      }
33902      if (element.hasType()) {
33903        openArray("type");
33904        for (CodeableConcept e : element.getType()) 
33905          composeCodeableConcept(null, e);
33906        closeArray();
33907      };
33908      if (element.hasDateElement()) {
33909        composeDateTimeCore("date", element.getDateElement(), false);
33910        composeDateTimeExtras("date", element.getDateElement(), false);
33911      }
33912      if (element.hasProcedure()) {
33913        composeType("procedure", element.getProcedure());
33914      }
33915      if (element.hasUdi()) {
33916        openArray("udi");
33917        for (Reference e : element.getUdi()) 
33918          composeReference(null, e);
33919        closeArray();
33920      };
33921  }
33922
33923  protected void composeClaimInsuranceComponent(String name, Claim.InsuranceComponent element) throws IOException {
33924    if (element != null) {
33925      open(name);
33926      composeClaimInsuranceComponentInner(element);
33927      close();
33928    }
33929  }
33930
33931  protected void composeClaimInsuranceComponentInner(Claim.InsuranceComponent element) throws IOException {
33932      composeBackbone(element);
33933      if (element.hasSequenceElement()) {
33934        composePositiveIntCore("sequence", element.getSequenceElement(), false);
33935        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
33936      }
33937      if (element.hasFocalElement()) {
33938        composeBooleanCore("focal", element.getFocalElement(), false);
33939        composeBooleanExtras("focal", element.getFocalElement(), false);
33940      }
33941      if (element.hasIdentifier()) {
33942        composeIdentifier("identifier", element.getIdentifier());
33943      }
33944      if (element.hasCoverage()) {
33945        composeReference("coverage", element.getCoverage());
33946      }
33947      if (element.hasBusinessArrangementElement()) {
33948        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
33949        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
33950      }
33951      if (element.hasPreAuthRef()) {
33952        openArray("preAuthRef");
33953        for (StringType e : element.getPreAuthRef()) 
33954          composeStringCore(null, e, true);
33955        closeArray();
33956        if (anyHasExtras(element.getPreAuthRef())) {
33957          openArray("_preAuthRef");
33958          for (StringType e : element.getPreAuthRef()) 
33959            composeStringExtras(null, e, true);
33960          closeArray();
33961        }
33962      };
33963      if (element.hasClaimResponse()) {
33964        composeReference("claimResponse", element.getClaimResponse());
33965      }
33966  }
33967
33968  protected void composeClaimAccidentComponent(String name, Claim.AccidentComponent element) throws IOException {
33969    if (element != null) {
33970      open(name);
33971      composeClaimAccidentComponentInner(element);
33972      close();
33973    }
33974  }
33975
33976  protected void composeClaimAccidentComponentInner(Claim.AccidentComponent element) throws IOException {
33977      composeBackbone(element);
33978      if (element.hasDateElement()) {
33979        composeDateCore("date", element.getDateElement(), false);
33980        composeDateExtras("date", element.getDateElement(), false);
33981      }
33982      if (element.hasType()) {
33983        composeCodeableConcept("type", element.getType());
33984      }
33985      if (element.hasLocation()) {
33986        composeType("location", element.getLocation());
33987      }
33988  }
33989
33990  protected void composeClaimItemComponent(String name, Claim.ItemComponent element) throws IOException {
33991    if (element != null) {
33992      open(name);
33993      composeClaimItemComponentInner(element);
33994      close();
33995    }
33996  }
33997
33998  protected void composeClaimItemComponentInner(Claim.ItemComponent element) throws IOException {
33999      composeBackbone(element);
34000      if (element.hasSequenceElement()) {
34001        composePositiveIntCore("sequence", element.getSequenceElement(), false);
34002        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
34003      }
34004      if (element.hasCareTeamSequence()) {
34005        openArray("careTeamSequence");
34006        for (PositiveIntType e : element.getCareTeamSequence()) 
34007          composePositiveIntCore(null, e, true);
34008        closeArray();
34009        if (anyHasExtras(element.getCareTeamSequence())) {
34010          openArray("_careTeamSequence");
34011          for (PositiveIntType e : element.getCareTeamSequence()) 
34012            composePositiveIntExtras(null, e, true);
34013          closeArray();
34014        }
34015      };
34016      if (element.hasDiagnosisSequence()) {
34017        openArray("diagnosisSequence");
34018        for (PositiveIntType e : element.getDiagnosisSequence()) 
34019          composePositiveIntCore(null, e, true);
34020        closeArray();
34021        if (anyHasExtras(element.getDiagnosisSequence())) {
34022          openArray("_diagnosisSequence");
34023          for (PositiveIntType e : element.getDiagnosisSequence()) 
34024            composePositiveIntExtras(null, e, true);
34025          closeArray();
34026        }
34027      };
34028      if (element.hasProcedureSequence()) {
34029        openArray("procedureSequence");
34030        for (PositiveIntType e : element.getProcedureSequence()) 
34031          composePositiveIntCore(null, e, true);
34032        closeArray();
34033        if (anyHasExtras(element.getProcedureSequence())) {
34034          openArray("_procedureSequence");
34035          for (PositiveIntType e : element.getProcedureSequence()) 
34036            composePositiveIntExtras(null, e, true);
34037          closeArray();
34038        }
34039      };
34040      if (element.hasInformationSequence()) {
34041        openArray("informationSequence");
34042        for (PositiveIntType e : element.getInformationSequence()) 
34043          composePositiveIntCore(null, e, true);
34044        closeArray();
34045        if (anyHasExtras(element.getInformationSequence())) {
34046          openArray("_informationSequence");
34047          for (PositiveIntType e : element.getInformationSequence()) 
34048            composePositiveIntExtras(null, e, true);
34049          closeArray();
34050        }
34051      };
34052      if (element.hasRevenue()) {
34053        composeCodeableConcept("revenue", element.getRevenue());
34054      }
34055      if (element.hasCategory()) {
34056        composeCodeableConcept("category", element.getCategory());
34057      }
34058      if (element.hasProductOrService()) {
34059        composeCodeableConcept("productOrService", element.getProductOrService());
34060      }
34061      if (element.hasModifier()) {
34062        openArray("modifier");
34063        for (CodeableConcept e : element.getModifier()) 
34064          composeCodeableConcept(null, e);
34065        closeArray();
34066      };
34067      if (element.hasProgramCode()) {
34068        openArray("programCode");
34069        for (CodeableConcept e : element.getProgramCode()) 
34070          composeCodeableConcept(null, e);
34071        closeArray();
34072      };
34073      if (element.hasServiced()) {
34074        composeType("serviced", element.getServiced());
34075      }
34076      if (element.hasLocation()) {
34077        composeType("location", element.getLocation());
34078      }
34079      if (element.hasQuantity()) {
34080        composeQuantity("quantity", element.getQuantity());
34081      }
34082      if (element.hasUnitPrice()) {
34083        composeMoney("unitPrice", element.getUnitPrice());
34084      }
34085      if (element.hasFactorElement()) {
34086        composeDecimalCore("factor", element.getFactorElement(), false);
34087        composeDecimalExtras("factor", element.getFactorElement(), false);
34088      }
34089      if (element.hasNet()) {
34090        composeMoney("net", element.getNet());
34091      }
34092      if (element.hasUdi()) {
34093        openArray("udi");
34094        for (Reference e : element.getUdi()) 
34095          composeReference(null, e);
34096        closeArray();
34097      };
34098      if (element.hasBodySite()) {
34099        composeCodeableConcept("bodySite", element.getBodySite());
34100      }
34101      if (element.hasSubSite()) {
34102        openArray("subSite");
34103        for (CodeableConcept e : element.getSubSite()) 
34104          composeCodeableConcept(null, e);
34105        closeArray();
34106      };
34107      if (element.hasEncounter()) {
34108        openArray("encounter");
34109        for (Reference e : element.getEncounter()) 
34110          composeReference(null, e);
34111        closeArray();
34112      };
34113      if (element.hasDetail()) {
34114        openArray("detail");
34115        for (Claim.DetailComponent e : element.getDetail()) 
34116          composeClaimDetailComponent(null, e);
34117        closeArray();
34118      };
34119  }
34120
34121  protected void composeClaimDetailComponent(String name, Claim.DetailComponent element) throws IOException {
34122    if (element != null) {
34123      open(name);
34124      composeClaimDetailComponentInner(element);
34125      close();
34126    }
34127  }
34128
34129  protected void composeClaimDetailComponentInner(Claim.DetailComponent element) throws IOException {
34130      composeBackbone(element);
34131      if (element.hasSequenceElement()) {
34132        composePositiveIntCore("sequence", element.getSequenceElement(), false);
34133        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
34134      }
34135      if (element.hasRevenue()) {
34136        composeCodeableConcept("revenue", element.getRevenue());
34137      }
34138      if (element.hasCategory()) {
34139        composeCodeableConcept("category", element.getCategory());
34140      }
34141      if (element.hasProductOrService()) {
34142        composeCodeableConcept("productOrService", element.getProductOrService());
34143      }
34144      if (element.hasModifier()) {
34145        openArray("modifier");
34146        for (CodeableConcept e : element.getModifier()) 
34147          composeCodeableConcept(null, e);
34148        closeArray();
34149      };
34150      if (element.hasProgramCode()) {
34151        openArray("programCode");
34152        for (CodeableConcept e : element.getProgramCode()) 
34153          composeCodeableConcept(null, e);
34154        closeArray();
34155      };
34156      if (element.hasQuantity()) {
34157        composeQuantity("quantity", element.getQuantity());
34158      }
34159      if (element.hasUnitPrice()) {
34160        composeMoney("unitPrice", element.getUnitPrice());
34161      }
34162      if (element.hasFactorElement()) {
34163        composeDecimalCore("factor", element.getFactorElement(), false);
34164        composeDecimalExtras("factor", element.getFactorElement(), false);
34165      }
34166      if (element.hasNet()) {
34167        composeMoney("net", element.getNet());
34168      }
34169      if (element.hasUdi()) {
34170        openArray("udi");
34171        for (Reference e : element.getUdi()) 
34172          composeReference(null, e);
34173        closeArray();
34174      };
34175      if (element.hasSubDetail()) {
34176        openArray("subDetail");
34177        for (Claim.SubDetailComponent e : element.getSubDetail()) 
34178          composeClaimSubDetailComponent(null, e);
34179        closeArray();
34180      };
34181  }
34182
34183  protected void composeClaimSubDetailComponent(String name, Claim.SubDetailComponent element) throws IOException {
34184    if (element != null) {
34185      open(name);
34186      composeClaimSubDetailComponentInner(element);
34187      close();
34188    }
34189  }
34190
34191  protected void composeClaimSubDetailComponentInner(Claim.SubDetailComponent element) throws IOException {
34192      composeBackbone(element);
34193      if (element.hasSequenceElement()) {
34194        composePositiveIntCore("sequence", element.getSequenceElement(), false);
34195        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
34196      }
34197      if (element.hasRevenue()) {
34198        composeCodeableConcept("revenue", element.getRevenue());
34199      }
34200      if (element.hasCategory()) {
34201        composeCodeableConcept("category", element.getCategory());
34202      }
34203      if (element.hasProductOrService()) {
34204        composeCodeableConcept("productOrService", element.getProductOrService());
34205      }
34206      if (element.hasModifier()) {
34207        openArray("modifier");
34208        for (CodeableConcept e : element.getModifier()) 
34209          composeCodeableConcept(null, e);
34210        closeArray();
34211      };
34212      if (element.hasProgramCode()) {
34213        openArray("programCode");
34214        for (CodeableConcept e : element.getProgramCode()) 
34215          composeCodeableConcept(null, e);
34216        closeArray();
34217      };
34218      if (element.hasQuantity()) {
34219        composeQuantity("quantity", element.getQuantity());
34220      }
34221      if (element.hasUnitPrice()) {
34222        composeMoney("unitPrice", element.getUnitPrice());
34223      }
34224      if (element.hasFactorElement()) {
34225        composeDecimalCore("factor", element.getFactorElement(), false);
34226        composeDecimalExtras("factor", element.getFactorElement(), false);
34227      }
34228      if (element.hasNet()) {
34229        composeMoney("net", element.getNet());
34230      }
34231      if (element.hasUdi()) {
34232        openArray("udi");
34233        for (Reference e : element.getUdi()) 
34234          composeReference(null, e);
34235        closeArray();
34236      };
34237  }
34238
34239  protected void composeClaimResponse(String name, ClaimResponse element) throws IOException {
34240    if (element != null) {
34241      prop("resourceType", name);
34242      composeClaimResponseInner(element);
34243    }
34244  }
34245
34246  protected void composeClaimResponseInner(ClaimResponse element) throws IOException {
34247      composeDomainResourceElements(element);
34248      if (element.hasIdentifier()) {
34249        openArray("identifier");
34250        for (Identifier e : element.getIdentifier()) 
34251          composeIdentifier(null, e);
34252        closeArray();
34253      };
34254      if (element.hasStatusElement()) {
34255        composeEnumerationCore("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(), false);
34256        composeEnumerationExtras("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(), false);
34257      }
34258      if (element.hasType()) {
34259        composeCodeableConcept("type", element.getType());
34260      }
34261      if (element.hasSubType()) {
34262        composeCodeableConcept("subType", element.getSubType());
34263      }
34264      if (element.hasUseElement()) {
34265        composeEnumerationCore("use", element.getUseElement(), new ClaimResponse.UseEnumFactory(), false);
34266        composeEnumerationExtras("use", element.getUseElement(), new ClaimResponse.UseEnumFactory(), false);
34267      }
34268      if (element.hasPatient()) {
34269        composeReference("patient", element.getPatient());
34270      }
34271      if (element.hasCreatedElement()) {
34272        composeDateTimeCore("created", element.getCreatedElement(), false);
34273        composeDateTimeExtras("created", element.getCreatedElement(), false);
34274      }
34275      if (element.hasInsurer()) {
34276        composeReference("insurer", element.getInsurer());
34277      }
34278      if (element.hasRequestor()) {
34279        composeReference("requestor", element.getRequestor());
34280      }
34281      if (element.hasRequest()) {
34282        composeReference("request", element.getRequest());
34283      }
34284      if (element.hasOutcomeElement()) {
34285        composeEnumerationCore("outcome", element.getOutcomeElement(), new ClaimResponse.RemittanceOutcomeEnumFactory(), false);
34286        composeEnumerationExtras("outcome", element.getOutcomeElement(), new ClaimResponse.RemittanceOutcomeEnumFactory(), false);
34287      }
34288      if (element.hasDispositionElement()) {
34289        composeStringCore("disposition", element.getDispositionElement(), false);
34290        composeStringExtras("disposition", element.getDispositionElement(), false);
34291      }
34292      if (element.hasPreAuthRefElement()) {
34293        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
34294        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
34295      }
34296      if (element.hasPreAuthPeriod()) {
34297        composePeriod("preAuthPeriod", element.getPreAuthPeriod());
34298      }
34299      if (element.hasPayeeType()) {
34300        composeCodeableConcept("payeeType", element.getPayeeType());
34301      }
34302      if (element.hasItem()) {
34303        openArray("item");
34304        for (ClaimResponse.ItemComponent e : element.getItem()) 
34305          composeClaimResponseItemComponent(null, e);
34306        closeArray();
34307      };
34308      if (element.hasAddItem()) {
34309        openArray("addItem");
34310        for (ClaimResponse.AddedItemComponent e : element.getAddItem()) 
34311          composeClaimResponseAddedItemComponent(null, e);
34312        closeArray();
34313      };
34314      if (element.hasAdjudication()) {
34315        openArray("adjudication");
34316        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
34317          composeClaimResponseAdjudicationComponent(null, e);
34318        closeArray();
34319      };
34320      if (element.hasTotal()) {
34321        openArray("total");
34322        for (ClaimResponse.TotalComponent e : element.getTotal()) 
34323          composeClaimResponseTotalComponent(null, e);
34324        closeArray();
34325      };
34326      if (element.hasPayment()) {
34327        composeClaimResponsePaymentComponent("payment", element.getPayment());
34328      }
34329      if (element.hasFundsReserve()) {
34330        composeCodeableConcept("fundsReserve", element.getFundsReserve());
34331      }
34332      if (element.hasFormCode()) {
34333        composeCodeableConcept("formCode", element.getFormCode());
34334      }
34335      if (element.hasForm()) {
34336        composeAttachment("form", element.getForm());
34337      }
34338      if (element.hasProcessNote()) {
34339        openArray("processNote");
34340        for (ClaimResponse.NoteComponent e : element.getProcessNote()) 
34341          composeClaimResponseNoteComponent(null, e);
34342        closeArray();
34343      };
34344      if (element.hasCommunicationRequest()) {
34345        openArray("communicationRequest");
34346        for (Reference e : element.getCommunicationRequest()) 
34347          composeReference(null, e);
34348        closeArray();
34349      };
34350      if (element.hasInsurance()) {
34351        openArray("insurance");
34352        for (ClaimResponse.InsuranceComponent e : element.getInsurance()) 
34353          composeClaimResponseInsuranceComponent(null, e);
34354        closeArray();
34355      };
34356      if (element.hasError()) {
34357        openArray("error");
34358        for (ClaimResponse.ErrorComponent e : element.getError()) 
34359          composeClaimResponseErrorComponent(null, e);
34360        closeArray();
34361      };
34362  }
34363
34364  protected void composeClaimResponseItemComponent(String name, ClaimResponse.ItemComponent element) throws IOException {
34365    if (element != null) {
34366      open(name);
34367      composeClaimResponseItemComponentInner(element);
34368      close();
34369    }
34370  }
34371
34372  protected void composeClaimResponseItemComponentInner(ClaimResponse.ItemComponent element) throws IOException {
34373      composeBackbone(element);
34374      if (element.hasItemSequenceElement()) {
34375        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
34376        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
34377      }
34378      if (element.hasNoteNumber()) {
34379        openArray("noteNumber");
34380        for (PositiveIntType e : element.getNoteNumber()) 
34381          composePositiveIntCore(null, e, true);
34382        closeArray();
34383        if (anyHasExtras(element.getNoteNumber())) {
34384          openArray("_noteNumber");
34385          for (PositiveIntType e : element.getNoteNumber()) 
34386            composePositiveIntExtras(null, e, true);
34387          closeArray();
34388        }
34389      };
34390      if (element.hasAdjudication()) {
34391        openArray("adjudication");
34392        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
34393          composeClaimResponseAdjudicationComponent(null, e);
34394        closeArray();
34395      };
34396      if (element.hasDetail()) {
34397        openArray("detail");
34398        for (ClaimResponse.ItemDetailComponent e : element.getDetail()) 
34399          composeClaimResponseItemDetailComponent(null, e);
34400        closeArray();
34401      };
34402  }
34403
34404  protected void composeClaimResponseAdjudicationComponent(String name, ClaimResponse.AdjudicationComponent element) throws IOException {
34405    if (element != null) {
34406      open(name);
34407      composeClaimResponseAdjudicationComponentInner(element);
34408      close();
34409    }
34410  }
34411
34412  protected void composeClaimResponseAdjudicationComponentInner(ClaimResponse.AdjudicationComponent element) throws IOException {
34413      composeBackbone(element);
34414      if (element.hasCategory()) {
34415        composeCodeableConcept("category", element.getCategory());
34416      }
34417      if (element.hasReason()) {
34418        composeCodeableConcept("reason", element.getReason());
34419      }
34420      if (element.hasAmount()) {
34421        composeMoney("amount", element.getAmount());
34422      }
34423      if (element.hasValueElement()) {
34424        composeDecimalCore("value", element.getValueElement(), false);
34425        composeDecimalExtras("value", element.getValueElement(), false);
34426      }
34427  }
34428
34429  protected void composeClaimResponseItemDetailComponent(String name, ClaimResponse.ItemDetailComponent element) throws IOException {
34430    if (element != null) {
34431      open(name);
34432      composeClaimResponseItemDetailComponentInner(element);
34433      close();
34434    }
34435  }
34436
34437  protected void composeClaimResponseItemDetailComponentInner(ClaimResponse.ItemDetailComponent element) throws IOException {
34438      composeBackbone(element);
34439      if (element.hasDetailSequenceElement()) {
34440        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
34441        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
34442      }
34443      if (element.hasNoteNumber()) {
34444        openArray("noteNumber");
34445        for (PositiveIntType e : element.getNoteNumber()) 
34446          composePositiveIntCore(null, e, true);
34447        closeArray();
34448        if (anyHasExtras(element.getNoteNumber())) {
34449          openArray("_noteNumber");
34450          for (PositiveIntType e : element.getNoteNumber()) 
34451            composePositiveIntExtras(null, e, true);
34452          closeArray();
34453        }
34454      };
34455      if (element.hasAdjudication()) {
34456        openArray("adjudication");
34457        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
34458          composeClaimResponseAdjudicationComponent(null, e);
34459        closeArray();
34460      };
34461      if (element.hasSubDetail()) {
34462        openArray("subDetail");
34463        for (ClaimResponse.SubDetailComponent e : element.getSubDetail()) 
34464          composeClaimResponseSubDetailComponent(null, e);
34465        closeArray();
34466      };
34467  }
34468
34469  protected void composeClaimResponseSubDetailComponent(String name, ClaimResponse.SubDetailComponent element) throws IOException {
34470    if (element != null) {
34471      open(name);
34472      composeClaimResponseSubDetailComponentInner(element);
34473      close();
34474    }
34475  }
34476
34477  protected void composeClaimResponseSubDetailComponentInner(ClaimResponse.SubDetailComponent element) throws IOException {
34478      composeBackbone(element);
34479      if (element.hasSubDetailSequenceElement()) {
34480        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
34481        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
34482      }
34483      if (element.hasNoteNumber()) {
34484        openArray("noteNumber");
34485        for (PositiveIntType e : element.getNoteNumber()) 
34486          composePositiveIntCore(null, e, true);
34487        closeArray();
34488        if (anyHasExtras(element.getNoteNumber())) {
34489          openArray("_noteNumber");
34490          for (PositiveIntType e : element.getNoteNumber()) 
34491            composePositiveIntExtras(null, e, true);
34492          closeArray();
34493        }
34494      };
34495      if (element.hasAdjudication()) {
34496        openArray("adjudication");
34497        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
34498          composeClaimResponseAdjudicationComponent(null, e);
34499        closeArray();
34500      };
34501  }
34502
34503  protected void composeClaimResponseAddedItemComponent(String name, ClaimResponse.AddedItemComponent element) throws IOException {
34504    if (element != null) {
34505      open(name);
34506      composeClaimResponseAddedItemComponentInner(element);
34507      close();
34508    }
34509  }
34510
34511  protected void composeClaimResponseAddedItemComponentInner(ClaimResponse.AddedItemComponent element) throws IOException {
34512      composeBackbone(element);
34513      if (element.hasItemSequence()) {
34514        openArray("itemSequence");
34515        for (PositiveIntType e : element.getItemSequence()) 
34516          composePositiveIntCore(null, e, true);
34517        closeArray();
34518        if (anyHasExtras(element.getItemSequence())) {
34519          openArray("_itemSequence");
34520          for (PositiveIntType e : element.getItemSequence()) 
34521            composePositiveIntExtras(null, e, true);
34522          closeArray();
34523        }
34524      };
34525      if (element.hasDetailSequence()) {
34526        openArray("detailSequence");
34527        for (PositiveIntType e : element.getDetailSequence()) 
34528          composePositiveIntCore(null, e, true);
34529        closeArray();
34530        if (anyHasExtras(element.getDetailSequence())) {
34531          openArray("_detailSequence");
34532          for (PositiveIntType e : element.getDetailSequence()) 
34533            composePositiveIntExtras(null, e, true);
34534          closeArray();
34535        }
34536      };
34537      if (element.hasSubdetailSequence()) {
34538        openArray("subdetailSequence");
34539        for (PositiveIntType e : element.getSubdetailSequence()) 
34540          composePositiveIntCore(null, e, true);
34541        closeArray();
34542        if (anyHasExtras(element.getSubdetailSequence())) {
34543          openArray("_subdetailSequence");
34544          for (PositiveIntType e : element.getSubdetailSequence()) 
34545            composePositiveIntExtras(null, e, true);
34546          closeArray();
34547        }
34548      };
34549      if (element.hasProvider()) {
34550        openArray("provider");
34551        for (Reference e : element.getProvider()) 
34552          composeReference(null, e);
34553        closeArray();
34554      };
34555      if (element.hasProductOrService()) {
34556        composeCodeableConcept("productOrService", element.getProductOrService());
34557      }
34558      if (element.hasModifier()) {
34559        openArray("modifier");
34560        for (CodeableConcept e : element.getModifier()) 
34561          composeCodeableConcept(null, e);
34562        closeArray();
34563      };
34564      if (element.hasProgramCode()) {
34565        openArray("programCode");
34566        for (CodeableConcept e : element.getProgramCode()) 
34567          composeCodeableConcept(null, e);
34568        closeArray();
34569      };
34570      if (element.hasServiced()) {
34571        composeType("serviced", element.getServiced());
34572      }
34573      if (element.hasLocation()) {
34574        composeType("location", element.getLocation());
34575      }
34576      if (element.hasQuantity()) {
34577        composeQuantity("quantity", element.getQuantity());
34578      }
34579      if (element.hasUnitPrice()) {
34580        composeMoney("unitPrice", element.getUnitPrice());
34581      }
34582      if (element.hasFactorElement()) {
34583        composeDecimalCore("factor", element.getFactorElement(), false);
34584        composeDecimalExtras("factor", element.getFactorElement(), false);
34585      }
34586      if (element.hasNet()) {
34587        composeMoney("net", element.getNet());
34588      }
34589      if (element.hasBodySite()) {
34590        composeCodeableConcept("bodySite", element.getBodySite());
34591      }
34592      if (element.hasSubSite()) {
34593        openArray("subSite");
34594        for (CodeableConcept e : element.getSubSite()) 
34595          composeCodeableConcept(null, e);
34596        closeArray();
34597      };
34598      if (element.hasNoteNumber()) {
34599        openArray("noteNumber");
34600        for (PositiveIntType e : element.getNoteNumber()) 
34601          composePositiveIntCore(null, e, true);
34602        closeArray();
34603        if (anyHasExtras(element.getNoteNumber())) {
34604          openArray("_noteNumber");
34605          for (PositiveIntType e : element.getNoteNumber()) 
34606            composePositiveIntExtras(null, e, true);
34607          closeArray();
34608        }
34609      };
34610      if (element.hasAdjudication()) {
34611        openArray("adjudication");
34612        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
34613          composeClaimResponseAdjudicationComponent(null, e);
34614        closeArray();
34615      };
34616      if (element.hasDetail()) {
34617        openArray("detail");
34618        for (ClaimResponse.AddedItemDetailComponent e : element.getDetail()) 
34619          composeClaimResponseAddedItemDetailComponent(null, e);
34620        closeArray();
34621      };
34622  }
34623
34624  protected void composeClaimResponseAddedItemDetailComponent(String name, ClaimResponse.AddedItemDetailComponent element) throws IOException {
34625    if (element != null) {
34626      open(name);
34627      composeClaimResponseAddedItemDetailComponentInner(element);
34628      close();
34629    }
34630  }
34631
34632  protected void composeClaimResponseAddedItemDetailComponentInner(ClaimResponse.AddedItemDetailComponent element) throws IOException {
34633      composeBackbone(element);
34634      if (element.hasProductOrService()) {
34635        composeCodeableConcept("productOrService", element.getProductOrService());
34636      }
34637      if (element.hasModifier()) {
34638        openArray("modifier");
34639        for (CodeableConcept e : element.getModifier()) 
34640          composeCodeableConcept(null, e);
34641        closeArray();
34642      };
34643      if (element.hasQuantity()) {
34644        composeQuantity("quantity", element.getQuantity());
34645      }
34646      if (element.hasUnitPrice()) {
34647        composeMoney("unitPrice", element.getUnitPrice());
34648      }
34649      if (element.hasFactorElement()) {
34650        composeDecimalCore("factor", element.getFactorElement(), false);
34651        composeDecimalExtras("factor", element.getFactorElement(), false);
34652      }
34653      if (element.hasNet()) {
34654        composeMoney("net", element.getNet());
34655      }
34656      if (element.hasNoteNumber()) {
34657        openArray("noteNumber");
34658        for (PositiveIntType e : element.getNoteNumber()) 
34659          composePositiveIntCore(null, e, true);
34660        closeArray();
34661        if (anyHasExtras(element.getNoteNumber())) {
34662          openArray("_noteNumber");
34663          for (PositiveIntType e : element.getNoteNumber()) 
34664            composePositiveIntExtras(null, e, true);
34665          closeArray();
34666        }
34667      };
34668      if (element.hasAdjudication()) {
34669        openArray("adjudication");
34670        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
34671          composeClaimResponseAdjudicationComponent(null, e);
34672        closeArray();
34673      };
34674      if (element.hasSubDetail()) {
34675        openArray("subDetail");
34676        for (ClaimResponse.AddedItemSubDetailComponent e : element.getSubDetail()) 
34677          composeClaimResponseAddedItemSubDetailComponent(null, e);
34678        closeArray();
34679      };
34680  }
34681
34682  protected void composeClaimResponseAddedItemSubDetailComponent(String name, ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
34683    if (element != null) {
34684      open(name);
34685      composeClaimResponseAddedItemSubDetailComponentInner(element);
34686      close();
34687    }
34688  }
34689
34690  protected void composeClaimResponseAddedItemSubDetailComponentInner(ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
34691      composeBackbone(element);
34692      if (element.hasProductOrService()) {
34693        composeCodeableConcept("productOrService", element.getProductOrService());
34694      }
34695      if (element.hasModifier()) {
34696        openArray("modifier");
34697        for (CodeableConcept e : element.getModifier()) 
34698          composeCodeableConcept(null, e);
34699        closeArray();
34700      };
34701      if (element.hasQuantity()) {
34702        composeQuantity("quantity", element.getQuantity());
34703      }
34704      if (element.hasUnitPrice()) {
34705        composeMoney("unitPrice", element.getUnitPrice());
34706      }
34707      if (element.hasFactorElement()) {
34708        composeDecimalCore("factor", element.getFactorElement(), false);
34709        composeDecimalExtras("factor", element.getFactorElement(), false);
34710      }
34711      if (element.hasNet()) {
34712        composeMoney("net", element.getNet());
34713      }
34714      if (element.hasNoteNumber()) {
34715        openArray("noteNumber");
34716        for (PositiveIntType e : element.getNoteNumber()) 
34717          composePositiveIntCore(null, e, true);
34718        closeArray();
34719        if (anyHasExtras(element.getNoteNumber())) {
34720          openArray("_noteNumber");
34721          for (PositiveIntType e : element.getNoteNumber()) 
34722            composePositiveIntExtras(null, e, true);
34723          closeArray();
34724        }
34725      };
34726      if (element.hasAdjudication()) {
34727        openArray("adjudication");
34728        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
34729          composeClaimResponseAdjudicationComponent(null, e);
34730        closeArray();
34731      };
34732  }
34733
34734  protected void composeClaimResponseTotalComponent(String name, ClaimResponse.TotalComponent element) throws IOException {
34735    if (element != null) {
34736      open(name);
34737      composeClaimResponseTotalComponentInner(element);
34738      close();
34739    }
34740  }
34741
34742  protected void composeClaimResponseTotalComponentInner(ClaimResponse.TotalComponent element) throws IOException {
34743      composeBackbone(element);
34744      if (element.hasCategory()) {
34745        composeCodeableConcept("category", element.getCategory());
34746      }
34747      if (element.hasAmount()) {
34748        composeMoney("amount", element.getAmount());
34749      }
34750  }
34751
34752  protected void composeClaimResponsePaymentComponent(String name, ClaimResponse.PaymentComponent element) throws IOException {
34753    if (element != null) {
34754      open(name);
34755      composeClaimResponsePaymentComponentInner(element);
34756      close();
34757    }
34758  }
34759
34760  protected void composeClaimResponsePaymentComponentInner(ClaimResponse.PaymentComponent element) throws IOException {
34761      composeBackbone(element);
34762      if (element.hasType()) {
34763        composeCodeableConcept("type", element.getType());
34764      }
34765      if (element.hasAdjustment()) {
34766        composeMoney("adjustment", element.getAdjustment());
34767      }
34768      if (element.hasAdjustmentReason()) {
34769        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
34770      }
34771      if (element.hasDateElement()) {
34772        composeDateCore("date", element.getDateElement(), false);
34773        composeDateExtras("date", element.getDateElement(), false);
34774      }
34775      if (element.hasAmount()) {
34776        composeMoney("amount", element.getAmount());
34777      }
34778      if (element.hasIdentifier()) {
34779        composeIdentifier("identifier", element.getIdentifier());
34780      }
34781  }
34782
34783  protected void composeClaimResponseNoteComponent(String name, ClaimResponse.NoteComponent element) throws IOException {
34784    if (element != null) {
34785      open(name);
34786      composeClaimResponseNoteComponentInner(element);
34787      close();
34788    }
34789  }
34790
34791  protected void composeClaimResponseNoteComponentInner(ClaimResponse.NoteComponent element) throws IOException {
34792      composeBackbone(element);
34793      if (element.hasNumberElement()) {
34794        composePositiveIntCore("number", element.getNumberElement(), false);
34795        composePositiveIntExtras("number", element.getNumberElement(), false);
34796      }
34797      if (element.hasTypeElement()) {
34798        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
34799        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
34800      }
34801      if (element.hasTextElement()) {
34802        composeStringCore("text", element.getTextElement(), false);
34803        composeStringExtras("text", element.getTextElement(), false);
34804      }
34805      if (element.hasLanguage()) {
34806        composeCodeableConcept("language", element.getLanguage());
34807      }
34808  }
34809
34810  protected void composeClaimResponseInsuranceComponent(String name, ClaimResponse.InsuranceComponent element) throws IOException {
34811    if (element != null) {
34812      open(name);
34813      composeClaimResponseInsuranceComponentInner(element);
34814      close();
34815    }
34816  }
34817
34818  protected void composeClaimResponseInsuranceComponentInner(ClaimResponse.InsuranceComponent element) throws IOException {
34819      composeBackbone(element);
34820      if (element.hasSequenceElement()) {
34821        composePositiveIntCore("sequence", element.getSequenceElement(), false);
34822        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
34823      }
34824      if (element.hasFocalElement()) {
34825        composeBooleanCore("focal", element.getFocalElement(), false);
34826        composeBooleanExtras("focal", element.getFocalElement(), false);
34827      }
34828      if (element.hasCoverage()) {
34829        composeReference("coverage", element.getCoverage());
34830      }
34831      if (element.hasBusinessArrangementElement()) {
34832        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
34833        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
34834      }
34835      if (element.hasClaimResponse()) {
34836        composeReference("claimResponse", element.getClaimResponse());
34837      }
34838  }
34839
34840  protected void composeClaimResponseErrorComponent(String name, ClaimResponse.ErrorComponent element) throws IOException {
34841    if (element != null) {
34842      open(name);
34843      composeClaimResponseErrorComponentInner(element);
34844      close();
34845    }
34846  }
34847
34848  protected void composeClaimResponseErrorComponentInner(ClaimResponse.ErrorComponent element) throws IOException {
34849      composeBackbone(element);
34850      if (element.hasItemSequenceElement()) {
34851        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
34852        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
34853      }
34854      if (element.hasDetailSequenceElement()) {
34855        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
34856        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
34857      }
34858      if (element.hasSubDetailSequenceElement()) {
34859        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
34860        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
34861      }
34862      if (element.hasCode()) {
34863        composeCodeableConcept("code", element.getCode());
34864      }
34865  }
34866
34867  protected void composeClinicalImpression(String name, ClinicalImpression element) throws IOException {
34868    if (element != null) {
34869      prop("resourceType", name);
34870      composeClinicalImpressionInner(element);
34871    }
34872  }
34873
34874  protected void composeClinicalImpressionInner(ClinicalImpression element) throws IOException {
34875      composeDomainResourceElements(element);
34876      if (element.hasIdentifier()) {
34877        openArray("identifier");
34878        for (Identifier e : element.getIdentifier()) 
34879          composeIdentifier(null, e);
34880        closeArray();
34881      };
34882      if (element.hasStatusElement()) {
34883        composeEnumerationCore("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
34884        composeEnumerationExtras("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
34885      }
34886      if (element.hasStatusReason()) {
34887        composeCodeableConcept("statusReason", element.getStatusReason());
34888      }
34889      if (element.hasCode()) {
34890        composeCodeableConcept("code", element.getCode());
34891      }
34892      if (element.hasDescriptionElement()) {
34893        composeStringCore("description", element.getDescriptionElement(), false);
34894        composeStringExtras("description", element.getDescriptionElement(), false);
34895      }
34896      if (element.hasSubject()) {
34897        composeReference("subject", element.getSubject());
34898      }
34899      if (element.hasEncounter()) {
34900        composeReference("encounter", element.getEncounter());
34901      }
34902      if (element.hasEffective()) {
34903        composeType("effective", element.getEffective());
34904      }
34905      if (element.hasDateElement()) {
34906        composeDateTimeCore("date", element.getDateElement(), false);
34907        composeDateTimeExtras("date", element.getDateElement(), false);
34908      }
34909      if (element.hasAssessor()) {
34910        composeReference("assessor", element.getAssessor());
34911      }
34912      if (element.hasPrevious()) {
34913        composeReference("previous", element.getPrevious());
34914      }
34915      if (element.hasProblem()) {
34916        openArray("problem");
34917        for (Reference e : element.getProblem()) 
34918          composeReference(null, e);
34919        closeArray();
34920      };
34921      if (element.hasInvestigation()) {
34922        openArray("investigation");
34923        for (ClinicalImpression.ClinicalImpressionInvestigationComponent e : element.getInvestigation()) 
34924          composeClinicalImpressionClinicalImpressionInvestigationComponent(null, e);
34925        closeArray();
34926      };
34927      if (element.hasProtocol()) {
34928        openArray("protocol");
34929        for (UriType e : element.getProtocol()) 
34930          composeUriCore(null, e, true);
34931        closeArray();
34932        if (anyHasExtras(element.getProtocol())) {
34933          openArray("_protocol");
34934          for (UriType e : element.getProtocol()) 
34935            composeUriExtras(null, e, true);
34936          closeArray();
34937        }
34938      };
34939      if (element.hasSummaryElement()) {
34940        composeStringCore("summary", element.getSummaryElement(), false);
34941        composeStringExtras("summary", element.getSummaryElement(), false);
34942      }
34943      if (element.hasFinding()) {
34944        openArray("finding");
34945        for (ClinicalImpression.ClinicalImpressionFindingComponent e : element.getFinding()) 
34946          composeClinicalImpressionClinicalImpressionFindingComponent(null, e);
34947        closeArray();
34948      };
34949      if (element.hasPrognosisCodeableConcept()) {
34950        openArray("prognosisCodeableConcept");
34951        for (CodeableConcept e : element.getPrognosisCodeableConcept()) 
34952          composeCodeableConcept(null, e);
34953        closeArray();
34954      };
34955      if (element.hasPrognosisReference()) {
34956        openArray("prognosisReference");
34957        for (Reference e : element.getPrognosisReference()) 
34958          composeReference(null, e);
34959        closeArray();
34960      };
34961      if (element.hasSupportingInfo()) {
34962        openArray("supportingInfo");
34963        for (Reference e : element.getSupportingInfo()) 
34964          composeReference(null, e);
34965        closeArray();
34966      };
34967      if (element.hasNote()) {
34968        openArray("note");
34969        for (Annotation e : element.getNote()) 
34970          composeAnnotation(null, e);
34971        closeArray();
34972      };
34973  }
34974
34975  protected void composeClinicalImpressionClinicalImpressionInvestigationComponent(String name, ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
34976    if (element != null) {
34977      open(name);
34978      composeClinicalImpressionClinicalImpressionInvestigationComponentInner(element);
34979      close();
34980    }
34981  }
34982
34983  protected void composeClinicalImpressionClinicalImpressionInvestigationComponentInner(ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
34984      composeBackbone(element);
34985      if (element.hasCode()) {
34986        composeCodeableConcept("code", element.getCode());
34987      }
34988      if (element.hasItem()) {
34989        openArray("item");
34990        for (Reference e : element.getItem()) 
34991          composeReference(null, e);
34992        closeArray();
34993      };
34994  }
34995
34996  protected void composeClinicalImpressionClinicalImpressionFindingComponent(String name, ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
34997    if (element != null) {
34998      open(name);
34999      composeClinicalImpressionClinicalImpressionFindingComponentInner(element);
35000      close();
35001    }
35002  }
35003
35004  protected void composeClinicalImpressionClinicalImpressionFindingComponentInner(ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
35005      composeBackbone(element);
35006      if (element.hasItemCodeableConcept()) {
35007        composeCodeableConcept("itemCodeableConcept", element.getItemCodeableConcept());
35008      }
35009      if (element.hasItemReference()) {
35010        composeReference("itemReference", element.getItemReference());
35011      }
35012      if (element.hasBasisElement()) {
35013        composeStringCore("basis", element.getBasisElement(), false);
35014        composeStringExtras("basis", element.getBasisElement(), false);
35015      }
35016  }
35017
35018  protected void composeCodeSystem(String name, CodeSystem element) throws IOException {
35019    if (element != null) {
35020      prop("resourceType", name);
35021      composeCodeSystemInner(element);
35022    }
35023  }
35024
35025  protected void composeCodeSystemInner(CodeSystem element) throws IOException {
35026      composeDomainResourceElements(element);
35027      if (element.hasUrlElement()) {
35028        composeUriCore("url", element.getUrlElement(), false);
35029        composeUriExtras("url", element.getUrlElement(), false);
35030      }
35031      if (element.hasIdentifier()) {
35032        openArray("identifier");
35033        for (Identifier e : element.getIdentifier()) 
35034          composeIdentifier(null, e);
35035        closeArray();
35036      };
35037      if (element.hasVersionElement()) {
35038        composeStringCore("version", element.getVersionElement(), false);
35039        composeStringExtras("version", element.getVersionElement(), false);
35040      }
35041      if (element.hasNameElement()) {
35042        composeStringCore("name", element.getNameElement(), false);
35043        composeStringExtras("name", element.getNameElement(), false);
35044      }
35045      if (element.hasTitleElement()) {
35046        composeStringCore("title", element.getTitleElement(), false);
35047        composeStringExtras("title", element.getTitleElement(), false);
35048      }
35049      if (element.hasStatusElement()) {
35050        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35051        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35052      }
35053      if (element.hasExperimentalElement()) {
35054        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35055        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35056      }
35057      if (element.hasDateElement()) {
35058        composeDateTimeCore("date", element.getDateElement(), false);
35059        composeDateTimeExtras("date", element.getDateElement(), false);
35060      }
35061      if (element.hasPublisherElement()) {
35062        composeStringCore("publisher", element.getPublisherElement(), false);
35063        composeStringExtras("publisher", element.getPublisherElement(), false);
35064      }
35065      if (element.hasContact()) {
35066        openArray("contact");
35067        for (ContactDetail e : element.getContact()) 
35068          composeContactDetail(null, e);
35069        closeArray();
35070      };
35071      if (element.hasDescriptionElement()) {
35072        composeMarkdownCore("description", element.getDescriptionElement(), false);
35073        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35074      }
35075      if (element.hasUseContext()) {
35076        openArray("useContext");
35077        for (UsageContext e : element.getUseContext()) 
35078          composeUsageContext(null, e);
35079        closeArray();
35080      };
35081      if (element.hasJurisdiction()) {
35082        openArray("jurisdiction");
35083        for (CodeableConcept e : element.getJurisdiction()) 
35084          composeCodeableConcept(null, e);
35085        closeArray();
35086      };
35087      if (element.hasPurposeElement()) {
35088        composeMarkdownCore("purpose", element.getPurposeElement(), false);
35089        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
35090      }
35091      if (element.hasCopyrightElement()) {
35092        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
35093        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
35094      }
35095      if (element.hasCaseSensitiveElement()) {
35096        composeBooleanCore("caseSensitive", element.getCaseSensitiveElement(), false);
35097        composeBooleanExtras("caseSensitive", element.getCaseSensitiveElement(), false);
35098      }
35099      if (element.hasValueSetElement()) {
35100        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
35101        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
35102      }
35103      if (element.hasHierarchyMeaningElement()) {
35104        composeEnumerationCore("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
35105        composeEnumerationExtras("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
35106      }
35107      if (element.hasCompositionalElement()) {
35108        composeBooleanCore("compositional", element.getCompositionalElement(), false);
35109        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
35110      }
35111      if (element.hasVersionNeededElement()) {
35112        composeBooleanCore("versionNeeded", element.getVersionNeededElement(), false);
35113        composeBooleanExtras("versionNeeded", element.getVersionNeededElement(), false);
35114      }
35115      if (element.hasContentElement()) {
35116        composeEnumerationCore("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
35117        composeEnumerationExtras("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
35118      }
35119      if (element.hasSupplementsElement()) {
35120        composeCanonicalCore("supplements", element.getSupplementsElement(), false);
35121        composeCanonicalExtras("supplements", element.getSupplementsElement(), false);
35122      }
35123      if (element.hasCountElement()) {
35124        composeUnsignedIntCore("count", element.getCountElement(), false);
35125        composeUnsignedIntExtras("count", element.getCountElement(), false);
35126      }
35127      if (element.hasFilter()) {
35128        openArray("filter");
35129        for (CodeSystem.CodeSystemFilterComponent e : element.getFilter()) 
35130          composeCodeSystemCodeSystemFilterComponent(null, e);
35131        closeArray();
35132      };
35133      if (element.hasProperty()) {
35134        openArray("property");
35135        for (CodeSystem.PropertyComponent e : element.getProperty()) 
35136          composeCodeSystemPropertyComponent(null, e);
35137        closeArray();
35138      };
35139      if (element.hasConcept()) {
35140        openArray("concept");
35141        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
35142          composeCodeSystemConceptDefinitionComponent(null, e);
35143        closeArray();
35144      };
35145  }
35146
35147  protected void composeCodeSystemCodeSystemFilterComponent(String name, CodeSystem.CodeSystemFilterComponent element) throws IOException {
35148    if (element != null) {
35149      open(name);
35150      composeCodeSystemCodeSystemFilterComponentInner(element);
35151      close();
35152    }
35153  }
35154
35155  protected void composeCodeSystemCodeSystemFilterComponentInner(CodeSystem.CodeSystemFilterComponent element) throws IOException {
35156      composeBackbone(element);
35157      if (element.hasCodeElement()) {
35158        composeCodeCore("code", element.getCodeElement(), false);
35159        composeCodeExtras("code", element.getCodeElement(), false);
35160      }
35161      if (element.hasDescriptionElement()) {
35162        composeStringCore("description", element.getDescriptionElement(), false);
35163        composeStringExtras("description", element.getDescriptionElement(), false);
35164      }
35165      if (element.hasOperator()) {
35166        openArray("operator");
35167        for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator()) 
35168          composeEnumerationCore(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
35169        closeArray();
35170        if (anyHasExtras(element.getOperator())) {
35171          openArray("_operator");
35172          for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator()) 
35173            composeEnumerationExtras(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
35174          closeArray();
35175        }
35176      };
35177      if (element.hasValueElement()) {
35178        composeStringCore("value", element.getValueElement(), false);
35179        composeStringExtras("value", element.getValueElement(), false);
35180      }
35181  }
35182
35183  protected void composeCodeSystemPropertyComponent(String name, CodeSystem.PropertyComponent element) throws IOException {
35184    if (element != null) {
35185      open(name);
35186      composeCodeSystemPropertyComponentInner(element);
35187      close();
35188    }
35189  }
35190
35191  protected void composeCodeSystemPropertyComponentInner(CodeSystem.PropertyComponent element) throws IOException {
35192      composeBackbone(element);
35193      if (element.hasCodeElement()) {
35194        composeCodeCore("code", element.getCodeElement(), false);
35195        composeCodeExtras("code", element.getCodeElement(), false);
35196      }
35197      if (element.hasUriElement()) {
35198        composeUriCore("uri", element.getUriElement(), false);
35199        composeUriExtras("uri", element.getUriElement(), false);
35200      }
35201      if (element.hasDescriptionElement()) {
35202        composeStringCore("description", element.getDescriptionElement(), false);
35203        composeStringExtras("description", element.getDescriptionElement(), false);
35204      }
35205      if (element.hasTypeElement()) {
35206        composeEnumerationCore("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
35207        composeEnumerationExtras("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
35208      }
35209  }
35210
35211  protected void composeCodeSystemConceptDefinitionComponent(String name, CodeSystem.ConceptDefinitionComponent element) throws IOException {
35212    if (element != null) {
35213      open(name);
35214      composeCodeSystemConceptDefinitionComponentInner(element);
35215      close();
35216    }
35217  }
35218
35219  protected void composeCodeSystemConceptDefinitionComponentInner(CodeSystem.ConceptDefinitionComponent element) throws IOException {
35220      composeBackbone(element);
35221      if (element.hasCodeElement()) {
35222        composeCodeCore("code", element.getCodeElement(), false);
35223        composeCodeExtras("code", element.getCodeElement(), false);
35224      }
35225      if (element.hasDisplayElement()) {
35226        composeStringCore("display", element.getDisplayElement(), false);
35227        composeStringExtras("display", element.getDisplayElement(), false);
35228      }
35229      if (element.hasDefinitionElement()) {
35230        composeStringCore("definition", element.getDefinitionElement(), false);
35231        composeStringExtras("definition", element.getDefinitionElement(), false);
35232      }
35233      if (element.hasDesignation()) {
35234        openArray("designation");
35235        for (CodeSystem.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
35236          composeCodeSystemConceptDefinitionDesignationComponent(null, e);
35237        closeArray();
35238      };
35239      if (element.hasProperty()) {
35240        openArray("property");
35241        for (CodeSystem.ConceptPropertyComponent e : element.getProperty()) 
35242          composeCodeSystemConceptPropertyComponent(null, e);
35243        closeArray();
35244      };
35245      if (element.hasConcept()) {
35246        openArray("concept");
35247        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
35248          composeCodeSystemConceptDefinitionComponent(null, e);
35249        closeArray();
35250      };
35251  }
35252
35253  protected void composeCodeSystemConceptDefinitionDesignationComponent(String name, CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
35254    if (element != null) {
35255      open(name);
35256      composeCodeSystemConceptDefinitionDesignationComponentInner(element);
35257      close();
35258    }
35259  }
35260
35261  protected void composeCodeSystemConceptDefinitionDesignationComponentInner(CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
35262      composeBackbone(element);
35263      if (element.hasLanguageElement()) {
35264        composeCodeCore("language", element.getLanguageElement(), false);
35265        composeCodeExtras("language", element.getLanguageElement(), false);
35266      }
35267      if (element.hasUse()) {
35268        composeCoding("use", element.getUse());
35269      }
35270      if (element.hasValueElement()) {
35271        composeStringCore("value", element.getValueElement(), false);
35272        composeStringExtras("value", element.getValueElement(), false);
35273      }
35274  }
35275
35276  protected void composeCodeSystemConceptPropertyComponent(String name, CodeSystem.ConceptPropertyComponent element) throws IOException {
35277    if (element != null) {
35278      open(name);
35279      composeCodeSystemConceptPropertyComponentInner(element);
35280      close();
35281    }
35282  }
35283
35284  protected void composeCodeSystemConceptPropertyComponentInner(CodeSystem.ConceptPropertyComponent element) throws IOException {
35285      composeBackbone(element);
35286      if (element.hasCodeElement()) {
35287        composeCodeCore("code", element.getCodeElement(), false);
35288        composeCodeExtras("code", element.getCodeElement(), false);
35289      }
35290      if (element.hasValue()) {
35291        composeType("value", element.getValue());
35292      }
35293  }
35294
35295  protected void composeCommunication(String name, Communication element) throws IOException {
35296    if (element != null) {
35297      prop("resourceType", name);
35298      composeCommunicationInner(element);
35299    }
35300  }
35301
35302  protected void composeCommunicationInner(Communication element) throws IOException {
35303      composeDomainResourceElements(element);
35304      if (element.hasIdentifier()) {
35305        openArray("identifier");
35306        for (Identifier e : element.getIdentifier()) 
35307          composeIdentifier(null, e);
35308        closeArray();
35309      };
35310      if (element.hasInstantiatesCanonical()) {
35311        openArray("instantiatesCanonical");
35312        for (CanonicalType e : element.getInstantiatesCanonical()) 
35313          composeCanonicalCore(null, e, true);
35314        closeArray();
35315        if (anyHasExtras(element.getInstantiatesCanonical())) {
35316          openArray("_instantiatesCanonical");
35317          for (CanonicalType e : element.getInstantiatesCanonical()) 
35318            composeCanonicalExtras(null, e, true);
35319          closeArray();
35320        }
35321      };
35322      if (element.hasInstantiatesUri()) {
35323        openArray("instantiatesUri");
35324        for (UriType e : element.getInstantiatesUri()) 
35325          composeUriCore(null, e, true);
35326        closeArray();
35327        if (anyHasExtras(element.getInstantiatesUri())) {
35328          openArray("_instantiatesUri");
35329          for (UriType e : element.getInstantiatesUri()) 
35330            composeUriExtras(null, e, true);
35331          closeArray();
35332        }
35333      };
35334      if (element.hasBasedOn()) {
35335        openArray("basedOn");
35336        for (Reference e : element.getBasedOn()) 
35337          composeReference(null, e);
35338        closeArray();
35339      };
35340      if (element.hasPartOf()) {
35341        openArray("partOf");
35342        for (Reference e : element.getPartOf()) 
35343          composeReference(null, e);
35344        closeArray();
35345      };
35346      if (element.hasInResponseTo()) {
35347        openArray("inResponseTo");
35348        for (Reference e : element.getInResponseTo()) 
35349          composeReference(null, e);
35350        closeArray();
35351      };
35352      if (element.hasStatusElement()) {
35353        composeEnumerationCore("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
35354        composeEnumerationExtras("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
35355      }
35356      if (element.hasStatusReason()) {
35357        composeCodeableConcept("statusReason", element.getStatusReason());
35358      }
35359      if (element.hasCategory()) {
35360        openArray("category");
35361        for (CodeableConcept e : element.getCategory()) 
35362          composeCodeableConcept(null, e);
35363        closeArray();
35364      };
35365      if (element.hasPriorityElement()) {
35366        composeEnumerationCore("priority", element.getPriorityElement(), new Communication.CommunicationPriorityEnumFactory(), false);
35367        composeEnumerationExtras("priority", element.getPriorityElement(), new Communication.CommunicationPriorityEnumFactory(), false);
35368      }
35369      if (element.hasMedium()) {
35370        openArray("medium");
35371        for (CodeableConcept e : element.getMedium()) 
35372          composeCodeableConcept(null, e);
35373        closeArray();
35374      };
35375      if (element.hasSubject()) {
35376        composeReference("subject", element.getSubject());
35377      }
35378      if (element.hasTopic()) {
35379        composeCodeableConcept("topic", element.getTopic());
35380      }
35381      if (element.hasAbout()) {
35382        openArray("about");
35383        for (Reference e : element.getAbout()) 
35384          composeReference(null, e);
35385        closeArray();
35386      };
35387      if (element.hasEncounter()) {
35388        composeReference("encounter", element.getEncounter());
35389      }
35390      if (element.hasSentElement()) {
35391        composeDateTimeCore("sent", element.getSentElement(), false);
35392        composeDateTimeExtras("sent", element.getSentElement(), false);
35393      }
35394      if (element.hasReceivedElement()) {
35395        composeDateTimeCore("received", element.getReceivedElement(), false);
35396        composeDateTimeExtras("received", element.getReceivedElement(), false);
35397      }
35398      if (element.hasRecipient()) {
35399        openArray("recipient");
35400        for (Reference e : element.getRecipient()) 
35401          composeReference(null, e);
35402        closeArray();
35403      };
35404      if (element.hasSender()) {
35405        composeReference("sender", element.getSender());
35406      }
35407      if (element.hasReasonCode()) {
35408        openArray("reasonCode");
35409        for (CodeableConcept e : element.getReasonCode()) 
35410          composeCodeableConcept(null, e);
35411        closeArray();
35412      };
35413      if (element.hasReasonReference()) {
35414        openArray("reasonReference");
35415        for (Reference e : element.getReasonReference()) 
35416          composeReference(null, e);
35417        closeArray();
35418      };
35419      if (element.hasPayload()) {
35420        openArray("payload");
35421        for (Communication.CommunicationPayloadComponent e : element.getPayload()) 
35422          composeCommunicationCommunicationPayloadComponent(null, e);
35423        closeArray();
35424      };
35425      if (element.hasNote()) {
35426        openArray("note");
35427        for (Annotation e : element.getNote()) 
35428          composeAnnotation(null, e);
35429        closeArray();
35430      };
35431  }
35432
35433  protected void composeCommunicationCommunicationPayloadComponent(String name, Communication.CommunicationPayloadComponent element) throws IOException {
35434    if (element != null) {
35435      open(name);
35436      composeCommunicationCommunicationPayloadComponentInner(element);
35437      close();
35438    }
35439  }
35440
35441  protected void composeCommunicationCommunicationPayloadComponentInner(Communication.CommunicationPayloadComponent element) throws IOException {
35442      composeBackbone(element);
35443      if (element.hasContent()) {
35444        composeType("content", element.getContent());
35445      }
35446  }
35447
35448  protected void composeCommunicationRequest(String name, CommunicationRequest element) throws IOException {
35449    if (element != null) {
35450      prop("resourceType", name);
35451      composeCommunicationRequestInner(element);
35452    }
35453  }
35454
35455  protected void composeCommunicationRequestInner(CommunicationRequest element) throws IOException {
35456      composeDomainResourceElements(element);
35457      if (element.hasIdentifier()) {
35458        openArray("identifier");
35459        for (Identifier e : element.getIdentifier()) 
35460          composeIdentifier(null, e);
35461        closeArray();
35462      };
35463      if (element.hasBasedOn()) {
35464        openArray("basedOn");
35465        for (Reference e : element.getBasedOn()) 
35466          composeReference(null, e);
35467        closeArray();
35468      };
35469      if (element.hasReplaces()) {
35470        openArray("replaces");
35471        for (Reference e : element.getReplaces()) 
35472          composeReference(null, e);
35473        closeArray();
35474      };
35475      if (element.hasGroupIdentifier()) {
35476        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
35477      }
35478      if (element.hasStatusElement()) {
35479        composeEnumerationCore("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
35480        composeEnumerationExtras("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
35481      }
35482      if (element.hasStatusReason()) {
35483        composeCodeableConcept("statusReason", element.getStatusReason());
35484      }
35485      if (element.hasCategory()) {
35486        openArray("category");
35487        for (CodeableConcept e : element.getCategory()) 
35488          composeCodeableConcept(null, e);
35489        closeArray();
35490      };
35491      if (element.hasPriorityElement()) {
35492        composeEnumerationCore("priority", element.getPriorityElement(), new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
35493        composeEnumerationExtras("priority", element.getPriorityElement(), new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
35494      }
35495      if (element.hasDoNotPerformElement()) {
35496        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
35497        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
35498      }
35499      if (element.hasMedium()) {
35500        openArray("medium");
35501        for (CodeableConcept e : element.getMedium()) 
35502          composeCodeableConcept(null, e);
35503        closeArray();
35504      };
35505      if (element.hasSubject()) {
35506        composeReference("subject", element.getSubject());
35507      }
35508      if (element.hasAbout()) {
35509        openArray("about");
35510        for (Reference e : element.getAbout()) 
35511          composeReference(null, e);
35512        closeArray();
35513      };
35514      if (element.hasEncounter()) {
35515        composeReference("encounter", element.getEncounter());
35516      }
35517      if (element.hasPayload()) {
35518        openArray("payload");
35519        for (CommunicationRequest.CommunicationRequestPayloadComponent e : element.getPayload()) 
35520          composeCommunicationRequestCommunicationRequestPayloadComponent(null, e);
35521        closeArray();
35522      };
35523      if (element.hasOccurrence()) {
35524        composeType("occurrence", element.getOccurrence());
35525      }
35526      if (element.hasAuthoredOnElement()) {
35527        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
35528        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
35529      }
35530      if (element.hasRequester()) {
35531        composeReference("requester", element.getRequester());
35532      }
35533      if (element.hasRecipient()) {
35534        openArray("recipient");
35535        for (Reference e : element.getRecipient()) 
35536          composeReference(null, e);
35537        closeArray();
35538      };
35539      if (element.hasSender()) {
35540        composeReference("sender", element.getSender());
35541      }
35542      if (element.hasReasonCode()) {
35543        openArray("reasonCode");
35544        for (CodeableConcept e : element.getReasonCode()) 
35545          composeCodeableConcept(null, e);
35546        closeArray();
35547      };
35548      if (element.hasReasonReference()) {
35549        openArray("reasonReference");
35550        for (Reference e : element.getReasonReference()) 
35551          composeReference(null, e);
35552        closeArray();
35553      };
35554      if (element.hasNote()) {
35555        openArray("note");
35556        for (Annotation e : element.getNote()) 
35557          composeAnnotation(null, e);
35558        closeArray();
35559      };
35560  }
35561
35562  protected void composeCommunicationRequestCommunicationRequestPayloadComponent(String name, CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
35563    if (element != null) {
35564      open(name);
35565      composeCommunicationRequestCommunicationRequestPayloadComponentInner(element);
35566      close();
35567    }
35568  }
35569
35570  protected void composeCommunicationRequestCommunicationRequestPayloadComponentInner(CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
35571      composeBackbone(element);
35572      if (element.hasContent()) {
35573        composeType("content", element.getContent());
35574      }
35575  }
35576
35577  protected void composeCompartmentDefinition(String name, CompartmentDefinition element) throws IOException {
35578    if (element != null) {
35579      prop("resourceType", name);
35580      composeCompartmentDefinitionInner(element);
35581    }
35582  }
35583
35584  protected void composeCompartmentDefinitionInner(CompartmentDefinition element) throws IOException {
35585      composeDomainResourceElements(element);
35586      if (element.hasUrlElement()) {
35587        composeUriCore("url", element.getUrlElement(), false);
35588        composeUriExtras("url", element.getUrlElement(), false);
35589      }
35590      if (element.hasVersionElement()) {
35591        composeStringCore("version", element.getVersionElement(), false);
35592        composeStringExtras("version", element.getVersionElement(), false);
35593      }
35594      if (element.hasNameElement()) {
35595        composeStringCore("name", element.getNameElement(), false);
35596        composeStringExtras("name", element.getNameElement(), false);
35597      }
35598      if (element.hasStatusElement()) {
35599        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35600        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35601      }
35602      if (element.hasExperimentalElement()) {
35603        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35604        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35605      }
35606      if (element.hasDateElement()) {
35607        composeDateTimeCore("date", element.getDateElement(), false);
35608        composeDateTimeExtras("date", element.getDateElement(), false);
35609      }
35610      if (element.hasPublisherElement()) {
35611        composeStringCore("publisher", element.getPublisherElement(), false);
35612        composeStringExtras("publisher", element.getPublisherElement(), false);
35613      }
35614      if (element.hasContact()) {
35615        openArray("contact");
35616        for (ContactDetail e : element.getContact()) 
35617          composeContactDetail(null, e);
35618        closeArray();
35619      };
35620      if (element.hasDescriptionElement()) {
35621        composeMarkdownCore("description", element.getDescriptionElement(), false);
35622        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35623      }
35624      if (element.hasUseContext()) {
35625        openArray("useContext");
35626        for (UsageContext e : element.getUseContext()) 
35627          composeUsageContext(null, e);
35628        closeArray();
35629      };
35630      if (element.hasPurposeElement()) {
35631        composeMarkdownCore("purpose", element.getPurposeElement(), false);
35632        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
35633      }
35634      if (element.hasCodeElement()) {
35635        composeEnumerationCore("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
35636        composeEnumerationExtras("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
35637      }
35638      if (element.hasSearchElement()) {
35639        composeBooleanCore("search", element.getSearchElement(), false);
35640        composeBooleanExtras("search", element.getSearchElement(), false);
35641      }
35642      if (element.hasResource()) {
35643        openArray("resource");
35644        for (CompartmentDefinition.CompartmentDefinitionResourceComponent e : element.getResource()) 
35645          composeCompartmentDefinitionCompartmentDefinitionResourceComponent(null, e);
35646        closeArray();
35647      };
35648  }
35649
35650  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponent(String name, CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
35651    if (element != null) {
35652      open(name);
35653      composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(element);
35654      close();
35655    }
35656  }
35657
35658  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
35659      composeBackbone(element);
35660      if (element.hasCodeElement()) {
35661        composeCodeCore("code", element.getCodeElement(), false);
35662        composeCodeExtras("code", element.getCodeElement(), false);
35663      }
35664      if (element.hasParam()) {
35665        openArray("param");
35666        for (StringType e : element.getParam()) 
35667          composeStringCore(null, e, true);
35668        closeArray();
35669        if (anyHasExtras(element.getParam())) {
35670          openArray("_param");
35671          for (StringType e : element.getParam()) 
35672            composeStringExtras(null, e, true);
35673          closeArray();
35674        }
35675      };
35676      if (element.hasDocumentationElement()) {
35677        composeStringCore("documentation", element.getDocumentationElement(), false);
35678        composeStringExtras("documentation", element.getDocumentationElement(), false);
35679      }
35680  }
35681
35682  protected void composeComposition(String name, Composition element) throws IOException {
35683    if (element != null) {
35684      prop("resourceType", name);
35685      composeCompositionInner(element);
35686    }
35687  }
35688
35689  protected void composeCompositionInner(Composition element) throws IOException {
35690      composeDomainResourceElements(element);
35691      if (element.hasIdentifier()) {
35692        composeIdentifier("identifier", element.getIdentifier());
35693      }
35694      if (element.hasStatusElement()) {
35695        composeEnumerationCore("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
35696        composeEnumerationExtras("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
35697      }
35698      if (element.hasType()) {
35699        composeCodeableConcept("type", element.getType());
35700      }
35701      if (element.hasCategory()) {
35702        openArray("category");
35703        for (CodeableConcept e : element.getCategory()) 
35704          composeCodeableConcept(null, e);
35705        closeArray();
35706      };
35707      if (element.hasSubject()) {
35708        composeReference("subject", element.getSubject());
35709      }
35710      if (element.hasEncounter()) {
35711        composeReference("encounter", element.getEncounter());
35712      }
35713      if (element.hasDateElement()) {
35714        composeDateTimeCore("date", element.getDateElement(), false);
35715        composeDateTimeExtras("date", element.getDateElement(), false);
35716      }
35717      if (element.hasAuthor()) {
35718        openArray("author");
35719        for (Reference e : element.getAuthor()) 
35720          composeReference(null, e);
35721        closeArray();
35722      };
35723      if (element.hasTitleElement()) {
35724        composeStringCore("title", element.getTitleElement(), false);
35725        composeStringExtras("title", element.getTitleElement(), false);
35726      }
35727      if (element.hasConfidentialityElement()) {
35728        composeEnumerationCore("confidentiality", element.getConfidentialityElement(), new Composition.DocumentConfidentialityEnumFactory(), false);
35729        composeEnumerationExtras("confidentiality", element.getConfidentialityElement(), new Composition.DocumentConfidentialityEnumFactory(), false);
35730      }
35731      if (element.hasAttester()) {
35732        openArray("attester");
35733        for (Composition.CompositionAttesterComponent e : element.getAttester()) 
35734          composeCompositionCompositionAttesterComponent(null, e);
35735        closeArray();
35736      };
35737      if (element.hasCustodian()) {
35738        composeReference("custodian", element.getCustodian());
35739      }
35740      if (element.hasRelatesTo()) {
35741        openArray("relatesTo");
35742        for (Composition.CompositionRelatesToComponent e : element.getRelatesTo()) 
35743          composeCompositionCompositionRelatesToComponent(null, e);
35744        closeArray();
35745      };
35746      if (element.hasEvent()) {
35747        openArray("event");
35748        for (Composition.CompositionEventComponent e : element.getEvent()) 
35749          composeCompositionCompositionEventComponent(null, e);
35750        closeArray();
35751      };
35752      if (element.hasSection()) {
35753        openArray("section");
35754        for (Composition.SectionComponent e : element.getSection()) 
35755          composeCompositionSectionComponent(null, e);
35756        closeArray();
35757      };
35758  }
35759
35760  protected void composeCompositionCompositionAttesterComponent(String name, Composition.CompositionAttesterComponent element) throws IOException {
35761    if (element != null) {
35762      open(name);
35763      composeCompositionCompositionAttesterComponentInner(element);
35764      close();
35765    }
35766  }
35767
35768  protected void composeCompositionCompositionAttesterComponentInner(Composition.CompositionAttesterComponent element) throws IOException {
35769      composeBackbone(element);
35770      if (element.hasModeElement()) {
35771        composeEnumerationCore("mode", element.getModeElement(), new Composition.CompositionAttestationModeEnumFactory(), false);
35772        composeEnumerationExtras("mode", element.getModeElement(), new Composition.CompositionAttestationModeEnumFactory(), false);
35773      }
35774      if (element.hasTimeElement()) {
35775        composeDateTimeCore("time", element.getTimeElement(), false);
35776        composeDateTimeExtras("time", element.getTimeElement(), false);
35777      }
35778      if (element.hasParty()) {
35779        composeReference("party", element.getParty());
35780      }
35781  }
35782
35783  protected void composeCompositionCompositionRelatesToComponent(String name, Composition.CompositionRelatesToComponent element) throws IOException {
35784    if (element != null) {
35785      open(name);
35786      composeCompositionCompositionRelatesToComponentInner(element);
35787      close();
35788    }
35789  }
35790
35791  protected void composeCompositionCompositionRelatesToComponentInner(Composition.CompositionRelatesToComponent element) throws IOException {
35792      composeBackbone(element);
35793      if (element.hasCodeElement()) {
35794        composeEnumerationCore("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(), false);
35795        composeEnumerationExtras("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(), false);
35796      }
35797      if (element.hasTarget()) {
35798        composeType("target", element.getTarget());
35799      }
35800  }
35801
35802  protected void composeCompositionCompositionEventComponent(String name, Composition.CompositionEventComponent element) throws IOException {
35803    if (element != null) {
35804      open(name);
35805      composeCompositionCompositionEventComponentInner(element);
35806      close();
35807    }
35808  }
35809
35810  protected void composeCompositionCompositionEventComponentInner(Composition.CompositionEventComponent element) throws IOException {
35811      composeBackbone(element);
35812      if (element.hasCode()) {
35813        openArray("code");
35814        for (CodeableConcept e : element.getCode()) 
35815          composeCodeableConcept(null, e);
35816        closeArray();
35817      };
35818      if (element.hasPeriod()) {
35819        composePeriod("period", element.getPeriod());
35820      }
35821      if (element.hasDetail()) {
35822        openArray("detail");
35823        for (Reference e : element.getDetail()) 
35824          composeReference(null, e);
35825        closeArray();
35826      };
35827  }
35828
35829  protected void composeCompositionSectionComponent(String name, Composition.SectionComponent element) throws IOException {
35830    if (element != null) {
35831      open(name);
35832      composeCompositionSectionComponentInner(element);
35833      close();
35834    }
35835  }
35836
35837  protected void composeCompositionSectionComponentInner(Composition.SectionComponent element) throws IOException {
35838      composeBackbone(element);
35839      if (element.hasTitleElement()) {
35840        composeStringCore("title", element.getTitleElement(), false);
35841        composeStringExtras("title", element.getTitleElement(), false);
35842      }
35843      if (element.hasCode()) {
35844        composeCodeableConcept("code", element.getCode());
35845      }
35846      if (element.hasAuthor()) {
35847        openArray("author");
35848        for (Reference e : element.getAuthor()) 
35849          composeReference(null, e);
35850        closeArray();
35851      };
35852      if (element.hasFocus()) {
35853        composeReference("focus", element.getFocus());
35854      }
35855      if (element.hasText()) {
35856        composeNarrative("text", element.getText());
35857      }
35858      if (element.hasModeElement()) {
35859        composeEnumerationCore("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
35860        composeEnumerationExtras("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
35861      }
35862      if (element.hasOrderedBy()) {
35863        composeCodeableConcept("orderedBy", element.getOrderedBy());
35864      }
35865      if (element.hasEntry()) {
35866        openArray("entry");
35867        for (Reference e : element.getEntry()) 
35868          composeReference(null, e);
35869        closeArray();
35870      };
35871      if (element.hasEmptyReason()) {
35872        composeCodeableConcept("emptyReason", element.getEmptyReason());
35873      }
35874      if (element.hasSection()) {
35875        openArray("section");
35876        for (Composition.SectionComponent e : element.getSection()) 
35877          composeCompositionSectionComponent(null, e);
35878        closeArray();
35879      };
35880  }
35881
35882  protected void composeConceptMap(String name, ConceptMap element) throws IOException {
35883    if (element != null) {
35884      prop("resourceType", name);
35885      composeConceptMapInner(element);
35886    }
35887  }
35888
35889  protected void composeConceptMapInner(ConceptMap element) throws IOException {
35890      composeDomainResourceElements(element);
35891      if (element.hasUrlElement()) {
35892        composeUriCore("url", element.getUrlElement(), false);
35893        composeUriExtras("url", element.getUrlElement(), false);
35894      }
35895      if (element.hasIdentifier()) {
35896        composeIdentifier("identifier", element.getIdentifier());
35897      }
35898      if (element.hasVersionElement()) {
35899        composeStringCore("version", element.getVersionElement(), false);
35900        composeStringExtras("version", element.getVersionElement(), false);
35901      }
35902      if (element.hasNameElement()) {
35903        composeStringCore("name", element.getNameElement(), false);
35904        composeStringExtras("name", element.getNameElement(), false);
35905      }
35906      if (element.hasTitleElement()) {
35907        composeStringCore("title", element.getTitleElement(), false);
35908        composeStringExtras("title", element.getTitleElement(), false);
35909      }
35910      if (element.hasStatusElement()) {
35911        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35912        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35913      }
35914      if (element.hasExperimentalElement()) {
35915        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35916        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35917      }
35918      if (element.hasDateElement()) {
35919        composeDateTimeCore("date", element.getDateElement(), false);
35920        composeDateTimeExtras("date", element.getDateElement(), false);
35921      }
35922      if (element.hasPublisherElement()) {
35923        composeStringCore("publisher", element.getPublisherElement(), false);
35924        composeStringExtras("publisher", element.getPublisherElement(), false);
35925      }
35926      if (element.hasContact()) {
35927        openArray("contact");
35928        for (ContactDetail e : element.getContact()) 
35929          composeContactDetail(null, e);
35930        closeArray();
35931      };
35932      if (element.hasDescriptionElement()) {
35933        composeMarkdownCore("description", element.getDescriptionElement(), false);
35934        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35935      }
35936      if (element.hasUseContext()) {
35937        openArray("useContext");
35938        for (UsageContext e : element.getUseContext()) 
35939          composeUsageContext(null, e);
35940        closeArray();
35941      };
35942      if (element.hasJurisdiction()) {
35943        openArray("jurisdiction");
35944        for (CodeableConcept e : element.getJurisdiction()) 
35945          composeCodeableConcept(null, e);
35946        closeArray();
35947      };
35948      if (element.hasPurposeElement()) {
35949        composeMarkdownCore("purpose", element.getPurposeElement(), false);
35950        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
35951      }
35952      if (element.hasCopyrightElement()) {
35953        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
35954        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
35955      }
35956      if (element.hasSource()) {
35957        composeType("source", element.getSource());
35958      }
35959      if (element.hasTarget()) {
35960        composeType("target", element.getTarget());
35961      }
35962      if (element.hasGroup()) {
35963        openArray("group");
35964        for (ConceptMap.ConceptMapGroupComponent e : element.getGroup()) 
35965          composeConceptMapConceptMapGroupComponent(null, e);
35966        closeArray();
35967      };
35968  }
35969
35970  protected void composeConceptMapConceptMapGroupComponent(String name, ConceptMap.ConceptMapGroupComponent element) throws IOException {
35971    if (element != null) {
35972      open(name);
35973      composeConceptMapConceptMapGroupComponentInner(element);
35974      close();
35975    }
35976  }
35977
35978  protected void composeConceptMapConceptMapGroupComponentInner(ConceptMap.ConceptMapGroupComponent element) throws IOException {
35979      composeBackbone(element);
35980      if (element.hasSourceElement()) {
35981        composeUriCore("source", element.getSourceElement(), false);
35982        composeUriExtras("source", element.getSourceElement(), false);
35983      }
35984      if (element.hasSourceVersionElement()) {
35985        composeStringCore("sourceVersion", element.getSourceVersionElement(), false);
35986        composeStringExtras("sourceVersion", element.getSourceVersionElement(), false);
35987      }
35988      if (element.hasTargetElement()) {
35989        composeUriCore("target", element.getTargetElement(), false);
35990        composeUriExtras("target", element.getTargetElement(), false);
35991      }
35992      if (element.hasTargetVersionElement()) {
35993        composeStringCore("targetVersion", element.getTargetVersionElement(), false);
35994        composeStringExtras("targetVersion", element.getTargetVersionElement(), false);
35995      }
35996      if (element.hasElement()) {
35997        openArray("element");
35998        for (ConceptMap.SourceElementComponent e : element.getElement()) 
35999          composeConceptMapSourceElementComponent(null, e);
36000        closeArray();
36001      };
36002      if (element.hasUnmapped()) {
36003        composeConceptMapConceptMapGroupUnmappedComponent("unmapped", element.getUnmapped());
36004      }
36005  }
36006
36007  protected void composeConceptMapSourceElementComponent(String name, ConceptMap.SourceElementComponent element) throws IOException {
36008    if (element != null) {
36009      open(name);
36010      composeConceptMapSourceElementComponentInner(element);
36011      close();
36012    }
36013  }
36014
36015  protected void composeConceptMapSourceElementComponentInner(ConceptMap.SourceElementComponent element) throws IOException {
36016      composeBackbone(element);
36017      if (element.hasCodeElement()) {
36018        composeCodeCore("code", element.getCodeElement(), false);
36019        composeCodeExtras("code", element.getCodeElement(), false);
36020      }
36021      if (element.hasDisplayElement()) {
36022        composeStringCore("display", element.getDisplayElement(), false);
36023        composeStringExtras("display", element.getDisplayElement(), false);
36024      }
36025      if (element.hasTarget()) {
36026        openArray("target");
36027        for (ConceptMap.TargetElementComponent e : element.getTarget()) 
36028          composeConceptMapTargetElementComponent(null, e);
36029        closeArray();
36030      };
36031  }
36032
36033  protected void composeConceptMapTargetElementComponent(String name, ConceptMap.TargetElementComponent element) throws IOException {
36034    if (element != null) {
36035      open(name);
36036      composeConceptMapTargetElementComponentInner(element);
36037      close();
36038    }
36039  }
36040
36041  protected void composeConceptMapTargetElementComponentInner(ConceptMap.TargetElementComponent element) throws IOException {
36042      composeBackbone(element);
36043      if (element.hasCodeElement()) {
36044        composeCodeCore("code", element.getCodeElement(), false);
36045        composeCodeExtras("code", element.getCodeElement(), false);
36046      }
36047      if (element.hasDisplayElement()) {
36048        composeStringCore("display", element.getDisplayElement(), false);
36049        composeStringExtras("display", element.getDisplayElement(), false);
36050      }
36051      if (element.hasEquivalenceElement()) {
36052        composeEnumerationCore("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
36053        composeEnumerationExtras("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
36054      }
36055      if (element.hasCommentElement()) {
36056        composeStringCore("comment", element.getCommentElement(), false);
36057        composeStringExtras("comment", element.getCommentElement(), false);
36058      }
36059      if (element.hasDependsOn()) {
36060        openArray("dependsOn");
36061        for (ConceptMap.OtherElementComponent e : element.getDependsOn()) 
36062          composeConceptMapOtherElementComponent(null, e);
36063        closeArray();
36064      };
36065      if (element.hasProduct()) {
36066        openArray("product");
36067        for (ConceptMap.OtherElementComponent e : element.getProduct()) 
36068          composeConceptMapOtherElementComponent(null, e);
36069        closeArray();
36070      };
36071  }
36072
36073  protected void composeConceptMapOtherElementComponent(String name, ConceptMap.OtherElementComponent element) throws IOException {
36074    if (element != null) {
36075      open(name);
36076      composeConceptMapOtherElementComponentInner(element);
36077      close();
36078    }
36079  }
36080
36081  protected void composeConceptMapOtherElementComponentInner(ConceptMap.OtherElementComponent element) throws IOException {
36082      composeBackbone(element);
36083      if (element.hasPropertyElement()) {
36084        composeUriCore("property", element.getPropertyElement(), false);
36085        composeUriExtras("property", element.getPropertyElement(), false);
36086      }
36087      if (element.hasSystemElement()) {
36088        composeCanonicalCore("system", element.getSystemElement(), false);
36089        composeCanonicalExtras("system", element.getSystemElement(), false);
36090      }
36091      if (element.hasValueElement()) {
36092        composeStringCore("value", element.getValueElement(), false);
36093        composeStringExtras("value", element.getValueElement(), false);
36094      }
36095      if (element.hasDisplayElement()) {
36096        composeStringCore("display", element.getDisplayElement(), false);
36097        composeStringExtras("display", element.getDisplayElement(), false);
36098      }
36099  }
36100
36101  protected void composeConceptMapConceptMapGroupUnmappedComponent(String name, ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
36102    if (element != null) {
36103      open(name);
36104      composeConceptMapConceptMapGroupUnmappedComponentInner(element);
36105      close();
36106    }
36107  }
36108
36109  protected void composeConceptMapConceptMapGroupUnmappedComponentInner(ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
36110      composeBackbone(element);
36111      if (element.hasModeElement()) {
36112        composeEnumerationCore("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
36113        composeEnumerationExtras("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
36114      }
36115      if (element.hasCodeElement()) {
36116        composeCodeCore("code", element.getCodeElement(), false);
36117        composeCodeExtras("code", element.getCodeElement(), false);
36118      }
36119      if (element.hasDisplayElement()) {
36120        composeStringCore("display", element.getDisplayElement(), false);
36121        composeStringExtras("display", element.getDisplayElement(), false);
36122      }
36123      if (element.hasUrlElement()) {
36124        composeCanonicalCore("url", element.getUrlElement(), false);
36125        composeCanonicalExtras("url", element.getUrlElement(), false);
36126      }
36127  }
36128
36129  protected void composeCondition(String name, Condition element) throws IOException {
36130    if (element != null) {
36131      prop("resourceType", name);
36132      composeConditionInner(element);
36133    }
36134  }
36135
36136  protected void composeConditionInner(Condition element) throws IOException {
36137      composeDomainResourceElements(element);
36138      if (element.hasIdentifier()) {
36139        openArray("identifier");
36140        for (Identifier e : element.getIdentifier()) 
36141          composeIdentifier(null, e);
36142        closeArray();
36143      };
36144      if (element.hasClinicalStatus()) {
36145        composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
36146      }
36147      if (element.hasVerificationStatus()) {
36148        composeCodeableConcept("verificationStatus", element.getVerificationStatus());
36149      }
36150      if (element.hasCategory()) {
36151        openArray("category");
36152        for (CodeableConcept e : element.getCategory()) 
36153          composeCodeableConcept(null, e);
36154        closeArray();
36155      };
36156      if (element.hasSeverity()) {
36157        composeCodeableConcept("severity", element.getSeverity());
36158      }
36159      if (element.hasCode()) {
36160        composeCodeableConcept("code", element.getCode());
36161      }
36162      if (element.hasBodySite()) {
36163        openArray("bodySite");
36164        for (CodeableConcept e : element.getBodySite()) 
36165          composeCodeableConcept(null, e);
36166        closeArray();
36167      };
36168      if (element.hasSubject()) {
36169        composeReference("subject", element.getSubject());
36170      }
36171      if (element.hasEncounter()) {
36172        composeReference("encounter", element.getEncounter());
36173      }
36174      if (element.hasOnset()) {
36175        composeType("onset", element.getOnset());
36176      }
36177      if (element.hasAbatement()) {
36178        composeType("abatement", element.getAbatement());
36179      }
36180      if (element.hasRecordedDateElement()) {
36181        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
36182        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
36183      }
36184      if (element.hasRecorder()) {
36185        composeReference("recorder", element.getRecorder());
36186      }
36187      if (element.hasAsserter()) {
36188        composeReference("asserter", element.getAsserter());
36189      }
36190      if (element.hasStage()) {
36191        openArray("stage");
36192        for (Condition.ConditionStageComponent e : element.getStage()) 
36193          composeConditionConditionStageComponent(null, e);
36194        closeArray();
36195      };
36196      if (element.hasEvidence()) {
36197        openArray("evidence");
36198        for (Condition.ConditionEvidenceComponent e : element.getEvidence()) 
36199          composeConditionConditionEvidenceComponent(null, e);
36200        closeArray();
36201      };
36202      if (element.hasNote()) {
36203        openArray("note");
36204        for (Annotation e : element.getNote()) 
36205          composeAnnotation(null, e);
36206        closeArray();
36207      };
36208  }
36209
36210  protected void composeConditionConditionStageComponent(String name, Condition.ConditionStageComponent element) throws IOException {
36211    if (element != null) {
36212      open(name);
36213      composeConditionConditionStageComponentInner(element);
36214      close();
36215    }
36216  }
36217
36218  protected void composeConditionConditionStageComponentInner(Condition.ConditionStageComponent element) throws IOException {
36219      composeBackbone(element);
36220      if (element.hasSummary()) {
36221        composeCodeableConcept("summary", element.getSummary());
36222      }
36223      if (element.hasAssessment()) {
36224        openArray("assessment");
36225        for (Reference e : element.getAssessment()) 
36226          composeReference(null, e);
36227        closeArray();
36228      };
36229      if (element.hasType()) {
36230        composeCodeableConcept("type", element.getType());
36231      }
36232  }
36233
36234  protected void composeConditionConditionEvidenceComponent(String name, Condition.ConditionEvidenceComponent element) throws IOException {
36235    if (element != null) {
36236      open(name);
36237      composeConditionConditionEvidenceComponentInner(element);
36238      close();
36239    }
36240  }
36241
36242  protected void composeConditionConditionEvidenceComponentInner(Condition.ConditionEvidenceComponent element) throws IOException {
36243      composeBackbone(element);
36244      if (element.hasCode()) {
36245        openArray("code");
36246        for (CodeableConcept e : element.getCode()) 
36247          composeCodeableConcept(null, e);
36248        closeArray();
36249      };
36250      if (element.hasDetail()) {
36251        openArray("detail");
36252        for (Reference e : element.getDetail()) 
36253          composeReference(null, e);
36254        closeArray();
36255      };
36256  }
36257
36258  protected void composeConsent(String name, Consent element) throws IOException {
36259    if (element != null) {
36260      prop("resourceType", name);
36261      composeConsentInner(element);
36262    }
36263  }
36264
36265  protected void composeConsentInner(Consent element) throws IOException {
36266      composeDomainResourceElements(element);
36267      if (element.hasIdentifier()) {
36268        openArray("identifier");
36269        for (Identifier e : element.getIdentifier()) 
36270          composeIdentifier(null, e);
36271        closeArray();
36272      };
36273      if (element.hasStatusElement()) {
36274        composeEnumerationCore("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
36275        composeEnumerationExtras("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
36276      }
36277      if (element.hasScope()) {
36278        composeCodeableConcept("scope", element.getScope());
36279      }
36280      if (element.hasCategory()) {
36281        openArray("category");
36282        for (CodeableConcept e : element.getCategory()) 
36283          composeCodeableConcept(null, e);
36284        closeArray();
36285      };
36286      if (element.hasPatient()) {
36287        composeReference("patient", element.getPatient());
36288      }
36289      if (element.hasDateTimeElement()) {
36290        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
36291        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
36292      }
36293      if (element.hasPerformer()) {
36294        openArray("performer");
36295        for (Reference e : element.getPerformer()) 
36296          composeReference(null, e);
36297        closeArray();
36298      };
36299      if (element.hasOrganization()) {
36300        openArray("organization");
36301        for (Reference e : element.getOrganization()) 
36302          composeReference(null, e);
36303        closeArray();
36304      };
36305      if (element.hasSource()) {
36306        composeType("source", element.getSource());
36307      }
36308      if (element.hasPolicy()) {
36309        openArray("policy");
36310        for (Consent.ConsentPolicyComponent e : element.getPolicy()) 
36311          composeConsentConsentPolicyComponent(null, e);
36312        closeArray();
36313      };
36314      if (element.hasPolicyRule()) {
36315        composeCodeableConcept("policyRule", element.getPolicyRule());
36316      }
36317      if (element.hasVerification()) {
36318        openArray("verification");
36319        for (Consent.ConsentVerificationComponent e : element.getVerification()) 
36320          composeConsentConsentVerificationComponent(null, e);
36321        closeArray();
36322      };
36323      if (element.hasProvision()) {
36324        composeConsentprovisionComponent("provision", element.getProvision());
36325      }
36326  }
36327
36328  protected void composeConsentConsentPolicyComponent(String name, Consent.ConsentPolicyComponent element) throws IOException {
36329    if (element != null) {
36330      open(name);
36331      composeConsentConsentPolicyComponentInner(element);
36332      close();
36333    }
36334  }
36335
36336  protected void composeConsentConsentPolicyComponentInner(Consent.ConsentPolicyComponent element) throws IOException {
36337      composeBackbone(element);
36338      if (element.hasAuthorityElement()) {
36339        composeUriCore("authority", element.getAuthorityElement(), false);
36340        composeUriExtras("authority", element.getAuthorityElement(), false);
36341      }
36342      if (element.hasUriElement()) {
36343        composeUriCore("uri", element.getUriElement(), false);
36344        composeUriExtras("uri", element.getUriElement(), false);
36345      }
36346  }
36347
36348  protected void composeConsentConsentVerificationComponent(String name, Consent.ConsentVerificationComponent element) throws IOException {
36349    if (element != null) {
36350      open(name);
36351      composeConsentConsentVerificationComponentInner(element);
36352      close();
36353    }
36354  }
36355
36356  protected void composeConsentConsentVerificationComponentInner(Consent.ConsentVerificationComponent element) throws IOException {
36357      composeBackbone(element);
36358      if (element.hasVerifiedElement()) {
36359        composeBooleanCore("verified", element.getVerifiedElement(), false);
36360        composeBooleanExtras("verified", element.getVerifiedElement(), false);
36361      }
36362      if (element.hasVerifiedWith()) {
36363        composeReference("verifiedWith", element.getVerifiedWith());
36364      }
36365      if (element.hasVerificationDateElement()) {
36366        composeDateTimeCore("verificationDate", element.getVerificationDateElement(), false);
36367        composeDateTimeExtras("verificationDate", element.getVerificationDateElement(), false);
36368      }
36369  }
36370
36371  protected void composeConsentprovisionComponent(String name, Consent.provisionComponent element) throws IOException {
36372    if (element != null) {
36373      open(name);
36374      composeConsentprovisionComponentInner(element);
36375      close();
36376    }
36377  }
36378
36379  protected void composeConsentprovisionComponentInner(Consent.provisionComponent element) throws IOException {
36380      composeBackbone(element);
36381      if (element.hasTypeElement()) {
36382        composeEnumerationCore("type", element.getTypeElement(), new Consent.ConsentProvisionTypeEnumFactory(), false);
36383        composeEnumerationExtras("type", element.getTypeElement(), new Consent.ConsentProvisionTypeEnumFactory(), false);
36384      }
36385      if (element.hasPeriod()) {
36386        composePeriod("period", element.getPeriod());
36387      }
36388      if (element.hasActor()) {
36389        openArray("actor");
36390        for (Consent.provisionActorComponent e : element.getActor()) 
36391          composeConsentprovisionActorComponent(null, e);
36392        closeArray();
36393      };
36394      if (element.hasAction()) {
36395        openArray("action");
36396        for (CodeableConcept e : element.getAction()) 
36397          composeCodeableConcept(null, e);
36398        closeArray();
36399      };
36400      if (element.hasSecurityLabel()) {
36401        openArray("securityLabel");
36402        for (Coding e : element.getSecurityLabel()) 
36403          composeCoding(null, e);
36404        closeArray();
36405      };
36406      if (element.hasPurpose()) {
36407        openArray("purpose");
36408        for (Coding e : element.getPurpose()) 
36409          composeCoding(null, e);
36410        closeArray();
36411      };
36412      if (element.hasClass_()) {
36413        openArray("class");
36414        for (Coding e : element.getClass_()) 
36415          composeCoding(null, e);
36416        closeArray();
36417      };
36418      if (element.hasCode()) {
36419        openArray("code");
36420        for (CodeableConcept e : element.getCode()) 
36421          composeCodeableConcept(null, e);
36422        closeArray();
36423      };
36424      if (element.hasDataPeriod()) {
36425        composePeriod("dataPeriod", element.getDataPeriod());
36426      }
36427      if (element.hasData()) {
36428        openArray("data");
36429        for (Consent.provisionDataComponent e : element.getData()) 
36430          composeConsentprovisionDataComponent(null, e);
36431        closeArray();
36432      };
36433      if (element.hasProvision()) {
36434        openArray("provision");
36435        for (Consent.provisionComponent e : element.getProvision()) 
36436          composeConsentprovisionComponent(null, e);
36437        closeArray();
36438      };
36439  }
36440
36441  protected void composeConsentprovisionActorComponent(String name, Consent.provisionActorComponent element) throws IOException {
36442    if (element != null) {
36443      open(name);
36444      composeConsentprovisionActorComponentInner(element);
36445      close();
36446    }
36447  }
36448
36449  protected void composeConsentprovisionActorComponentInner(Consent.provisionActorComponent element) throws IOException {
36450      composeBackbone(element);
36451      if (element.hasRole()) {
36452        composeCodeableConcept("role", element.getRole());
36453      }
36454      if (element.hasReference()) {
36455        composeReference("reference", element.getReference());
36456      }
36457  }
36458
36459  protected void composeConsentprovisionDataComponent(String name, Consent.provisionDataComponent element) throws IOException {
36460    if (element != null) {
36461      open(name);
36462      composeConsentprovisionDataComponentInner(element);
36463      close();
36464    }
36465  }
36466
36467  protected void composeConsentprovisionDataComponentInner(Consent.provisionDataComponent element) throws IOException {
36468      composeBackbone(element);
36469      if (element.hasMeaningElement()) {
36470        composeEnumerationCore("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
36471        composeEnumerationExtras("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
36472      }
36473      if (element.hasReference()) {
36474        composeReference("reference", element.getReference());
36475      }
36476  }
36477
36478  protected void composeContract(String name, Contract element) throws IOException {
36479    if (element != null) {
36480      prop("resourceType", name);
36481      composeContractInner(element);
36482    }
36483  }
36484
36485  protected void composeContractInner(Contract element) throws IOException {
36486      composeDomainResourceElements(element);
36487      if (element.hasIdentifier()) {
36488        openArray("identifier");
36489        for (Identifier e : element.getIdentifier()) 
36490          composeIdentifier(null, e);
36491        closeArray();
36492      };
36493      if (element.hasUrlElement()) {
36494        composeUriCore("url", element.getUrlElement(), false);
36495        composeUriExtras("url", element.getUrlElement(), false);
36496      }
36497      if (element.hasVersionElement()) {
36498        composeStringCore("version", element.getVersionElement(), false);
36499        composeStringExtras("version", element.getVersionElement(), false);
36500      }
36501      if (element.hasStatusElement()) {
36502        composeEnumerationCore("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
36503        composeEnumerationExtras("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
36504      }
36505      if (element.hasLegalState()) {
36506        composeCodeableConcept("legalState", element.getLegalState());
36507      }
36508      if (element.hasInstantiatesCanonical()) {
36509        composeReference("instantiatesCanonical", element.getInstantiatesCanonical());
36510      }
36511      if (element.hasInstantiatesUriElement()) {
36512        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
36513        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
36514      }
36515      if (element.hasContentDerivative()) {
36516        composeCodeableConcept("contentDerivative", element.getContentDerivative());
36517      }
36518      if (element.hasIssuedElement()) {
36519        composeDateTimeCore("issued", element.getIssuedElement(), false);
36520        composeDateTimeExtras("issued", element.getIssuedElement(), false);
36521      }
36522      if (element.hasApplies()) {
36523        composePeriod("applies", element.getApplies());
36524      }
36525      if (element.hasExpirationType()) {
36526        composeCodeableConcept("expirationType", element.getExpirationType());
36527      }
36528      if (element.hasSubject()) {
36529        openArray("subject");
36530        for (Reference e : element.getSubject()) 
36531          composeReference(null, e);
36532        closeArray();
36533      };
36534      if (element.hasAuthority()) {
36535        openArray("authority");
36536        for (Reference e : element.getAuthority()) 
36537          composeReference(null, e);
36538        closeArray();
36539      };
36540      if (element.hasDomain()) {
36541        openArray("domain");
36542        for (Reference e : element.getDomain()) 
36543          composeReference(null, e);
36544        closeArray();
36545      };
36546      if (element.hasSite()) {
36547        openArray("site");
36548        for (Reference e : element.getSite()) 
36549          composeReference(null, e);
36550        closeArray();
36551      };
36552      if (element.hasNameElement()) {
36553        composeStringCore("name", element.getNameElement(), false);
36554        composeStringExtras("name", element.getNameElement(), false);
36555      }
36556      if (element.hasTitleElement()) {
36557        composeStringCore("title", element.getTitleElement(), false);
36558        composeStringExtras("title", element.getTitleElement(), false);
36559      }
36560      if (element.hasSubtitleElement()) {
36561        composeStringCore("subtitle", element.getSubtitleElement(), false);
36562        composeStringExtras("subtitle", element.getSubtitleElement(), false);
36563      }
36564      if (element.hasAlias()) {
36565        openArray("alias");
36566        for (StringType e : element.getAlias()) 
36567          composeStringCore(null, e, true);
36568        closeArray();
36569        if (anyHasExtras(element.getAlias())) {
36570          openArray("_alias");
36571          for (StringType e : element.getAlias()) 
36572            composeStringExtras(null, e, true);
36573          closeArray();
36574        }
36575      };
36576      if (element.hasAuthor()) {
36577        composeReference("author", element.getAuthor());
36578      }
36579      if (element.hasScope()) {
36580        composeCodeableConcept("scope", element.getScope());
36581      }
36582      if (element.hasTopic()) {
36583        composeType("topic", element.getTopic());
36584      }
36585      if (element.hasType()) {
36586        composeCodeableConcept("type", element.getType());
36587      }
36588      if (element.hasSubType()) {
36589        openArray("subType");
36590        for (CodeableConcept e : element.getSubType()) 
36591          composeCodeableConcept(null, e);
36592        closeArray();
36593      };
36594      if (element.hasContentDefinition()) {
36595        composeContractContentDefinitionComponent("contentDefinition", element.getContentDefinition());
36596      }
36597      if (element.hasTerm()) {
36598        openArray("term");
36599        for (Contract.TermComponent e : element.getTerm()) 
36600          composeContractTermComponent(null, e);
36601        closeArray();
36602      };
36603      if (element.hasSupportingInfo()) {
36604        openArray("supportingInfo");
36605        for (Reference e : element.getSupportingInfo()) 
36606          composeReference(null, e);
36607        closeArray();
36608      };
36609      if (element.hasRelevantHistory()) {
36610        openArray("relevantHistory");
36611        for (Reference e : element.getRelevantHistory()) 
36612          composeReference(null, e);
36613        closeArray();
36614      };
36615      if (element.hasSigner()) {
36616        openArray("signer");
36617        for (Contract.SignatoryComponent e : element.getSigner()) 
36618          composeContractSignatoryComponent(null, e);
36619        closeArray();
36620      };
36621      if (element.hasFriendly()) {
36622        openArray("friendly");
36623        for (Contract.FriendlyLanguageComponent e : element.getFriendly()) 
36624          composeContractFriendlyLanguageComponent(null, e);
36625        closeArray();
36626      };
36627      if (element.hasLegal()) {
36628        openArray("legal");
36629        for (Contract.LegalLanguageComponent e : element.getLegal()) 
36630          composeContractLegalLanguageComponent(null, e);
36631        closeArray();
36632      };
36633      if (element.hasRule()) {
36634        openArray("rule");
36635        for (Contract.ComputableLanguageComponent e : element.getRule()) 
36636          composeContractComputableLanguageComponent(null, e);
36637        closeArray();
36638      };
36639      if (element.hasLegallyBinding()) {
36640        composeType("legallyBinding", element.getLegallyBinding());
36641      }
36642  }
36643
36644  protected void composeContractContentDefinitionComponent(String name, Contract.ContentDefinitionComponent element) throws IOException {
36645    if (element != null) {
36646      open(name);
36647      composeContractContentDefinitionComponentInner(element);
36648      close();
36649    }
36650  }
36651
36652  protected void composeContractContentDefinitionComponentInner(Contract.ContentDefinitionComponent element) throws IOException {
36653      composeBackbone(element);
36654      if (element.hasType()) {
36655        composeCodeableConcept("type", element.getType());
36656      }
36657      if (element.hasSubType()) {
36658        composeCodeableConcept("subType", element.getSubType());
36659      }
36660      if (element.hasPublisher()) {
36661        composeReference("publisher", element.getPublisher());
36662      }
36663      if (element.hasPublicationDateElement()) {
36664        composeDateTimeCore("publicationDate", element.getPublicationDateElement(), false);
36665        composeDateTimeExtras("publicationDate", element.getPublicationDateElement(), false);
36666      }
36667      if (element.hasPublicationStatusElement()) {
36668        composeEnumerationCore("publicationStatus", element.getPublicationStatusElement(), new Contract.ContractPublicationStatusEnumFactory(), false);
36669        composeEnumerationExtras("publicationStatus", element.getPublicationStatusElement(), new Contract.ContractPublicationStatusEnumFactory(), false);
36670      }
36671      if (element.hasCopyrightElement()) {
36672        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
36673        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
36674      }
36675  }
36676
36677  protected void composeContractTermComponent(String name, Contract.TermComponent element) throws IOException {
36678    if (element != null) {
36679      open(name);
36680      composeContractTermComponentInner(element);
36681      close();
36682    }
36683  }
36684
36685  protected void composeContractTermComponentInner(Contract.TermComponent element) throws IOException {
36686      composeBackbone(element);
36687      if (element.hasIdentifier()) {
36688        composeIdentifier("identifier", element.getIdentifier());
36689      }
36690      if (element.hasIssuedElement()) {
36691        composeDateTimeCore("issued", element.getIssuedElement(), false);
36692        composeDateTimeExtras("issued", element.getIssuedElement(), false);
36693      }
36694      if (element.hasApplies()) {
36695        composePeriod("applies", element.getApplies());
36696      }
36697      if (element.hasTopic()) {
36698        composeType("topic", element.getTopic());
36699      }
36700      if (element.hasType()) {
36701        composeCodeableConcept("type", element.getType());
36702      }
36703      if (element.hasSubType()) {
36704        composeCodeableConcept("subType", element.getSubType());
36705      }
36706      if (element.hasTextElement()) {
36707        composeStringCore("text", element.getTextElement(), false);
36708        composeStringExtras("text", element.getTextElement(), false);
36709      }
36710      if (element.hasSecurityLabel()) {
36711        openArray("securityLabel");
36712        for (Contract.SecurityLabelComponent e : element.getSecurityLabel()) 
36713          composeContractSecurityLabelComponent(null, e);
36714        closeArray();
36715      };
36716      if (element.hasOffer()) {
36717        composeContractContractOfferComponent("offer", element.getOffer());
36718      }
36719      if (element.hasAsset()) {
36720        openArray("asset");
36721        for (Contract.ContractAssetComponent e : element.getAsset()) 
36722          composeContractContractAssetComponent(null, e);
36723        closeArray();
36724      };
36725      if (element.hasAction()) {
36726        openArray("action");
36727        for (Contract.ActionComponent e : element.getAction()) 
36728          composeContractActionComponent(null, e);
36729        closeArray();
36730      };
36731      if (element.hasGroup()) {
36732        openArray("group");
36733        for (Contract.TermComponent e : element.getGroup()) 
36734          composeContractTermComponent(null, e);
36735        closeArray();
36736      };
36737  }
36738
36739  protected void composeContractSecurityLabelComponent(String name, Contract.SecurityLabelComponent element) throws IOException {
36740    if (element != null) {
36741      open(name);
36742      composeContractSecurityLabelComponentInner(element);
36743      close();
36744    }
36745  }
36746
36747  protected void composeContractSecurityLabelComponentInner(Contract.SecurityLabelComponent element) throws IOException {
36748      composeBackbone(element);
36749      if (element.hasNumber()) {
36750        openArray("number");
36751        for (UnsignedIntType e : element.getNumber()) 
36752          composeUnsignedIntCore(null, e, true);
36753        closeArray();
36754        if (anyHasExtras(element.getNumber())) {
36755          openArray("_number");
36756          for (UnsignedIntType e : element.getNumber()) 
36757            composeUnsignedIntExtras(null, e, true);
36758          closeArray();
36759        }
36760      };
36761      if (element.hasClassification()) {
36762        composeCoding("classification", element.getClassification());
36763      }
36764      if (element.hasCategory()) {
36765        openArray("category");
36766        for (Coding e : element.getCategory()) 
36767          composeCoding(null, e);
36768        closeArray();
36769      };
36770      if (element.hasControl()) {
36771        openArray("control");
36772        for (Coding e : element.getControl()) 
36773          composeCoding(null, e);
36774        closeArray();
36775      };
36776  }
36777
36778  protected void composeContractContractOfferComponent(String name, Contract.ContractOfferComponent element) throws IOException {
36779    if (element != null) {
36780      open(name);
36781      composeContractContractOfferComponentInner(element);
36782      close();
36783    }
36784  }
36785
36786  protected void composeContractContractOfferComponentInner(Contract.ContractOfferComponent element) throws IOException {
36787      composeBackbone(element);
36788      if (element.hasIdentifier()) {
36789        openArray("identifier");
36790        for (Identifier e : element.getIdentifier()) 
36791          composeIdentifier(null, e);
36792        closeArray();
36793      };
36794      if (element.hasParty()) {
36795        openArray("party");
36796        for (Contract.ContractPartyComponent e : element.getParty()) 
36797          composeContractContractPartyComponent(null, e);
36798        closeArray();
36799      };
36800      if (element.hasTopic()) {
36801        composeReference("topic", element.getTopic());
36802      }
36803      if (element.hasType()) {
36804        composeCodeableConcept("type", element.getType());
36805      }
36806      if (element.hasDecision()) {
36807        composeCodeableConcept("decision", element.getDecision());
36808      }
36809      if (element.hasDecisionMode()) {
36810        openArray("decisionMode");
36811        for (CodeableConcept e : element.getDecisionMode()) 
36812          composeCodeableConcept(null, e);
36813        closeArray();
36814      };
36815      if (element.hasAnswer()) {
36816        openArray("answer");
36817        for (Contract.AnswerComponent e : element.getAnswer()) 
36818          composeContractAnswerComponent(null, e);
36819        closeArray();
36820      };
36821      if (element.hasTextElement()) {
36822        composeStringCore("text", element.getTextElement(), false);
36823        composeStringExtras("text", element.getTextElement(), false);
36824      }
36825      if (element.hasLinkId()) {
36826        openArray("linkId");
36827        for (StringType e : element.getLinkId()) 
36828          composeStringCore(null, e, true);
36829        closeArray();
36830        if (anyHasExtras(element.getLinkId())) {
36831          openArray("_linkId");
36832          for (StringType e : element.getLinkId()) 
36833            composeStringExtras(null, e, true);
36834          closeArray();
36835        }
36836      };
36837      if (element.hasSecurityLabelNumber()) {
36838        openArray("securityLabelNumber");
36839        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
36840          composeUnsignedIntCore(null, e, true);
36841        closeArray();
36842        if (anyHasExtras(element.getSecurityLabelNumber())) {
36843          openArray("_securityLabelNumber");
36844          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
36845            composeUnsignedIntExtras(null, e, true);
36846          closeArray();
36847        }
36848      };
36849  }
36850
36851  protected void composeContractContractPartyComponent(String name, Contract.ContractPartyComponent element) throws IOException {
36852    if (element != null) {
36853      open(name);
36854      composeContractContractPartyComponentInner(element);
36855      close();
36856    }
36857  }
36858
36859  protected void composeContractContractPartyComponentInner(Contract.ContractPartyComponent element) throws IOException {
36860      composeBackbone(element);
36861      if (element.hasReference()) {
36862        openArray("reference");
36863        for (Reference e : element.getReference()) 
36864          composeReference(null, e);
36865        closeArray();
36866      };
36867      if (element.hasRole()) {
36868        composeCodeableConcept("role", element.getRole());
36869      }
36870  }
36871
36872  protected void composeContractAnswerComponent(String name, Contract.AnswerComponent element) throws IOException {
36873    if (element != null) {
36874      open(name);
36875      composeContractAnswerComponentInner(element);
36876      close();
36877    }
36878  }
36879
36880  protected void composeContractAnswerComponentInner(Contract.AnswerComponent element) throws IOException {
36881      composeBackbone(element);
36882      if (element.hasValue()) {
36883        composeType("value", element.getValue());
36884      }
36885  }
36886
36887  protected void composeContractContractAssetComponent(String name, Contract.ContractAssetComponent element) throws IOException {
36888    if (element != null) {
36889      open(name);
36890      composeContractContractAssetComponentInner(element);
36891      close();
36892    }
36893  }
36894
36895  protected void composeContractContractAssetComponentInner(Contract.ContractAssetComponent element) throws IOException {
36896      composeBackbone(element);
36897      if (element.hasScope()) {
36898        composeCodeableConcept("scope", element.getScope());
36899      }
36900      if (element.hasType()) {
36901        openArray("type");
36902        for (CodeableConcept e : element.getType()) 
36903          composeCodeableConcept(null, e);
36904        closeArray();
36905      };
36906      if (element.hasTypeReference()) {
36907        openArray("typeReference");
36908        for (Reference e : element.getTypeReference()) 
36909          composeReference(null, e);
36910        closeArray();
36911      };
36912      if (element.hasSubtype()) {
36913        openArray("subtype");
36914        for (CodeableConcept e : element.getSubtype()) 
36915          composeCodeableConcept(null, e);
36916        closeArray();
36917      };
36918      if (element.hasRelationship()) {
36919        composeCoding("relationship", element.getRelationship());
36920      }
36921      if (element.hasContext()) {
36922        openArray("context");
36923        for (Contract.AssetContextComponent e : element.getContext()) 
36924          composeContractAssetContextComponent(null, e);
36925        closeArray();
36926      };
36927      if (element.hasConditionElement()) {
36928        composeStringCore("condition", element.getConditionElement(), false);
36929        composeStringExtras("condition", element.getConditionElement(), false);
36930      }
36931      if (element.hasPeriodType()) {
36932        openArray("periodType");
36933        for (CodeableConcept e : element.getPeriodType()) 
36934          composeCodeableConcept(null, e);
36935        closeArray();
36936      };
36937      if (element.hasPeriod()) {
36938        openArray("period");
36939        for (Period e : element.getPeriod()) 
36940          composePeriod(null, e);
36941        closeArray();
36942      };
36943      if (element.hasUsePeriod()) {
36944        openArray("usePeriod");
36945        for (Period e : element.getUsePeriod()) 
36946          composePeriod(null, e);
36947        closeArray();
36948      };
36949      if (element.hasTextElement()) {
36950        composeStringCore("text", element.getTextElement(), false);
36951        composeStringExtras("text", element.getTextElement(), false);
36952      }
36953      if (element.hasLinkId()) {
36954        openArray("linkId");
36955        for (StringType e : element.getLinkId()) 
36956          composeStringCore(null, e, true);
36957        closeArray();
36958        if (anyHasExtras(element.getLinkId())) {
36959          openArray("_linkId");
36960          for (StringType e : element.getLinkId()) 
36961            composeStringExtras(null, e, true);
36962          closeArray();
36963        }
36964      };
36965      if (element.hasAnswer()) {
36966        openArray("answer");
36967        for (Contract.AnswerComponent e : element.getAnswer()) 
36968          composeContractAnswerComponent(null, e);
36969        closeArray();
36970      };
36971      if (element.hasSecurityLabelNumber()) {
36972        openArray("securityLabelNumber");
36973        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
36974          composeUnsignedIntCore(null, e, true);
36975        closeArray();
36976        if (anyHasExtras(element.getSecurityLabelNumber())) {
36977          openArray("_securityLabelNumber");
36978          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
36979            composeUnsignedIntExtras(null, e, true);
36980          closeArray();
36981        }
36982      };
36983      if (element.hasValuedItem()) {
36984        openArray("valuedItem");
36985        for (Contract.ValuedItemComponent e : element.getValuedItem()) 
36986          composeContractValuedItemComponent(null, e);
36987        closeArray();
36988      };
36989  }
36990
36991  protected void composeContractAssetContextComponent(String name, Contract.AssetContextComponent element) throws IOException {
36992    if (element != null) {
36993      open(name);
36994      composeContractAssetContextComponentInner(element);
36995      close();
36996    }
36997  }
36998
36999  protected void composeContractAssetContextComponentInner(Contract.AssetContextComponent element) throws IOException {
37000      composeBackbone(element);
37001      if (element.hasReference()) {
37002        composeReference("reference", element.getReference());
37003      }
37004      if (element.hasCode()) {
37005        openArray("code");
37006        for (CodeableConcept e : element.getCode()) 
37007          composeCodeableConcept(null, e);
37008        closeArray();
37009      };
37010      if (element.hasTextElement()) {
37011        composeStringCore("text", element.getTextElement(), false);
37012        composeStringExtras("text", element.getTextElement(), false);
37013      }
37014  }
37015
37016  protected void composeContractValuedItemComponent(String name, Contract.ValuedItemComponent element) throws IOException {
37017    if (element != null) {
37018      open(name);
37019      composeContractValuedItemComponentInner(element);
37020      close();
37021    }
37022  }
37023
37024  protected void composeContractValuedItemComponentInner(Contract.ValuedItemComponent element) throws IOException {
37025      composeBackbone(element);
37026      if (element.hasEntity()) {
37027        composeType("entity", element.getEntity());
37028      }
37029      if (element.hasIdentifier()) {
37030        composeIdentifier("identifier", element.getIdentifier());
37031      }
37032      if (element.hasEffectiveTimeElement()) {
37033        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
37034        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
37035      }
37036      if (element.hasQuantity()) {
37037        composeQuantity("quantity", element.getQuantity());
37038      }
37039      if (element.hasUnitPrice()) {
37040        composeMoney("unitPrice", element.getUnitPrice());
37041      }
37042      if (element.hasFactorElement()) {
37043        composeDecimalCore("factor", element.getFactorElement(), false);
37044        composeDecimalExtras("factor", element.getFactorElement(), false);
37045      }
37046      if (element.hasPointsElement()) {
37047        composeDecimalCore("points", element.getPointsElement(), false);
37048        composeDecimalExtras("points", element.getPointsElement(), false);
37049      }
37050      if (element.hasNet()) {
37051        composeMoney("net", element.getNet());
37052      }
37053      if (element.hasPaymentElement()) {
37054        composeStringCore("payment", element.getPaymentElement(), false);
37055        composeStringExtras("payment", element.getPaymentElement(), false);
37056      }
37057      if (element.hasPaymentDateElement()) {
37058        composeDateTimeCore("paymentDate", element.getPaymentDateElement(), false);
37059        composeDateTimeExtras("paymentDate", element.getPaymentDateElement(), false);
37060      }
37061      if (element.hasResponsible()) {
37062        composeReference("responsible", element.getResponsible());
37063      }
37064      if (element.hasRecipient()) {
37065        composeReference("recipient", element.getRecipient());
37066      }
37067      if (element.hasLinkId()) {
37068        openArray("linkId");
37069        for (StringType e : element.getLinkId()) 
37070          composeStringCore(null, e, true);
37071        closeArray();
37072        if (anyHasExtras(element.getLinkId())) {
37073          openArray("_linkId");
37074          for (StringType e : element.getLinkId()) 
37075            composeStringExtras(null, e, true);
37076          closeArray();
37077        }
37078      };
37079      if (element.hasSecurityLabelNumber()) {
37080        openArray("securityLabelNumber");
37081        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
37082          composeUnsignedIntCore(null, e, true);
37083        closeArray();
37084        if (anyHasExtras(element.getSecurityLabelNumber())) {
37085          openArray("_securityLabelNumber");
37086          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
37087            composeUnsignedIntExtras(null, e, true);
37088          closeArray();
37089        }
37090      };
37091  }
37092
37093  protected void composeContractActionComponent(String name, Contract.ActionComponent element) throws IOException {
37094    if (element != null) {
37095      open(name);
37096      composeContractActionComponentInner(element);
37097      close();
37098    }
37099  }
37100
37101  protected void composeContractActionComponentInner(Contract.ActionComponent element) throws IOException {
37102      composeBackbone(element);
37103      if (element.hasDoNotPerformElement()) {
37104        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
37105        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
37106      }
37107      if (element.hasType()) {
37108        composeCodeableConcept("type", element.getType());
37109      }
37110      if (element.hasSubject()) {
37111        openArray("subject");
37112        for (Contract.ActionSubjectComponent e : element.getSubject()) 
37113          composeContractActionSubjectComponent(null, e);
37114        closeArray();
37115      };
37116      if (element.hasIntent()) {
37117        composeCodeableConcept("intent", element.getIntent());
37118      }
37119      if (element.hasLinkId()) {
37120        openArray("linkId");
37121        for (StringType e : element.getLinkId()) 
37122          composeStringCore(null, e, true);
37123        closeArray();
37124        if (anyHasExtras(element.getLinkId())) {
37125          openArray("_linkId");
37126          for (StringType e : element.getLinkId()) 
37127            composeStringExtras(null, e, true);
37128          closeArray();
37129        }
37130      };
37131      if (element.hasStatus()) {
37132        composeCodeableConcept("status", element.getStatus());
37133      }
37134      if (element.hasContext()) {
37135        composeReference("context", element.getContext());
37136      }
37137      if (element.hasContextLinkId()) {
37138        openArray("contextLinkId");
37139        for (StringType e : element.getContextLinkId()) 
37140          composeStringCore(null, e, true);
37141        closeArray();
37142        if (anyHasExtras(element.getContextLinkId())) {
37143          openArray("_contextLinkId");
37144          for (StringType e : element.getContextLinkId()) 
37145            composeStringExtras(null, e, true);
37146          closeArray();
37147        }
37148      };
37149      if (element.hasOccurrence()) {
37150        composeType("occurrence", element.getOccurrence());
37151      }
37152      if (element.hasRequester()) {
37153        openArray("requester");
37154        for (Reference e : element.getRequester()) 
37155          composeReference(null, e);
37156        closeArray();
37157      };
37158      if (element.hasRequesterLinkId()) {
37159        openArray("requesterLinkId");
37160        for (StringType e : element.getRequesterLinkId()) 
37161          composeStringCore(null, e, true);
37162        closeArray();
37163        if (anyHasExtras(element.getRequesterLinkId())) {
37164          openArray("_requesterLinkId");
37165          for (StringType e : element.getRequesterLinkId()) 
37166            composeStringExtras(null, e, true);
37167          closeArray();
37168        }
37169      };
37170      if (element.hasPerformerType()) {
37171        openArray("performerType");
37172        for (CodeableConcept e : element.getPerformerType()) 
37173          composeCodeableConcept(null, e);
37174        closeArray();
37175      };
37176      if (element.hasPerformerRole()) {
37177        composeCodeableConcept("performerRole", element.getPerformerRole());
37178      }
37179      if (element.hasPerformer()) {
37180        composeReference("performer", element.getPerformer());
37181      }
37182      if (element.hasPerformerLinkId()) {
37183        openArray("performerLinkId");
37184        for (StringType e : element.getPerformerLinkId()) 
37185          composeStringCore(null, e, true);
37186        closeArray();
37187        if (anyHasExtras(element.getPerformerLinkId())) {
37188          openArray("_performerLinkId");
37189          for (StringType e : element.getPerformerLinkId()) 
37190            composeStringExtras(null, e, true);
37191          closeArray();
37192        }
37193      };
37194      if (element.hasReasonCode()) {
37195        openArray("reasonCode");
37196        for (CodeableConcept e : element.getReasonCode()) 
37197          composeCodeableConcept(null, e);
37198        closeArray();
37199      };
37200      if (element.hasReasonReference()) {
37201        openArray("reasonReference");
37202        for (Reference e : element.getReasonReference()) 
37203          composeReference(null, e);
37204        closeArray();
37205      };
37206      if (element.hasReason()) {
37207        openArray("reason");
37208        for (StringType e : element.getReason()) 
37209          composeStringCore(null, e, true);
37210        closeArray();
37211        if (anyHasExtras(element.getReason())) {
37212          openArray("_reason");
37213          for (StringType e : element.getReason()) 
37214            composeStringExtras(null, e, true);
37215          closeArray();
37216        }
37217      };
37218      if (element.hasReasonLinkId()) {
37219        openArray("reasonLinkId");
37220        for (StringType e : element.getReasonLinkId()) 
37221          composeStringCore(null, e, true);
37222        closeArray();
37223        if (anyHasExtras(element.getReasonLinkId())) {
37224          openArray("_reasonLinkId");
37225          for (StringType e : element.getReasonLinkId()) 
37226            composeStringExtras(null, e, true);
37227          closeArray();
37228        }
37229      };
37230      if (element.hasNote()) {
37231        openArray("note");
37232        for (Annotation e : element.getNote()) 
37233          composeAnnotation(null, e);
37234        closeArray();
37235      };
37236      if (element.hasSecurityLabelNumber()) {
37237        openArray("securityLabelNumber");
37238        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
37239          composeUnsignedIntCore(null, e, true);
37240        closeArray();
37241        if (anyHasExtras(element.getSecurityLabelNumber())) {
37242          openArray("_securityLabelNumber");
37243          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
37244            composeUnsignedIntExtras(null, e, true);
37245          closeArray();
37246        }
37247      };
37248  }
37249
37250  protected void composeContractActionSubjectComponent(String name, Contract.ActionSubjectComponent element) throws IOException {
37251    if (element != null) {
37252      open(name);
37253      composeContractActionSubjectComponentInner(element);
37254      close();
37255    }
37256  }
37257
37258  protected void composeContractActionSubjectComponentInner(Contract.ActionSubjectComponent element) throws IOException {
37259      composeBackbone(element);
37260      if (element.hasReference()) {
37261        openArray("reference");
37262        for (Reference e : element.getReference()) 
37263          composeReference(null, e);
37264        closeArray();
37265      };
37266      if (element.hasRole()) {
37267        composeCodeableConcept("role", element.getRole());
37268      }
37269  }
37270
37271  protected void composeContractSignatoryComponent(String name, Contract.SignatoryComponent element) throws IOException {
37272    if (element != null) {
37273      open(name);
37274      composeContractSignatoryComponentInner(element);
37275      close();
37276    }
37277  }
37278
37279  protected void composeContractSignatoryComponentInner(Contract.SignatoryComponent element) throws IOException {
37280      composeBackbone(element);
37281      if (element.hasType()) {
37282        composeCoding("type", element.getType());
37283      }
37284      if (element.hasParty()) {
37285        composeReference("party", element.getParty());
37286      }
37287      if (element.hasSignature()) {
37288        openArray("signature");
37289        for (Signature e : element.getSignature()) 
37290          composeSignature(null, e);
37291        closeArray();
37292      };
37293  }
37294
37295  protected void composeContractFriendlyLanguageComponent(String name, Contract.FriendlyLanguageComponent element) throws IOException {
37296    if (element != null) {
37297      open(name);
37298      composeContractFriendlyLanguageComponentInner(element);
37299      close();
37300    }
37301  }
37302
37303  protected void composeContractFriendlyLanguageComponentInner(Contract.FriendlyLanguageComponent element) throws IOException {
37304      composeBackbone(element);
37305      if (element.hasContent()) {
37306        composeType("content", element.getContent());
37307      }
37308  }
37309
37310  protected void composeContractLegalLanguageComponent(String name, Contract.LegalLanguageComponent element) throws IOException {
37311    if (element != null) {
37312      open(name);
37313      composeContractLegalLanguageComponentInner(element);
37314      close();
37315    }
37316  }
37317
37318  protected void composeContractLegalLanguageComponentInner(Contract.LegalLanguageComponent element) throws IOException {
37319      composeBackbone(element);
37320      if (element.hasContent()) {
37321        composeType("content", element.getContent());
37322      }
37323  }
37324
37325  protected void composeContractComputableLanguageComponent(String name, Contract.ComputableLanguageComponent element) throws IOException {
37326    if (element != null) {
37327      open(name);
37328      composeContractComputableLanguageComponentInner(element);
37329      close();
37330    }
37331  }
37332
37333  protected void composeContractComputableLanguageComponentInner(Contract.ComputableLanguageComponent element) throws IOException {
37334      composeBackbone(element);
37335      if (element.hasContent()) {
37336        composeType("content", element.getContent());
37337      }
37338  }
37339
37340  protected void composeCoverage(String name, Coverage element) throws IOException {
37341    if (element != null) {
37342      prop("resourceType", name);
37343      composeCoverageInner(element);
37344    }
37345  }
37346
37347  protected void composeCoverageInner(Coverage element) throws IOException {
37348      composeDomainResourceElements(element);
37349      if (element.hasIdentifier()) {
37350        openArray("identifier");
37351        for (Identifier e : element.getIdentifier()) 
37352          composeIdentifier(null, e);
37353        closeArray();
37354      };
37355      if (element.hasStatusElement()) {
37356        composeEnumerationCore("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
37357        composeEnumerationExtras("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
37358      }
37359      if (element.hasType()) {
37360        composeCodeableConcept("type", element.getType());
37361      }
37362      if (element.hasPolicyHolder()) {
37363        composeReference("policyHolder", element.getPolicyHolder());
37364      }
37365      if (element.hasSubscriber()) {
37366        composeReference("subscriber", element.getSubscriber());
37367      }
37368      if (element.hasSubscriberIdElement()) {
37369        composeStringCore("subscriberId", element.getSubscriberIdElement(), false);
37370        composeStringExtras("subscriberId", element.getSubscriberIdElement(), false);
37371      }
37372      if (element.hasBeneficiary()) {
37373        composeReference("beneficiary", element.getBeneficiary());
37374      }
37375      if (element.hasDependentElement()) {
37376        composeStringCore("dependent", element.getDependentElement(), false);
37377        composeStringExtras("dependent", element.getDependentElement(), false);
37378      }
37379      if (element.hasRelationship()) {
37380        composeCodeableConcept("relationship", element.getRelationship());
37381      }
37382      if (element.hasPeriod()) {
37383        composePeriod("period", element.getPeriod());
37384      }
37385      if (element.hasPayor()) {
37386        openArray("payor");
37387        for (Reference e : element.getPayor()) 
37388          composeReference(null, e);
37389        closeArray();
37390      };
37391      if (element.hasClass_()) {
37392        openArray("class");
37393        for (Coverage.ClassComponent e : element.getClass_()) 
37394          composeCoverageClassComponent(null, e);
37395        closeArray();
37396      };
37397      if (element.hasOrderElement()) {
37398        composePositiveIntCore("order", element.getOrderElement(), false);
37399        composePositiveIntExtras("order", element.getOrderElement(), false);
37400      }
37401      if (element.hasNetworkElement()) {
37402        composeStringCore("network", element.getNetworkElement(), false);
37403        composeStringExtras("network", element.getNetworkElement(), false);
37404      }
37405      if (element.hasCostToBeneficiary()) {
37406        openArray("costToBeneficiary");
37407        for (Coverage.CostToBeneficiaryComponent e : element.getCostToBeneficiary()) 
37408          composeCoverageCostToBeneficiaryComponent(null, e);
37409        closeArray();
37410      };
37411      if (element.hasSubrogationElement()) {
37412        composeBooleanCore("subrogation", element.getSubrogationElement(), false);
37413        composeBooleanExtras("subrogation", element.getSubrogationElement(), false);
37414      }
37415      if (element.hasContract()) {
37416        openArray("contract");
37417        for (Reference e : element.getContract()) 
37418          composeReference(null, e);
37419        closeArray();
37420      };
37421  }
37422
37423  protected void composeCoverageClassComponent(String name, Coverage.ClassComponent element) throws IOException {
37424    if (element != null) {
37425      open(name);
37426      composeCoverageClassComponentInner(element);
37427      close();
37428    }
37429  }
37430
37431  protected void composeCoverageClassComponentInner(Coverage.ClassComponent element) throws IOException {
37432      composeBackbone(element);
37433      if (element.hasType()) {
37434        composeCodeableConcept("type", element.getType());
37435      }
37436      if (element.hasValueElement()) {
37437        composeStringCore("value", element.getValueElement(), false);
37438        composeStringExtras("value", element.getValueElement(), false);
37439      }
37440      if (element.hasNameElement()) {
37441        composeStringCore("name", element.getNameElement(), false);
37442        composeStringExtras("name", element.getNameElement(), false);
37443      }
37444  }
37445
37446  protected void composeCoverageCostToBeneficiaryComponent(String name, Coverage.CostToBeneficiaryComponent element) throws IOException {
37447    if (element != null) {
37448      open(name);
37449      composeCoverageCostToBeneficiaryComponentInner(element);
37450      close();
37451    }
37452  }
37453
37454  protected void composeCoverageCostToBeneficiaryComponentInner(Coverage.CostToBeneficiaryComponent element) throws IOException {
37455      composeBackbone(element);
37456      if (element.hasType()) {
37457        composeCodeableConcept("type", element.getType());
37458      }
37459      if (element.hasValue()) {
37460        composeType("value", element.getValue());
37461      }
37462      if (element.hasException()) {
37463        openArray("exception");
37464        for (Coverage.ExemptionComponent e : element.getException()) 
37465          composeCoverageExemptionComponent(null, e);
37466        closeArray();
37467      };
37468  }
37469
37470  protected void composeCoverageExemptionComponent(String name, Coverage.ExemptionComponent element) throws IOException {
37471    if (element != null) {
37472      open(name);
37473      composeCoverageExemptionComponentInner(element);
37474      close();
37475    }
37476  }
37477
37478  protected void composeCoverageExemptionComponentInner(Coverage.ExemptionComponent element) throws IOException {
37479      composeBackbone(element);
37480      if (element.hasType()) {
37481        composeCodeableConcept("type", element.getType());
37482      }
37483      if (element.hasPeriod()) {
37484        composePeriod("period", element.getPeriod());
37485      }
37486  }
37487
37488  protected void composeCoverageEligibilityRequest(String name, CoverageEligibilityRequest element) throws IOException {
37489    if (element != null) {
37490      prop("resourceType", name);
37491      composeCoverageEligibilityRequestInner(element);
37492    }
37493  }
37494
37495  protected void composeCoverageEligibilityRequestInner(CoverageEligibilityRequest element) throws IOException {
37496      composeDomainResourceElements(element);
37497      if (element.hasIdentifier()) {
37498        openArray("identifier");
37499        for (Identifier e : element.getIdentifier()) 
37500          composeIdentifier(null, e);
37501        closeArray();
37502      };
37503      if (element.hasStatusElement()) {
37504        composeEnumerationCore("status", element.getStatusElement(), new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
37505        composeEnumerationExtras("status", element.getStatusElement(), new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
37506      }
37507      if (element.hasPriority()) {
37508        composeCodeableConcept("priority", element.getPriority());
37509      }
37510      if (element.hasPurpose()) {
37511        openArray("purpose");
37512        for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose()) 
37513          composeEnumerationCore(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), true);
37514        closeArray();
37515        if (anyHasExtras(element.getPurpose())) {
37516          openArray("_purpose");
37517          for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose()) 
37518            composeEnumerationExtras(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), true);
37519          closeArray();
37520        }
37521      };
37522      if (element.hasPatient()) {
37523        composeReference("patient", element.getPatient());
37524      }
37525      if (element.hasServiced()) {
37526        composeType("serviced", element.getServiced());
37527      }
37528      if (element.hasCreatedElement()) {
37529        composeDateTimeCore("created", element.getCreatedElement(), false);
37530        composeDateTimeExtras("created", element.getCreatedElement(), false);
37531      }
37532      if (element.hasEnterer()) {
37533        composeReference("enterer", element.getEnterer());
37534      }
37535      if (element.hasProvider()) {
37536        composeReference("provider", element.getProvider());
37537      }
37538      if (element.hasInsurer()) {
37539        composeReference("insurer", element.getInsurer());
37540      }
37541      if (element.hasFacility()) {
37542        composeReference("facility", element.getFacility());
37543      }
37544      if (element.hasSupportingInfo()) {
37545        openArray("supportingInfo");
37546        for (CoverageEligibilityRequest.SupportingInformationComponent e : element.getSupportingInfo()) 
37547          composeCoverageEligibilityRequestSupportingInformationComponent(null, e);
37548        closeArray();
37549      };
37550      if (element.hasInsurance()) {
37551        openArray("insurance");
37552        for (CoverageEligibilityRequest.InsuranceComponent e : element.getInsurance()) 
37553          composeCoverageEligibilityRequestInsuranceComponent(null, e);
37554        closeArray();
37555      };
37556      if (element.hasItem()) {
37557        openArray("item");
37558        for (CoverageEligibilityRequest.DetailsComponent e : element.getItem()) 
37559          composeCoverageEligibilityRequestDetailsComponent(null, e);
37560        closeArray();
37561      };
37562  }
37563
37564  protected void composeCoverageEligibilityRequestSupportingInformationComponent(String name, CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
37565    if (element != null) {
37566      open(name);
37567      composeCoverageEligibilityRequestSupportingInformationComponentInner(element);
37568      close();
37569    }
37570  }
37571
37572  protected void composeCoverageEligibilityRequestSupportingInformationComponentInner(CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
37573      composeBackbone(element);
37574      if (element.hasSequenceElement()) {
37575        composePositiveIntCore("sequence", element.getSequenceElement(), false);
37576        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
37577      }
37578      if (element.hasInformation()) {
37579        composeReference("information", element.getInformation());
37580      }
37581      if (element.hasAppliesToAllElement()) {
37582        composeBooleanCore("appliesToAll", element.getAppliesToAllElement(), false);
37583        composeBooleanExtras("appliesToAll", element.getAppliesToAllElement(), false);
37584      }
37585  }
37586
37587  protected void composeCoverageEligibilityRequestInsuranceComponent(String name, CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
37588    if (element != null) {
37589      open(name);
37590      composeCoverageEligibilityRequestInsuranceComponentInner(element);
37591      close();
37592    }
37593  }
37594
37595  protected void composeCoverageEligibilityRequestInsuranceComponentInner(CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
37596      composeBackbone(element);
37597      if (element.hasFocalElement()) {
37598        composeBooleanCore("focal", element.getFocalElement(), false);
37599        composeBooleanExtras("focal", element.getFocalElement(), false);
37600      }
37601      if (element.hasCoverage()) {
37602        composeReference("coverage", element.getCoverage());
37603      }
37604      if (element.hasBusinessArrangementElement()) {
37605        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
37606        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
37607      }
37608  }
37609
37610  protected void composeCoverageEligibilityRequestDetailsComponent(String name, CoverageEligibilityRequest.DetailsComponent element) throws IOException {
37611    if (element != null) {
37612      open(name);
37613      composeCoverageEligibilityRequestDetailsComponentInner(element);
37614      close();
37615    }
37616  }
37617
37618  protected void composeCoverageEligibilityRequestDetailsComponentInner(CoverageEligibilityRequest.DetailsComponent element) throws IOException {
37619      composeBackbone(element);
37620      if (element.hasSupportingInfoSequence()) {
37621        openArray("supportingInfoSequence");
37622        for (PositiveIntType e : element.getSupportingInfoSequence()) 
37623          composePositiveIntCore(null, e, true);
37624        closeArray();
37625        if (anyHasExtras(element.getSupportingInfoSequence())) {
37626          openArray("_supportingInfoSequence");
37627          for (PositiveIntType e : element.getSupportingInfoSequence()) 
37628            composePositiveIntExtras(null, e, true);
37629          closeArray();
37630        }
37631      };
37632      if (element.hasCategory()) {
37633        composeCodeableConcept("category", element.getCategory());
37634      }
37635      if (element.hasProductOrService()) {
37636        composeCodeableConcept("productOrService", element.getProductOrService());
37637      }
37638      if (element.hasModifier()) {
37639        openArray("modifier");
37640        for (CodeableConcept e : element.getModifier()) 
37641          composeCodeableConcept(null, e);
37642        closeArray();
37643      };
37644      if (element.hasProvider()) {
37645        composeReference("provider", element.getProvider());
37646      }
37647      if (element.hasQuantity()) {
37648        composeQuantity("quantity", element.getQuantity());
37649      }
37650      if (element.hasUnitPrice()) {
37651        composeMoney("unitPrice", element.getUnitPrice());
37652      }
37653      if (element.hasFacility()) {
37654        composeReference("facility", element.getFacility());
37655      }
37656      if (element.hasDiagnosis()) {
37657        openArray("diagnosis");
37658        for (CoverageEligibilityRequest.DiagnosisComponent e : element.getDiagnosis()) 
37659          composeCoverageEligibilityRequestDiagnosisComponent(null, e);
37660        closeArray();
37661      };
37662      if (element.hasDetail()) {
37663        openArray("detail");
37664        for (Reference e : element.getDetail()) 
37665          composeReference(null, e);
37666        closeArray();
37667      };
37668  }
37669
37670  protected void composeCoverageEligibilityRequestDiagnosisComponent(String name, CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
37671    if (element != null) {
37672      open(name);
37673      composeCoverageEligibilityRequestDiagnosisComponentInner(element);
37674      close();
37675    }
37676  }
37677
37678  protected void composeCoverageEligibilityRequestDiagnosisComponentInner(CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
37679      composeBackbone(element);
37680      if (element.hasDiagnosis()) {
37681        composeType("diagnosis", element.getDiagnosis());
37682      }
37683  }
37684
37685  protected void composeCoverageEligibilityResponse(String name, CoverageEligibilityResponse element) throws IOException {
37686    if (element != null) {
37687      prop("resourceType", name);
37688      composeCoverageEligibilityResponseInner(element);
37689    }
37690  }
37691
37692  protected void composeCoverageEligibilityResponseInner(CoverageEligibilityResponse element) throws IOException {
37693      composeDomainResourceElements(element);
37694      if (element.hasIdentifier()) {
37695        openArray("identifier");
37696        for (Identifier e : element.getIdentifier()) 
37697          composeIdentifier(null, e);
37698        closeArray();
37699      };
37700      if (element.hasStatusElement()) {
37701        composeEnumerationCore("status", element.getStatusElement(), new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
37702        composeEnumerationExtras("status", element.getStatusElement(), new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
37703      }
37704      if (element.hasPurpose()) {
37705        openArray("purpose");
37706        for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose()) 
37707          composeEnumerationCore(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), true);
37708        closeArray();
37709        if (anyHasExtras(element.getPurpose())) {
37710          openArray("_purpose");
37711          for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose()) 
37712            composeEnumerationExtras(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), true);
37713          closeArray();
37714        }
37715      };
37716      if (element.hasPatient()) {
37717        composeReference("patient", element.getPatient());
37718      }
37719      if (element.hasServiced()) {
37720        composeType("serviced", element.getServiced());
37721      }
37722      if (element.hasCreatedElement()) {
37723        composeDateTimeCore("created", element.getCreatedElement(), false);
37724        composeDateTimeExtras("created", element.getCreatedElement(), false);
37725      }
37726      if (element.hasRequestor()) {
37727        composeReference("requestor", element.getRequestor());
37728      }
37729      if (element.hasRequest()) {
37730        composeReference("request", element.getRequest());
37731      }
37732      if (element.hasOutcomeElement()) {
37733        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
37734        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
37735      }
37736      if (element.hasDispositionElement()) {
37737        composeStringCore("disposition", element.getDispositionElement(), false);
37738        composeStringExtras("disposition", element.getDispositionElement(), false);
37739      }
37740      if (element.hasInsurer()) {
37741        composeReference("insurer", element.getInsurer());
37742      }
37743      if (element.hasInsurance()) {
37744        openArray("insurance");
37745        for (CoverageEligibilityResponse.InsuranceComponent e : element.getInsurance()) 
37746          composeCoverageEligibilityResponseInsuranceComponent(null, e);
37747        closeArray();
37748      };
37749      if (element.hasPreAuthRefElement()) {
37750        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
37751        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
37752      }
37753      if (element.hasForm()) {
37754        composeCodeableConcept("form", element.getForm());
37755      }
37756      if (element.hasError()) {
37757        openArray("error");
37758        for (CoverageEligibilityResponse.ErrorsComponent e : element.getError()) 
37759          composeCoverageEligibilityResponseErrorsComponent(null, e);
37760        closeArray();
37761      };
37762  }
37763
37764  protected void composeCoverageEligibilityResponseInsuranceComponent(String name, CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
37765    if (element != null) {
37766      open(name);
37767      composeCoverageEligibilityResponseInsuranceComponentInner(element);
37768      close();
37769    }
37770  }
37771
37772  protected void composeCoverageEligibilityResponseInsuranceComponentInner(CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
37773      composeBackbone(element);
37774      if (element.hasCoverage()) {
37775        composeReference("coverage", element.getCoverage());
37776      }
37777      if (element.hasInforceElement()) {
37778        composeBooleanCore("inforce", element.getInforceElement(), false);
37779        composeBooleanExtras("inforce", element.getInforceElement(), false);
37780      }
37781      if (element.hasBenefitPeriod()) {
37782        composePeriod("benefitPeriod", element.getBenefitPeriod());
37783      }
37784      if (element.hasItem()) {
37785        openArray("item");
37786        for (CoverageEligibilityResponse.ItemsComponent e : element.getItem()) 
37787          composeCoverageEligibilityResponseItemsComponent(null, e);
37788        closeArray();
37789      };
37790  }
37791
37792  protected void composeCoverageEligibilityResponseItemsComponent(String name, CoverageEligibilityResponse.ItemsComponent element) throws IOException {
37793    if (element != null) {
37794      open(name);
37795      composeCoverageEligibilityResponseItemsComponentInner(element);
37796      close();
37797    }
37798  }
37799
37800  protected void composeCoverageEligibilityResponseItemsComponentInner(CoverageEligibilityResponse.ItemsComponent element) throws IOException {
37801      composeBackbone(element);
37802      if (element.hasCategory()) {
37803        composeCodeableConcept("category", element.getCategory());
37804      }
37805      if (element.hasProductOrService()) {
37806        composeCodeableConcept("productOrService", element.getProductOrService());
37807      }
37808      if (element.hasModifier()) {
37809        openArray("modifier");
37810        for (CodeableConcept e : element.getModifier()) 
37811          composeCodeableConcept(null, e);
37812        closeArray();
37813      };
37814      if (element.hasProvider()) {
37815        composeReference("provider", element.getProvider());
37816      }
37817      if (element.hasExcludedElement()) {
37818        composeBooleanCore("excluded", element.getExcludedElement(), false);
37819        composeBooleanExtras("excluded", element.getExcludedElement(), false);
37820      }
37821      if (element.hasNameElement()) {
37822        composeStringCore("name", element.getNameElement(), false);
37823        composeStringExtras("name", element.getNameElement(), false);
37824      }
37825      if (element.hasDescriptionElement()) {
37826        composeStringCore("description", element.getDescriptionElement(), false);
37827        composeStringExtras("description", element.getDescriptionElement(), false);
37828      }
37829      if (element.hasNetwork()) {
37830        composeCodeableConcept("network", element.getNetwork());
37831      }
37832      if (element.hasUnit()) {
37833        composeCodeableConcept("unit", element.getUnit());
37834      }
37835      if (element.hasTerm()) {
37836        composeCodeableConcept("term", element.getTerm());
37837      }
37838      if (element.hasBenefit()) {
37839        openArray("benefit");
37840        for (CoverageEligibilityResponse.BenefitComponent e : element.getBenefit()) 
37841          composeCoverageEligibilityResponseBenefitComponent(null, e);
37842        closeArray();
37843      };
37844      if (element.hasAuthorizationRequiredElement()) {
37845        composeBooleanCore("authorizationRequired", element.getAuthorizationRequiredElement(), false);
37846        composeBooleanExtras("authorizationRequired", element.getAuthorizationRequiredElement(), false);
37847      }
37848      if (element.hasAuthorizationSupporting()) {
37849        openArray("authorizationSupporting");
37850        for (CodeableConcept e : element.getAuthorizationSupporting()) 
37851          composeCodeableConcept(null, e);
37852        closeArray();
37853      };
37854      if (element.hasAuthorizationUrlElement()) {
37855        composeUriCore("authorizationUrl", element.getAuthorizationUrlElement(), false);
37856        composeUriExtras("authorizationUrl", element.getAuthorizationUrlElement(), false);
37857      }
37858  }
37859
37860  protected void composeCoverageEligibilityResponseBenefitComponent(String name, CoverageEligibilityResponse.BenefitComponent element) throws IOException {
37861    if (element != null) {
37862      open(name);
37863      composeCoverageEligibilityResponseBenefitComponentInner(element);
37864      close();
37865    }
37866  }
37867
37868  protected void composeCoverageEligibilityResponseBenefitComponentInner(CoverageEligibilityResponse.BenefitComponent element) throws IOException {
37869      composeBackbone(element);
37870      if (element.hasType()) {
37871        composeCodeableConcept("type", element.getType());
37872      }
37873      if (element.hasAllowed()) {
37874        composeType("allowed", element.getAllowed());
37875      }
37876      if (element.hasUsed()) {
37877        composeType("used", element.getUsed());
37878      }
37879  }
37880
37881  protected void composeCoverageEligibilityResponseErrorsComponent(String name, CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
37882    if (element != null) {
37883      open(name);
37884      composeCoverageEligibilityResponseErrorsComponentInner(element);
37885      close();
37886    }
37887  }
37888
37889  protected void composeCoverageEligibilityResponseErrorsComponentInner(CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
37890      composeBackbone(element);
37891      if (element.hasCode()) {
37892        composeCodeableConcept("code", element.getCode());
37893      }
37894  }
37895
37896  protected void composeDetectedIssue(String name, DetectedIssue element) throws IOException {
37897    if (element != null) {
37898      prop("resourceType", name);
37899      composeDetectedIssueInner(element);
37900    }
37901  }
37902
37903  protected void composeDetectedIssueInner(DetectedIssue element) throws IOException {
37904      composeDomainResourceElements(element);
37905      if (element.hasIdentifier()) {
37906        openArray("identifier");
37907        for (Identifier e : element.getIdentifier()) 
37908          composeIdentifier(null, e);
37909        closeArray();
37910      };
37911      if (element.hasStatusElement()) {
37912        composeEnumerationCore("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
37913        composeEnumerationExtras("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
37914      }
37915      if (element.hasCode()) {
37916        composeCodeableConcept("code", element.getCode());
37917      }
37918      if (element.hasSeverityElement()) {
37919        composeEnumerationCore("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
37920        composeEnumerationExtras("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
37921      }
37922      if (element.hasPatient()) {
37923        composeReference("patient", element.getPatient());
37924      }
37925      if (element.hasIdentified()) {
37926        composeType("identified", element.getIdentified());
37927      }
37928      if (element.hasAuthor()) {
37929        composeReference("author", element.getAuthor());
37930      }
37931      if (element.hasImplicated()) {
37932        openArray("implicated");
37933        for (Reference e : element.getImplicated()) 
37934          composeReference(null, e);
37935        closeArray();
37936      };
37937      if (element.hasEvidence()) {
37938        openArray("evidence");
37939        for (DetectedIssue.DetectedIssueEvidenceComponent e : element.getEvidence()) 
37940          composeDetectedIssueDetectedIssueEvidenceComponent(null, e);
37941        closeArray();
37942      };
37943      if (element.hasDetailElement()) {
37944        composeStringCore("detail", element.getDetailElement(), false);
37945        composeStringExtras("detail", element.getDetailElement(), false);
37946      }
37947      if (element.hasReferenceElement()) {
37948        composeUriCore("reference", element.getReferenceElement(), false);
37949        composeUriExtras("reference", element.getReferenceElement(), false);
37950      }
37951      if (element.hasMitigation()) {
37952        openArray("mitigation");
37953        for (DetectedIssue.DetectedIssueMitigationComponent e : element.getMitigation()) 
37954          composeDetectedIssueDetectedIssueMitigationComponent(null, e);
37955        closeArray();
37956      };
37957  }
37958
37959  protected void composeDetectedIssueDetectedIssueEvidenceComponent(String name, DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
37960    if (element != null) {
37961      open(name);
37962      composeDetectedIssueDetectedIssueEvidenceComponentInner(element);
37963      close();
37964    }
37965  }
37966
37967  protected void composeDetectedIssueDetectedIssueEvidenceComponentInner(DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
37968      composeBackbone(element);
37969      if (element.hasCode()) {
37970        openArray("code");
37971        for (CodeableConcept e : element.getCode()) 
37972          composeCodeableConcept(null, e);
37973        closeArray();
37974      };
37975      if (element.hasDetail()) {
37976        openArray("detail");
37977        for (Reference e : element.getDetail()) 
37978          composeReference(null, e);
37979        closeArray();
37980      };
37981  }
37982
37983  protected void composeDetectedIssueDetectedIssueMitigationComponent(String name, DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
37984    if (element != null) {
37985      open(name);
37986      composeDetectedIssueDetectedIssueMitigationComponentInner(element);
37987      close();
37988    }
37989  }
37990
37991  protected void composeDetectedIssueDetectedIssueMitigationComponentInner(DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
37992      composeBackbone(element);
37993      if (element.hasAction()) {
37994        composeCodeableConcept("action", element.getAction());
37995      }
37996      if (element.hasDateElement()) {
37997        composeDateTimeCore("date", element.getDateElement(), false);
37998        composeDateTimeExtras("date", element.getDateElement(), false);
37999      }
38000      if (element.hasAuthor()) {
38001        composeReference("author", element.getAuthor());
38002      }
38003  }
38004
38005  protected void composeDevice(String name, Device element) throws IOException {
38006    if (element != null) {
38007      prop("resourceType", name);
38008      composeDeviceInner(element);
38009    }
38010  }
38011
38012  protected void composeDeviceInner(Device element) throws IOException {
38013      composeDomainResourceElements(element);
38014      if (element.hasIdentifier()) {
38015        openArray("identifier");
38016        for (Identifier e : element.getIdentifier()) 
38017          composeIdentifier(null, e);
38018        closeArray();
38019      };
38020      if (element.hasDefinition()) {
38021        composeReference("definition", element.getDefinition());
38022      }
38023      if (element.hasUdiCarrier()) {
38024        openArray("udiCarrier");
38025        for (Device.DeviceUdiCarrierComponent e : element.getUdiCarrier()) 
38026          composeDeviceDeviceUdiCarrierComponent(null, e);
38027        closeArray();
38028      };
38029      if (element.hasStatusElement()) {
38030        composeEnumerationCore("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
38031        composeEnumerationExtras("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
38032      }
38033      if (element.hasStatusReason()) {
38034        openArray("statusReason");
38035        for (CodeableConcept e : element.getStatusReason()) 
38036          composeCodeableConcept(null, e);
38037        closeArray();
38038      };
38039      if (element.hasDistinctIdentifierElement()) {
38040        composeStringCore("distinctIdentifier", element.getDistinctIdentifierElement(), false);
38041        composeStringExtras("distinctIdentifier", element.getDistinctIdentifierElement(), false);
38042      }
38043      if (element.hasManufacturerElement()) {
38044        composeStringCore("manufacturer", element.getManufacturerElement(), false);
38045        composeStringExtras("manufacturer", element.getManufacturerElement(), false);
38046      }
38047      if (element.hasManufactureDateElement()) {
38048        composeDateTimeCore("manufactureDate", element.getManufactureDateElement(), false);
38049        composeDateTimeExtras("manufactureDate", element.getManufactureDateElement(), false);
38050      }
38051      if (element.hasExpirationDateElement()) {
38052        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
38053        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
38054      }
38055      if (element.hasLotNumberElement()) {
38056        composeStringCore("lotNumber", element.getLotNumberElement(), false);
38057        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
38058      }
38059      if (element.hasSerialNumberElement()) {
38060        composeStringCore("serialNumber", element.getSerialNumberElement(), false);
38061        composeStringExtras("serialNumber", element.getSerialNumberElement(), false);
38062      }
38063      if (element.hasDeviceName()) {
38064        openArray("deviceName");
38065        for (Device.DeviceDeviceNameComponent e : element.getDeviceName()) 
38066          composeDeviceDeviceDeviceNameComponent(null, e);
38067        closeArray();
38068      };
38069      if (element.hasModelNumberElement()) {
38070        composeStringCore("modelNumber", element.getModelNumberElement(), false);
38071        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
38072      }
38073      if (element.hasPartNumberElement()) {
38074        composeStringCore("partNumber", element.getPartNumberElement(), false);
38075        composeStringExtras("partNumber", element.getPartNumberElement(), false);
38076      }
38077      if (element.hasType()) {
38078        composeCodeableConcept("type", element.getType());
38079      }
38080      if (element.hasSpecialization()) {
38081        openArray("specialization");
38082        for (Device.DeviceSpecializationComponent e : element.getSpecialization()) 
38083          composeDeviceDeviceSpecializationComponent(null, e);
38084        closeArray();
38085      };
38086      if (element.hasVersion()) {
38087        openArray("version");
38088        for (Device.DeviceVersionComponent e : element.getVersion()) 
38089          composeDeviceDeviceVersionComponent(null, e);
38090        closeArray();
38091      };
38092      if (element.hasProperty()) {
38093        openArray("property");
38094        for (Device.DevicePropertyComponent e : element.getProperty()) 
38095          composeDeviceDevicePropertyComponent(null, e);
38096        closeArray();
38097      };
38098      if (element.hasPatient()) {
38099        composeReference("patient", element.getPatient());
38100      }
38101      if (element.hasOwner()) {
38102        composeReference("owner", element.getOwner());
38103      }
38104      if (element.hasContact()) {
38105        openArray("contact");
38106        for (ContactPoint e : element.getContact()) 
38107          composeContactPoint(null, e);
38108        closeArray();
38109      };
38110      if (element.hasLocation()) {
38111        composeReference("location", element.getLocation());
38112      }
38113      if (element.hasUrlElement()) {
38114        composeUriCore("url", element.getUrlElement(), false);
38115        composeUriExtras("url", element.getUrlElement(), false);
38116      }
38117      if (element.hasNote()) {
38118        openArray("note");
38119        for (Annotation e : element.getNote()) 
38120          composeAnnotation(null, e);
38121        closeArray();
38122      };
38123      if (element.hasSafety()) {
38124        openArray("safety");
38125        for (CodeableConcept e : element.getSafety()) 
38126          composeCodeableConcept(null, e);
38127        closeArray();
38128      };
38129      if (element.hasParent()) {
38130        composeReference("parent", element.getParent());
38131      }
38132  }
38133
38134  protected void composeDeviceDeviceUdiCarrierComponent(String name, Device.DeviceUdiCarrierComponent element) throws IOException {
38135    if (element != null) {
38136      open(name);
38137      composeDeviceDeviceUdiCarrierComponentInner(element);
38138      close();
38139    }
38140  }
38141
38142  protected void composeDeviceDeviceUdiCarrierComponentInner(Device.DeviceUdiCarrierComponent element) throws IOException {
38143      composeBackbone(element);
38144      if (element.hasDeviceIdentifierElement()) {
38145        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
38146        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
38147      }
38148      if (element.hasIssuerElement()) {
38149        composeUriCore("issuer", element.getIssuerElement(), false);
38150        composeUriExtras("issuer", element.getIssuerElement(), false);
38151      }
38152      if (element.hasJurisdictionElement()) {
38153        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
38154        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
38155      }
38156      if (element.hasCarrierAIDCElement()) {
38157        composeBase64BinaryCore("carrierAIDC", element.getCarrierAIDCElement(), false);
38158        composeBase64BinaryExtras("carrierAIDC", element.getCarrierAIDCElement(), false);
38159      }
38160      if (element.hasCarrierHRFElement()) {
38161        composeStringCore("carrierHRF", element.getCarrierHRFElement(), false);
38162        composeStringExtras("carrierHRF", element.getCarrierHRFElement(), false);
38163      }
38164      if (element.hasEntryTypeElement()) {
38165        composeEnumerationCore("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
38166        composeEnumerationExtras("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
38167      }
38168  }
38169
38170  protected void composeDeviceDeviceDeviceNameComponent(String name, Device.DeviceDeviceNameComponent element) throws IOException {
38171    if (element != null) {
38172      open(name);
38173      composeDeviceDeviceDeviceNameComponentInner(element);
38174      close();
38175    }
38176  }
38177
38178  protected void composeDeviceDeviceDeviceNameComponentInner(Device.DeviceDeviceNameComponent element) throws IOException {
38179      composeBackbone(element);
38180      if (element.hasNameElement()) {
38181        composeStringCore("name", element.getNameElement(), false);
38182        composeStringExtras("name", element.getNameElement(), false);
38183      }
38184      if (element.hasTypeElement()) {
38185        composeEnumerationCore("type", element.getTypeElement(), new Device.DeviceNameTypeEnumFactory(), false);
38186        composeEnumerationExtras("type", element.getTypeElement(), new Device.DeviceNameTypeEnumFactory(), false);
38187      }
38188  }
38189
38190  protected void composeDeviceDeviceSpecializationComponent(String name, Device.DeviceSpecializationComponent element) throws IOException {
38191    if (element != null) {
38192      open(name);
38193      composeDeviceDeviceSpecializationComponentInner(element);
38194      close();
38195    }
38196  }
38197
38198  protected void composeDeviceDeviceSpecializationComponentInner(Device.DeviceSpecializationComponent element) throws IOException {
38199      composeBackbone(element);
38200      if (element.hasSystemType()) {
38201        composeCodeableConcept("systemType", element.getSystemType());
38202      }
38203      if (element.hasVersionElement()) {
38204        composeStringCore("version", element.getVersionElement(), false);
38205        composeStringExtras("version", element.getVersionElement(), false);
38206      }
38207  }
38208
38209  protected void composeDeviceDeviceVersionComponent(String name, Device.DeviceVersionComponent element) throws IOException {
38210    if (element != null) {
38211      open(name);
38212      composeDeviceDeviceVersionComponentInner(element);
38213      close();
38214    }
38215  }
38216
38217  protected void composeDeviceDeviceVersionComponentInner(Device.DeviceVersionComponent element) throws IOException {
38218      composeBackbone(element);
38219      if (element.hasType()) {
38220        composeCodeableConcept("type", element.getType());
38221      }
38222      if (element.hasComponent()) {
38223        composeIdentifier("component", element.getComponent());
38224      }
38225      if (element.hasValueElement()) {
38226        composeStringCore("value", element.getValueElement(), false);
38227        composeStringExtras("value", element.getValueElement(), false);
38228      }
38229  }
38230
38231  protected void composeDeviceDevicePropertyComponent(String name, Device.DevicePropertyComponent element) throws IOException {
38232    if (element != null) {
38233      open(name);
38234      composeDeviceDevicePropertyComponentInner(element);
38235      close();
38236    }
38237  }
38238
38239  protected void composeDeviceDevicePropertyComponentInner(Device.DevicePropertyComponent element) throws IOException {
38240      composeBackbone(element);
38241      if (element.hasType()) {
38242        composeCodeableConcept("type", element.getType());
38243      }
38244      if (element.hasValueQuantity()) {
38245        openArray("valueQuantity");
38246        for (Quantity e : element.getValueQuantity()) 
38247          composeQuantity(null, e);
38248        closeArray();
38249      };
38250      if (element.hasValueCode()) {
38251        openArray("valueCode");
38252        for (CodeableConcept e : element.getValueCode()) 
38253          composeCodeableConcept(null, e);
38254        closeArray();
38255      };
38256  }
38257
38258  protected void composeDeviceDefinition(String name, DeviceDefinition element) throws IOException {
38259    if (element != null) {
38260      prop("resourceType", name);
38261      composeDeviceDefinitionInner(element);
38262    }
38263  }
38264
38265  protected void composeDeviceDefinitionInner(DeviceDefinition element) throws IOException {
38266      composeDomainResourceElements(element);
38267      if (element.hasIdentifier()) {
38268        openArray("identifier");
38269        for (Identifier e : element.getIdentifier()) 
38270          composeIdentifier(null, e);
38271        closeArray();
38272      };
38273      if (element.hasUdiDeviceIdentifier()) {
38274        openArray("udiDeviceIdentifier");
38275        for (DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent e : element.getUdiDeviceIdentifier()) 
38276          composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(null, e);
38277        closeArray();
38278      };
38279      if (element.hasManufacturer()) {
38280        composeType("manufacturer", element.getManufacturer());
38281      }
38282      if (element.hasDeviceName()) {
38283        openArray("deviceName");
38284        for (DeviceDefinition.DeviceDefinitionDeviceNameComponent e : element.getDeviceName()) 
38285          composeDeviceDefinitionDeviceDefinitionDeviceNameComponent(null, e);
38286        closeArray();
38287      };
38288      if (element.hasModelNumberElement()) {
38289        composeStringCore("modelNumber", element.getModelNumberElement(), false);
38290        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
38291      }
38292      if (element.hasType()) {
38293        composeCodeableConcept("type", element.getType());
38294      }
38295      if (element.hasSpecialization()) {
38296        openArray("specialization");
38297        for (DeviceDefinition.DeviceDefinitionSpecializationComponent e : element.getSpecialization()) 
38298          composeDeviceDefinitionDeviceDefinitionSpecializationComponent(null, e);
38299        closeArray();
38300      };
38301      if (element.hasVersion()) {
38302        openArray("version");
38303        for (StringType e : element.getVersion()) 
38304          composeStringCore(null, e, true);
38305        closeArray();
38306        if (anyHasExtras(element.getVersion())) {
38307          openArray("_version");
38308          for (StringType e : element.getVersion()) 
38309            composeStringExtras(null, e, true);
38310          closeArray();
38311        }
38312      };
38313      if (element.hasSafety()) {
38314        openArray("safety");
38315        for (CodeableConcept e : element.getSafety()) 
38316          composeCodeableConcept(null, e);
38317        closeArray();
38318      };
38319      if (element.hasShelfLifeStorage()) {
38320        openArray("shelfLifeStorage");
38321        for (ProductShelfLife e : element.getShelfLifeStorage()) 
38322          composeProductShelfLife(null, e);
38323        closeArray();
38324      };
38325      if (element.hasPhysicalCharacteristics()) {
38326        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
38327      }
38328      if (element.hasLanguageCode()) {
38329        openArray("languageCode");
38330        for (CodeableConcept e : element.getLanguageCode()) 
38331          composeCodeableConcept(null, e);
38332        closeArray();
38333      };
38334      if (element.hasCapability()) {
38335        openArray("capability");
38336        for (DeviceDefinition.DeviceDefinitionCapabilityComponent e : element.getCapability()) 
38337          composeDeviceDefinitionDeviceDefinitionCapabilityComponent(null, e);
38338        closeArray();
38339      };
38340      if (element.hasProperty()) {
38341        openArray("property");
38342        for (DeviceDefinition.DeviceDefinitionPropertyComponent e : element.getProperty()) 
38343          composeDeviceDefinitionDeviceDefinitionPropertyComponent(null, e);
38344        closeArray();
38345      };
38346      if (element.hasOwner()) {
38347        composeReference("owner", element.getOwner());
38348      }
38349      if (element.hasContact()) {
38350        openArray("contact");
38351        for (ContactPoint e : element.getContact()) 
38352          composeContactPoint(null, e);
38353        closeArray();
38354      };
38355      if (element.hasUrlElement()) {
38356        composeUriCore("url", element.getUrlElement(), false);
38357        composeUriExtras("url", element.getUrlElement(), false);
38358      }
38359      if (element.hasOnlineInformationElement()) {
38360        composeUriCore("onlineInformation", element.getOnlineInformationElement(), false);
38361        composeUriExtras("onlineInformation", element.getOnlineInformationElement(), false);
38362      }
38363      if (element.hasNote()) {
38364        openArray("note");
38365        for (Annotation e : element.getNote()) 
38366          composeAnnotation(null, e);
38367        closeArray();
38368      };
38369      if (element.hasQuantity()) {
38370        composeQuantity("quantity", element.getQuantity());
38371      }
38372      if (element.hasParentDevice()) {
38373        composeReference("parentDevice", element.getParentDevice());
38374      }
38375      if (element.hasMaterial()) {
38376        openArray("material");
38377        for (DeviceDefinition.DeviceDefinitionMaterialComponent e : element.getMaterial()) 
38378          composeDeviceDefinitionDeviceDefinitionMaterialComponent(null, e);
38379        closeArray();
38380      };
38381  }
38382
38383  protected void composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(String name, DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
38384    if (element != null) {
38385      open(name);
38386      composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentInner(element);
38387      close();
38388    }
38389  }
38390
38391  protected void composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentInner(DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
38392      composeBackbone(element);
38393      if (element.hasDeviceIdentifierElement()) {
38394        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
38395        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
38396      }
38397      if (element.hasIssuerElement()) {
38398        composeUriCore("issuer", element.getIssuerElement(), false);
38399        composeUriExtras("issuer", element.getIssuerElement(), false);
38400      }
38401      if (element.hasJurisdictionElement()) {
38402        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
38403        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
38404      }
38405  }
38406
38407  protected void composeDeviceDefinitionDeviceDefinitionDeviceNameComponent(String name, DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
38408    if (element != null) {
38409      open(name);
38410      composeDeviceDefinitionDeviceDefinitionDeviceNameComponentInner(element);
38411      close();
38412    }
38413  }
38414
38415  protected void composeDeviceDefinitionDeviceDefinitionDeviceNameComponentInner(DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
38416      composeBackbone(element);
38417      if (element.hasNameElement()) {
38418        composeStringCore("name", element.getNameElement(), false);
38419        composeStringExtras("name", element.getNameElement(), false);
38420      }
38421      if (element.hasTypeElement()) {
38422        composeEnumerationCore("type", element.getTypeElement(), new DeviceDefinition.DeviceNameTypeEnumFactory(), false);
38423        composeEnumerationExtras("type", element.getTypeElement(), new DeviceDefinition.DeviceNameTypeEnumFactory(), false);
38424      }
38425  }
38426
38427  protected void composeDeviceDefinitionDeviceDefinitionSpecializationComponent(String name, DeviceDefinition.DeviceDefinitionSpecializationComponent element) throws IOException {
38428    if (element != null) {
38429      open(name);
38430      composeDeviceDefinitionDeviceDefinitionSpecializationComponentInner(element);
38431      close();
38432    }
38433  }
38434
38435  protected void composeDeviceDefinitionDeviceDefinitionSpecializationComponentInner(DeviceDefinition.DeviceDefinitionSpecializationComponent element) throws IOException {
38436      composeBackbone(element);
38437      if (element.hasSystemTypeElement()) {
38438        composeStringCore("systemType", element.getSystemTypeElement(), false);
38439        composeStringExtras("systemType", element.getSystemTypeElement(), false);
38440      }
38441      if (element.hasVersionElement()) {
38442        composeStringCore("version", element.getVersionElement(), false);
38443        composeStringExtras("version", element.getVersionElement(), false);
38444      }
38445  }
38446
38447  protected void composeDeviceDefinitionDeviceDefinitionCapabilityComponent(String name, DeviceDefinition.DeviceDefinitionCapabilityComponent element) throws IOException {
38448    if (element != null) {
38449      open(name);
38450      composeDeviceDefinitionDeviceDefinitionCapabilityComponentInner(element);
38451      close();
38452    }
38453  }
38454
38455  protected void composeDeviceDefinitionDeviceDefinitionCapabilityComponentInner(DeviceDefinition.DeviceDefinitionCapabilityComponent element) throws IOException {
38456      composeBackbone(element);
38457      if (element.hasType()) {
38458        composeCodeableConcept("type", element.getType());
38459      }
38460      if (element.hasDescription()) {
38461        openArray("description");
38462        for (CodeableConcept e : element.getDescription()) 
38463          composeCodeableConcept(null, e);
38464        closeArray();
38465      };
38466  }
38467
38468  protected void composeDeviceDefinitionDeviceDefinitionPropertyComponent(String name, DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
38469    if (element != null) {
38470      open(name);
38471      composeDeviceDefinitionDeviceDefinitionPropertyComponentInner(element);
38472      close();
38473    }
38474  }
38475
38476  protected void composeDeviceDefinitionDeviceDefinitionPropertyComponentInner(DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
38477      composeBackbone(element);
38478      if (element.hasType()) {
38479        composeCodeableConcept("type", element.getType());
38480      }
38481      if (element.hasValueQuantity()) {
38482        openArray("valueQuantity");
38483        for (Quantity e : element.getValueQuantity()) 
38484          composeQuantity(null, e);
38485        closeArray();
38486      };
38487      if (element.hasValueCode()) {
38488        openArray("valueCode");
38489        for (CodeableConcept e : element.getValueCode()) 
38490          composeCodeableConcept(null, e);
38491        closeArray();
38492      };
38493  }
38494
38495  protected void composeDeviceDefinitionDeviceDefinitionMaterialComponent(String name, DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
38496    if (element != null) {
38497      open(name);
38498      composeDeviceDefinitionDeviceDefinitionMaterialComponentInner(element);
38499      close();
38500    }
38501  }
38502
38503  protected void composeDeviceDefinitionDeviceDefinitionMaterialComponentInner(DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
38504      composeBackbone(element);
38505      if (element.hasSubstance()) {
38506        composeCodeableConcept("substance", element.getSubstance());
38507      }
38508      if (element.hasAlternateElement()) {
38509        composeBooleanCore("alternate", element.getAlternateElement(), false);
38510        composeBooleanExtras("alternate", element.getAlternateElement(), false);
38511      }
38512      if (element.hasAllergenicIndicatorElement()) {
38513        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
38514        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
38515      }
38516  }
38517
38518  protected void composeDeviceMetric(String name, DeviceMetric element) throws IOException {
38519    if (element != null) {
38520      prop("resourceType", name);
38521      composeDeviceMetricInner(element);
38522    }
38523  }
38524
38525  protected void composeDeviceMetricInner(DeviceMetric element) throws IOException {
38526      composeDomainResourceElements(element);
38527      if (element.hasIdentifier()) {
38528        openArray("identifier");
38529        for (Identifier e : element.getIdentifier()) 
38530          composeIdentifier(null, e);
38531        closeArray();
38532      };
38533      if (element.hasType()) {
38534        composeCodeableConcept("type", element.getType());
38535      }
38536      if (element.hasUnit()) {
38537        composeCodeableConcept("unit", element.getUnit());
38538      }
38539      if (element.hasSource()) {
38540        composeReference("source", element.getSource());
38541      }
38542      if (element.hasParent()) {
38543        composeReference("parent", element.getParent());
38544      }
38545      if (element.hasOperationalStatusElement()) {
38546        composeEnumerationCore("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
38547        composeEnumerationExtras("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
38548      }
38549      if (element.hasColorElement()) {
38550        composeEnumerationCore("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
38551        composeEnumerationExtras("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
38552      }
38553      if (element.hasCategoryElement()) {
38554        composeEnumerationCore("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
38555        composeEnumerationExtras("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
38556      }
38557      if (element.hasMeasurementPeriod()) {
38558        composeTiming("measurementPeriod", element.getMeasurementPeriod());
38559      }
38560      if (element.hasCalibration()) {
38561        openArray("calibration");
38562        for (DeviceMetric.DeviceMetricCalibrationComponent e : element.getCalibration()) 
38563          composeDeviceMetricDeviceMetricCalibrationComponent(null, e);
38564        closeArray();
38565      };
38566  }
38567
38568  protected void composeDeviceMetricDeviceMetricCalibrationComponent(String name, DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
38569    if (element != null) {
38570      open(name);
38571      composeDeviceMetricDeviceMetricCalibrationComponentInner(element);
38572      close();
38573    }
38574  }
38575
38576  protected void composeDeviceMetricDeviceMetricCalibrationComponentInner(DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
38577      composeBackbone(element);
38578      if (element.hasTypeElement()) {
38579        composeEnumerationCore("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
38580        composeEnumerationExtras("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
38581      }
38582      if (element.hasStateElement()) {
38583        composeEnumerationCore("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
38584        composeEnumerationExtras("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
38585      }
38586      if (element.hasTimeElement()) {
38587        composeInstantCore("time", element.getTimeElement(), false);
38588        composeInstantExtras("time", element.getTimeElement(), false);
38589      }
38590  }
38591
38592  protected void composeDeviceRequest(String name, DeviceRequest element) throws IOException {
38593    if (element != null) {
38594      prop("resourceType", name);
38595      composeDeviceRequestInner(element);
38596    }
38597  }
38598
38599  protected void composeDeviceRequestInner(DeviceRequest element) throws IOException {
38600      composeDomainResourceElements(element);
38601      if (element.hasIdentifier()) {
38602        openArray("identifier");
38603        for (Identifier e : element.getIdentifier()) 
38604          composeIdentifier(null, e);
38605        closeArray();
38606      };
38607      if (element.hasInstantiatesCanonical()) {
38608        openArray("instantiatesCanonical");
38609        for (CanonicalType e : element.getInstantiatesCanonical()) 
38610          composeCanonicalCore(null, e, true);
38611        closeArray();
38612        if (anyHasExtras(element.getInstantiatesCanonical())) {
38613          openArray("_instantiatesCanonical");
38614          for (CanonicalType e : element.getInstantiatesCanonical()) 
38615            composeCanonicalExtras(null, e, true);
38616          closeArray();
38617        }
38618      };
38619      if (element.hasInstantiatesUri()) {
38620        openArray("instantiatesUri");
38621        for (UriType e : element.getInstantiatesUri()) 
38622          composeUriCore(null, e, true);
38623        closeArray();
38624        if (anyHasExtras(element.getInstantiatesUri())) {
38625          openArray("_instantiatesUri");
38626          for (UriType e : element.getInstantiatesUri()) 
38627            composeUriExtras(null, e, true);
38628          closeArray();
38629        }
38630      };
38631      if (element.hasBasedOn()) {
38632        openArray("basedOn");
38633        for (Reference e : element.getBasedOn()) 
38634          composeReference(null, e);
38635        closeArray();
38636      };
38637      if (element.hasPriorRequest()) {
38638        openArray("priorRequest");
38639        for (Reference e : element.getPriorRequest()) 
38640          composeReference(null, e);
38641        closeArray();
38642      };
38643      if (element.hasGroupIdentifier()) {
38644        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
38645      }
38646      if (element.hasStatusElement()) {
38647        composeEnumerationCore("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(), false);
38648        composeEnumerationExtras("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(), false);
38649      }
38650      if (element.hasIntentElement()) {
38651        composeEnumerationCore("intent", element.getIntentElement(), new DeviceRequest.RequestIntentEnumFactory(), false);
38652        composeEnumerationExtras("intent", element.getIntentElement(), new DeviceRequest.RequestIntentEnumFactory(), false);
38653      }
38654      if (element.hasPriorityElement()) {
38655        composeEnumerationCore("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(), false);
38656        composeEnumerationExtras("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(), false);
38657      }
38658      if (element.hasCode()) {
38659        composeType("code", element.getCode());
38660      }
38661      if (element.hasParameter()) {
38662        openArray("parameter");
38663        for (DeviceRequest.DeviceRequestParameterComponent e : element.getParameter()) 
38664          composeDeviceRequestDeviceRequestParameterComponent(null, e);
38665        closeArray();
38666      };
38667      if (element.hasSubject()) {
38668        composeReference("subject", element.getSubject());
38669      }
38670      if (element.hasEncounter()) {
38671        composeReference("encounter", element.getEncounter());
38672      }
38673      if (element.hasOccurrence()) {
38674        composeType("occurrence", element.getOccurrence());
38675      }
38676      if (element.hasAuthoredOnElement()) {
38677        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
38678        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
38679      }
38680      if (element.hasRequester()) {
38681        composeReference("requester", element.getRequester());
38682      }
38683      if (element.hasPerformerType()) {
38684        composeCodeableConcept("performerType", element.getPerformerType());
38685      }
38686      if (element.hasPerformer()) {
38687        composeReference("performer", element.getPerformer());
38688      }
38689      if (element.hasReasonCode()) {
38690        openArray("reasonCode");
38691        for (CodeableConcept e : element.getReasonCode()) 
38692          composeCodeableConcept(null, e);
38693        closeArray();
38694      };
38695      if (element.hasReasonReference()) {
38696        openArray("reasonReference");
38697        for (Reference e : element.getReasonReference()) 
38698          composeReference(null, e);
38699        closeArray();
38700      };
38701      if (element.hasInsurance()) {
38702        openArray("insurance");
38703        for (Reference e : element.getInsurance()) 
38704          composeReference(null, e);
38705        closeArray();
38706      };
38707      if (element.hasSupportingInfo()) {
38708        openArray("supportingInfo");
38709        for (Reference e : element.getSupportingInfo()) 
38710          composeReference(null, e);
38711        closeArray();
38712      };
38713      if (element.hasNote()) {
38714        openArray("note");
38715        for (Annotation e : element.getNote()) 
38716          composeAnnotation(null, e);
38717        closeArray();
38718      };
38719      if (element.hasRelevantHistory()) {
38720        openArray("relevantHistory");
38721        for (Reference e : element.getRelevantHistory()) 
38722          composeReference(null, e);
38723        closeArray();
38724      };
38725  }
38726
38727  protected void composeDeviceRequestDeviceRequestParameterComponent(String name, DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
38728    if (element != null) {
38729      open(name);
38730      composeDeviceRequestDeviceRequestParameterComponentInner(element);
38731      close();
38732    }
38733  }
38734
38735  protected void composeDeviceRequestDeviceRequestParameterComponentInner(DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
38736      composeBackbone(element);
38737      if (element.hasCode()) {
38738        composeCodeableConcept("code", element.getCode());
38739      }
38740      if (element.hasValue()) {
38741        composeType("value", element.getValue());
38742      }
38743  }
38744
38745  protected void composeDeviceUseStatement(String name, DeviceUseStatement element) throws IOException {
38746    if (element != null) {
38747      prop("resourceType", name);
38748      composeDeviceUseStatementInner(element);
38749    }
38750  }
38751
38752  protected void composeDeviceUseStatementInner(DeviceUseStatement element) throws IOException {
38753      composeDomainResourceElements(element);
38754      if (element.hasIdentifier()) {
38755        openArray("identifier");
38756        for (Identifier e : element.getIdentifier()) 
38757          composeIdentifier(null, e);
38758        closeArray();
38759      };
38760      if (element.hasBasedOn()) {
38761        openArray("basedOn");
38762        for (Reference e : element.getBasedOn()) 
38763          composeReference(null, e);
38764        closeArray();
38765      };
38766      if (element.hasStatusElement()) {
38767        composeEnumerationCore("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
38768        composeEnumerationExtras("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
38769      }
38770      if (element.hasSubject()) {
38771        composeReference("subject", element.getSubject());
38772      }
38773      if (element.hasDerivedFrom()) {
38774        openArray("derivedFrom");
38775        for (Reference e : element.getDerivedFrom()) 
38776          composeReference(null, e);
38777        closeArray();
38778      };
38779      if (element.hasTiming()) {
38780        composeType("timing", element.getTiming());
38781      }
38782      if (element.hasRecordedOnElement()) {
38783        composeDateTimeCore("recordedOn", element.getRecordedOnElement(), false);
38784        composeDateTimeExtras("recordedOn", element.getRecordedOnElement(), false);
38785      }
38786      if (element.hasSource()) {
38787        composeReference("source", element.getSource());
38788      }
38789      if (element.hasDevice()) {
38790        composeReference("device", element.getDevice());
38791      }
38792      if (element.hasReasonCode()) {
38793        openArray("reasonCode");
38794        for (CodeableConcept e : element.getReasonCode()) 
38795          composeCodeableConcept(null, e);
38796        closeArray();
38797      };
38798      if (element.hasReasonReference()) {
38799        openArray("reasonReference");
38800        for (Reference e : element.getReasonReference()) 
38801          composeReference(null, e);
38802        closeArray();
38803      };
38804      if (element.hasBodySite()) {
38805        composeCodeableConcept("bodySite", element.getBodySite());
38806      }
38807      if (element.hasNote()) {
38808        openArray("note");
38809        for (Annotation e : element.getNote()) 
38810          composeAnnotation(null, e);
38811        closeArray();
38812      };
38813  }
38814
38815  protected void composeDiagnosticReport(String name, DiagnosticReport element) throws IOException {
38816    if (element != null) {
38817      prop("resourceType", name);
38818      composeDiagnosticReportInner(element);
38819    }
38820  }
38821
38822  protected void composeDiagnosticReportInner(DiagnosticReport element) throws IOException {
38823      composeDomainResourceElements(element);
38824      if (element.hasIdentifier()) {
38825        openArray("identifier");
38826        for (Identifier e : element.getIdentifier()) 
38827          composeIdentifier(null, e);
38828        closeArray();
38829      };
38830      if (element.hasBasedOn()) {
38831        openArray("basedOn");
38832        for (Reference e : element.getBasedOn()) 
38833          composeReference(null, e);
38834        closeArray();
38835      };
38836      if (element.hasStatusElement()) {
38837        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
38838        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
38839      }
38840      if (element.hasCategory()) {
38841        openArray("category");
38842        for (CodeableConcept e : element.getCategory()) 
38843          composeCodeableConcept(null, e);
38844        closeArray();
38845      };
38846      if (element.hasCode()) {
38847        composeCodeableConcept("code", element.getCode());
38848      }
38849      if (element.hasSubject()) {
38850        composeReference("subject", element.getSubject());
38851      }
38852      if (element.hasEncounter()) {
38853        composeReference("encounter", element.getEncounter());
38854      }
38855      if (element.hasEffective()) {
38856        composeType("effective", element.getEffective());
38857      }
38858      if (element.hasIssuedElement()) {
38859        composeInstantCore("issued", element.getIssuedElement(), false);
38860        composeInstantExtras("issued", element.getIssuedElement(), false);
38861      }
38862      if (element.hasPerformer()) {
38863        openArray("performer");
38864        for (Reference e : element.getPerformer()) 
38865          composeReference(null, e);
38866        closeArray();
38867      };
38868      if (element.hasResultsInterpreter()) {
38869        openArray("resultsInterpreter");
38870        for (Reference e : element.getResultsInterpreter()) 
38871          composeReference(null, e);
38872        closeArray();
38873      };
38874      if (element.hasSpecimen()) {
38875        openArray("specimen");
38876        for (Reference e : element.getSpecimen()) 
38877          composeReference(null, e);
38878        closeArray();
38879      };
38880      if (element.hasResult()) {
38881        openArray("result");
38882        for (Reference e : element.getResult()) 
38883          composeReference(null, e);
38884        closeArray();
38885      };
38886      if (element.hasImagingStudy()) {
38887        openArray("imagingStudy");
38888        for (Reference e : element.getImagingStudy()) 
38889          composeReference(null, e);
38890        closeArray();
38891      };
38892      if (element.hasMedia()) {
38893        openArray("media");
38894        for (DiagnosticReport.DiagnosticReportMediaComponent e : element.getMedia()) 
38895          composeDiagnosticReportDiagnosticReportMediaComponent(null, e);
38896        closeArray();
38897      };
38898      if (element.hasConclusionElement()) {
38899        composeStringCore("conclusion", element.getConclusionElement(), false);
38900        composeStringExtras("conclusion", element.getConclusionElement(), false);
38901      }
38902      if (element.hasConclusionCode()) {
38903        openArray("conclusionCode");
38904        for (CodeableConcept e : element.getConclusionCode()) 
38905          composeCodeableConcept(null, e);
38906        closeArray();
38907      };
38908      if (element.hasPresentedForm()) {
38909        openArray("presentedForm");
38910        for (Attachment e : element.getPresentedForm()) 
38911          composeAttachment(null, e);
38912        closeArray();
38913      };
38914  }
38915
38916  protected void composeDiagnosticReportDiagnosticReportMediaComponent(String name, DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
38917    if (element != null) {
38918      open(name);
38919      composeDiagnosticReportDiagnosticReportMediaComponentInner(element);
38920      close();
38921    }
38922  }
38923
38924  protected void composeDiagnosticReportDiagnosticReportMediaComponentInner(DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
38925      composeBackbone(element);
38926      if (element.hasCommentElement()) {
38927        composeStringCore("comment", element.getCommentElement(), false);
38928        composeStringExtras("comment", element.getCommentElement(), false);
38929      }
38930      if (element.hasLink()) {
38931        composeReference("link", element.getLink());
38932      }
38933  }
38934
38935  protected void composeDocumentManifest(String name, DocumentManifest element) throws IOException {
38936    if (element != null) {
38937      prop("resourceType", name);
38938      composeDocumentManifestInner(element);
38939    }
38940  }
38941
38942  protected void composeDocumentManifestInner(DocumentManifest element) throws IOException {
38943      composeDomainResourceElements(element);
38944      if (element.hasMasterIdentifier()) {
38945        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
38946      }
38947      if (element.hasIdentifier()) {
38948        openArray("identifier");
38949        for (Identifier e : element.getIdentifier()) 
38950          composeIdentifier(null, e);
38951        closeArray();
38952      };
38953      if (element.hasStatusElement()) {
38954        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
38955        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
38956      }
38957      if (element.hasType()) {
38958        composeCodeableConcept("type", element.getType());
38959      }
38960      if (element.hasSubject()) {
38961        composeReference("subject", element.getSubject());
38962      }
38963      if (element.hasCreatedElement()) {
38964        composeDateTimeCore("created", element.getCreatedElement(), false);
38965        composeDateTimeExtras("created", element.getCreatedElement(), false);
38966      }
38967      if (element.hasAuthor()) {
38968        openArray("author");
38969        for (Reference e : element.getAuthor()) 
38970          composeReference(null, e);
38971        closeArray();
38972      };
38973      if (element.hasRecipient()) {
38974        openArray("recipient");
38975        for (Reference e : element.getRecipient()) 
38976          composeReference(null, e);
38977        closeArray();
38978      };
38979      if (element.hasSourceElement()) {
38980        composeUriCore("source", element.getSourceElement(), false);
38981        composeUriExtras("source", element.getSourceElement(), false);
38982      }
38983      if (element.hasDescriptionElement()) {
38984        composeStringCore("description", element.getDescriptionElement(), false);
38985        composeStringExtras("description", element.getDescriptionElement(), false);
38986      }
38987      if (element.hasContent()) {
38988        openArray("content");
38989        for (Reference e : element.getContent()) 
38990          composeReference(null, e);
38991        closeArray();
38992      };
38993      if (element.hasRelated()) {
38994        openArray("related");
38995        for (DocumentManifest.DocumentManifestRelatedComponent e : element.getRelated()) 
38996          composeDocumentManifestDocumentManifestRelatedComponent(null, e);
38997        closeArray();
38998      };
38999  }
39000
39001  protected void composeDocumentManifestDocumentManifestRelatedComponent(String name, DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
39002    if (element != null) {
39003      open(name);
39004      composeDocumentManifestDocumentManifestRelatedComponentInner(element);
39005      close();
39006    }
39007  }
39008
39009  protected void composeDocumentManifestDocumentManifestRelatedComponentInner(DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
39010      composeBackbone(element);
39011      if (element.hasIdentifier()) {
39012        composeIdentifier("identifier", element.getIdentifier());
39013      }
39014      if (element.hasRef()) {
39015        composeReference("ref", element.getRef());
39016      }
39017  }
39018
39019  protected void composeDocumentReference(String name, DocumentReference element) throws IOException {
39020    if (element != null) {
39021      prop("resourceType", name);
39022      composeDocumentReferenceInner(element);
39023    }
39024  }
39025
39026  protected void composeDocumentReferenceInner(DocumentReference element) throws IOException {
39027      composeDomainResourceElements(element);
39028      if (element.hasMasterIdentifier()) {
39029        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
39030      }
39031      if (element.hasIdentifier()) {
39032        openArray("identifier");
39033        for (Identifier e : element.getIdentifier()) 
39034          composeIdentifier(null, e);
39035        closeArray();
39036      };
39037      if (element.hasStatusElement()) {
39038        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
39039        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
39040      }
39041      if (element.hasDocStatusElement()) {
39042        composeEnumerationCore("docStatus", element.getDocStatusElement(), new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
39043        composeEnumerationExtras("docStatus", element.getDocStatusElement(), new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
39044      }
39045      if (element.hasType()) {
39046        composeCodeableConcept("type", element.getType());
39047      }
39048      if (element.hasCategory()) {
39049        openArray("category");
39050        for (CodeableConcept e : element.getCategory()) 
39051          composeCodeableConcept(null, e);
39052        closeArray();
39053      };
39054      if (element.hasSubject()) {
39055        composeReference("subject", element.getSubject());
39056      }
39057      if (element.hasDateElement()) {
39058        composeInstantCore("date", element.getDateElement(), false);
39059        composeInstantExtras("date", element.getDateElement(), false);
39060      }
39061      if (element.hasAuthor()) {
39062        openArray("author");
39063        for (Reference e : element.getAuthor()) 
39064          composeReference(null, e);
39065        closeArray();
39066      };
39067      if (element.hasAuthenticator()) {
39068        composeReference("authenticator", element.getAuthenticator());
39069      }
39070      if (element.hasCustodian()) {
39071        composeReference("custodian", element.getCustodian());
39072      }
39073      if (element.hasRelatesTo()) {
39074        openArray("relatesTo");
39075        for (DocumentReference.DocumentReferenceRelatesToComponent e : element.getRelatesTo()) 
39076          composeDocumentReferenceDocumentReferenceRelatesToComponent(null, e);
39077        closeArray();
39078      };
39079      if (element.hasDescriptionElement()) {
39080        composeStringCore("description", element.getDescriptionElement(), false);
39081        composeStringExtras("description", element.getDescriptionElement(), false);
39082      }
39083      if (element.hasSecurityLabel()) {
39084        openArray("securityLabel");
39085        for (CodeableConcept e : element.getSecurityLabel()) 
39086          composeCodeableConcept(null, e);
39087        closeArray();
39088      };
39089      if (element.hasContent()) {
39090        openArray("content");
39091        for (DocumentReference.DocumentReferenceContentComponent e : element.getContent()) 
39092          composeDocumentReferenceDocumentReferenceContentComponent(null, e);
39093        closeArray();
39094      };
39095      if (element.hasContext()) {
39096        composeDocumentReferenceDocumentReferenceContextComponent("context", element.getContext());
39097      }
39098  }
39099
39100  protected void composeDocumentReferenceDocumentReferenceRelatesToComponent(String name, DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
39101    if (element != null) {
39102      open(name);
39103      composeDocumentReferenceDocumentReferenceRelatesToComponentInner(element);
39104      close();
39105    }
39106  }
39107
39108  protected void composeDocumentReferenceDocumentReferenceRelatesToComponentInner(DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
39109      composeBackbone(element);
39110      if (element.hasCodeElement()) {
39111        composeEnumerationCore("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
39112        composeEnumerationExtras("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
39113      }
39114      if (element.hasTarget()) {
39115        composeReference("target", element.getTarget());
39116      }
39117  }
39118
39119  protected void composeDocumentReferenceDocumentReferenceContentComponent(String name, DocumentReference.DocumentReferenceContentComponent element) throws IOException {
39120    if (element != null) {
39121      open(name);
39122      composeDocumentReferenceDocumentReferenceContentComponentInner(element);
39123      close();
39124    }
39125  }
39126
39127  protected void composeDocumentReferenceDocumentReferenceContentComponentInner(DocumentReference.DocumentReferenceContentComponent element) throws IOException {
39128      composeBackbone(element);
39129      if (element.hasAttachment()) {
39130        composeAttachment("attachment", element.getAttachment());
39131      }
39132      if (element.hasFormat()) {
39133        composeCoding("format", element.getFormat());
39134      }
39135  }
39136
39137  protected void composeDocumentReferenceDocumentReferenceContextComponent(String name, DocumentReference.DocumentReferenceContextComponent element) throws IOException {
39138    if (element != null) {
39139      open(name);
39140      composeDocumentReferenceDocumentReferenceContextComponentInner(element);
39141      close();
39142    }
39143  }
39144
39145  protected void composeDocumentReferenceDocumentReferenceContextComponentInner(DocumentReference.DocumentReferenceContextComponent element) throws IOException {
39146      composeBackbone(element);
39147      if (element.hasEncounter()) {
39148        openArray("encounter");
39149        for (Reference e : element.getEncounter()) 
39150          composeReference(null, e);
39151        closeArray();
39152      };
39153      if (element.hasEvent()) {
39154        openArray("event");
39155        for (CodeableConcept e : element.getEvent()) 
39156          composeCodeableConcept(null, e);
39157        closeArray();
39158      };
39159      if (element.hasPeriod()) {
39160        composePeriod("period", element.getPeriod());
39161      }
39162      if (element.hasFacilityType()) {
39163        composeCodeableConcept("facilityType", element.getFacilityType());
39164      }
39165      if (element.hasPracticeSetting()) {
39166        composeCodeableConcept("practiceSetting", element.getPracticeSetting());
39167      }
39168      if (element.hasSourcePatientInfo()) {
39169        composeReference("sourcePatientInfo", element.getSourcePatientInfo());
39170      }
39171      if (element.hasRelated()) {
39172        openArray("related");
39173        for (Reference e : element.getRelated()) 
39174          composeReference(null, e);
39175        closeArray();
39176      };
39177  }
39178
39179  protected void composeEffectEvidenceSynthesis(String name, EffectEvidenceSynthesis element) throws IOException {
39180    if (element != null) {
39181      prop("resourceType", name);
39182      composeEffectEvidenceSynthesisInner(element);
39183    }
39184  }
39185
39186  protected void composeEffectEvidenceSynthesisInner(EffectEvidenceSynthesis element) throws IOException {
39187      composeDomainResourceElements(element);
39188      if (element.hasUrlElement()) {
39189        composeUriCore("url", element.getUrlElement(), false);
39190        composeUriExtras("url", element.getUrlElement(), false);
39191      }
39192      if (element.hasIdentifier()) {
39193        openArray("identifier");
39194        for (Identifier e : element.getIdentifier()) 
39195          composeIdentifier(null, e);
39196        closeArray();
39197      };
39198      if (element.hasVersionElement()) {
39199        composeStringCore("version", element.getVersionElement(), false);
39200        composeStringExtras("version", element.getVersionElement(), false);
39201      }
39202      if (element.hasNameElement()) {
39203        composeStringCore("name", element.getNameElement(), false);
39204        composeStringExtras("name", element.getNameElement(), false);
39205      }
39206      if (element.hasTitleElement()) {
39207        composeStringCore("title", element.getTitleElement(), false);
39208        composeStringExtras("title", element.getTitleElement(), false);
39209      }
39210      if (element.hasStatusElement()) {
39211        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39212        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39213      }
39214      if (element.hasDateElement()) {
39215        composeDateTimeCore("date", element.getDateElement(), false);
39216        composeDateTimeExtras("date", element.getDateElement(), false);
39217      }
39218      if (element.hasPublisherElement()) {
39219        composeStringCore("publisher", element.getPublisherElement(), false);
39220        composeStringExtras("publisher", element.getPublisherElement(), false);
39221      }
39222      if (element.hasContact()) {
39223        openArray("contact");
39224        for (ContactDetail e : element.getContact()) 
39225          composeContactDetail(null, e);
39226        closeArray();
39227      };
39228      if (element.hasDescriptionElement()) {
39229        composeMarkdownCore("description", element.getDescriptionElement(), false);
39230        composeMarkdownExtras("description", element.getDescriptionElement(), false);
39231      }
39232      if (element.hasNote()) {
39233        openArray("note");
39234        for (Annotation e : element.getNote()) 
39235          composeAnnotation(null, e);
39236        closeArray();
39237      };
39238      if (element.hasUseContext()) {
39239        openArray("useContext");
39240        for (UsageContext e : element.getUseContext()) 
39241          composeUsageContext(null, e);
39242        closeArray();
39243      };
39244      if (element.hasJurisdiction()) {
39245        openArray("jurisdiction");
39246        for (CodeableConcept e : element.getJurisdiction()) 
39247          composeCodeableConcept(null, e);
39248        closeArray();
39249      };
39250      if (element.hasCopyrightElement()) {
39251        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
39252        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
39253      }
39254      if (element.hasApprovalDateElement()) {
39255        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
39256        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
39257      }
39258      if (element.hasLastReviewDateElement()) {
39259        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
39260        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
39261      }
39262      if (element.hasEffectivePeriod()) {
39263        composePeriod("effectivePeriod", element.getEffectivePeriod());
39264      }
39265      if (element.hasTopic()) {
39266        openArray("topic");
39267        for (CodeableConcept e : element.getTopic()) 
39268          composeCodeableConcept(null, e);
39269        closeArray();
39270      };
39271      if (element.hasAuthor()) {
39272        openArray("author");
39273        for (ContactDetail e : element.getAuthor()) 
39274          composeContactDetail(null, e);
39275        closeArray();
39276      };
39277      if (element.hasEditor()) {
39278        openArray("editor");
39279        for (ContactDetail e : element.getEditor()) 
39280          composeContactDetail(null, e);
39281        closeArray();
39282      };
39283      if (element.hasReviewer()) {
39284        openArray("reviewer");
39285        for (ContactDetail e : element.getReviewer()) 
39286          composeContactDetail(null, e);
39287        closeArray();
39288      };
39289      if (element.hasEndorser()) {
39290        openArray("endorser");
39291        for (ContactDetail e : element.getEndorser()) 
39292          composeContactDetail(null, e);
39293        closeArray();
39294      };
39295      if (element.hasRelatedArtifact()) {
39296        openArray("relatedArtifact");
39297        for (RelatedArtifact e : element.getRelatedArtifact()) 
39298          composeRelatedArtifact(null, e);
39299        closeArray();
39300      };
39301      if (element.hasSynthesisType()) {
39302        composeCodeableConcept("synthesisType", element.getSynthesisType());
39303      }
39304      if (element.hasStudyType()) {
39305        composeCodeableConcept("studyType", element.getStudyType());
39306      }
39307      if (element.hasPopulation()) {
39308        composeReference("population", element.getPopulation());
39309      }
39310      if (element.hasExposure()) {
39311        composeReference("exposure", element.getExposure());
39312      }
39313      if (element.hasExposureAlternative()) {
39314        composeReference("exposureAlternative", element.getExposureAlternative());
39315      }
39316      if (element.hasOutcome()) {
39317        composeReference("outcome", element.getOutcome());
39318      }
39319      if (element.hasSampleSize()) {
39320        composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent("sampleSize", element.getSampleSize());
39321      }
39322      if (element.hasResultsByExposure()) {
39323        openArray("resultsByExposure");
39324        for (EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent e : element.getResultsByExposure()) 
39325          composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(null, e);
39326        closeArray();
39327      };
39328      if (element.hasEffectEstimate()) {
39329        openArray("effectEstimate");
39330        for (EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent e : element.getEffectEstimate()) 
39331          composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(null, e);
39332        closeArray();
39333      };
39334      if (element.hasCertainty()) {
39335        openArray("certainty");
39336        for (EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent e : element.getCertainty()) 
39337          composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(null, e);
39338        closeArray();
39339      };
39340  }
39341
39342  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent element) throws IOException {
39343    if (element != null) {
39344      open(name);
39345      composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentInner(element);
39346      close();
39347    }
39348  }
39349
39350  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent element) throws IOException {
39351      composeBackbone(element);
39352      if (element.hasDescriptionElement()) {
39353        composeStringCore("description", element.getDescriptionElement(), false);
39354        composeStringExtras("description", element.getDescriptionElement(), false);
39355      }
39356      if (element.hasNumberOfStudiesElement()) {
39357        composeIntegerCore("numberOfStudies", element.getNumberOfStudiesElement(), false);
39358        composeIntegerExtras("numberOfStudies", element.getNumberOfStudiesElement(), false);
39359      }
39360      if (element.hasNumberOfParticipantsElement()) {
39361        composeIntegerCore("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
39362        composeIntegerExtras("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
39363      }
39364  }
39365
39366  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent element) throws IOException {
39367    if (element != null) {
39368      open(name);
39369      composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentInner(element);
39370      close();
39371    }
39372  }
39373
39374  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent element) throws IOException {
39375      composeBackbone(element);
39376      if (element.hasDescriptionElement()) {
39377        composeStringCore("description", element.getDescriptionElement(), false);
39378        composeStringExtras("description", element.getDescriptionElement(), false);
39379      }
39380      if (element.hasExposureStateElement()) {
39381        composeEnumerationCore("exposureState", element.getExposureStateElement(), new EffectEvidenceSynthesis.ExposureStateEnumFactory(), false);
39382        composeEnumerationExtras("exposureState", element.getExposureStateElement(), new EffectEvidenceSynthesis.ExposureStateEnumFactory(), false);
39383      }
39384      if (element.hasVariantState()) {
39385        composeCodeableConcept("variantState", element.getVariantState());
39386      }
39387      if (element.hasRiskEvidenceSynthesis()) {
39388        composeReference("riskEvidenceSynthesis", element.getRiskEvidenceSynthesis());
39389      }
39390  }
39391
39392  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent element) throws IOException {
39393    if (element != null) {
39394      open(name);
39395      composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentInner(element);
39396      close();
39397    }
39398  }
39399
39400  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent element) throws IOException {
39401      composeBackbone(element);
39402      if (element.hasDescriptionElement()) {
39403        composeStringCore("description", element.getDescriptionElement(), false);
39404        composeStringExtras("description", element.getDescriptionElement(), false);
39405      }
39406      if (element.hasType()) {
39407        composeCodeableConcept("type", element.getType());
39408      }
39409      if (element.hasVariantState()) {
39410        composeCodeableConcept("variantState", element.getVariantState());
39411      }
39412      if (element.hasValueElement()) {
39413        composeDecimalCore("value", element.getValueElement(), false);
39414        composeDecimalExtras("value", element.getValueElement(), false);
39415      }
39416      if (element.hasUnitOfMeasure()) {
39417        composeCodeableConcept("unitOfMeasure", element.getUnitOfMeasure());
39418      }
39419      if (element.hasPrecisionEstimate()) {
39420        openArray("precisionEstimate");
39421        for (EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent e : element.getPrecisionEstimate()) 
39422          composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(null, e);
39423        closeArray();
39424      };
39425  }
39426
39427  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent element) throws IOException {
39428    if (element != null) {
39429      open(name);
39430      composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentInner(element);
39431      close();
39432    }
39433  }
39434
39435  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent element) throws IOException {
39436      composeBackbone(element);
39437      if (element.hasType()) {
39438        composeCodeableConcept("type", element.getType());
39439      }
39440      if (element.hasLevelElement()) {
39441        composeDecimalCore("level", element.getLevelElement(), false);
39442        composeDecimalExtras("level", element.getLevelElement(), false);
39443      }
39444      if (element.hasFromElement()) {
39445        composeDecimalCore("from", element.getFromElement(), false);
39446        composeDecimalExtras("from", element.getFromElement(), false);
39447      }
39448      if (element.hasToElement()) {
39449        composeDecimalCore("to", element.getToElement(), false);
39450        composeDecimalExtras("to", element.getToElement(), false);
39451      }
39452  }
39453
39454  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent element) throws IOException {
39455    if (element != null) {
39456      open(name);
39457      composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentInner(element);
39458      close();
39459    }
39460  }
39461
39462  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent element) throws IOException {
39463      composeBackbone(element);
39464      if (element.hasRating()) {
39465        openArray("rating");
39466        for (CodeableConcept e : element.getRating()) 
39467          composeCodeableConcept(null, e);
39468        closeArray();
39469      };
39470      if (element.hasNote()) {
39471        openArray("note");
39472        for (Annotation e : element.getNote()) 
39473          composeAnnotation(null, e);
39474        closeArray();
39475      };
39476      if (element.hasCertaintySubcomponent()) {
39477        openArray("certaintySubcomponent");
39478        for (EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent e : element.getCertaintySubcomponent()) 
39479          composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(null, e);
39480        closeArray();
39481      };
39482  }
39483
39484  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent element) throws IOException {
39485    if (element != null) {
39486      open(name);
39487      composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentInner(element);
39488      close();
39489    }
39490  }
39491
39492  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent element) throws IOException {
39493      composeBackbone(element);
39494      if (element.hasType()) {
39495        composeCodeableConcept("type", element.getType());
39496      }
39497      if (element.hasRating()) {
39498        openArray("rating");
39499        for (CodeableConcept e : element.getRating()) 
39500          composeCodeableConcept(null, e);
39501        closeArray();
39502      };
39503      if (element.hasNote()) {
39504        openArray("note");
39505        for (Annotation e : element.getNote()) 
39506          composeAnnotation(null, e);
39507        closeArray();
39508      };
39509  }
39510
39511  protected void composeEncounter(String name, Encounter element) throws IOException {
39512    if (element != null) {
39513      prop("resourceType", name);
39514      composeEncounterInner(element);
39515    }
39516  }
39517
39518  protected void composeEncounterInner(Encounter element) throws IOException {
39519      composeDomainResourceElements(element);
39520      if (element.hasIdentifier()) {
39521        openArray("identifier");
39522        for (Identifier e : element.getIdentifier()) 
39523          composeIdentifier(null, e);
39524        closeArray();
39525      };
39526      if (element.hasStatusElement()) {
39527        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
39528        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
39529      }
39530      if (element.hasStatusHistory()) {
39531        openArray("statusHistory");
39532        for (Encounter.StatusHistoryComponent e : element.getStatusHistory()) 
39533          composeEncounterStatusHistoryComponent(null, e);
39534        closeArray();
39535      };
39536      if (element.hasClass_()) {
39537        composeCoding("class", element.getClass_());
39538      }
39539      if (element.hasClassHistory()) {
39540        openArray("classHistory");
39541        for (Encounter.ClassHistoryComponent e : element.getClassHistory()) 
39542          composeEncounterClassHistoryComponent(null, e);
39543        closeArray();
39544      };
39545      if (element.hasType()) {
39546        openArray("type");
39547        for (CodeableConcept e : element.getType()) 
39548          composeCodeableConcept(null, e);
39549        closeArray();
39550      };
39551      if (element.hasServiceType()) {
39552        composeCodeableConcept("serviceType", element.getServiceType());
39553      }
39554      if (element.hasPriority()) {
39555        composeCodeableConcept("priority", element.getPriority());
39556      }
39557      if (element.hasSubject()) {
39558        composeReference("subject", element.getSubject());
39559      }
39560      if (element.hasEpisodeOfCare()) {
39561        openArray("episodeOfCare");
39562        for (Reference e : element.getEpisodeOfCare()) 
39563          composeReference(null, e);
39564        closeArray();
39565      };
39566      if (element.hasBasedOn()) {
39567        openArray("basedOn");
39568        for (Reference e : element.getBasedOn()) 
39569          composeReference(null, e);
39570        closeArray();
39571      };
39572      if (element.hasParticipant()) {
39573        openArray("participant");
39574        for (Encounter.EncounterParticipantComponent e : element.getParticipant()) 
39575          composeEncounterEncounterParticipantComponent(null, e);
39576        closeArray();
39577      };
39578      if (element.hasAppointment()) {
39579        openArray("appointment");
39580        for (Reference e : element.getAppointment()) 
39581          composeReference(null, e);
39582        closeArray();
39583      };
39584      if (element.hasPeriod()) {
39585        composePeriod("period", element.getPeriod());
39586      }
39587      if (element.hasLength()) {
39588        composeDuration("length", element.getLength());
39589      }
39590      if (element.hasReasonCode()) {
39591        openArray("reasonCode");
39592        for (CodeableConcept e : element.getReasonCode()) 
39593          composeCodeableConcept(null, e);
39594        closeArray();
39595      };
39596      if (element.hasReasonReference()) {
39597        openArray("reasonReference");
39598        for (Reference e : element.getReasonReference()) 
39599          composeReference(null, e);
39600        closeArray();
39601      };
39602      if (element.hasDiagnosis()) {
39603        openArray("diagnosis");
39604        for (Encounter.DiagnosisComponent e : element.getDiagnosis()) 
39605          composeEncounterDiagnosisComponent(null, e);
39606        closeArray();
39607      };
39608      if (element.hasAccount()) {
39609        openArray("account");
39610        for (Reference e : element.getAccount()) 
39611          composeReference(null, e);
39612        closeArray();
39613      };
39614      if (element.hasHospitalization()) {
39615        composeEncounterEncounterHospitalizationComponent("hospitalization", element.getHospitalization());
39616      }
39617      if (element.hasLocation()) {
39618        openArray("location");
39619        for (Encounter.EncounterLocationComponent e : element.getLocation()) 
39620          composeEncounterEncounterLocationComponent(null, e);
39621        closeArray();
39622      };
39623      if (element.hasServiceProvider()) {
39624        composeReference("serviceProvider", element.getServiceProvider());
39625      }
39626      if (element.hasPartOf()) {
39627        composeReference("partOf", element.getPartOf());
39628      }
39629  }
39630
39631  protected void composeEncounterStatusHistoryComponent(String name, Encounter.StatusHistoryComponent element) throws IOException {
39632    if (element != null) {
39633      open(name);
39634      composeEncounterStatusHistoryComponentInner(element);
39635      close();
39636    }
39637  }
39638
39639  protected void composeEncounterStatusHistoryComponentInner(Encounter.StatusHistoryComponent element) throws IOException {
39640      composeBackbone(element);
39641      if (element.hasStatusElement()) {
39642        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
39643        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
39644      }
39645      if (element.hasPeriod()) {
39646        composePeriod("period", element.getPeriod());
39647      }
39648  }
39649
39650  protected void composeEncounterClassHistoryComponent(String name, Encounter.ClassHistoryComponent element) throws IOException {
39651    if (element != null) {
39652      open(name);
39653      composeEncounterClassHistoryComponentInner(element);
39654      close();
39655    }
39656  }
39657
39658  protected void composeEncounterClassHistoryComponentInner(Encounter.ClassHistoryComponent element) throws IOException {
39659      composeBackbone(element);
39660      if (element.hasClass_()) {
39661        composeCoding("class", element.getClass_());
39662      }
39663      if (element.hasPeriod()) {
39664        composePeriod("period", element.getPeriod());
39665      }
39666  }
39667
39668  protected void composeEncounterEncounterParticipantComponent(String name, Encounter.EncounterParticipantComponent element) throws IOException {
39669    if (element != null) {
39670      open(name);
39671      composeEncounterEncounterParticipantComponentInner(element);
39672      close();
39673    }
39674  }
39675
39676  protected void composeEncounterEncounterParticipantComponentInner(Encounter.EncounterParticipantComponent element) throws IOException {
39677      composeBackbone(element);
39678      if (element.hasType()) {
39679        openArray("type");
39680        for (CodeableConcept e : element.getType()) 
39681          composeCodeableConcept(null, e);
39682        closeArray();
39683      };
39684      if (element.hasPeriod()) {
39685        composePeriod("period", element.getPeriod());
39686      }
39687      if (element.hasIndividual()) {
39688        composeReference("individual", element.getIndividual());
39689      }
39690  }
39691
39692  protected void composeEncounterDiagnosisComponent(String name, Encounter.DiagnosisComponent element) throws IOException {
39693    if (element != null) {
39694      open(name);
39695      composeEncounterDiagnosisComponentInner(element);
39696      close();
39697    }
39698  }
39699
39700  protected void composeEncounterDiagnosisComponentInner(Encounter.DiagnosisComponent element) throws IOException {
39701      composeBackbone(element);
39702      if (element.hasCondition()) {
39703        composeReference("condition", element.getCondition());
39704      }
39705      if (element.hasUse()) {
39706        composeCodeableConcept("use", element.getUse());
39707      }
39708      if (element.hasRankElement()) {
39709        composePositiveIntCore("rank", element.getRankElement(), false);
39710        composePositiveIntExtras("rank", element.getRankElement(), false);
39711      }
39712  }
39713
39714  protected void composeEncounterEncounterHospitalizationComponent(String name, Encounter.EncounterHospitalizationComponent element) throws IOException {
39715    if (element != null) {
39716      open(name);
39717      composeEncounterEncounterHospitalizationComponentInner(element);
39718      close();
39719    }
39720  }
39721
39722  protected void composeEncounterEncounterHospitalizationComponentInner(Encounter.EncounterHospitalizationComponent element) throws IOException {
39723      composeBackbone(element);
39724      if (element.hasPreAdmissionIdentifier()) {
39725        composeIdentifier("preAdmissionIdentifier", element.getPreAdmissionIdentifier());
39726      }
39727      if (element.hasOrigin()) {
39728        composeReference("origin", element.getOrigin());
39729      }
39730      if (element.hasAdmitSource()) {
39731        composeCodeableConcept("admitSource", element.getAdmitSource());
39732      }
39733      if (element.hasReAdmission()) {
39734        composeCodeableConcept("reAdmission", element.getReAdmission());
39735      }
39736      if (element.hasDietPreference()) {
39737        openArray("dietPreference");
39738        for (CodeableConcept e : element.getDietPreference()) 
39739          composeCodeableConcept(null, e);
39740        closeArray();
39741      };
39742      if (element.hasSpecialCourtesy()) {
39743        openArray("specialCourtesy");
39744        for (CodeableConcept e : element.getSpecialCourtesy()) 
39745          composeCodeableConcept(null, e);
39746        closeArray();
39747      };
39748      if (element.hasSpecialArrangement()) {
39749        openArray("specialArrangement");
39750        for (CodeableConcept e : element.getSpecialArrangement()) 
39751          composeCodeableConcept(null, e);
39752        closeArray();
39753      };
39754      if (element.hasDestination()) {
39755        composeReference("destination", element.getDestination());
39756      }
39757      if (element.hasDischargeDisposition()) {
39758        composeCodeableConcept("dischargeDisposition", element.getDischargeDisposition());
39759      }
39760  }
39761
39762  protected void composeEncounterEncounterLocationComponent(String name, Encounter.EncounterLocationComponent element) throws IOException {
39763    if (element != null) {
39764      open(name);
39765      composeEncounterEncounterLocationComponentInner(element);
39766      close();
39767    }
39768  }
39769
39770  protected void composeEncounterEncounterLocationComponentInner(Encounter.EncounterLocationComponent element) throws IOException {
39771      composeBackbone(element);
39772      if (element.hasLocation()) {
39773        composeReference("location", element.getLocation());
39774      }
39775      if (element.hasStatusElement()) {
39776        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
39777        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
39778      }
39779      if (element.hasPhysicalType()) {
39780        composeCodeableConcept("physicalType", element.getPhysicalType());
39781      }
39782      if (element.hasPeriod()) {
39783        composePeriod("period", element.getPeriod());
39784      }
39785  }
39786
39787  protected void composeEndpoint(String name, Endpoint element) throws IOException {
39788    if (element != null) {
39789      prop("resourceType", name);
39790      composeEndpointInner(element);
39791    }
39792  }
39793
39794  protected void composeEndpointInner(Endpoint element) throws IOException {
39795      composeDomainResourceElements(element);
39796      if (element.hasIdentifier()) {
39797        openArray("identifier");
39798        for (Identifier e : element.getIdentifier()) 
39799          composeIdentifier(null, e);
39800        closeArray();
39801      };
39802      if (element.hasStatusElement()) {
39803        composeEnumerationCore("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
39804        composeEnumerationExtras("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
39805      }
39806      if (element.hasConnectionType()) {
39807        composeCoding("connectionType", element.getConnectionType());
39808      }
39809      if (element.hasNameElement()) {
39810        composeStringCore("name", element.getNameElement(), false);
39811        composeStringExtras("name", element.getNameElement(), false);
39812      }
39813      if (element.hasManagingOrganization()) {
39814        composeReference("managingOrganization", element.getManagingOrganization());
39815      }
39816      if (element.hasContact()) {
39817        openArray("contact");
39818        for (ContactPoint e : element.getContact()) 
39819          composeContactPoint(null, e);
39820        closeArray();
39821      };
39822      if (element.hasPeriod()) {
39823        composePeriod("period", element.getPeriod());
39824      }
39825      if (element.hasPayloadType()) {
39826        openArray("payloadType");
39827        for (CodeableConcept e : element.getPayloadType()) 
39828          composeCodeableConcept(null, e);
39829        closeArray();
39830      };
39831      if (element.hasPayloadMimeType()) {
39832        openArray("payloadMimeType");
39833        for (CodeType e : element.getPayloadMimeType()) 
39834          composeCodeCore(null, e, true);
39835        closeArray();
39836        if (anyHasExtras(element.getPayloadMimeType())) {
39837          openArray("_payloadMimeType");
39838          for (CodeType e : element.getPayloadMimeType()) 
39839            composeCodeExtras(null, e, true);
39840          closeArray();
39841        }
39842      };
39843      if (element.hasAddressElement()) {
39844        composeUrlCore("address", element.getAddressElement(), false);
39845        composeUrlExtras("address", element.getAddressElement(), false);
39846      }
39847      if (element.hasHeader()) {
39848        openArray("header");
39849        for (StringType e : element.getHeader()) 
39850          composeStringCore(null, e, true);
39851        closeArray();
39852        if (anyHasExtras(element.getHeader())) {
39853          openArray("_header");
39854          for (StringType e : element.getHeader()) 
39855            composeStringExtras(null, e, true);
39856          closeArray();
39857        }
39858      };
39859  }
39860
39861  protected void composeEnrollmentRequest(String name, EnrollmentRequest element) throws IOException {
39862    if (element != null) {
39863      prop("resourceType", name);
39864      composeEnrollmentRequestInner(element);
39865    }
39866  }
39867
39868  protected void composeEnrollmentRequestInner(EnrollmentRequest element) throws IOException {
39869      composeDomainResourceElements(element);
39870      if (element.hasIdentifier()) {
39871        openArray("identifier");
39872        for (Identifier e : element.getIdentifier()) 
39873          composeIdentifier(null, e);
39874        closeArray();
39875      };
39876      if (element.hasStatusElement()) {
39877        composeEnumerationCore("status", element.getStatusElement(), new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
39878        composeEnumerationExtras("status", element.getStatusElement(), new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
39879      }
39880      if (element.hasCreatedElement()) {
39881        composeDateTimeCore("created", element.getCreatedElement(), false);
39882        composeDateTimeExtras("created", element.getCreatedElement(), false);
39883      }
39884      if (element.hasInsurer()) {
39885        composeReference("insurer", element.getInsurer());
39886      }
39887      if (element.hasProvider()) {
39888        composeReference("provider", element.getProvider());
39889      }
39890      if (element.hasCandidate()) {
39891        composeReference("candidate", element.getCandidate());
39892      }
39893      if (element.hasCoverage()) {
39894        composeReference("coverage", element.getCoverage());
39895      }
39896  }
39897
39898  protected void composeEnrollmentResponse(String name, EnrollmentResponse element) throws IOException {
39899    if (element != null) {
39900      prop("resourceType", name);
39901      composeEnrollmentResponseInner(element);
39902    }
39903  }
39904
39905  protected void composeEnrollmentResponseInner(EnrollmentResponse element) throws IOException {
39906      composeDomainResourceElements(element);
39907      if (element.hasIdentifier()) {
39908        openArray("identifier");
39909        for (Identifier e : element.getIdentifier()) 
39910          composeIdentifier(null, e);
39911        closeArray();
39912      };
39913      if (element.hasStatusElement()) {
39914        composeEnumerationCore("status", element.getStatusElement(), new EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
39915        composeEnumerationExtras("status", element.getStatusElement(), new EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
39916      }
39917      if (element.hasRequest()) {
39918        composeReference("request", element.getRequest());
39919      }
39920      if (element.hasOutcomeElement()) {
39921        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
39922        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
39923      }
39924      if (element.hasDispositionElement()) {
39925        composeStringCore("disposition", element.getDispositionElement(), false);
39926        composeStringExtras("disposition", element.getDispositionElement(), false);
39927      }
39928      if (element.hasCreatedElement()) {
39929        composeDateTimeCore("created", element.getCreatedElement(), false);
39930        composeDateTimeExtras("created", element.getCreatedElement(), false);
39931      }
39932      if (element.hasOrganization()) {
39933        composeReference("organization", element.getOrganization());
39934      }
39935      if (element.hasRequestProvider()) {
39936        composeReference("requestProvider", element.getRequestProvider());
39937      }
39938  }
39939
39940  protected void composeEpisodeOfCare(String name, EpisodeOfCare element) throws IOException {
39941    if (element != null) {
39942      prop("resourceType", name);
39943      composeEpisodeOfCareInner(element);
39944    }
39945  }
39946
39947  protected void composeEpisodeOfCareInner(EpisodeOfCare element) throws IOException {
39948      composeDomainResourceElements(element);
39949      if (element.hasIdentifier()) {
39950        openArray("identifier");
39951        for (Identifier e : element.getIdentifier()) 
39952          composeIdentifier(null, e);
39953        closeArray();
39954      };
39955      if (element.hasStatusElement()) {
39956        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
39957        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
39958      }
39959      if (element.hasStatusHistory()) {
39960        openArray("statusHistory");
39961        for (EpisodeOfCare.EpisodeOfCareStatusHistoryComponent e : element.getStatusHistory()) 
39962          composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(null, e);
39963        closeArray();
39964      };
39965      if (element.hasType()) {
39966        openArray("type");
39967        for (CodeableConcept e : element.getType()) 
39968          composeCodeableConcept(null, e);
39969        closeArray();
39970      };
39971      if (element.hasDiagnosis()) {
39972        openArray("diagnosis");
39973        for (EpisodeOfCare.DiagnosisComponent e : element.getDiagnosis()) 
39974          composeEpisodeOfCareDiagnosisComponent(null, e);
39975        closeArray();
39976      };
39977      if (element.hasPatient()) {
39978        composeReference("patient", element.getPatient());
39979      }
39980      if (element.hasManagingOrganization()) {
39981        composeReference("managingOrganization", element.getManagingOrganization());
39982      }
39983      if (element.hasPeriod()) {
39984        composePeriod("period", element.getPeriod());
39985      }
39986      if (element.hasReferralRequest()) {
39987        openArray("referralRequest");
39988        for (Reference e : element.getReferralRequest()) 
39989          composeReference(null, e);
39990        closeArray();
39991      };
39992      if (element.hasCareManager()) {
39993        composeReference("careManager", element.getCareManager());
39994      }
39995      if (element.hasTeam()) {
39996        openArray("team");
39997        for (Reference e : element.getTeam()) 
39998          composeReference(null, e);
39999        closeArray();
40000      };
40001      if (element.hasAccount()) {
40002        openArray("account");
40003        for (Reference e : element.getAccount()) 
40004          composeReference(null, e);
40005        closeArray();
40006      };
40007  }
40008
40009  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(String name, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
40010    if (element != null) {
40011      open(name);
40012      composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(element);
40013      close();
40014    }
40015  }
40016
40017  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
40018      composeBackbone(element);
40019      if (element.hasStatusElement()) {
40020        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
40021        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
40022      }
40023      if (element.hasPeriod()) {
40024        composePeriod("period", element.getPeriod());
40025      }
40026  }
40027
40028  protected void composeEpisodeOfCareDiagnosisComponent(String name, EpisodeOfCare.DiagnosisComponent element) throws IOException {
40029    if (element != null) {
40030      open(name);
40031      composeEpisodeOfCareDiagnosisComponentInner(element);
40032      close();
40033    }
40034  }
40035
40036  protected void composeEpisodeOfCareDiagnosisComponentInner(EpisodeOfCare.DiagnosisComponent element) throws IOException {
40037      composeBackbone(element);
40038      if (element.hasCondition()) {
40039        composeReference("condition", element.getCondition());
40040      }
40041      if (element.hasRole()) {
40042        composeCodeableConcept("role", element.getRole());
40043      }
40044      if (element.hasRankElement()) {
40045        composePositiveIntCore("rank", element.getRankElement(), false);
40046        composePositiveIntExtras("rank", element.getRankElement(), false);
40047      }
40048  }
40049
40050  protected void composeEventDefinition(String name, EventDefinition element) throws IOException {
40051    if (element != null) {
40052      prop("resourceType", name);
40053      composeEventDefinitionInner(element);
40054    }
40055  }
40056
40057  protected void composeEventDefinitionInner(EventDefinition element) throws IOException {
40058      composeDomainResourceElements(element);
40059      if (element.hasUrlElement()) {
40060        composeUriCore("url", element.getUrlElement(), false);
40061        composeUriExtras("url", element.getUrlElement(), false);
40062      }
40063      if (element.hasIdentifier()) {
40064        openArray("identifier");
40065        for (Identifier e : element.getIdentifier()) 
40066          composeIdentifier(null, e);
40067        closeArray();
40068      };
40069      if (element.hasVersionElement()) {
40070        composeStringCore("version", element.getVersionElement(), false);
40071        composeStringExtras("version", element.getVersionElement(), false);
40072      }
40073      if (element.hasNameElement()) {
40074        composeStringCore("name", element.getNameElement(), false);
40075        composeStringExtras("name", element.getNameElement(), false);
40076      }
40077      if (element.hasTitleElement()) {
40078        composeStringCore("title", element.getTitleElement(), false);
40079        composeStringExtras("title", element.getTitleElement(), false);
40080      }
40081      if (element.hasSubtitleElement()) {
40082        composeStringCore("subtitle", element.getSubtitleElement(), false);
40083        composeStringExtras("subtitle", element.getSubtitleElement(), false);
40084      }
40085      if (element.hasStatusElement()) {
40086        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40087        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40088      }
40089      if (element.hasExperimentalElement()) {
40090        composeBooleanCore("experimental", element.getExperimentalElement(), false);
40091        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
40092      }
40093      if (element.hasSubject()) {
40094        composeType("subject", element.getSubject());
40095      }
40096      if (element.hasDateElement()) {
40097        composeDateTimeCore("date", element.getDateElement(), false);
40098        composeDateTimeExtras("date", element.getDateElement(), false);
40099      }
40100      if (element.hasPublisherElement()) {
40101        composeStringCore("publisher", element.getPublisherElement(), false);
40102        composeStringExtras("publisher", element.getPublisherElement(), false);
40103      }
40104      if (element.hasContact()) {
40105        openArray("contact");
40106        for (ContactDetail e : element.getContact()) 
40107          composeContactDetail(null, e);
40108        closeArray();
40109      };
40110      if (element.hasDescriptionElement()) {
40111        composeMarkdownCore("description", element.getDescriptionElement(), false);
40112        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40113      }
40114      if (element.hasUseContext()) {
40115        openArray("useContext");
40116        for (UsageContext e : element.getUseContext()) 
40117          composeUsageContext(null, e);
40118        closeArray();
40119      };
40120      if (element.hasJurisdiction()) {
40121        openArray("jurisdiction");
40122        for (CodeableConcept e : element.getJurisdiction()) 
40123          composeCodeableConcept(null, e);
40124        closeArray();
40125      };
40126      if (element.hasPurposeElement()) {
40127        composeMarkdownCore("purpose", element.getPurposeElement(), false);
40128        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
40129      }
40130      if (element.hasUsageElement()) {
40131        composeStringCore("usage", element.getUsageElement(), false);
40132        composeStringExtras("usage", element.getUsageElement(), false);
40133      }
40134      if (element.hasCopyrightElement()) {
40135        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
40136        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
40137      }
40138      if (element.hasApprovalDateElement()) {
40139        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
40140        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
40141      }
40142      if (element.hasLastReviewDateElement()) {
40143        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
40144        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
40145      }
40146      if (element.hasEffectivePeriod()) {
40147        composePeriod("effectivePeriod", element.getEffectivePeriod());
40148      }
40149      if (element.hasTopic()) {
40150        openArray("topic");
40151        for (CodeableConcept e : element.getTopic()) 
40152          composeCodeableConcept(null, e);
40153        closeArray();
40154      };
40155      if (element.hasAuthor()) {
40156        openArray("author");
40157        for (ContactDetail e : element.getAuthor()) 
40158          composeContactDetail(null, e);
40159        closeArray();
40160      };
40161      if (element.hasEditor()) {
40162        openArray("editor");
40163        for (ContactDetail e : element.getEditor()) 
40164          composeContactDetail(null, e);
40165        closeArray();
40166      };
40167      if (element.hasReviewer()) {
40168        openArray("reviewer");
40169        for (ContactDetail e : element.getReviewer()) 
40170          composeContactDetail(null, e);
40171        closeArray();
40172      };
40173      if (element.hasEndorser()) {
40174        openArray("endorser");
40175        for (ContactDetail e : element.getEndorser()) 
40176          composeContactDetail(null, e);
40177        closeArray();
40178      };
40179      if (element.hasRelatedArtifact()) {
40180        openArray("relatedArtifact");
40181        for (RelatedArtifact e : element.getRelatedArtifact()) 
40182          composeRelatedArtifact(null, e);
40183        closeArray();
40184      };
40185      if (element.hasTrigger()) {
40186        openArray("trigger");
40187        for (TriggerDefinition e : element.getTrigger()) 
40188          composeTriggerDefinition(null, e);
40189        closeArray();
40190      };
40191  }
40192
40193  protected void composeEvidence(String name, Evidence element) throws IOException {
40194    if (element != null) {
40195      prop("resourceType", name);
40196      composeEvidenceInner(element);
40197    }
40198  }
40199
40200  protected void composeEvidenceInner(Evidence element) throws IOException {
40201      composeDomainResourceElements(element);
40202      if (element.hasUrlElement()) {
40203        composeUriCore("url", element.getUrlElement(), false);
40204        composeUriExtras("url", element.getUrlElement(), false);
40205      }
40206      if (element.hasIdentifier()) {
40207        openArray("identifier");
40208        for (Identifier e : element.getIdentifier()) 
40209          composeIdentifier(null, e);
40210        closeArray();
40211      };
40212      if (element.hasVersionElement()) {
40213        composeStringCore("version", element.getVersionElement(), false);
40214        composeStringExtras("version", element.getVersionElement(), false);
40215      }
40216      if (element.hasNameElement()) {
40217        composeStringCore("name", element.getNameElement(), false);
40218        composeStringExtras("name", element.getNameElement(), false);
40219      }
40220      if (element.hasTitleElement()) {
40221        composeStringCore("title", element.getTitleElement(), false);
40222        composeStringExtras("title", element.getTitleElement(), false);
40223      }
40224      if (element.hasShortTitleElement()) {
40225        composeStringCore("shortTitle", element.getShortTitleElement(), false);
40226        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
40227      }
40228      if (element.hasSubtitleElement()) {
40229        composeStringCore("subtitle", element.getSubtitleElement(), false);
40230        composeStringExtras("subtitle", element.getSubtitleElement(), false);
40231      }
40232      if (element.hasStatusElement()) {
40233        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40234        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40235      }
40236      if (element.hasDateElement()) {
40237        composeDateTimeCore("date", element.getDateElement(), false);
40238        composeDateTimeExtras("date", element.getDateElement(), false);
40239      }
40240      if (element.hasPublisherElement()) {
40241        composeStringCore("publisher", element.getPublisherElement(), false);
40242        composeStringExtras("publisher", element.getPublisherElement(), false);
40243      }
40244      if (element.hasContact()) {
40245        openArray("contact");
40246        for (ContactDetail e : element.getContact()) 
40247          composeContactDetail(null, e);
40248        closeArray();
40249      };
40250      if (element.hasDescriptionElement()) {
40251        composeMarkdownCore("description", element.getDescriptionElement(), false);
40252        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40253      }
40254      if (element.hasNote()) {
40255        openArray("note");
40256        for (Annotation e : element.getNote()) 
40257          composeAnnotation(null, e);
40258        closeArray();
40259      };
40260      if (element.hasUseContext()) {
40261        openArray("useContext");
40262        for (UsageContext e : element.getUseContext()) 
40263          composeUsageContext(null, e);
40264        closeArray();
40265      };
40266      if (element.hasJurisdiction()) {
40267        openArray("jurisdiction");
40268        for (CodeableConcept e : element.getJurisdiction()) 
40269          composeCodeableConcept(null, e);
40270        closeArray();
40271      };
40272      if (element.hasCopyrightElement()) {
40273        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
40274        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
40275      }
40276      if (element.hasApprovalDateElement()) {
40277        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
40278        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
40279      }
40280      if (element.hasLastReviewDateElement()) {
40281        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
40282        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
40283      }
40284      if (element.hasEffectivePeriod()) {
40285        composePeriod("effectivePeriod", element.getEffectivePeriod());
40286      }
40287      if (element.hasTopic()) {
40288        openArray("topic");
40289        for (CodeableConcept e : element.getTopic()) 
40290          composeCodeableConcept(null, e);
40291        closeArray();
40292      };
40293      if (element.hasAuthor()) {
40294        openArray("author");
40295        for (ContactDetail e : element.getAuthor()) 
40296          composeContactDetail(null, e);
40297        closeArray();
40298      };
40299      if (element.hasEditor()) {
40300        openArray("editor");
40301        for (ContactDetail e : element.getEditor()) 
40302          composeContactDetail(null, e);
40303        closeArray();
40304      };
40305      if (element.hasReviewer()) {
40306        openArray("reviewer");
40307        for (ContactDetail e : element.getReviewer()) 
40308          composeContactDetail(null, e);
40309        closeArray();
40310      };
40311      if (element.hasEndorser()) {
40312        openArray("endorser");
40313        for (ContactDetail e : element.getEndorser()) 
40314          composeContactDetail(null, e);
40315        closeArray();
40316      };
40317      if (element.hasRelatedArtifact()) {
40318        openArray("relatedArtifact");
40319        for (RelatedArtifact e : element.getRelatedArtifact()) 
40320          composeRelatedArtifact(null, e);
40321        closeArray();
40322      };
40323      if (element.hasExposureBackground()) {
40324        composeReference("exposureBackground", element.getExposureBackground());
40325      }
40326      if (element.hasExposureVariant()) {
40327        openArray("exposureVariant");
40328        for (Reference e : element.getExposureVariant()) 
40329          composeReference(null, e);
40330        closeArray();
40331      };
40332      if (element.hasOutcome()) {
40333        openArray("outcome");
40334        for (Reference e : element.getOutcome()) 
40335          composeReference(null, e);
40336        closeArray();
40337      };
40338  }
40339
40340  protected void composeEvidenceVariable(String name, EvidenceVariable element) throws IOException {
40341    if (element != null) {
40342      prop("resourceType", name);
40343      composeEvidenceVariableInner(element);
40344    }
40345  }
40346
40347  protected void composeEvidenceVariableInner(EvidenceVariable element) throws IOException {
40348      composeDomainResourceElements(element);
40349      if (element.hasUrlElement()) {
40350        composeUriCore("url", element.getUrlElement(), false);
40351        composeUriExtras("url", element.getUrlElement(), false);
40352      }
40353      if (element.hasIdentifier()) {
40354        openArray("identifier");
40355        for (Identifier e : element.getIdentifier()) 
40356          composeIdentifier(null, e);
40357        closeArray();
40358      };
40359      if (element.hasVersionElement()) {
40360        composeStringCore("version", element.getVersionElement(), false);
40361        composeStringExtras("version", element.getVersionElement(), false);
40362      }
40363      if (element.hasNameElement()) {
40364        composeStringCore("name", element.getNameElement(), false);
40365        composeStringExtras("name", element.getNameElement(), false);
40366      }
40367      if (element.hasTitleElement()) {
40368        composeStringCore("title", element.getTitleElement(), false);
40369        composeStringExtras("title", element.getTitleElement(), false);
40370      }
40371      if (element.hasShortTitleElement()) {
40372        composeStringCore("shortTitle", element.getShortTitleElement(), false);
40373        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
40374      }
40375      if (element.hasSubtitleElement()) {
40376        composeStringCore("subtitle", element.getSubtitleElement(), false);
40377        composeStringExtras("subtitle", element.getSubtitleElement(), false);
40378      }
40379      if (element.hasStatusElement()) {
40380        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40381        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40382      }
40383      if (element.hasDateElement()) {
40384        composeDateTimeCore("date", element.getDateElement(), false);
40385        composeDateTimeExtras("date", element.getDateElement(), false);
40386      }
40387      if (element.hasPublisherElement()) {
40388        composeStringCore("publisher", element.getPublisherElement(), false);
40389        composeStringExtras("publisher", element.getPublisherElement(), false);
40390      }
40391      if (element.hasContact()) {
40392        openArray("contact");
40393        for (ContactDetail e : element.getContact()) 
40394          composeContactDetail(null, e);
40395        closeArray();
40396      };
40397      if (element.hasDescriptionElement()) {
40398        composeMarkdownCore("description", element.getDescriptionElement(), false);
40399        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40400      }
40401      if (element.hasNote()) {
40402        openArray("note");
40403        for (Annotation e : element.getNote()) 
40404          composeAnnotation(null, e);
40405        closeArray();
40406      };
40407      if (element.hasUseContext()) {
40408        openArray("useContext");
40409        for (UsageContext e : element.getUseContext()) 
40410          composeUsageContext(null, e);
40411        closeArray();
40412      };
40413      if (element.hasJurisdiction()) {
40414        openArray("jurisdiction");
40415        for (CodeableConcept e : element.getJurisdiction()) 
40416          composeCodeableConcept(null, e);
40417        closeArray();
40418      };
40419      if (element.hasCopyrightElement()) {
40420        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
40421        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
40422      }
40423      if (element.hasApprovalDateElement()) {
40424        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
40425        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
40426      }
40427      if (element.hasLastReviewDateElement()) {
40428        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
40429        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
40430      }
40431      if (element.hasEffectivePeriod()) {
40432        composePeriod("effectivePeriod", element.getEffectivePeriod());
40433      }
40434      if (element.hasTopic()) {
40435        openArray("topic");
40436        for (CodeableConcept e : element.getTopic()) 
40437          composeCodeableConcept(null, e);
40438        closeArray();
40439      };
40440      if (element.hasAuthor()) {
40441        openArray("author");
40442        for (ContactDetail e : element.getAuthor()) 
40443          composeContactDetail(null, e);
40444        closeArray();
40445      };
40446      if (element.hasEditor()) {
40447        openArray("editor");
40448        for (ContactDetail e : element.getEditor()) 
40449          composeContactDetail(null, e);
40450        closeArray();
40451      };
40452      if (element.hasReviewer()) {
40453        openArray("reviewer");
40454        for (ContactDetail e : element.getReviewer()) 
40455          composeContactDetail(null, e);
40456        closeArray();
40457      };
40458      if (element.hasEndorser()) {
40459        openArray("endorser");
40460        for (ContactDetail e : element.getEndorser()) 
40461          composeContactDetail(null, e);
40462        closeArray();
40463      };
40464      if (element.hasRelatedArtifact()) {
40465        openArray("relatedArtifact");
40466        for (RelatedArtifact e : element.getRelatedArtifact()) 
40467          composeRelatedArtifact(null, e);
40468        closeArray();
40469      };
40470      if (element.hasTypeElement()) {
40471        composeEnumerationCore("type", element.getTypeElement(), new EvidenceVariable.EvidenceVariableTypeEnumFactory(), false);
40472        composeEnumerationExtras("type", element.getTypeElement(), new EvidenceVariable.EvidenceVariableTypeEnumFactory(), false);
40473      }
40474      if (element.hasCharacteristic()) {
40475        openArray("characteristic");
40476        for (EvidenceVariable.EvidenceVariableCharacteristicComponent e : element.getCharacteristic()) 
40477          composeEvidenceVariableEvidenceVariableCharacteristicComponent(null, e);
40478        closeArray();
40479      };
40480  }
40481
40482  protected void composeEvidenceVariableEvidenceVariableCharacteristicComponent(String name, EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
40483    if (element != null) {
40484      open(name);
40485      composeEvidenceVariableEvidenceVariableCharacteristicComponentInner(element);
40486      close();
40487    }
40488  }
40489
40490  protected void composeEvidenceVariableEvidenceVariableCharacteristicComponentInner(EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
40491      composeBackbone(element);
40492      if (element.hasDescriptionElement()) {
40493        composeStringCore("description", element.getDescriptionElement(), false);
40494        composeStringExtras("description", element.getDescriptionElement(), false);
40495      }
40496      if (element.hasDefinition()) {
40497        composeType("definition", element.getDefinition());
40498      }
40499      if (element.hasUsageContext()) {
40500        openArray("usageContext");
40501        for (UsageContext e : element.getUsageContext()) 
40502          composeUsageContext(null, e);
40503        closeArray();
40504      };
40505      if (element.hasExcludeElement()) {
40506        composeBooleanCore("exclude", element.getExcludeElement(), false);
40507        composeBooleanExtras("exclude", element.getExcludeElement(), false);
40508      }
40509      if (element.hasParticipantEffective()) {
40510        composeType("participantEffective", element.getParticipantEffective());
40511      }
40512      if (element.hasTimeFromStart()) {
40513        composeDuration("timeFromStart", element.getTimeFromStart());
40514      }
40515      if (element.hasGroupMeasureElement()) {
40516        composeEnumerationCore("groupMeasure", element.getGroupMeasureElement(), new EvidenceVariable.GroupMeasureEnumFactory(), false);
40517        composeEnumerationExtras("groupMeasure", element.getGroupMeasureElement(), new EvidenceVariable.GroupMeasureEnumFactory(), false);
40518      }
40519  }
40520
40521  protected void composeExampleScenario(String name, ExampleScenario element) throws IOException {
40522    if (element != null) {
40523      prop("resourceType", name);
40524      composeExampleScenarioInner(element);
40525    }
40526  }
40527
40528  protected void composeExampleScenarioInner(ExampleScenario element) throws IOException {
40529      composeDomainResourceElements(element);
40530      if (element.hasUrlElement()) {
40531        composeUriCore("url", element.getUrlElement(), false);
40532        composeUriExtras("url", element.getUrlElement(), false);
40533      }
40534      if (element.hasIdentifier()) {
40535        openArray("identifier");
40536        for (Identifier e : element.getIdentifier()) 
40537          composeIdentifier(null, e);
40538        closeArray();
40539      };
40540      if (element.hasVersionElement()) {
40541        composeStringCore("version", element.getVersionElement(), false);
40542        composeStringExtras("version", element.getVersionElement(), false);
40543      }
40544      if (element.hasNameElement()) {
40545        composeStringCore("name", element.getNameElement(), false);
40546        composeStringExtras("name", element.getNameElement(), false);
40547      }
40548      if (element.hasStatusElement()) {
40549        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40550        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40551      }
40552      if (element.hasExperimentalElement()) {
40553        composeBooleanCore("experimental", element.getExperimentalElement(), false);
40554        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
40555      }
40556      if (element.hasDateElement()) {
40557        composeDateTimeCore("date", element.getDateElement(), false);
40558        composeDateTimeExtras("date", element.getDateElement(), false);
40559      }
40560      if (element.hasPublisherElement()) {
40561        composeStringCore("publisher", element.getPublisherElement(), false);
40562        composeStringExtras("publisher", element.getPublisherElement(), false);
40563      }
40564      if (element.hasContact()) {
40565        openArray("contact");
40566        for (ContactDetail e : element.getContact()) 
40567          composeContactDetail(null, e);
40568        closeArray();
40569      };
40570      if (element.hasUseContext()) {
40571        openArray("useContext");
40572        for (UsageContext e : element.getUseContext()) 
40573          composeUsageContext(null, e);
40574        closeArray();
40575      };
40576      if (element.hasJurisdiction()) {
40577        openArray("jurisdiction");
40578        for (CodeableConcept e : element.getJurisdiction()) 
40579          composeCodeableConcept(null, e);
40580        closeArray();
40581      };
40582      if (element.hasCopyrightElement()) {
40583        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
40584        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
40585      }
40586      if (element.hasPurposeElement()) {
40587        composeMarkdownCore("purpose", element.getPurposeElement(), false);
40588        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
40589      }
40590      if (element.hasActor()) {
40591        openArray("actor");
40592        for (ExampleScenario.ExampleScenarioActorComponent e : element.getActor()) 
40593          composeExampleScenarioExampleScenarioActorComponent(null, e);
40594        closeArray();
40595      };
40596      if (element.hasInstance()) {
40597        openArray("instance");
40598        for (ExampleScenario.ExampleScenarioInstanceComponent e : element.getInstance()) 
40599          composeExampleScenarioExampleScenarioInstanceComponent(null, e);
40600        closeArray();
40601      };
40602      if (element.hasProcess()) {
40603        openArray("process");
40604        for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess()) 
40605          composeExampleScenarioExampleScenarioProcessComponent(null, e);
40606        closeArray();
40607      };
40608      if (element.hasWorkflow()) {
40609        openArray("workflow");
40610        for (CanonicalType e : element.getWorkflow()) 
40611          composeCanonicalCore(null, e, true);
40612        closeArray();
40613        if (anyHasExtras(element.getWorkflow())) {
40614          openArray("_workflow");
40615          for (CanonicalType e : element.getWorkflow()) 
40616            composeCanonicalExtras(null, e, true);
40617          closeArray();
40618        }
40619      };
40620  }
40621
40622  protected void composeExampleScenarioExampleScenarioActorComponent(String name, ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
40623    if (element != null) {
40624      open(name);
40625      composeExampleScenarioExampleScenarioActorComponentInner(element);
40626      close();
40627    }
40628  }
40629
40630  protected void composeExampleScenarioExampleScenarioActorComponentInner(ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
40631      composeBackbone(element);
40632      if (element.hasActorIdElement()) {
40633        composeStringCore("actorId", element.getActorIdElement(), false);
40634        composeStringExtras("actorId", element.getActorIdElement(), false);
40635      }
40636      if (element.hasTypeElement()) {
40637        composeEnumerationCore("type", element.getTypeElement(), new ExampleScenario.ExampleScenarioActorTypeEnumFactory(), false);
40638        composeEnumerationExtras("type", element.getTypeElement(), new ExampleScenario.ExampleScenarioActorTypeEnumFactory(), false);
40639      }
40640      if (element.hasNameElement()) {
40641        composeStringCore("name", element.getNameElement(), false);
40642        composeStringExtras("name", element.getNameElement(), false);
40643      }
40644      if (element.hasDescriptionElement()) {
40645        composeMarkdownCore("description", element.getDescriptionElement(), false);
40646        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40647      }
40648  }
40649
40650  protected void composeExampleScenarioExampleScenarioInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
40651    if (element != null) {
40652      open(name);
40653      composeExampleScenarioExampleScenarioInstanceComponentInner(element);
40654      close();
40655    }
40656  }
40657
40658  protected void composeExampleScenarioExampleScenarioInstanceComponentInner(ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
40659      composeBackbone(element);
40660      if (element.hasResourceIdElement()) {
40661        composeStringCore("resourceId", element.getResourceIdElement(), false);
40662        composeStringExtras("resourceId", element.getResourceIdElement(), false);
40663      }
40664      if (element.hasResourceTypeElement()) {
40665        composeEnumerationCore("resourceType", element.getResourceTypeElement(), new ExampleScenario.FHIRResourceTypeEnumFactory(), false);
40666        composeEnumerationExtras("resourceType", element.getResourceTypeElement(), new ExampleScenario.FHIRResourceTypeEnumFactory(), false);
40667      }
40668      if (element.hasNameElement()) {
40669        composeStringCore("name", element.getNameElement(), false);
40670        composeStringExtras("name", element.getNameElement(), false);
40671      }
40672      if (element.hasDescriptionElement()) {
40673        composeMarkdownCore("description", element.getDescriptionElement(), false);
40674        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40675      }
40676      if (element.hasVersion()) {
40677        openArray("version");
40678        for (ExampleScenario.ExampleScenarioInstanceVersionComponent e : element.getVersion()) 
40679          composeExampleScenarioExampleScenarioInstanceVersionComponent(null, e);
40680        closeArray();
40681      };
40682      if (element.hasContainedInstance()) {
40683        openArray("containedInstance");
40684        for (ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent e : element.getContainedInstance()) 
40685          composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent(null, e);
40686        closeArray();
40687      };
40688  }
40689
40690  protected void composeExampleScenarioExampleScenarioInstanceVersionComponent(String name, ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
40691    if (element != null) {
40692      open(name);
40693      composeExampleScenarioExampleScenarioInstanceVersionComponentInner(element);
40694      close();
40695    }
40696  }
40697
40698  protected void composeExampleScenarioExampleScenarioInstanceVersionComponentInner(ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
40699      composeBackbone(element);
40700      if (element.hasVersionIdElement()) {
40701        composeStringCore("versionId", element.getVersionIdElement(), false);
40702        composeStringExtras("versionId", element.getVersionIdElement(), false);
40703      }
40704      if (element.hasDescriptionElement()) {
40705        composeMarkdownCore("description", element.getDescriptionElement(), false);
40706        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40707      }
40708  }
40709
40710  protected void composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
40711    if (element != null) {
40712      open(name);
40713      composeExampleScenarioExampleScenarioInstanceContainedInstanceComponentInner(element);
40714      close();
40715    }
40716  }
40717
40718  protected void composeExampleScenarioExampleScenarioInstanceContainedInstanceComponentInner(ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
40719      composeBackbone(element);
40720      if (element.hasResourceIdElement()) {
40721        composeStringCore("resourceId", element.getResourceIdElement(), false);
40722        composeStringExtras("resourceId", element.getResourceIdElement(), false);
40723      }
40724      if (element.hasVersionIdElement()) {
40725        composeStringCore("versionId", element.getVersionIdElement(), false);
40726        composeStringExtras("versionId", element.getVersionIdElement(), false);
40727      }
40728  }
40729
40730  protected void composeExampleScenarioExampleScenarioProcessComponent(String name, ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
40731    if (element != null) {
40732      open(name);
40733      composeExampleScenarioExampleScenarioProcessComponentInner(element);
40734      close();
40735    }
40736  }
40737
40738  protected void composeExampleScenarioExampleScenarioProcessComponentInner(ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
40739      composeBackbone(element);
40740      if (element.hasTitleElement()) {
40741        composeStringCore("title", element.getTitleElement(), false);
40742        composeStringExtras("title", element.getTitleElement(), false);
40743      }
40744      if (element.hasDescriptionElement()) {
40745        composeMarkdownCore("description", element.getDescriptionElement(), false);
40746        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40747      }
40748      if (element.hasPreConditionsElement()) {
40749        composeMarkdownCore("preConditions", element.getPreConditionsElement(), false);
40750        composeMarkdownExtras("preConditions", element.getPreConditionsElement(), false);
40751      }
40752      if (element.hasPostConditionsElement()) {
40753        composeMarkdownCore("postConditions", element.getPostConditionsElement(), false);
40754        composeMarkdownExtras("postConditions", element.getPostConditionsElement(), false);
40755      }
40756      if (element.hasStep()) {
40757        openArray("step");
40758        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
40759          composeExampleScenarioExampleScenarioProcessStepComponent(null, e);
40760        closeArray();
40761      };
40762  }
40763
40764  protected void composeExampleScenarioExampleScenarioProcessStepComponent(String name, ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
40765    if (element != null) {
40766      open(name);
40767      composeExampleScenarioExampleScenarioProcessStepComponentInner(element);
40768      close();
40769    }
40770  }
40771
40772  protected void composeExampleScenarioExampleScenarioProcessStepComponentInner(ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
40773      composeBackbone(element);
40774      if (element.hasProcess()) {
40775        openArray("process");
40776        for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess()) 
40777          composeExampleScenarioExampleScenarioProcessComponent(null, e);
40778        closeArray();
40779      };
40780      if (element.hasPauseElement()) {
40781        composeBooleanCore("pause", element.getPauseElement(), false);
40782        composeBooleanExtras("pause", element.getPauseElement(), false);
40783      }
40784      if (element.hasOperation()) {
40785        composeExampleScenarioExampleScenarioProcessStepOperationComponent("operation", element.getOperation());
40786      }
40787      if (element.hasAlternative()) {
40788        openArray("alternative");
40789        for (ExampleScenario.ExampleScenarioProcessStepAlternativeComponent e : element.getAlternative()) 
40790          composeExampleScenarioExampleScenarioProcessStepAlternativeComponent(null, e);
40791        closeArray();
40792      };
40793  }
40794
40795  protected void composeExampleScenarioExampleScenarioProcessStepOperationComponent(String name, ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
40796    if (element != null) {
40797      open(name);
40798      composeExampleScenarioExampleScenarioProcessStepOperationComponentInner(element);
40799      close();
40800    }
40801  }
40802
40803  protected void composeExampleScenarioExampleScenarioProcessStepOperationComponentInner(ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
40804      composeBackbone(element);
40805      if (element.hasNumberElement()) {
40806        composeStringCore("number", element.getNumberElement(), false);
40807        composeStringExtras("number", element.getNumberElement(), false);
40808      }
40809      if (element.hasTypeElement()) {
40810        composeStringCore("type", element.getTypeElement(), false);
40811        composeStringExtras("type", element.getTypeElement(), false);
40812      }
40813      if (element.hasNameElement()) {
40814        composeStringCore("name", element.getNameElement(), false);
40815        composeStringExtras("name", element.getNameElement(), false);
40816      }
40817      if (element.hasInitiatorElement()) {
40818        composeStringCore("initiator", element.getInitiatorElement(), false);
40819        composeStringExtras("initiator", element.getInitiatorElement(), false);
40820      }
40821      if (element.hasReceiverElement()) {
40822        composeStringCore("receiver", element.getReceiverElement(), false);
40823        composeStringExtras("receiver", element.getReceiverElement(), false);
40824      }
40825      if (element.hasDescriptionElement()) {
40826        composeMarkdownCore("description", element.getDescriptionElement(), false);
40827        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40828      }
40829      if (element.hasInitiatorActiveElement()) {
40830        composeBooleanCore("initiatorActive", element.getInitiatorActiveElement(), false);
40831        composeBooleanExtras("initiatorActive", element.getInitiatorActiveElement(), false);
40832      }
40833      if (element.hasReceiverActiveElement()) {
40834        composeBooleanCore("receiverActive", element.getReceiverActiveElement(), false);
40835        composeBooleanExtras("receiverActive", element.getReceiverActiveElement(), false);
40836      }
40837      if (element.hasRequest()) {
40838        composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent("request", element.getRequest());
40839      }
40840      if (element.hasResponse()) {
40841        composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent("response", element.getResponse());
40842      }
40843  }
40844
40845  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeComponent(String name, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
40846    if (element != null) {
40847      open(name);
40848      composeExampleScenarioExampleScenarioProcessStepAlternativeComponentInner(element);
40849      close();
40850    }
40851  }
40852
40853  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeComponentInner(ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
40854      composeBackbone(element);
40855      if (element.hasTitleElement()) {
40856        composeStringCore("title", element.getTitleElement(), false);
40857        composeStringExtras("title", element.getTitleElement(), false);
40858      }
40859      if (element.hasDescriptionElement()) {
40860        composeMarkdownCore("description", element.getDescriptionElement(), false);
40861        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40862      }
40863      if (element.hasStep()) {
40864        openArray("step");
40865        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
40866          composeExampleScenarioExampleScenarioProcessStepComponent(null, e);
40867        closeArray();
40868      };
40869  }
40870
40871  protected void composeExplanationOfBenefit(String name, ExplanationOfBenefit element) throws IOException {
40872    if (element != null) {
40873      prop("resourceType", name);
40874      composeExplanationOfBenefitInner(element);
40875    }
40876  }
40877
40878  protected void composeExplanationOfBenefitInner(ExplanationOfBenefit element) throws IOException {
40879      composeDomainResourceElements(element);
40880      if (element.hasIdentifier()) {
40881        openArray("identifier");
40882        for (Identifier e : element.getIdentifier()) 
40883          composeIdentifier(null, e);
40884        closeArray();
40885      };
40886      if (element.hasStatusElement()) {
40887        composeEnumerationCore("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
40888        composeEnumerationExtras("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
40889      }
40890      if (element.hasType()) {
40891        composeCodeableConcept("type", element.getType());
40892      }
40893      if (element.hasSubType()) {
40894        composeCodeableConcept("subType", element.getSubType());
40895      }
40896      if (element.hasUseElement()) {
40897        composeEnumerationCore("use", element.getUseElement(), new ExplanationOfBenefit.UseEnumFactory(), false);
40898        composeEnumerationExtras("use", element.getUseElement(), new ExplanationOfBenefit.UseEnumFactory(), false);
40899      }
40900      if (element.hasPatient()) {
40901        composeReference("patient", element.getPatient());
40902      }
40903      if (element.hasBillablePeriod()) {
40904        composePeriod("billablePeriod", element.getBillablePeriod());
40905      }
40906      if (element.hasCreatedElement()) {
40907        composeDateTimeCore("created", element.getCreatedElement(), false);
40908        composeDateTimeExtras("created", element.getCreatedElement(), false);
40909      }
40910      if (element.hasEnterer()) {
40911        composeReference("enterer", element.getEnterer());
40912      }
40913      if (element.hasInsurer()) {
40914        composeReference("insurer", element.getInsurer());
40915      }
40916      if (element.hasProvider()) {
40917        composeReference("provider", element.getProvider());
40918      }
40919      if (element.hasPriority()) {
40920        composeCodeableConcept("priority", element.getPriority());
40921      }
40922      if (element.hasFundsReserveRequested()) {
40923        composeCodeableConcept("fundsReserveRequested", element.getFundsReserveRequested());
40924      }
40925      if (element.hasFundsReserve()) {
40926        composeCodeableConcept("fundsReserve", element.getFundsReserve());
40927      }
40928      if (element.hasRelated()) {
40929        openArray("related");
40930        for (ExplanationOfBenefit.RelatedClaimComponent e : element.getRelated()) 
40931          composeExplanationOfBenefitRelatedClaimComponent(null, e);
40932        closeArray();
40933      };
40934      if (element.hasPrescription()) {
40935        composeReference("prescription", element.getPrescription());
40936      }
40937      if (element.hasOriginalPrescription()) {
40938        composeReference("originalPrescription", element.getOriginalPrescription());
40939      }
40940      if (element.hasPayee()) {
40941        composeExplanationOfBenefitPayeeComponent("payee", element.getPayee());
40942      }
40943      if (element.hasReferral()) {
40944        composeReference("referral", element.getReferral());
40945      }
40946      if (element.hasFacility()) {
40947        composeReference("facility", element.getFacility());
40948      }
40949      if (element.hasClaim()) {
40950        composeReference("claim", element.getClaim());
40951      }
40952      if (element.hasClaimResponse()) {
40953        composeReference("claimResponse", element.getClaimResponse());
40954      }
40955      if (element.hasOutcomeElement()) {
40956        composeEnumerationCore("outcome", element.getOutcomeElement(), new ExplanationOfBenefit.RemittanceOutcomeEnumFactory(), false);
40957        composeEnumerationExtras("outcome", element.getOutcomeElement(), new ExplanationOfBenefit.RemittanceOutcomeEnumFactory(), false);
40958      }
40959      if (element.hasDispositionElement()) {
40960        composeStringCore("disposition", element.getDispositionElement(), false);
40961        composeStringExtras("disposition", element.getDispositionElement(), false);
40962      }
40963      if (element.hasPreAuthRef()) {
40964        openArray("preAuthRef");
40965        for (StringType e : element.getPreAuthRef()) 
40966          composeStringCore(null, e, true);
40967        closeArray();
40968        if (anyHasExtras(element.getPreAuthRef())) {
40969          openArray("_preAuthRef");
40970          for (StringType e : element.getPreAuthRef()) 
40971            composeStringExtras(null, e, true);
40972          closeArray();
40973        }
40974      };
40975      if (element.hasPreAuthRefPeriod()) {
40976        openArray("preAuthRefPeriod");
40977        for (Period e : element.getPreAuthRefPeriod()) 
40978          composePeriod(null, e);
40979        closeArray();
40980      };
40981      if (element.hasCareTeam()) {
40982        openArray("careTeam");
40983        for (ExplanationOfBenefit.CareTeamComponent e : element.getCareTeam()) 
40984          composeExplanationOfBenefitCareTeamComponent(null, e);
40985        closeArray();
40986      };
40987      if (element.hasSupportingInfo()) {
40988        openArray("supportingInfo");
40989        for (ExplanationOfBenefit.SupportingInformationComponent e : element.getSupportingInfo()) 
40990          composeExplanationOfBenefitSupportingInformationComponent(null, e);
40991        closeArray();
40992      };
40993      if (element.hasDiagnosis()) {
40994        openArray("diagnosis");
40995        for (ExplanationOfBenefit.DiagnosisComponent e : element.getDiagnosis()) 
40996          composeExplanationOfBenefitDiagnosisComponent(null, e);
40997        closeArray();
40998      };
40999      if (element.hasProcedure()) {
41000        openArray("procedure");
41001        for (ExplanationOfBenefit.ProcedureComponent e : element.getProcedure()) 
41002          composeExplanationOfBenefitProcedureComponent(null, e);
41003        closeArray();
41004      };
41005      if (element.hasPrecedenceElement()) {
41006        composePositiveIntCore("precedence", element.getPrecedenceElement(), false);
41007        composePositiveIntExtras("precedence", element.getPrecedenceElement(), false);
41008      }
41009      if (element.hasInsurance()) {
41010        openArray("insurance");
41011        for (ExplanationOfBenefit.InsuranceComponent e : element.getInsurance()) 
41012          composeExplanationOfBenefitInsuranceComponent(null, e);
41013        closeArray();
41014      };
41015      if (element.hasAccident()) {
41016        composeExplanationOfBenefitAccidentComponent("accident", element.getAccident());
41017      }
41018      if (element.hasItem()) {
41019        openArray("item");
41020        for (ExplanationOfBenefit.ItemComponent e : element.getItem()) 
41021          composeExplanationOfBenefitItemComponent(null, e);
41022        closeArray();
41023      };
41024      if (element.hasAddItem()) {
41025        openArray("addItem");
41026        for (ExplanationOfBenefit.AddedItemComponent e : element.getAddItem()) 
41027          composeExplanationOfBenefitAddedItemComponent(null, e);
41028        closeArray();
41029      };
41030      if (element.hasAdjudication()) {
41031        openArray("adjudication");
41032        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41033          composeExplanationOfBenefitAdjudicationComponent(null, e);
41034        closeArray();
41035      };
41036      if (element.hasTotal()) {
41037        openArray("total");
41038        for (ExplanationOfBenefit.TotalComponent e : element.getTotal()) 
41039          composeExplanationOfBenefitTotalComponent(null, e);
41040        closeArray();
41041      };
41042      if (element.hasPayment()) {
41043        composeExplanationOfBenefitPaymentComponent("payment", element.getPayment());
41044      }
41045      if (element.hasFormCode()) {
41046        composeCodeableConcept("formCode", element.getFormCode());
41047      }
41048      if (element.hasForm()) {
41049        composeAttachment("form", element.getForm());
41050      }
41051      if (element.hasProcessNote()) {
41052        openArray("processNote");
41053        for (ExplanationOfBenefit.NoteComponent e : element.getProcessNote()) 
41054          composeExplanationOfBenefitNoteComponent(null, e);
41055        closeArray();
41056      };
41057      if (element.hasBenefitPeriod()) {
41058        composePeriod("benefitPeriod", element.getBenefitPeriod());
41059      }
41060      if (element.hasBenefitBalance()) {
41061        openArray("benefitBalance");
41062        for (ExplanationOfBenefit.BenefitBalanceComponent e : element.getBenefitBalance()) 
41063          composeExplanationOfBenefitBenefitBalanceComponent(null, e);
41064        closeArray();
41065      };
41066  }
41067
41068  protected void composeExplanationOfBenefitRelatedClaimComponent(String name, ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
41069    if (element != null) {
41070      open(name);
41071      composeExplanationOfBenefitRelatedClaimComponentInner(element);
41072      close();
41073    }
41074  }
41075
41076  protected void composeExplanationOfBenefitRelatedClaimComponentInner(ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
41077      composeBackbone(element);
41078      if (element.hasClaim()) {
41079        composeReference("claim", element.getClaim());
41080      }
41081      if (element.hasRelationship()) {
41082        composeCodeableConcept("relationship", element.getRelationship());
41083      }
41084      if (element.hasReference()) {
41085        composeIdentifier("reference", element.getReference());
41086      }
41087  }
41088
41089  protected void composeExplanationOfBenefitPayeeComponent(String name, ExplanationOfBenefit.PayeeComponent element) throws IOException {
41090    if (element != null) {
41091      open(name);
41092      composeExplanationOfBenefitPayeeComponentInner(element);
41093      close();
41094    }
41095  }
41096
41097  protected void composeExplanationOfBenefitPayeeComponentInner(ExplanationOfBenefit.PayeeComponent element) throws IOException {
41098      composeBackbone(element);
41099      if (element.hasType()) {
41100        composeCodeableConcept("type", element.getType());
41101      }
41102      if (element.hasParty()) {
41103        composeReference("party", element.getParty());
41104      }
41105  }
41106
41107  protected void composeExplanationOfBenefitCareTeamComponent(String name, ExplanationOfBenefit.CareTeamComponent element) throws IOException {
41108    if (element != null) {
41109      open(name);
41110      composeExplanationOfBenefitCareTeamComponentInner(element);
41111      close();
41112    }
41113  }
41114
41115  protected void composeExplanationOfBenefitCareTeamComponentInner(ExplanationOfBenefit.CareTeamComponent element) throws IOException {
41116      composeBackbone(element);
41117      if (element.hasSequenceElement()) {
41118        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41119        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41120      }
41121      if (element.hasProvider()) {
41122        composeReference("provider", element.getProvider());
41123      }
41124      if (element.hasResponsibleElement()) {
41125        composeBooleanCore("responsible", element.getResponsibleElement(), false);
41126        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
41127      }
41128      if (element.hasRole()) {
41129        composeCodeableConcept("role", element.getRole());
41130      }
41131      if (element.hasQualification()) {
41132        composeCodeableConcept("qualification", element.getQualification());
41133      }
41134  }
41135
41136  protected void composeExplanationOfBenefitSupportingInformationComponent(String name, ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
41137    if (element != null) {
41138      open(name);
41139      composeExplanationOfBenefitSupportingInformationComponentInner(element);
41140      close();
41141    }
41142  }
41143
41144  protected void composeExplanationOfBenefitSupportingInformationComponentInner(ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
41145      composeBackbone(element);
41146      if (element.hasSequenceElement()) {
41147        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41148        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41149      }
41150      if (element.hasCategory()) {
41151        composeCodeableConcept("category", element.getCategory());
41152      }
41153      if (element.hasCode()) {
41154        composeCodeableConcept("code", element.getCode());
41155      }
41156      if (element.hasTiming()) {
41157        composeType("timing", element.getTiming());
41158      }
41159      if (element.hasValue()) {
41160        composeType("value", element.getValue());
41161      }
41162      if (element.hasReason()) {
41163        composeCoding("reason", element.getReason());
41164      }
41165  }
41166
41167  protected void composeExplanationOfBenefitDiagnosisComponent(String name, ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
41168    if (element != null) {
41169      open(name);
41170      composeExplanationOfBenefitDiagnosisComponentInner(element);
41171      close();
41172    }
41173  }
41174
41175  protected void composeExplanationOfBenefitDiagnosisComponentInner(ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
41176      composeBackbone(element);
41177      if (element.hasSequenceElement()) {
41178        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41179        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41180      }
41181      if (element.hasDiagnosis()) {
41182        composeType("diagnosis", element.getDiagnosis());
41183      }
41184      if (element.hasType()) {
41185        openArray("type");
41186        for (CodeableConcept e : element.getType()) 
41187          composeCodeableConcept(null, e);
41188        closeArray();
41189      };
41190      if (element.hasOnAdmission()) {
41191        composeCodeableConcept("onAdmission", element.getOnAdmission());
41192      }
41193      if (element.hasPackageCode()) {
41194        composeCodeableConcept("packageCode", element.getPackageCode());
41195      }
41196  }
41197
41198  protected void composeExplanationOfBenefitProcedureComponent(String name, ExplanationOfBenefit.ProcedureComponent element) throws IOException {
41199    if (element != null) {
41200      open(name);
41201      composeExplanationOfBenefitProcedureComponentInner(element);
41202      close();
41203    }
41204  }
41205
41206  protected void composeExplanationOfBenefitProcedureComponentInner(ExplanationOfBenefit.ProcedureComponent element) throws IOException {
41207      composeBackbone(element);
41208      if (element.hasSequenceElement()) {
41209        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41210        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41211      }
41212      if (element.hasType()) {
41213        openArray("type");
41214        for (CodeableConcept e : element.getType()) 
41215          composeCodeableConcept(null, e);
41216        closeArray();
41217      };
41218      if (element.hasDateElement()) {
41219        composeDateTimeCore("date", element.getDateElement(), false);
41220        composeDateTimeExtras("date", element.getDateElement(), false);
41221      }
41222      if (element.hasProcedure()) {
41223        composeType("procedure", element.getProcedure());
41224      }
41225      if (element.hasUdi()) {
41226        openArray("udi");
41227        for (Reference e : element.getUdi()) 
41228          composeReference(null, e);
41229        closeArray();
41230      };
41231  }
41232
41233  protected void composeExplanationOfBenefitInsuranceComponent(String name, ExplanationOfBenefit.InsuranceComponent element) throws IOException {
41234    if (element != null) {
41235      open(name);
41236      composeExplanationOfBenefitInsuranceComponentInner(element);
41237      close();
41238    }
41239  }
41240
41241  protected void composeExplanationOfBenefitInsuranceComponentInner(ExplanationOfBenefit.InsuranceComponent element) throws IOException {
41242      composeBackbone(element);
41243      if (element.hasFocalElement()) {
41244        composeBooleanCore("focal", element.getFocalElement(), false);
41245        composeBooleanExtras("focal", element.getFocalElement(), false);
41246      }
41247      if (element.hasCoverage()) {
41248        composeReference("coverage", element.getCoverage());
41249      }
41250      if (element.hasPreAuthRef()) {
41251        openArray("preAuthRef");
41252        for (StringType e : element.getPreAuthRef()) 
41253          composeStringCore(null, e, true);
41254        closeArray();
41255        if (anyHasExtras(element.getPreAuthRef())) {
41256          openArray("_preAuthRef");
41257          for (StringType e : element.getPreAuthRef()) 
41258            composeStringExtras(null, e, true);
41259          closeArray();
41260        }
41261      };
41262  }
41263
41264  protected void composeExplanationOfBenefitAccidentComponent(String name, ExplanationOfBenefit.AccidentComponent element) throws IOException {
41265    if (element != null) {
41266      open(name);
41267      composeExplanationOfBenefitAccidentComponentInner(element);
41268      close();
41269    }
41270  }
41271
41272  protected void composeExplanationOfBenefitAccidentComponentInner(ExplanationOfBenefit.AccidentComponent element) throws IOException {
41273      composeBackbone(element);
41274      if (element.hasDateElement()) {
41275        composeDateCore("date", element.getDateElement(), false);
41276        composeDateExtras("date", element.getDateElement(), false);
41277      }
41278      if (element.hasType()) {
41279        composeCodeableConcept("type", element.getType());
41280      }
41281      if (element.hasLocation()) {
41282        composeType("location", element.getLocation());
41283      }
41284  }
41285
41286  protected void composeExplanationOfBenefitItemComponent(String name, ExplanationOfBenefit.ItemComponent element) throws IOException {
41287    if (element != null) {
41288      open(name);
41289      composeExplanationOfBenefitItemComponentInner(element);
41290      close();
41291    }
41292  }
41293
41294  protected void composeExplanationOfBenefitItemComponentInner(ExplanationOfBenefit.ItemComponent element) throws IOException {
41295      composeBackbone(element);
41296      if (element.hasSequenceElement()) {
41297        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41298        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41299      }
41300      if (element.hasCareTeamSequence()) {
41301        openArray("careTeamSequence");
41302        for (PositiveIntType e : element.getCareTeamSequence()) 
41303          composePositiveIntCore(null, e, true);
41304        closeArray();
41305        if (anyHasExtras(element.getCareTeamSequence())) {
41306          openArray("_careTeamSequence");
41307          for (PositiveIntType e : element.getCareTeamSequence()) 
41308            composePositiveIntExtras(null, e, true);
41309          closeArray();
41310        }
41311      };
41312      if (element.hasDiagnosisSequence()) {
41313        openArray("diagnosisSequence");
41314        for (PositiveIntType e : element.getDiagnosisSequence()) 
41315          composePositiveIntCore(null, e, true);
41316        closeArray();
41317        if (anyHasExtras(element.getDiagnosisSequence())) {
41318          openArray("_diagnosisSequence");
41319          for (PositiveIntType e : element.getDiagnosisSequence()) 
41320            composePositiveIntExtras(null, e, true);
41321          closeArray();
41322        }
41323      };
41324      if (element.hasProcedureSequence()) {
41325        openArray("procedureSequence");
41326        for (PositiveIntType e : element.getProcedureSequence()) 
41327          composePositiveIntCore(null, e, true);
41328        closeArray();
41329        if (anyHasExtras(element.getProcedureSequence())) {
41330          openArray("_procedureSequence");
41331          for (PositiveIntType e : element.getProcedureSequence()) 
41332            composePositiveIntExtras(null, e, true);
41333          closeArray();
41334        }
41335      };
41336      if (element.hasInformationSequence()) {
41337        openArray("informationSequence");
41338        for (PositiveIntType e : element.getInformationSequence()) 
41339          composePositiveIntCore(null, e, true);
41340        closeArray();
41341        if (anyHasExtras(element.getInformationSequence())) {
41342          openArray("_informationSequence");
41343          for (PositiveIntType e : element.getInformationSequence()) 
41344            composePositiveIntExtras(null, e, true);
41345          closeArray();
41346        }
41347      };
41348      if (element.hasRevenue()) {
41349        composeCodeableConcept("revenue", element.getRevenue());
41350      }
41351      if (element.hasCategory()) {
41352        composeCodeableConcept("category", element.getCategory());
41353      }
41354      if (element.hasProductOrService()) {
41355        composeCodeableConcept("productOrService", element.getProductOrService());
41356      }
41357      if (element.hasModifier()) {
41358        openArray("modifier");
41359        for (CodeableConcept e : element.getModifier()) 
41360          composeCodeableConcept(null, e);
41361        closeArray();
41362      };
41363      if (element.hasProgramCode()) {
41364        openArray("programCode");
41365        for (CodeableConcept e : element.getProgramCode()) 
41366          composeCodeableConcept(null, e);
41367        closeArray();
41368      };
41369      if (element.hasServiced()) {
41370        composeType("serviced", element.getServiced());
41371      }
41372      if (element.hasLocation()) {
41373        composeType("location", element.getLocation());
41374      }
41375      if (element.hasQuantity()) {
41376        composeQuantity("quantity", element.getQuantity());
41377      }
41378      if (element.hasUnitPrice()) {
41379        composeMoney("unitPrice", element.getUnitPrice());
41380      }
41381      if (element.hasFactorElement()) {
41382        composeDecimalCore("factor", element.getFactorElement(), false);
41383        composeDecimalExtras("factor", element.getFactorElement(), false);
41384      }
41385      if (element.hasNet()) {
41386        composeMoney("net", element.getNet());
41387      }
41388      if (element.hasUdi()) {
41389        openArray("udi");
41390        for (Reference e : element.getUdi()) 
41391          composeReference(null, e);
41392        closeArray();
41393      };
41394      if (element.hasBodySite()) {
41395        composeCodeableConcept("bodySite", element.getBodySite());
41396      }
41397      if (element.hasSubSite()) {
41398        openArray("subSite");
41399        for (CodeableConcept e : element.getSubSite()) 
41400          composeCodeableConcept(null, e);
41401        closeArray();
41402      };
41403      if (element.hasEncounter()) {
41404        openArray("encounter");
41405        for (Reference e : element.getEncounter()) 
41406          composeReference(null, e);
41407        closeArray();
41408      };
41409      if (element.hasNoteNumber()) {
41410        openArray("noteNumber");
41411        for (PositiveIntType e : element.getNoteNumber()) 
41412          composePositiveIntCore(null, e, true);
41413        closeArray();
41414        if (anyHasExtras(element.getNoteNumber())) {
41415          openArray("_noteNumber");
41416          for (PositiveIntType e : element.getNoteNumber()) 
41417            composePositiveIntExtras(null, e, true);
41418          closeArray();
41419        }
41420      };
41421      if (element.hasAdjudication()) {
41422        openArray("adjudication");
41423        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41424          composeExplanationOfBenefitAdjudicationComponent(null, e);
41425        closeArray();
41426      };
41427      if (element.hasDetail()) {
41428        openArray("detail");
41429        for (ExplanationOfBenefit.DetailComponent e : element.getDetail()) 
41430          composeExplanationOfBenefitDetailComponent(null, e);
41431        closeArray();
41432      };
41433  }
41434
41435  protected void composeExplanationOfBenefitAdjudicationComponent(String name, ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
41436    if (element != null) {
41437      open(name);
41438      composeExplanationOfBenefitAdjudicationComponentInner(element);
41439      close();
41440    }
41441  }
41442
41443  protected void composeExplanationOfBenefitAdjudicationComponentInner(ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
41444      composeBackbone(element);
41445      if (element.hasCategory()) {
41446        composeCodeableConcept("category", element.getCategory());
41447      }
41448      if (element.hasReason()) {
41449        composeCodeableConcept("reason", element.getReason());
41450      }
41451      if (element.hasAmount()) {
41452        composeMoney("amount", element.getAmount());
41453      }
41454      if (element.hasValueElement()) {
41455        composeDecimalCore("value", element.getValueElement(), false);
41456        composeDecimalExtras("value", element.getValueElement(), false);
41457      }
41458  }
41459
41460  protected void composeExplanationOfBenefitDetailComponent(String name, ExplanationOfBenefit.DetailComponent element) throws IOException {
41461    if (element != null) {
41462      open(name);
41463      composeExplanationOfBenefitDetailComponentInner(element);
41464      close();
41465    }
41466  }
41467
41468  protected void composeExplanationOfBenefitDetailComponentInner(ExplanationOfBenefit.DetailComponent element) throws IOException {
41469      composeBackbone(element);
41470      if (element.hasSequenceElement()) {
41471        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41472        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41473      }
41474      if (element.hasRevenue()) {
41475        composeCodeableConcept("revenue", element.getRevenue());
41476      }
41477      if (element.hasCategory()) {
41478        composeCodeableConcept("category", element.getCategory());
41479      }
41480      if (element.hasProductOrService()) {
41481        composeCodeableConcept("productOrService", element.getProductOrService());
41482      }
41483      if (element.hasModifier()) {
41484        openArray("modifier");
41485        for (CodeableConcept e : element.getModifier()) 
41486          composeCodeableConcept(null, e);
41487        closeArray();
41488      };
41489      if (element.hasProgramCode()) {
41490        openArray("programCode");
41491        for (CodeableConcept e : element.getProgramCode()) 
41492          composeCodeableConcept(null, e);
41493        closeArray();
41494      };
41495      if (element.hasQuantity()) {
41496        composeQuantity("quantity", element.getQuantity());
41497      }
41498      if (element.hasUnitPrice()) {
41499        composeMoney("unitPrice", element.getUnitPrice());
41500      }
41501      if (element.hasFactorElement()) {
41502        composeDecimalCore("factor", element.getFactorElement(), false);
41503        composeDecimalExtras("factor", element.getFactorElement(), false);
41504      }
41505      if (element.hasNet()) {
41506        composeMoney("net", element.getNet());
41507      }
41508      if (element.hasUdi()) {
41509        openArray("udi");
41510        for (Reference e : element.getUdi()) 
41511          composeReference(null, e);
41512        closeArray();
41513      };
41514      if (element.hasNoteNumber()) {
41515        openArray("noteNumber");
41516        for (PositiveIntType e : element.getNoteNumber()) 
41517          composePositiveIntCore(null, e, true);
41518        closeArray();
41519        if (anyHasExtras(element.getNoteNumber())) {
41520          openArray("_noteNumber");
41521          for (PositiveIntType e : element.getNoteNumber()) 
41522            composePositiveIntExtras(null, e, true);
41523          closeArray();
41524        }
41525      };
41526      if (element.hasAdjudication()) {
41527        openArray("adjudication");
41528        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41529          composeExplanationOfBenefitAdjudicationComponent(null, e);
41530        closeArray();
41531      };
41532      if (element.hasSubDetail()) {
41533        openArray("subDetail");
41534        for (ExplanationOfBenefit.SubDetailComponent e : element.getSubDetail()) 
41535          composeExplanationOfBenefitSubDetailComponent(null, e);
41536        closeArray();
41537      };
41538  }
41539
41540  protected void composeExplanationOfBenefitSubDetailComponent(String name, ExplanationOfBenefit.SubDetailComponent element) throws IOException {
41541    if (element != null) {
41542      open(name);
41543      composeExplanationOfBenefitSubDetailComponentInner(element);
41544      close();
41545    }
41546  }
41547
41548  protected void composeExplanationOfBenefitSubDetailComponentInner(ExplanationOfBenefit.SubDetailComponent element) throws IOException {
41549      composeBackbone(element);
41550      if (element.hasSequenceElement()) {
41551        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41552        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41553      }
41554      if (element.hasRevenue()) {
41555        composeCodeableConcept("revenue", element.getRevenue());
41556      }
41557      if (element.hasCategory()) {
41558        composeCodeableConcept("category", element.getCategory());
41559      }
41560      if (element.hasProductOrService()) {
41561        composeCodeableConcept("productOrService", element.getProductOrService());
41562      }
41563      if (element.hasModifier()) {
41564        openArray("modifier");
41565        for (CodeableConcept e : element.getModifier()) 
41566          composeCodeableConcept(null, e);
41567        closeArray();
41568      };
41569      if (element.hasProgramCode()) {
41570        openArray("programCode");
41571        for (CodeableConcept e : element.getProgramCode()) 
41572          composeCodeableConcept(null, e);
41573        closeArray();
41574      };
41575      if (element.hasQuantity()) {
41576        composeQuantity("quantity", element.getQuantity());
41577      }
41578      if (element.hasUnitPrice()) {
41579        composeMoney("unitPrice", element.getUnitPrice());
41580      }
41581      if (element.hasFactorElement()) {
41582        composeDecimalCore("factor", element.getFactorElement(), false);
41583        composeDecimalExtras("factor", element.getFactorElement(), false);
41584      }
41585      if (element.hasNet()) {
41586        composeMoney("net", element.getNet());
41587      }
41588      if (element.hasUdi()) {
41589        openArray("udi");
41590        for (Reference e : element.getUdi()) 
41591          composeReference(null, e);
41592        closeArray();
41593      };
41594      if (element.hasNoteNumber()) {
41595        openArray("noteNumber");
41596        for (PositiveIntType e : element.getNoteNumber()) 
41597          composePositiveIntCore(null, e, true);
41598        closeArray();
41599        if (anyHasExtras(element.getNoteNumber())) {
41600          openArray("_noteNumber");
41601          for (PositiveIntType e : element.getNoteNumber()) 
41602            composePositiveIntExtras(null, e, true);
41603          closeArray();
41604        }
41605      };
41606      if (element.hasAdjudication()) {
41607        openArray("adjudication");
41608        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41609          composeExplanationOfBenefitAdjudicationComponent(null, e);
41610        closeArray();
41611      };
41612  }
41613
41614  protected void composeExplanationOfBenefitAddedItemComponent(String name, ExplanationOfBenefit.AddedItemComponent element) throws IOException {
41615    if (element != null) {
41616      open(name);
41617      composeExplanationOfBenefitAddedItemComponentInner(element);
41618      close();
41619    }
41620  }
41621
41622  protected void composeExplanationOfBenefitAddedItemComponentInner(ExplanationOfBenefit.AddedItemComponent element) throws IOException {
41623      composeBackbone(element);
41624      if (element.hasItemSequence()) {
41625        openArray("itemSequence");
41626        for (PositiveIntType e : element.getItemSequence()) 
41627          composePositiveIntCore(null, e, true);
41628        closeArray();
41629        if (anyHasExtras(element.getItemSequence())) {
41630          openArray("_itemSequence");
41631          for (PositiveIntType e : element.getItemSequence()) 
41632            composePositiveIntExtras(null, e, true);
41633          closeArray();
41634        }
41635      };
41636      if (element.hasDetailSequence()) {
41637        openArray("detailSequence");
41638        for (PositiveIntType e : element.getDetailSequence()) 
41639          composePositiveIntCore(null, e, true);
41640        closeArray();
41641        if (anyHasExtras(element.getDetailSequence())) {
41642          openArray("_detailSequence");
41643          for (PositiveIntType e : element.getDetailSequence()) 
41644            composePositiveIntExtras(null, e, true);
41645          closeArray();
41646        }
41647      };
41648      if (element.hasSubDetailSequence()) {
41649        openArray("subDetailSequence");
41650        for (PositiveIntType e : element.getSubDetailSequence()) 
41651          composePositiveIntCore(null, e, true);
41652        closeArray();
41653        if (anyHasExtras(element.getSubDetailSequence())) {
41654          openArray("_subDetailSequence");
41655          for (PositiveIntType e : element.getSubDetailSequence()) 
41656            composePositiveIntExtras(null, e, true);
41657          closeArray();
41658        }
41659      };
41660      if (element.hasProvider()) {
41661        openArray("provider");
41662        for (Reference e : element.getProvider()) 
41663          composeReference(null, e);
41664        closeArray();
41665      };
41666      if (element.hasProductOrService()) {
41667        composeCodeableConcept("productOrService", element.getProductOrService());
41668      }
41669      if (element.hasModifier()) {
41670        openArray("modifier");
41671        for (CodeableConcept e : element.getModifier()) 
41672          composeCodeableConcept(null, e);
41673        closeArray();
41674      };
41675      if (element.hasProgramCode()) {
41676        openArray("programCode");
41677        for (CodeableConcept e : element.getProgramCode()) 
41678          composeCodeableConcept(null, e);
41679        closeArray();
41680      };
41681      if (element.hasServiced()) {
41682        composeType("serviced", element.getServiced());
41683      }
41684      if (element.hasLocation()) {
41685        composeType("location", element.getLocation());
41686      }
41687      if (element.hasQuantity()) {
41688        composeQuantity("quantity", element.getQuantity());
41689      }
41690      if (element.hasUnitPrice()) {
41691        composeMoney("unitPrice", element.getUnitPrice());
41692      }
41693      if (element.hasFactorElement()) {
41694        composeDecimalCore("factor", element.getFactorElement(), false);
41695        composeDecimalExtras("factor", element.getFactorElement(), false);
41696      }
41697      if (element.hasNet()) {
41698        composeMoney("net", element.getNet());
41699      }
41700      if (element.hasBodySite()) {
41701        composeCodeableConcept("bodySite", element.getBodySite());
41702      }
41703      if (element.hasSubSite()) {
41704        openArray("subSite");
41705        for (CodeableConcept e : element.getSubSite()) 
41706          composeCodeableConcept(null, e);
41707        closeArray();
41708      };
41709      if (element.hasNoteNumber()) {
41710        openArray("noteNumber");
41711        for (PositiveIntType e : element.getNoteNumber()) 
41712          composePositiveIntCore(null, e, true);
41713        closeArray();
41714        if (anyHasExtras(element.getNoteNumber())) {
41715          openArray("_noteNumber");
41716          for (PositiveIntType e : element.getNoteNumber()) 
41717            composePositiveIntExtras(null, e, true);
41718          closeArray();
41719        }
41720      };
41721      if (element.hasAdjudication()) {
41722        openArray("adjudication");
41723        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41724          composeExplanationOfBenefitAdjudicationComponent(null, e);
41725        closeArray();
41726      };
41727      if (element.hasDetail()) {
41728        openArray("detail");
41729        for (ExplanationOfBenefit.AddedItemDetailComponent e : element.getDetail()) 
41730          composeExplanationOfBenefitAddedItemDetailComponent(null, e);
41731        closeArray();
41732      };
41733  }
41734
41735  protected void composeExplanationOfBenefitAddedItemDetailComponent(String name, ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
41736    if (element != null) {
41737      open(name);
41738      composeExplanationOfBenefitAddedItemDetailComponentInner(element);
41739      close();
41740    }
41741  }
41742
41743  protected void composeExplanationOfBenefitAddedItemDetailComponentInner(ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
41744      composeBackbone(element);
41745      if (element.hasProductOrService()) {
41746        composeCodeableConcept("productOrService", element.getProductOrService());
41747      }
41748      if (element.hasModifier()) {
41749        openArray("modifier");
41750        for (CodeableConcept e : element.getModifier()) 
41751          composeCodeableConcept(null, e);
41752        closeArray();
41753      };
41754      if (element.hasQuantity()) {
41755        composeQuantity("quantity", element.getQuantity());
41756      }
41757      if (element.hasUnitPrice()) {
41758        composeMoney("unitPrice", element.getUnitPrice());
41759      }
41760      if (element.hasFactorElement()) {
41761        composeDecimalCore("factor", element.getFactorElement(), false);
41762        composeDecimalExtras("factor", element.getFactorElement(), false);
41763      }
41764      if (element.hasNet()) {
41765        composeMoney("net", element.getNet());
41766      }
41767      if (element.hasNoteNumber()) {
41768        openArray("noteNumber");
41769        for (PositiveIntType e : element.getNoteNumber()) 
41770          composePositiveIntCore(null, e, true);
41771        closeArray();
41772        if (anyHasExtras(element.getNoteNumber())) {
41773          openArray("_noteNumber");
41774          for (PositiveIntType e : element.getNoteNumber()) 
41775            composePositiveIntExtras(null, e, true);
41776          closeArray();
41777        }
41778      };
41779      if (element.hasAdjudication()) {
41780        openArray("adjudication");
41781        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41782          composeExplanationOfBenefitAdjudicationComponent(null, e);
41783        closeArray();
41784      };
41785      if (element.hasSubDetail()) {
41786        openArray("subDetail");
41787        for (ExplanationOfBenefit.AddedItemDetailSubDetailComponent e : element.getSubDetail()) 
41788          composeExplanationOfBenefitAddedItemDetailSubDetailComponent(null, e);
41789        closeArray();
41790      };
41791  }
41792
41793  protected void composeExplanationOfBenefitAddedItemDetailSubDetailComponent(String name, ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
41794    if (element != null) {
41795      open(name);
41796      composeExplanationOfBenefitAddedItemDetailSubDetailComponentInner(element);
41797      close();
41798    }
41799  }
41800
41801  protected void composeExplanationOfBenefitAddedItemDetailSubDetailComponentInner(ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
41802      composeBackbone(element);
41803      if (element.hasProductOrService()) {
41804        composeCodeableConcept("productOrService", element.getProductOrService());
41805      }
41806      if (element.hasModifier()) {
41807        openArray("modifier");
41808        for (CodeableConcept e : element.getModifier()) 
41809          composeCodeableConcept(null, e);
41810        closeArray();
41811      };
41812      if (element.hasQuantity()) {
41813        composeQuantity("quantity", element.getQuantity());
41814      }
41815      if (element.hasUnitPrice()) {
41816        composeMoney("unitPrice", element.getUnitPrice());
41817      }
41818      if (element.hasFactorElement()) {
41819        composeDecimalCore("factor", element.getFactorElement(), false);
41820        composeDecimalExtras("factor", element.getFactorElement(), false);
41821      }
41822      if (element.hasNet()) {
41823        composeMoney("net", element.getNet());
41824      }
41825      if (element.hasNoteNumber()) {
41826        openArray("noteNumber");
41827        for (PositiveIntType e : element.getNoteNumber()) 
41828          composePositiveIntCore(null, e, true);
41829        closeArray();
41830        if (anyHasExtras(element.getNoteNumber())) {
41831          openArray("_noteNumber");
41832          for (PositiveIntType e : element.getNoteNumber()) 
41833            composePositiveIntExtras(null, e, true);
41834          closeArray();
41835        }
41836      };
41837      if (element.hasAdjudication()) {
41838        openArray("adjudication");
41839        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41840          composeExplanationOfBenefitAdjudicationComponent(null, e);
41841        closeArray();
41842      };
41843  }
41844
41845  protected void composeExplanationOfBenefitTotalComponent(String name, ExplanationOfBenefit.TotalComponent element) throws IOException {
41846    if (element != null) {
41847      open(name);
41848      composeExplanationOfBenefitTotalComponentInner(element);
41849      close();
41850    }
41851  }
41852
41853  protected void composeExplanationOfBenefitTotalComponentInner(ExplanationOfBenefit.TotalComponent element) throws IOException {
41854      composeBackbone(element);
41855      if (element.hasCategory()) {
41856        composeCodeableConcept("category", element.getCategory());
41857      }
41858      if (element.hasAmount()) {
41859        composeMoney("amount", element.getAmount());
41860      }
41861  }
41862
41863  protected void composeExplanationOfBenefitPaymentComponent(String name, ExplanationOfBenefit.PaymentComponent element) throws IOException {
41864    if (element != null) {
41865      open(name);
41866      composeExplanationOfBenefitPaymentComponentInner(element);
41867      close();
41868    }
41869  }
41870
41871  protected void composeExplanationOfBenefitPaymentComponentInner(ExplanationOfBenefit.PaymentComponent element) throws IOException {
41872      composeBackbone(element);
41873      if (element.hasType()) {
41874        composeCodeableConcept("type", element.getType());
41875      }
41876      if (element.hasAdjustment()) {
41877        composeMoney("adjustment", element.getAdjustment());
41878      }
41879      if (element.hasAdjustmentReason()) {
41880        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
41881      }
41882      if (element.hasDateElement()) {
41883        composeDateCore("date", element.getDateElement(), false);
41884        composeDateExtras("date", element.getDateElement(), false);
41885      }
41886      if (element.hasAmount()) {
41887        composeMoney("amount", element.getAmount());
41888      }
41889      if (element.hasIdentifier()) {
41890        composeIdentifier("identifier", element.getIdentifier());
41891      }
41892  }
41893
41894  protected void composeExplanationOfBenefitNoteComponent(String name, ExplanationOfBenefit.NoteComponent element) throws IOException {
41895    if (element != null) {
41896      open(name);
41897      composeExplanationOfBenefitNoteComponentInner(element);
41898      close();
41899    }
41900  }
41901
41902  protected void composeExplanationOfBenefitNoteComponentInner(ExplanationOfBenefit.NoteComponent element) throws IOException {
41903      composeBackbone(element);
41904      if (element.hasNumberElement()) {
41905        composePositiveIntCore("number", element.getNumberElement(), false);
41906        composePositiveIntExtras("number", element.getNumberElement(), false);
41907      }
41908      if (element.hasTypeElement()) {
41909        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
41910        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
41911      }
41912      if (element.hasTextElement()) {
41913        composeStringCore("text", element.getTextElement(), false);
41914        composeStringExtras("text", element.getTextElement(), false);
41915      }
41916      if (element.hasLanguage()) {
41917        composeCodeableConcept("language", element.getLanguage());
41918      }
41919  }
41920
41921  protected void composeExplanationOfBenefitBenefitBalanceComponent(String name, ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
41922    if (element != null) {
41923      open(name);
41924      composeExplanationOfBenefitBenefitBalanceComponentInner(element);
41925      close();
41926    }
41927  }
41928
41929  protected void composeExplanationOfBenefitBenefitBalanceComponentInner(ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
41930      composeBackbone(element);
41931      if (element.hasCategory()) {
41932        composeCodeableConcept("category", element.getCategory());
41933      }
41934      if (element.hasExcludedElement()) {
41935        composeBooleanCore("excluded", element.getExcludedElement(), false);
41936        composeBooleanExtras("excluded", element.getExcludedElement(), false);
41937      }
41938      if (element.hasNameElement()) {
41939        composeStringCore("name", element.getNameElement(), false);
41940        composeStringExtras("name", element.getNameElement(), false);
41941      }
41942      if (element.hasDescriptionElement()) {
41943        composeStringCore("description", element.getDescriptionElement(), false);
41944        composeStringExtras("description", element.getDescriptionElement(), false);
41945      }
41946      if (element.hasNetwork()) {
41947        composeCodeableConcept("network", element.getNetwork());
41948      }
41949      if (element.hasUnit()) {
41950        composeCodeableConcept("unit", element.getUnit());
41951      }
41952      if (element.hasTerm()) {
41953        composeCodeableConcept("term", element.getTerm());
41954      }
41955      if (element.hasFinancial()) {
41956        openArray("financial");
41957        for (ExplanationOfBenefit.BenefitComponent e : element.getFinancial()) 
41958          composeExplanationOfBenefitBenefitComponent(null, e);
41959        closeArray();
41960      };
41961  }
41962
41963  protected void composeExplanationOfBenefitBenefitComponent(String name, ExplanationOfBenefit.BenefitComponent element) throws IOException {
41964    if (element != null) {
41965      open(name);
41966      composeExplanationOfBenefitBenefitComponentInner(element);
41967      close();
41968    }
41969  }
41970
41971  protected void composeExplanationOfBenefitBenefitComponentInner(ExplanationOfBenefit.BenefitComponent element) throws IOException {
41972      composeBackbone(element);
41973      if (element.hasType()) {
41974        composeCodeableConcept("type", element.getType());
41975      }
41976      if (element.hasAllowed()) {
41977        composeType("allowed", element.getAllowed());
41978      }
41979      if (element.hasUsed()) {
41980        composeType("used", element.getUsed());
41981      }
41982  }
41983
41984  protected void composeFamilyMemberHistory(String name, FamilyMemberHistory element) throws IOException {
41985    if (element != null) {
41986      prop("resourceType", name);
41987      composeFamilyMemberHistoryInner(element);
41988    }
41989  }
41990
41991  protected void composeFamilyMemberHistoryInner(FamilyMemberHistory element) throws IOException {
41992      composeDomainResourceElements(element);
41993      if (element.hasIdentifier()) {
41994        openArray("identifier");
41995        for (Identifier e : element.getIdentifier()) 
41996          composeIdentifier(null, e);
41997        closeArray();
41998      };
41999      if (element.hasInstantiatesCanonical()) {
42000        openArray("instantiatesCanonical");
42001        for (CanonicalType e : element.getInstantiatesCanonical()) 
42002          composeCanonicalCore(null, e, true);
42003        closeArray();
42004        if (anyHasExtras(element.getInstantiatesCanonical())) {
42005          openArray("_instantiatesCanonical");
42006          for (CanonicalType e : element.getInstantiatesCanonical()) 
42007            composeCanonicalExtras(null, e, true);
42008          closeArray();
42009        }
42010      };
42011      if (element.hasInstantiatesUri()) {
42012        openArray("instantiatesUri");
42013        for (UriType e : element.getInstantiatesUri()) 
42014          composeUriCore(null, e, true);
42015        closeArray();
42016        if (anyHasExtras(element.getInstantiatesUri())) {
42017          openArray("_instantiatesUri");
42018          for (UriType e : element.getInstantiatesUri()) 
42019            composeUriExtras(null, e, true);
42020          closeArray();
42021        }
42022      };
42023      if (element.hasStatusElement()) {
42024        composeEnumerationCore("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
42025        composeEnumerationExtras("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
42026      }
42027      if (element.hasDataAbsentReason()) {
42028        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
42029      }
42030      if (element.hasPatient()) {
42031        composeReference("patient", element.getPatient());
42032      }
42033      if (element.hasDateElement()) {
42034        composeDateTimeCore("date", element.getDateElement(), false);
42035        composeDateTimeExtras("date", element.getDateElement(), false);
42036      }
42037      if (element.hasNameElement()) {
42038        composeStringCore("name", element.getNameElement(), false);
42039        composeStringExtras("name", element.getNameElement(), false);
42040      }
42041      if (element.hasRelationship()) {
42042        composeCodeableConcept("relationship", element.getRelationship());
42043      }
42044      if (element.hasSex()) {
42045        composeCodeableConcept("sex", element.getSex());
42046      }
42047      if (element.hasBorn()) {
42048        composeType("born", element.getBorn());
42049      }
42050      if (element.hasAge()) {
42051        composeType("age", element.getAge());
42052      }
42053      if (element.hasEstimatedAgeElement()) {
42054        composeBooleanCore("estimatedAge", element.getEstimatedAgeElement(), false);
42055        composeBooleanExtras("estimatedAge", element.getEstimatedAgeElement(), false);
42056      }
42057      if (element.hasDeceased()) {
42058        composeType("deceased", element.getDeceased());
42059      }
42060      if (element.hasReasonCode()) {
42061        openArray("reasonCode");
42062        for (CodeableConcept e : element.getReasonCode()) 
42063          composeCodeableConcept(null, e);
42064        closeArray();
42065      };
42066      if (element.hasReasonReference()) {
42067        openArray("reasonReference");
42068        for (Reference e : element.getReasonReference()) 
42069          composeReference(null, e);
42070        closeArray();
42071      };
42072      if (element.hasNote()) {
42073        openArray("note");
42074        for (Annotation e : element.getNote()) 
42075          composeAnnotation(null, e);
42076        closeArray();
42077      };
42078      if (element.hasCondition()) {
42079        openArray("condition");
42080        for (FamilyMemberHistory.FamilyMemberHistoryConditionComponent e : element.getCondition()) 
42081          composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(null, e);
42082        closeArray();
42083      };
42084  }
42085
42086  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
42087    if (element != null) {
42088      open(name);
42089      composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(element);
42090      close();
42091    }
42092  }
42093
42094  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
42095      composeBackbone(element);
42096      if (element.hasCode()) {
42097        composeCodeableConcept("code", element.getCode());
42098      }
42099      if (element.hasOutcome()) {
42100        composeCodeableConcept("outcome", element.getOutcome());
42101      }
42102      if (element.hasContributedToDeathElement()) {
42103        composeBooleanCore("contributedToDeath", element.getContributedToDeathElement(), false);
42104        composeBooleanExtras("contributedToDeath", element.getContributedToDeathElement(), false);
42105      }
42106      if (element.hasOnset()) {
42107        composeType("onset", element.getOnset());
42108      }
42109      if (element.hasNote()) {
42110        openArray("note");
42111        for (Annotation e : element.getNote()) 
42112          composeAnnotation(null, e);
42113        closeArray();
42114      };
42115  }
42116
42117  protected void composeFlag(String name, Flag element) throws IOException {
42118    if (element != null) {
42119      prop("resourceType", name);
42120      composeFlagInner(element);
42121    }
42122  }
42123
42124  protected void composeFlagInner(Flag element) throws IOException {
42125      composeDomainResourceElements(element);
42126      if (element.hasIdentifier()) {
42127        openArray("identifier");
42128        for (Identifier e : element.getIdentifier()) 
42129          composeIdentifier(null, e);
42130        closeArray();
42131      };
42132      if (element.hasStatusElement()) {
42133        composeEnumerationCore("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
42134        composeEnumerationExtras("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
42135      }
42136      if (element.hasCategory()) {
42137        openArray("category");
42138        for (CodeableConcept e : element.getCategory()) 
42139          composeCodeableConcept(null, e);
42140        closeArray();
42141      };
42142      if (element.hasCode()) {
42143        composeCodeableConcept("code", element.getCode());
42144      }
42145      if (element.hasSubject()) {
42146        composeReference("subject", element.getSubject());
42147      }
42148      if (element.hasPeriod()) {
42149        composePeriod("period", element.getPeriod());
42150      }
42151      if (element.hasEncounter()) {
42152        composeReference("encounter", element.getEncounter());
42153      }
42154      if (element.hasAuthor()) {
42155        composeReference("author", element.getAuthor());
42156      }
42157  }
42158
42159  protected void composeGoal(String name, Goal element) throws IOException {
42160    if (element != null) {
42161      prop("resourceType", name);
42162      composeGoalInner(element);
42163    }
42164  }
42165
42166  protected void composeGoalInner(Goal element) throws IOException {
42167      composeDomainResourceElements(element);
42168      if (element.hasIdentifier()) {
42169        openArray("identifier");
42170        for (Identifier e : element.getIdentifier()) 
42171          composeIdentifier(null, e);
42172        closeArray();
42173      };
42174      if (element.hasLifecycleStatusElement()) {
42175        composeEnumerationCore("lifecycleStatus", element.getLifecycleStatusElement(), new Goal.GoalLifecycleStatusEnumFactory(), false);
42176        composeEnumerationExtras("lifecycleStatus", element.getLifecycleStatusElement(), new Goal.GoalLifecycleStatusEnumFactory(), false);
42177      }
42178      if (element.hasAchievementStatus()) {
42179        composeCodeableConcept("achievementStatus", element.getAchievementStatus());
42180      }
42181      if (element.hasCategory()) {
42182        openArray("category");
42183        for (CodeableConcept e : element.getCategory()) 
42184          composeCodeableConcept(null, e);
42185        closeArray();
42186      };
42187      if (element.hasPriority()) {
42188        composeCodeableConcept("priority", element.getPriority());
42189      }
42190      if (element.hasDescription()) {
42191        composeCodeableConcept("description", element.getDescription());
42192      }
42193      if (element.hasSubject()) {
42194        composeReference("subject", element.getSubject());
42195      }
42196      if (element.hasStart()) {
42197        composeType("start", element.getStart());
42198      }
42199      if (element.hasTarget()) {
42200        openArray("target");
42201        for (Goal.GoalTargetComponent e : element.getTarget()) 
42202          composeGoalGoalTargetComponent(null, e);
42203        closeArray();
42204      };
42205      if (element.hasStatusDateElement()) {
42206        composeDateCore("statusDate", element.getStatusDateElement(), false);
42207        composeDateExtras("statusDate", element.getStatusDateElement(), false);
42208      }
42209      if (element.hasStatusReasonElement()) {
42210        composeStringCore("statusReason", element.getStatusReasonElement(), false);
42211        composeStringExtras("statusReason", element.getStatusReasonElement(), false);
42212      }
42213      if (element.hasExpressedBy()) {
42214        composeReference("expressedBy", element.getExpressedBy());
42215      }
42216      if (element.hasAddresses()) {
42217        openArray("addresses");
42218        for (Reference e : element.getAddresses()) 
42219          composeReference(null, e);
42220        closeArray();
42221      };
42222      if (element.hasNote()) {
42223        openArray("note");
42224        for (Annotation e : element.getNote()) 
42225          composeAnnotation(null, e);
42226        closeArray();
42227      };
42228      if (element.hasOutcomeCode()) {
42229        openArray("outcomeCode");
42230        for (CodeableConcept e : element.getOutcomeCode()) 
42231          composeCodeableConcept(null, e);
42232        closeArray();
42233      };
42234      if (element.hasOutcomeReference()) {
42235        openArray("outcomeReference");
42236        for (Reference e : element.getOutcomeReference()) 
42237          composeReference(null, e);
42238        closeArray();
42239      };
42240  }
42241
42242  protected void composeGoalGoalTargetComponent(String name, Goal.GoalTargetComponent element) throws IOException {
42243    if (element != null) {
42244      open(name);
42245      composeGoalGoalTargetComponentInner(element);
42246      close();
42247    }
42248  }
42249
42250  protected void composeGoalGoalTargetComponentInner(Goal.GoalTargetComponent element) throws IOException {
42251      composeBackbone(element);
42252      if (element.hasMeasure()) {
42253        composeCodeableConcept("measure", element.getMeasure());
42254      }
42255      if (element.hasDetail()) {
42256        composeType("detail", element.getDetail());
42257      }
42258      if (element.hasDue()) {
42259        composeType("due", element.getDue());
42260      }
42261  }
42262
42263  protected void composeGraphDefinition(String name, GraphDefinition element) throws IOException {
42264    if (element != null) {
42265      prop("resourceType", name);
42266      composeGraphDefinitionInner(element);
42267    }
42268  }
42269
42270  protected void composeGraphDefinitionInner(GraphDefinition element) throws IOException {
42271      composeDomainResourceElements(element);
42272      if (element.hasUrlElement()) {
42273        composeUriCore("url", element.getUrlElement(), false);
42274        composeUriExtras("url", element.getUrlElement(), false);
42275      }
42276      if (element.hasVersionElement()) {
42277        composeStringCore("version", element.getVersionElement(), false);
42278        composeStringExtras("version", element.getVersionElement(), false);
42279      }
42280      if (element.hasNameElement()) {
42281        composeStringCore("name", element.getNameElement(), false);
42282        composeStringExtras("name", element.getNameElement(), false);
42283      }
42284      if (element.hasStatusElement()) {
42285        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42286        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42287      }
42288      if (element.hasExperimentalElement()) {
42289        composeBooleanCore("experimental", element.getExperimentalElement(), false);
42290        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
42291      }
42292      if (element.hasDateElement()) {
42293        composeDateTimeCore("date", element.getDateElement(), false);
42294        composeDateTimeExtras("date", element.getDateElement(), false);
42295      }
42296      if (element.hasPublisherElement()) {
42297        composeStringCore("publisher", element.getPublisherElement(), false);
42298        composeStringExtras("publisher", element.getPublisherElement(), false);
42299      }
42300      if (element.hasContact()) {
42301        openArray("contact");
42302        for (ContactDetail e : element.getContact()) 
42303          composeContactDetail(null, e);
42304        closeArray();
42305      };
42306      if (element.hasDescriptionElement()) {
42307        composeMarkdownCore("description", element.getDescriptionElement(), false);
42308        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42309      }
42310      if (element.hasUseContext()) {
42311        openArray("useContext");
42312        for (UsageContext e : element.getUseContext()) 
42313          composeUsageContext(null, e);
42314        closeArray();
42315      };
42316      if (element.hasJurisdiction()) {
42317        openArray("jurisdiction");
42318        for (CodeableConcept e : element.getJurisdiction()) 
42319          composeCodeableConcept(null, e);
42320        closeArray();
42321      };
42322      if (element.hasPurposeElement()) {
42323        composeMarkdownCore("purpose", element.getPurposeElement(), false);
42324        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
42325      }
42326      if (element.hasStartElement()) {
42327        composeCodeCore("start", element.getStartElement(), false);
42328        composeCodeExtras("start", element.getStartElement(), false);
42329      }
42330      if (element.hasProfileElement()) {
42331        composeCanonicalCore("profile", element.getProfileElement(), false);
42332        composeCanonicalExtras("profile", element.getProfileElement(), false);
42333      }
42334      if (element.hasLink()) {
42335        openArray("link");
42336        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
42337          composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
42338        closeArray();
42339      };
42340  }
42341
42342  protected void composeGraphDefinitionGraphDefinitionLinkComponent(String name, GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
42343    if (element != null) {
42344      open(name);
42345      composeGraphDefinitionGraphDefinitionLinkComponentInner(element);
42346      close();
42347    }
42348  }
42349
42350  protected void composeGraphDefinitionGraphDefinitionLinkComponentInner(GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
42351      composeBackbone(element);
42352      if (element.hasPathElement()) {
42353        composeStringCore("path", element.getPathElement(), false);
42354        composeStringExtras("path", element.getPathElement(), false);
42355      }
42356      if (element.hasSliceNameElement()) {
42357        composeStringCore("sliceName", element.getSliceNameElement(), false);
42358        composeStringExtras("sliceName", element.getSliceNameElement(), false);
42359      }
42360      if (element.hasMinElement()) {
42361        composeIntegerCore("min", element.getMinElement(), false);
42362        composeIntegerExtras("min", element.getMinElement(), false);
42363      }
42364      if (element.hasMaxElement()) {
42365        composeStringCore("max", element.getMaxElement(), false);
42366        composeStringExtras("max", element.getMaxElement(), false);
42367      }
42368      if (element.hasDescriptionElement()) {
42369        composeStringCore("description", element.getDescriptionElement(), false);
42370        composeStringExtras("description", element.getDescriptionElement(), false);
42371      }
42372      if (element.hasTarget()) {
42373        openArray("target");
42374        for (GraphDefinition.GraphDefinitionLinkTargetComponent e : element.getTarget()) 
42375          composeGraphDefinitionGraphDefinitionLinkTargetComponent(null, e);
42376        closeArray();
42377      };
42378  }
42379
42380  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponent(String name, GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
42381    if (element != null) {
42382      open(name);
42383      composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(element);
42384      close();
42385    }
42386  }
42387
42388  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
42389      composeBackbone(element);
42390      if (element.hasTypeElement()) {
42391        composeCodeCore("type", element.getTypeElement(), false);
42392        composeCodeExtras("type", element.getTypeElement(), false);
42393      }
42394      if (element.hasParamsElement()) {
42395        composeStringCore("params", element.getParamsElement(), false);
42396        composeStringExtras("params", element.getParamsElement(), false);
42397      }
42398      if (element.hasProfileElement()) {
42399        composeCanonicalCore("profile", element.getProfileElement(), false);
42400        composeCanonicalExtras("profile", element.getProfileElement(), false);
42401      }
42402      if (element.hasCompartment()) {
42403        openArray("compartment");
42404        for (GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent e : element.getCompartment()) 
42405          composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(null, e);
42406        closeArray();
42407      };
42408      if (element.hasLink()) {
42409        openArray("link");
42410        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
42411          composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
42412        closeArray();
42413      };
42414  }
42415
42416  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(String name, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
42417    if (element != null) {
42418      open(name);
42419      composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(element);
42420      close();
42421    }
42422  }
42423
42424  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
42425      composeBackbone(element);
42426      if (element.hasUseElement()) {
42427        composeEnumerationCore("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
42428        composeEnumerationExtras("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
42429      }
42430      if (element.hasCodeElement()) {
42431        composeEnumerationCore("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(), false);
42432        composeEnumerationExtras("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(), false);
42433      }
42434      if (element.hasRuleElement()) {
42435        composeEnumerationCore("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
42436        composeEnumerationExtras("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
42437      }
42438      if (element.hasExpressionElement()) {
42439        composeStringCore("expression", element.getExpressionElement(), false);
42440        composeStringExtras("expression", element.getExpressionElement(), false);
42441      }
42442      if (element.hasDescriptionElement()) {
42443        composeStringCore("description", element.getDescriptionElement(), false);
42444        composeStringExtras("description", element.getDescriptionElement(), false);
42445      }
42446  }
42447
42448  protected void composeGroup(String name, Group element) throws IOException {
42449    if (element != null) {
42450      prop("resourceType", name);
42451      composeGroupInner(element);
42452    }
42453  }
42454
42455  protected void composeGroupInner(Group element) throws IOException {
42456      composeDomainResourceElements(element);
42457      if (element.hasIdentifier()) {
42458        openArray("identifier");
42459        for (Identifier e : element.getIdentifier()) 
42460          composeIdentifier(null, e);
42461        closeArray();
42462      };
42463      if (element.hasActiveElement()) {
42464        composeBooleanCore("active", element.getActiveElement(), false);
42465        composeBooleanExtras("active", element.getActiveElement(), false);
42466      }
42467      if (element.hasTypeElement()) {
42468        composeEnumerationCore("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
42469        composeEnumerationExtras("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
42470      }
42471      if (element.hasActualElement()) {
42472        composeBooleanCore("actual", element.getActualElement(), false);
42473        composeBooleanExtras("actual", element.getActualElement(), false);
42474      }
42475      if (element.hasCode()) {
42476        composeCodeableConcept("code", element.getCode());
42477      }
42478      if (element.hasNameElement()) {
42479        composeStringCore("name", element.getNameElement(), false);
42480        composeStringExtras("name", element.getNameElement(), false);
42481      }
42482      if (element.hasQuantityElement()) {
42483        composeUnsignedIntCore("quantity", element.getQuantityElement(), false);
42484        composeUnsignedIntExtras("quantity", element.getQuantityElement(), false);
42485      }
42486      if (element.hasManagingEntity()) {
42487        composeReference("managingEntity", element.getManagingEntity());
42488      }
42489      if (element.hasCharacteristic()) {
42490        openArray("characteristic");
42491        for (Group.GroupCharacteristicComponent e : element.getCharacteristic()) 
42492          composeGroupGroupCharacteristicComponent(null, e);
42493        closeArray();
42494      };
42495      if (element.hasMember()) {
42496        openArray("member");
42497        for (Group.GroupMemberComponent e : element.getMember()) 
42498          composeGroupGroupMemberComponent(null, e);
42499        closeArray();
42500      };
42501  }
42502
42503  protected void composeGroupGroupCharacteristicComponent(String name, Group.GroupCharacteristicComponent element) throws IOException {
42504    if (element != null) {
42505      open(name);
42506      composeGroupGroupCharacteristicComponentInner(element);
42507      close();
42508    }
42509  }
42510
42511  protected void composeGroupGroupCharacteristicComponentInner(Group.GroupCharacteristicComponent element) throws IOException {
42512      composeBackbone(element);
42513      if (element.hasCode()) {
42514        composeCodeableConcept("code", element.getCode());
42515      }
42516      if (element.hasValue()) {
42517        composeType("value", element.getValue());
42518      }
42519      if (element.hasExcludeElement()) {
42520        composeBooleanCore("exclude", element.getExcludeElement(), false);
42521        composeBooleanExtras("exclude", element.getExcludeElement(), false);
42522      }
42523      if (element.hasPeriod()) {
42524        composePeriod("period", element.getPeriod());
42525      }
42526  }
42527
42528  protected void composeGroupGroupMemberComponent(String name, Group.GroupMemberComponent element) throws IOException {
42529    if (element != null) {
42530      open(name);
42531      composeGroupGroupMemberComponentInner(element);
42532      close();
42533    }
42534  }
42535
42536  protected void composeGroupGroupMemberComponentInner(Group.GroupMemberComponent element) throws IOException {
42537      composeBackbone(element);
42538      if (element.hasEntity()) {
42539        composeReference("entity", element.getEntity());
42540      }
42541      if (element.hasPeriod()) {
42542        composePeriod("period", element.getPeriod());
42543      }
42544      if (element.hasInactiveElement()) {
42545        composeBooleanCore("inactive", element.getInactiveElement(), false);
42546        composeBooleanExtras("inactive", element.getInactiveElement(), false);
42547      }
42548  }
42549
42550  protected void composeGuidanceResponse(String name, GuidanceResponse element) throws IOException {
42551    if (element != null) {
42552      prop("resourceType", name);
42553      composeGuidanceResponseInner(element);
42554    }
42555  }
42556
42557  protected void composeGuidanceResponseInner(GuidanceResponse element) throws IOException {
42558      composeDomainResourceElements(element);
42559      if (element.hasRequestIdentifier()) {
42560        composeIdentifier("requestIdentifier", element.getRequestIdentifier());
42561      }
42562      if (element.hasIdentifier()) {
42563        openArray("identifier");
42564        for (Identifier e : element.getIdentifier()) 
42565          composeIdentifier(null, e);
42566        closeArray();
42567      };
42568      if (element.hasModule()) {
42569        composeType("module", element.getModule());
42570      }
42571      if (element.hasStatusElement()) {
42572        composeEnumerationCore("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
42573        composeEnumerationExtras("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
42574      }
42575      if (element.hasSubject()) {
42576        composeReference("subject", element.getSubject());
42577      }
42578      if (element.hasEncounter()) {
42579        composeReference("encounter", element.getEncounter());
42580      }
42581      if (element.hasOccurrenceDateTimeElement()) {
42582        composeDateTimeCore("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
42583        composeDateTimeExtras("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
42584      }
42585      if (element.hasPerformer()) {
42586        composeReference("performer", element.getPerformer());
42587      }
42588      if (element.hasReasonCode()) {
42589        openArray("reasonCode");
42590        for (CodeableConcept e : element.getReasonCode()) 
42591          composeCodeableConcept(null, e);
42592        closeArray();
42593      };
42594      if (element.hasReasonReference()) {
42595        openArray("reasonReference");
42596        for (Reference e : element.getReasonReference()) 
42597          composeReference(null, e);
42598        closeArray();
42599      };
42600      if (element.hasNote()) {
42601        openArray("note");
42602        for (Annotation e : element.getNote()) 
42603          composeAnnotation(null, e);
42604        closeArray();
42605      };
42606      if (element.hasEvaluationMessage()) {
42607        openArray("evaluationMessage");
42608        for (Reference e : element.getEvaluationMessage()) 
42609          composeReference(null, e);
42610        closeArray();
42611      };
42612      if (element.hasOutputParameters()) {
42613        composeReference("outputParameters", element.getOutputParameters());
42614      }
42615      if (element.hasResult()) {
42616        composeReference("result", element.getResult());
42617      }
42618      if (element.hasDataRequirement()) {
42619        openArray("dataRequirement");
42620        for (DataRequirement e : element.getDataRequirement()) 
42621          composeDataRequirement(null, e);
42622        closeArray();
42623      };
42624  }
42625
42626  protected void composeHealthcareService(String name, HealthcareService element) throws IOException {
42627    if (element != null) {
42628      prop("resourceType", name);
42629      composeHealthcareServiceInner(element);
42630    }
42631  }
42632
42633  protected void composeHealthcareServiceInner(HealthcareService element) throws IOException {
42634      composeDomainResourceElements(element);
42635      if (element.hasIdentifier()) {
42636        openArray("identifier");
42637        for (Identifier e : element.getIdentifier()) 
42638          composeIdentifier(null, e);
42639        closeArray();
42640      };
42641      if (element.hasActiveElement()) {
42642        composeBooleanCore("active", element.getActiveElement(), false);
42643        composeBooleanExtras("active", element.getActiveElement(), false);
42644      }
42645      if (element.hasProvidedBy()) {
42646        composeReference("providedBy", element.getProvidedBy());
42647      }
42648      if (element.hasCategory()) {
42649        openArray("category");
42650        for (CodeableConcept e : element.getCategory()) 
42651          composeCodeableConcept(null, e);
42652        closeArray();
42653      };
42654      if (element.hasType()) {
42655        openArray("type");
42656        for (CodeableConcept e : element.getType()) 
42657          composeCodeableConcept(null, e);
42658        closeArray();
42659      };
42660      if (element.hasSpecialty()) {
42661        openArray("specialty");
42662        for (CodeableConcept e : element.getSpecialty()) 
42663          composeCodeableConcept(null, e);
42664        closeArray();
42665      };
42666      if (element.hasLocation()) {
42667        openArray("location");
42668        for (Reference e : element.getLocation()) 
42669          composeReference(null, e);
42670        closeArray();
42671      };
42672      if (element.hasNameElement()) {
42673        composeStringCore("name", element.getNameElement(), false);
42674        composeStringExtras("name", element.getNameElement(), false);
42675      }
42676      if (element.hasCommentElement()) {
42677        composeStringCore("comment", element.getCommentElement(), false);
42678        composeStringExtras("comment", element.getCommentElement(), false);
42679      }
42680      if (element.hasExtraDetailsElement()) {
42681        composeMarkdownCore("extraDetails", element.getExtraDetailsElement(), false);
42682        composeMarkdownExtras("extraDetails", element.getExtraDetailsElement(), false);
42683      }
42684      if (element.hasPhoto()) {
42685        composeAttachment("photo", element.getPhoto());
42686      }
42687      if (element.hasTelecom()) {
42688        openArray("telecom");
42689        for (ContactPoint e : element.getTelecom()) 
42690          composeContactPoint(null, e);
42691        closeArray();
42692      };
42693      if (element.hasCoverageArea()) {
42694        openArray("coverageArea");
42695        for (Reference e : element.getCoverageArea()) 
42696          composeReference(null, e);
42697        closeArray();
42698      };
42699      if (element.hasServiceProvisionCode()) {
42700        openArray("serviceProvisionCode");
42701        for (CodeableConcept e : element.getServiceProvisionCode()) 
42702          composeCodeableConcept(null, e);
42703        closeArray();
42704      };
42705      if (element.hasEligibility()) {
42706        openArray("eligibility");
42707        for (HealthcareService.HealthcareServiceEligibilityComponent e : element.getEligibility()) 
42708          composeHealthcareServiceHealthcareServiceEligibilityComponent(null, e);
42709        closeArray();
42710      };
42711      if (element.hasProgram()) {
42712        openArray("program");
42713        for (CodeableConcept e : element.getProgram()) 
42714          composeCodeableConcept(null, e);
42715        closeArray();
42716      };
42717      if (element.hasCharacteristic()) {
42718        openArray("characteristic");
42719        for (CodeableConcept e : element.getCharacteristic()) 
42720          composeCodeableConcept(null, e);
42721        closeArray();
42722      };
42723      if (element.hasCommunication()) {
42724        openArray("communication");
42725        for (CodeableConcept e : element.getCommunication()) 
42726          composeCodeableConcept(null, e);
42727        closeArray();
42728      };
42729      if (element.hasReferralMethod()) {
42730        openArray("referralMethod");
42731        for (CodeableConcept e : element.getReferralMethod()) 
42732          composeCodeableConcept(null, e);
42733        closeArray();
42734      };
42735      if (element.hasAppointmentRequiredElement()) {
42736        composeBooleanCore("appointmentRequired", element.getAppointmentRequiredElement(), false);
42737        composeBooleanExtras("appointmentRequired", element.getAppointmentRequiredElement(), false);
42738      }
42739      if (element.hasAvailableTime()) {
42740        openArray("availableTime");
42741        for (HealthcareService.HealthcareServiceAvailableTimeComponent e : element.getAvailableTime()) 
42742          composeHealthcareServiceHealthcareServiceAvailableTimeComponent(null, e);
42743        closeArray();
42744      };
42745      if (element.hasNotAvailable()) {
42746        openArray("notAvailable");
42747        for (HealthcareService.HealthcareServiceNotAvailableComponent e : element.getNotAvailable()) 
42748          composeHealthcareServiceHealthcareServiceNotAvailableComponent(null, e);
42749        closeArray();
42750      };
42751      if (element.hasAvailabilityExceptionsElement()) {
42752        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
42753        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
42754      }
42755      if (element.hasEndpoint()) {
42756        openArray("endpoint");
42757        for (Reference e : element.getEndpoint()) 
42758          composeReference(null, e);
42759        closeArray();
42760      };
42761  }
42762
42763  protected void composeHealthcareServiceHealthcareServiceEligibilityComponent(String name, HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
42764    if (element != null) {
42765      open(name);
42766      composeHealthcareServiceHealthcareServiceEligibilityComponentInner(element);
42767      close();
42768    }
42769  }
42770
42771  protected void composeHealthcareServiceHealthcareServiceEligibilityComponentInner(HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
42772      composeBackbone(element);
42773      if (element.hasCode()) {
42774        composeCodeableConcept("code", element.getCode());
42775      }
42776      if (element.hasCommentElement()) {
42777        composeMarkdownCore("comment", element.getCommentElement(), false);
42778        composeMarkdownExtras("comment", element.getCommentElement(), false);
42779      }
42780  }
42781
42782  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponent(String name, HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
42783    if (element != null) {
42784      open(name);
42785      composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(element);
42786      close();
42787    }
42788  }
42789
42790  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
42791      composeBackbone(element);
42792      if (element.hasDaysOfWeek()) {
42793        openArray("daysOfWeek");
42794        for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
42795          composeEnumerationCore(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
42796        closeArray();
42797        if (anyHasExtras(element.getDaysOfWeek())) {
42798          openArray("_daysOfWeek");
42799          for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
42800            composeEnumerationExtras(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
42801          closeArray();
42802        }
42803      };
42804      if (element.hasAllDayElement()) {
42805        composeBooleanCore("allDay", element.getAllDayElement(), false);
42806        composeBooleanExtras("allDay", element.getAllDayElement(), false);
42807      }
42808      if (element.hasAvailableStartTimeElement()) {
42809        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
42810        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
42811      }
42812      if (element.hasAvailableEndTimeElement()) {
42813        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
42814        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
42815      }
42816  }
42817
42818  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponent(String name, HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
42819    if (element != null) {
42820      open(name);
42821      composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(element);
42822      close();
42823    }
42824  }
42825
42826  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
42827      composeBackbone(element);
42828      if (element.hasDescriptionElement()) {
42829        composeStringCore("description", element.getDescriptionElement(), false);
42830        composeStringExtras("description", element.getDescriptionElement(), false);
42831      }
42832      if (element.hasDuring()) {
42833        composePeriod("during", element.getDuring());
42834      }
42835  }
42836
42837  protected void composeImagingStudy(String name, ImagingStudy element) throws IOException {
42838    if (element != null) {
42839      prop("resourceType", name);
42840      composeImagingStudyInner(element);
42841    }
42842  }
42843
42844  protected void composeImagingStudyInner(ImagingStudy element) throws IOException {
42845      composeDomainResourceElements(element);
42846      if (element.hasIdentifier()) {
42847        openArray("identifier");
42848        for (Identifier e : element.getIdentifier()) 
42849          composeIdentifier(null, e);
42850        closeArray();
42851      };
42852      if (element.hasStatusElement()) {
42853        composeEnumerationCore("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
42854        composeEnumerationExtras("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
42855      }
42856      if (element.hasModality()) {
42857        openArray("modality");
42858        for (Coding e : element.getModality()) 
42859          composeCoding(null, e);
42860        closeArray();
42861      };
42862      if (element.hasSubject()) {
42863        composeReference("subject", element.getSubject());
42864      }
42865      if (element.hasEncounter()) {
42866        composeReference("encounter", element.getEncounter());
42867      }
42868      if (element.hasStartedElement()) {
42869        composeDateTimeCore("started", element.getStartedElement(), false);
42870        composeDateTimeExtras("started", element.getStartedElement(), false);
42871      }
42872      if (element.hasBasedOn()) {
42873        openArray("basedOn");
42874        for (Reference e : element.getBasedOn()) 
42875          composeReference(null, e);
42876        closeArray();
42877      };
42878      if (element.hasReferrer()) {
42879        composeReference("referrer", element.getReferrer());
42880      }
42881      if (element.hasInterpreter()) {
42882        openArray("interpreter");
42883        for (Reference e : element.getInterpreter()) 
42884          composeReference(null, e);
42885        closeArray();
42886      };
42887      if (element.hasEndpoint()) {
42888        openArray("endpoint");
42889        for (Reference e : element.getEndpoint()) 
42890          composeReference(null, e);
42891        closeArray();
42892      };
42893      if (element.hasNumberOfSeriesElement()) {
42894        composeUnsignedIntCore("numberOfSeries", element.getNumberOfSeriesElement(), false);
42895        composeUnsignedIntExtras("numberOfSeries", element.getNumberOfSeriesElement(), false);
42896      }
42897      if (element.hasNumberOfInstancesElement()) {
42898        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
42899        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
42900      }
42901      if (element.hasProcedureReference()) {
42902        composeReference("procedureReference", element.getProcedureReference());
42903      }
42904      if (element.hasProcedureCode()) {
42905        openArray("procedureCode");
42906        for (CodeableConcept e : element.getProcedureCode()) 
42907          composeCodeableConcept(null, e);
42908        closeArray();
42909      };
42910      if (element.hasLocation()) {
42911        composeReference("location", element.getLocation());
42912      }
42913      if (element.hasReasonCode()) {
42914        openArray("reasonCode");
42915        for (CodeableConcept e : element.getReasonCode()) 
42916          composeCodeableConcept(null, e);
42917        closeArray();
42918      };
42919      if (element.hasReasonReference()) {
42920        openArray("reasonReference");
42921        for (Reference e : element.getReasonReference()) 
42922          composeReference(null, e);
42923        closeArray();
42924      };
42925      if (element.hasNote()) {
42926        openArray("note");
42927        for (Annotation e : element.getNote()) 
42928          composeAnnotation(null, e);
42929        closeArray();
42930      };
42931      if (element.hasDescriptionElement()) {
42932        composeStringCore("description", element.getDescriptionElement(), false);
42933        composeStringExtras("description", element.getDescriptionElement(), false);
42934      }
42935      if (element.hasSeries()) {
42936        openArray("series");
42937        for (ImagingStudy.ImagingStudySeriesComponent e : element.getSeries()) 
42938          composeImagingStudyImagingStudySeriesComponent(null, e);
42939        closeArray();
42940      };
42941  }
42942
42943  protected void composeImagingStudyImagingStudySeriesComponent(String name, ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
42944    if (element != null) {
42945      open(name);
42946      composeImagingStudyImagingStudySeriesComponentInner(element);
42947      close();
42948    }
42949  }
42950
42951  protected void composeImagingStudyImagingStudySeriesComponentInner(ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
42952      composeBackbone(element);
42953      if (element.hasUidElement()) {
42954        composeIdCore("uid", element.getUidElement(), false);
42955        composeIdExtras("uid", element.getUidElement(), false);
42956      }
42957      if (element.hasNumberElement()) {
42958        composeUnsignedIntCore("number", element.getNumberElement(), false);
42959        composeUnsignedIntExtras("number", element.getNumberElement(), false);
42960      }
42961      if (element.hasModality()) {
42962        composeCoding("modality", element.getModality());
42963      }
42964      if (element.hasDescriptionElement()) {
42965        composeStringCore("description", element.getDescriptionElement(), false);
42966        composeStringExtras("description", element.getDescriptionElement(), false);
42967      }
42968      if (element.hasNumberOfInstancesElement()) {
42969        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
42970        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
42971      }
42972      if (element.hasEndpoint()) {
42973        openArray("endpoint");
42974        for (Reference e : element.getEndpoint()) 
42975          composeReference(null, e);
42976        closeArray();
42977      };
42978      if (element.hasBodySite()) {
42979        composeCoding("bodySite", element.getBodySite());
42980      }
42981      if (element.hasLaterality()) {
42982        composeCoding("laterality", element.getLaterality());
42983      }
42984      if (element.hasSpecimen()) {
42985        openArray("specimen");
42986        for (Reference e : element.getSpecimen()) 
42987          composeReference(null, e);
42988        closeArray();
42989      };
42990      if (element.hasStartedElement()) {
42991        composeDateTimeCore("started", element.getStartedElement(), false);
42992        composeDateTimeExtras("started", element.getStartedElement(), false);
42993      }
42994      if (element.hasPerformer()) {
42995        openArray("performer");
42996        for (ImagingStudy.ImagingStudySeriesPerformerComponent e : element.getPerformer()) 
42997          composeImagingStudyImagingStudySeriesPerformerComponent(null, e);
42998        closeArray();
42999      };
43000      if (element.hasInstance()) {
43001        openArray("instance");
43002        for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance()) 
43003          composeImagingStudyImagingStudySeriesInstanceComponent(null, e);
43004        closeArray();
43005      };
43006  }
43007
43008  protected void composeImagingStudyImagingStudySeriesPerformerComponent(String name, ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
43009    if (element != null) {
43010      open(name);
43011      composeImagingStudyImagingStudySeriesPerformerComponentInner(element);
43012      close();
43013    }
43014  }
43015
43016  protected void composeImagingStudyImagingStudySeriesPerformerComponentInner(ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
43017      composeBackbone(element);
43018      if (element.hasFunction()) {
43019        composeCodeableConcept("function", element.getFunction());
43020      }
43021      if (element.hasActor()) {
43022        composeReference("actor", element.getActor());
43023      }
43024  }
43025
43026  protected void composeImagingStudyImagingStudySeriesInstanceComponent(String name, ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
43027    if (element != null) {
43028      open(name);
43029      composeImagingStudyImagingStudySeriesInstanceComponentInner(element);
43030      close();
43031    }
43032  }
43033
43034  protected void composeImagingStudyImagingStudySeriesInstanceComponentInner(ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
43035      composeBackbone(element);
43036      if (element.hasUidElement()) {
43037        composeIdCore("uid", element.getUidElement(), false);
43038        composeIdExtras("uid", element.getUidElement(), false);
43039      }
43040      if (element.hasSopClass()) {
43041        composeCoding("sopClass", element.getSopClass());
43042      }
43043      if (element.hasNumberElement()) {
43044        composeUnsignedIntCore("number", element.getNumberElement(), false);
43045        composeUnsignedIntExtras("number", element.getNumberElement(), false);
43046      }
43047      if (element.hasTitleElement()) {
43048        composeStringCore("title", element.getTitleElement(), false);
43049        composeStringExtras("title", element.getTitleElement(), false);
43050      }
43051  }
43052
43053  protected void composeImmunization(String name, Immunization element) throws IOException {
43054    if (element != null) {
43055      prop("resourceType", name);
43056      composeImmunizationInner(element);
43057    }
43058  }
43059
43060  protected void composeImmunizationInner(Immunization element) throws IOException {
43061      composeDomainResourceElements(element);
43062      if (element.hasIdentifier()) {
43063        openArray("identifier");
43064        for (Identifier e : element.getIdentifier()) 
43065          composeIdentifier(null, e);
43066        closeArray();
43067      };
43068      if (element.hasStatusElement()) {
43069        composeEnumerationCore("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(), false);
43070        composeEnumerationExtras("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(), false);
43071      }
43072      if (element.hasStatusReason()) {
43073        composeCodeableConcept("statusReason", element.getStatusReason());
43074      }
43075      if (element.hasVaccineCode()) {
43076        composeCodeableConcept("vaccineCode", element.getVaccineCode());
43077      }
43078      if (element.hasPatient()) {
43079        composeReference("patient", element.getPatient());
43080      }
43081      if (element.hasEncounter()) {
43082        composeReference("encounter", element.getEncounter());
43083      }
43084      if (element.hasOccurrence()) {
43085        composeType("occurrence", element.getOccurrence());
43086      }
43087      if (element.hasRecordedElement()) {
43088        composeDateTimeCore("recorded", element.getRecordedElement(), false);
43089        composeDateTimeExtras("recorded", element.getRecordedElement(), false);
43090      }
43091      if (element.hasPrimarySourceElement()) {
43092        composeBooleanCore("primarySource", element.getPrimarySourceElement(), false);
43093        composeBooleanExtras("primarySource", element.getPrimarySourceElement(), false);
43094      }
43095      if (element.hasReportOrigin()) {
43096        composeCodeableConcept("reportOrigin", element.getReportOrigin());
43097      }
43098      if (element.hasLocation()) {
43099        composeReference("location", element.getLocation());
43100      }
43101      if (element.hasManufacturer()) {
43102        composeReference("manufacturer", element.getManufacturer());
43103      }
43104      if (element.hasLotNumberElement()) {
43105        composeStringCore("lotNumber", element.getLotNumberElement(), false);
43106        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
43107      }
43108      if (element.hasExpirationDateElement()) {
43109        composeDateCore("expirationDate", element.getExpirationDateElement(), false);
43110        composeDateExtras("expirationDate", element.getExpirationDateElement(), false);
43111      }
43112      if (element.hasSite()) {
43113        composeCodeableConcept("site", element.getSite());
43114      }
43115      if (element.hasRoute()) {
43116        composeCodeableConcept("route", element.getRoute());
43117      }
43118      if (element.hasDoseQuantity()) {
43119        composeQuantity("doseQuantity", element.getDoseQuantity());
43120      }
43121      if (element.hasPerformer()) {
43122        openArray("performer");
43123        for (Immunization.ImmunizationPerformerComponent e : element.getPerformer()) 
43124          composeImmunizationImmunizationPerformerComponent(null, e);
43125        closeArray();
43126      };
43127      if (element.hasNote()) {
43128        openArray("note");
43129        for (Annotation e : element.getNote()) 
43130          composeAnnotation(null, e);
43131        closeArray();
43132      };
43133      if (element.hasReasonCode()) {
43134        openArray("reasonCode");
43135        for (CodeableConcept e : element.getReasonCode()) 
43136          composeCodeableConcept(null, e);
43137        closeArray();
43138      };
43139      if (element.hasReasonReference()) {
43140        openArray("reasonReference");
43141        for (Reference e : element.getReasonReference()) 
43142          composeReference(null, e);
43143        closeArray();
43144      };
43145      if (element.hasIsSubpotentElement()) {
43146        composeBooleanCore("isSubpotent", element.getIsSubpotentElement(), false);
43147        composeBooleanExtras("isSubpotent", element.getIsSubpotentElement(), false);
43148      }
43149      if (element.hasSubpotentReason()) {
43150        openArray("subpotentReason");
43151        for (CodeableConcept e : element.getSubpotentReason()) 
43152          composeCodeableConcept(null, e);
43153        closeArray();
43154      };
43155      if (element.hasEducation()) {
43156        openArray("education");
43157        for (Immunization.ImmunizationEducationComponent e : element.getEducation()) 
43158          composeImmunizationImmunizationEducationComponent(null, e);
43159        closeArray();
43160      };
43161      if (element.hasProgramEligibility()) {
43162        openArray("programEligibility");
43163        for (CodeableConcept e : element.getProgramEligibility()) 
43164          composeCodeableConcept(null, e);
43165        closeArray();
43166      };
43167      if (element.hasFundingSource()) {
43168        composeCodeableConcept("fundingSource", element.getFundingSource());
43169      }
43170      if (element.hasReaction()) {
43171        openArray("reaction");
43172        for (Immunization.ImmunizationReactionComponent e : element.getReaction()) 
43173          composeImmunizationImmunizationReactionComponent(null, e);
43174        closeArray();
43175      };
43176      if (element.hasProtocolApplied()) {
43177        openArray("protocolApplied");
43178        for (Immunization.ImmunizationProtocolAppliedComponent e : element.getProtocolApplied()) 
43179          composeImmunizationImmunizationProtocolAppliedComponent(null, e);
43180        closeArray();
43181      };
43182  }
43183
43184  protected void composeImmunizationImmunizationPerformerComponent(String name, Immunization.ImmunizationPerformerComponent element) throws IOException {
43185    if (element != null) {
43186      open(name);
43187      composeImmunizationImmunizationPerformerComponentInner(element);
43188      close();
43189    }
43190  }
43191
43192  protected void composeImmunizationImmunizationPerformerComponentInner(Immunization.ImmunizationPerformerComponent element) throws IOException {
43193      composeBackbone(element);
43194      if (element.hasFunction()) {
43195        composeCodeableConcept("function", element.getFunction());
43196      }
43197      if (element.hasActor()) {
43198        composeReference("actor", element.getActor());
43199      }
43200  }
43201
43202  protected void composeImmunizationImmunizationEducationComponent(String name, Immunization.ImmunizationEducationComponent element) throws IOException {
43203    if (element != null) {
43204      open(name);
43205      composeImmunizationImmunizationEducationComponentInner(element);
43206      close();
43207    }
43208  }
43209
43210  protected void composeImmunizationImmunizationEducationComponentInner(Immunization.ImmunizationEducationComponent element) throws IOException {
43211      composeBackbone(element);
43212      if (element.hasDocumentTypeElement()) {
43213        composeStringCore("documentType", element.getDocumentTypeElement(), false);
43214        composeStringExtras("documentType", element.getDocumentTypeElement(), false);
43215      }
43216      if (element.hasReferenceElement()) {
43217        composeUriCore("reference", element.getReferenceElement(), false);
43218        composeUriExtras("reference", element.getReferenceElement(), false);
43219      }
43220      if (element.hasPublicationDateElement()) {
43221        composeDateTimeCore("publicationDate", element.getPublicationDateElement(), false);
43222        composeDateTimeExtras("publicationDate", element.getPublicationDateElement(), false);
43223      }
43224      if (element.hasPresentationDateElement()) {
43225        composeDateTimeCore("presentationDate", element.getPresentationDateElement(), false);
43226        composeDateTimeExtras("presentationDate", element.getPresentationDateElement(), false);
43227      }
43228  }
43229
43230  protected void composeImmunizationImmunizationReactionComponent(String name, Immunization.ImmunizationReactionComponent element) throws IOException {
43231    if (element != null) {
43232      open(name);
43233      composeImmunizationImmunizationReactionComponentInner(element);
43234      close();
43235    }
43236  }
43237
43238  protected void composeImmunizationImmunizationReactionComponentInner(Immunization.ImmunizationReactionComponent element) throws IOException {
43239      composeBackbone(element);
43240      if (element.hasDateElement()) {
43241        composeDateTimeCore("date", element.getDateElement(), false);
43242        composeDateTimeExtras("date", element.getDateElement(), false);
43243      }
43244      if (element.hasDetail()) {
43245        composeReference("detail", element.getDetail());
43246      }
43247      if (element.hasReportedElement()) {
43248        composeBooleanCore("reported", element.getReportedElement(), false);
43249        composeBooleanExtras("reported", element.getReportedElement(), false);
43250      }
43251  }
43252
43253  protected void composeImmunizationImmunizationProtocolAppliedComponent(String name, Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
43254    if (element != null) {
43255      open(name);
43256      composeImmunizationImmunizationProtocolAppliedComponentInner(element);
43257      close();
43258    }
43259  }
43260
43261  protected void composeImmunizationImmunizationProtocolAppliedComponentInner(Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
43262      composeBackbone(element);
43263      if (element.hasSeriesElement()) {
43264        composeStringCore("series", element.getSeriesElement(), false);
43265        composeStringExtras("series", element.getSeriesElement(), false);
43266      }
43267      if (element.hasAuthority()) {
43268        composeReference("authority", element.getAuthority());
43269      }
43270      if (element.hasTargetDisease()) {
43271        openArray("targetDisease");
43272        for (CodeableConcept e : element.getTargetDisease()) 
43273          composeCodeableConcept(null, e);
43274        closeArray();
43275      };
43276      if (element.hasDoseNumber()) {
43277        composeType("doseNumber", element.getDoseNumber());
43278      }
43279      if (element.hasSeriesDoses()) {
43280        composeType("seriesDoses", element.getSeriesDoses());
43281      }
43282  }
43283
43284  protected void composeImmunizationEvaluation(String name, ImmunizationEvaluation element) throws IOException {
43285    if (element != null) {
43286      prop("resourceType", name);
43287      composeImmunizationEvaluationInner(element);
43288    }
43289  }
43290
43291  protected void composeImmunizationEvaluationInner(ImmunizationEvaluation element) throws IOException {
43292      composeDomainResourceElements(element);
43293      if (element.hasIdentifier()) {
43294        openArray("identifier");
43295        for (Identifier e : element.getIdentifier()) 
43296          composeIdentifier(null, e);
43297        closeArray();
43298      };
43299      if (element.hasStatusElement()) {
43300        composeEnumerationCore("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory(), false);
43301        composeEnumerationExtras("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory(), false);
43302      }
43303      if (element.hasPatient()) {
43304        composeReference("patient", element.getPatient());
43305      }
43306      if (element.hasDateElement()) {
43307        composeDateTimeCore("date", element.getDateElement(), false);
43308        composeDateTimeExtras("date", element.getDateElement(), false);
43309      }
43310      if (element.hasAuthority()) {
43311        composeReference("authority", element.getAuthority());
43312      }
43313      if (element.hasTargetDisease()) {
43314        composeCodeableConcept("targetDisease", element.getTargetDisease());
43315      }
43316      if (element.hasImmunizationEvent()) {
43317        composeReference("immunizationEvent", element.getImmunizationEvent());
43318      }
43319      if (element.hasDoseStatus()) {
43320        composeCodeableConcept("doseStatus", element.getDoseStatus());
43321      }
43322      if (element.hasDoseStatusReason()) {
43323        openArray("doseStatusReason");
43324        for (CodeableConcept e : element.getDoseStatusReason()) 
43325          composeCodeableConcept(null, e);
43326        closeArray();
43327      };
43328      if (element.hasDescriptionElement()) {
43329        composeStringCore("description", element.getDescriptionElement(), false);
43330        composeStringExtras("description", element.getDescriptionElement(), false);
43331      }
43332      if (element.hasSeriesElement()) {
43333        composeStringCore("series", element.getSeriesElement(), false);
43334        composeStringExtras("series", element.getSeriesElement(), false);
43335      }
43336      if (element.hasDoseNumber()) {
43337        composeType("doseNumber", element.getDoseNumber());
43338      }
43339      if (element.hasSeriesDoses()) {
43340        composeType("seriesDoses", element.getSeriesDoses());
43341      }
43342  }
43343
43344  protected void composeImmunizationRecommendation(String name, ImmunizationRecommendation element) throws IOException {
43345    if (element != null) {
43346      prop("resourceType", name);
43347      composeImmunizationRecommendationInner(element);
43348    }
43349  }
43350
43351  protected void composeImmunizationRecommendationInner(ImmunizationRecommendation element) throws IOException {
43352      composeDomainResourceElements(element);
43353      if (element.hasIdentifier()) {
43354        openArray("identifier");
43355        for (Identifier e : element.getIdentifier()) 
43356          composeIdentifier(null, e);
43357        closeArray();
43358      };
43359      if (element.hasPatient()) {
43360        composeReference("patient", element.getPatient());
43361      }
43362      if (element.hasDateElement()) {
43363        composeDateTimeCore("date", element.getDateElement(), false);
43364        composeDateTimeExtras("date", element.getDateElement(), false);
43365      }
43366      if (element.hasAuthority()) {
43367        composeReference("authority", element.getAuthority());
43368      }
43369      if (element.hasRecommendation()) {
43370        openArray("recommendation");
43371        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent e : element.getRecommendation()) 
43372          composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(null, e);
43373        closeArray();
43374      };
43375  }
43376
43377  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
43378    if (element != null) {
43379      open(name);
43380      composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(element);
43381      close();
43382    }
43383  }
43384
43385  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
43386      composeBackbone(element);
43387      if (element.hasVaccineCode()) {
43388        openArray("vaccineCode");
43389        for (CodeableConcept e : element.getVaccineCode()) 
43390          composeCodeableConcept(null, e);
43391        closeArray();
43392      };
43393      if (element.hasTargetDisease()) {
43394        composeCodeableConcept("targetDisease", element.getTargetDisease());
43395      }
43396      if (element.hasContraindicatedVaccineCode()) {
43397        openArray("contraindicatedVaccineCode");
43398        for (CodeableConcept e : element.getContraindicatedVaccineCode()) 
43399          composeCodeableConcept(null, e);
43400        closeArray();
43401      };
43402      if (element.hasForecastStatus()) {
43403        composeCodeableConcept("forecastStatus", element.getForecastStatus());
43404      }
43405      if (element.hasForecastReason()) {
43406        openArray("forecastReason");
43407        for (CodeableConcept e : element.getForecastReason()) 
43408          composeCodeableConcept(null, e);
43409        closeArray();
43410      };
43411      if (element.hasDateCriterion()) {
43412        openArray("dateCriterion");
43413        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent e : element.getDateCriterion()) 
43414          composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(null, e);
43415        closeArray();
43416      };
43417      if (element.hasDescriptionElement()) {
43418        composeStringCore("description", element.getDescriptionElement(), false);
43419        composeStringExtras("description", element.getDescriptionElement(), false);
43420      }
43421      if (element.hasSeriesElement()) {
43422        composeStringCore("series", element.getSeriesElement(), false);
43423        composeStringExtras("series", element.getSeriesElement(), false);
43424      }
43425      if (element.hasDoseNumber()) {
43426        composeType("doseNumber", element.getDoseNumber());
43427      }
43428      if (element.hasSeriesDoses()) {
43429        composeType("seriesDoses", element.getSeriesDoses());
43430      }
43431      if (element.hasSupportingImmunization()) {
43432        openArray("supportingImmunization");
43433        for (Reference e : element.getSupportingImmunization()) 
43434          composeReference(null, e);
43435        closeArray();
43436      };
43437      if (element.hasSupportingPatientInformation()) {
43438        openArray("supportingPatientInformation");
43439        for (Reference e : element.getSupportingPatientInformation()) 
43440          composeReference(null, e);
43441        closeArray();
43442      };
43443  }
43444
43445  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
43446    if (element != null) {
43447      open(name);
43448      composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(element);
43449      close();
43450    }
43451  }
43452
43453  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
43454      composeBackbone(element);
43455      if (element.hasCode()) {
43456        composeCodeableConcept("code", element.getCode());
43457      }
43458      if (element.hasValueElement()) {
43459        composeDateTimeCore("value", element.getValueElement(), false);
43460        composeDateTimeExtras("value", element.getValueElement(), false);
43461      }
43462  }
43463
43464  protected void composeImplementationGuide(String name, ImplementationGuide element) throws IOException {
43465    if (element != null) {
43466      prop("resourceType", name);
43467      composeImplementationGuideInner(element);
43468    }
43469  }
43470
43471  protected void composeImplementationGuideInner(ImplementationGuide element) throws IOException {
43472      composeDomainResourceElements(element);
43473      if (element.hasUrlElement()) {
43474        composeUriCore("url", element.getUrlElement(), false);
43475        composeUriExtras("url", element.getUrlElement(), false);
43476      }
43477      if (element.hasVersionElement()) {
43478        composeStringCore("version", element.getVersionElement(), false);
43479        composeStringExtras("version", element.getVersionElement(), false);
43480      }
43481      if (element.hasNameElement()) {
43482        composeStringCore("name", element.getNameElement(), false);
43483        composeStringExtras("name", element.getNameElement(), false);
43484      }
43485      if (element.hasTitleElement()) {
43486        composeStringCore("title", element.getTitleElement(), false);
43487        composeStringExtras("title", element.getTitleElement(), false);
43488      }
43489      if (element.hasStatusElement()) {
43490        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43491        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43492      }
43493      if (element.hasExperimentalElement()) {
43494        composeBooleanCore("experimental", element.getExperimentalElement(), false);
43495        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
43496      }
43497      if (element.hasDateElement()) {
43498        composeDateTimeCore("date", element.getDateElement(), false);
43499        composeDateTimeExtras("date", element.getDateElement(), false);
43500      }
43501      if (element.hasPublisherElement()) {
43502        composeStringCore("publisher", element.getPublisherElement(), false);
43503        composeStringExtras("publisher", element.getPublisherElement(), false);
43504      }
43505      if (element.hasContact()) {
43506        openArray("contact");
43507        for (ContactDetail e : element.getContact()) 
43508          composeContactDetail(null, e);
43509        closeArray();
43510      };
43511      if (element.hasDescriptionElement()) {
43512        composeMarkdownCore("description", element.getDescriptionElement(), false);
43513        composeMarkdownExtras("description", element.getDescriptionElement(), false);
43514      }
43515      if (element.hasUseContext()) {
43516        openArray("useContext");
43517        for (UsageContext e : element.getUseContext()) 
43518          composeUsageContext(null, e);
43519        closeArray();
43520      };
43521      if (element.hasJurisdiction()) {
43522        openArray("jurisdiction");
43523        for (CodeableConcept e : element.getJurisdiction()) 
43524          composeCodeableConcept(null, e);
43525        closeArray();
43526      };
43527      if (element.hasCopyrightElement()) {
43528        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
43529        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
43530      }
43531      if (element.hasPackageIdElement()) {
43532        composeIdCore("packageId", element.getPackageIdElement(), false);
43533        composeIdExtras("packageId", element.getPackageIdElement(), false);
43534      }
43535      if (element.hasLicenseElement()) {
43536        composeEnumerationCore("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(), false);
43537        composeEnumerationExtras("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(), false);
43538      }
43539      if (element.hasDependsOn()) {
43540        openArray("dependsOn");
43541        for (ImplementationGuide.ImplementationGuideDependsOnComponent e : element.getDependsOn()) 
43542          composeImplementationGuideImplementationGuideDependsOnComponent(null, e);
43543        closeArray();
43544      };
43545      if (element.hasGlobal()) {
43546        openArray("global");
43547        for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal()) 
43548          composeImplementationGuideImplementationGuideGlobalComponent(null, e);
43549        closeArray();
43550      };
43551      if (element.hasDefinition()) {
43552        composeImplementationGuideImplementationGuideDefinitionComponent("definition", element.getDefinition());
43553      }
43554      if (element.hasManifest()) {
43555        composeImplementationGuideImplementationGuideManifestComponent("manifest", element.getManifest());
43556      }
43557  }
43558
43559  protected void composeImplementationGuideImplementationGuideDependsOnComponent(String name, ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
43560    if (element != null) {
43561      open(name);
43562      composeImplementationGuideImplementationGuideDependsOnComponentInner(element);
43563      close();
43564    }
43565  }
43566
43567  protected void composeImplementationGuideImplementationGuideDependsOnComponentInner(ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
43568      composeBackbone(element);
43569      if (element.hasUriElement()) {
43570        composeCanonicalCore("uri", element.getUriElement(), false);
43571        composeCanonicalExtras("uri", element.getUriElement(), false);
43572      }
43573      if (element.hasPackageIdElement()) {
43574        composeIdCore("packageId", element.getPackageIdElement(), false);
43575        composeIdExtras("packageId", element.getPackageIdElement(), false);
43576      }
43577      if (element.hasVersionElement()) {
43578        composeStringCore("version", element.getVersionElement(), false);
43579        composeStringExtras("version", element.getVersionElement(), false);
43580      }
43581  }
43582
43583  protected void composeImplementationGuideImplementationGuideGlobalComponent(String name, ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
43584    if (element != null) {
43585      open(name);
43586      composeImplementationGuideImplementationGuideGlobalComponentInner(element);
43587      close();
43588    }
43589  }
43590
43591  protected void composeImplementationGuideImplementationGuideGlobalComponentInner(ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
43592      composeBackbone(element);
43593      if (element.hasTypeElement()) {
43594        composeCodeCore("type", element.getTypeElement(), false);
43595        composeCodeExtras("type", element.getTypeElement(), false);
43596      }
43597      if (element.hasProfileElement()) {
43598        composeCanonicalCore("profile", element.getProfileElement(), false);
43599        composeCanonicalExtras("profile", element.getProfileElement(), false);
43600      }
43601  }
43602
43603  protected void composeImplementationGuideImplementationGuideDefinitionComponent(String name, ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
43604    if (element != null) {
43605      open(name);
43606      composeImplementationGuideImplementationGuideDefinitionComponentInner(element);
43607      close();
43608    }
43609  }
43610
43611  protected void composeImplementationGuideImplementationGuideDefinitionComponentInner(ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
43612      composeBackbone(element);
43613      if (element.hasGrouping()) {
43614        openArray("grouping");
43615        for (ImplementationGuide.ImplementationGuideDefinitionGroupingComponent e : element.getGrouping()) 
43616          composeImplementationGuideImplementationGuideDefinitionGroupingComponent(null, e);
43617        closeArray();
43618      };
43619      if (element.hasResource()) {
43620        openArray("resource");
43621        for (ImplementationGuide.ImplementationGuideDefinitionResourceComponent e : element.getResource()) 
43622          composeImplementationGuideImplementationGuideDefinitionResourceComponent(null, e);
43623        closeArray();
43624      };
43625      if (element.hasPage()) {
43626        composeImplementationGuideImplementationGuideDefinitionPageComponent("page", element.getPage());
43627      }
43628      if (element.hasParameter()) {
43629        openArray("parameter");
43630        for (ImplementationGuide.ImplementationGuideDefinitionParameterComponent e : element.getParameter()) 
43631          composeImplementationGuideImplementationGuideDefinitionParameterComponent(null, e);
43632        closeArray();
43633      };
43634      if (element.hasTemplate()) {
43635        openArray("template");
43636        for (ImplementationGuide.ImplementationGuideDefinitionTemplateComponent e : element.getTemplate()) 
43637          composeImplementationGuideImplementationGuideDefinitionTemplateComponent(null, e);
43638        closeArray();
43639      };
43640  }
43641
43642  protected void composeImplementationGuideImplementationGuideDefinitionGroupingComponent(String name, ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
43643    if (element != null) {
43644      open(name);
43645      composeImplementationGuideImplementationGuideDefinitionGroupingComponentInner(element);
43646      close();
43647    }
43648  }
43649
43650  protected void composeImplementationGuideImplementationGuideDefinitionGroupingComponentInner(ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
43651      composeBackbone(element);
43652      if (element.hasNameElement()) {
43653        composeStringCore("name", element.getNameElement(), false);
43654        composeStringExtras("name", element.getNameElement(), false);
43655      }
43656      if (element.hasDescriptionElement()) {
43657        composeStringCore("description", element.getDescriptionElement(), false);
43658        composeStringExtras("description", element.getDescriptionElement(), false);
43659      }
43660  }
43661
43662  protected void composeImplementationGuideImplementationGuideDefinitionResourceComponent(String name, ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
43663    if (element != null) {
43664      open(name);
43665      composeImplementationGuideImplementationGuideDefinitionResourceComponentInner(element);
43666      close();
43667    }
43668  }
43669
43670  protected void composeImplementationGuideImplementationGuideDefinitionResourceComponentInner(ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
43671      composeBackbone(element);
43672      if (element.hasReference()) {
43673        composeReference("reference", element.getReference());
43674      }
43675      if (element.hasNameElement()) {
43676        composeStringCore("name", element.getNameElement(), false);
43677        composeStringExtras("name", element.getNameElement(), false);
43678      }
43679      if (element.hasDescriptionElement()) {
43680        composeStringCore("description", element.getDescriptionElement(), false);
43681        composeStringExtras("description", element.getDescriptionElement(), false);
43682      }
43683      if (element.hasExample()) {
43684        composeType("example", element.getExample());
43685      }
43686      if (element.hasGroupingIdElement()) {
43687        composeIdCore("groupingId", element.getGroupingIdElement(), false);
43688        composeIdExtras("groupingId", element.getGroupingIdElement(), false);
43689      }
43690  }
43691
43692  protected void composeImplementationGuideImplementationGuideDefinitionPageComponent(String name, ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
43693    if (element != null) {
43694      open(name);
43695      composeImplementationGuideImplementationGuideDefinitionPageComponentInner(element);
43696      close();
43697    }
43698  }
43699
43700  protected void composeImplementationGuideImplementationGuideDefinitionPageComponentInner(ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
43701      composeBackbone(element);
43702      if (element.hasName()) {
43703        composeType("name", element.getName());
43704      }
43705      if (element.hasTitleElement()) {
43706        composeStringCore("title", element.getTitleElement(), false);
43707        composeStringExtras("title", element.getTitleElement(), false);
43708      }
43709      if (element.hasGenerationElement()) {
43710        composeEnumerationCore("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
43711        composeEnumerationExtras("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
43712      }
43713      if (element.hasPage()) {
43714        openArray("page");
43715        for (ImplementationGuide.ImplementationGuideDefinitionPageComponent e : element.getPage()) 
43716          composeImplementationGuideImplementationGuideDefinitionPageComponent(null, e);
43717        closeArray();
43718      };
43719  }
43720
43721  protected void composeImplementationGuideImplementationGuideDefinitionParameterComponent(String name, ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
43722    if (element != null) {
43723      open(name);
43724      composeImplementationGuideImplementationGuideDefinitionParameterComponentInner(element);
43725      close();
43726    }
43727  }
43728
43729  protected void composeImplementationGuideImplementationGuideDefinitionParameterComponentInner(ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
43730      composeBackbone(element);
43731      if (element.hasCodeElement()) {
43732        composeEnumerationCore("code", element.getCodeElement(), new ImplementationGuide.GuideParameterCodeEnumFactory(), false);
43733        composeEnumerationExtras("code", element.getCodeElement(), new ImplementationGuide.GuideParameterCodeEnumFactory(), false);
43734      }
43735      if (element.hasValueElement()) {
43736        composeStringCore("value", element.getValueElement(), false);
43737        composeStringExtras("value", element.getValueElement(), false);
43738      }
43739  }
43740
43741  protected void composeImplementationGuideImplementationGuideDefinitionTemplateComponent(String name, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
43742    if (element != null) {
43743      open(name);
43744      composeImplementationGuideImplementationGuideDefinitionTemplateComponentInner(element);
43745      close();
43746    }
43747  }
43748
43749  protected void composeImplementationGuideImplementationGuideDefinitionTemplateComponentInner(ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
43750      composeBackbone(element);
43751      if (element.hasCodeElement()) {
43752        composeCodeCore("code", element.getCodeElement(), false);
43753        composeCodeExtras("code", element.getCodeElement(), false);
43754      }
43755      if (element.hasSourceElement()) {
43756        composeStringCore("source", element.getSourceElement(), false);
43757        composeStringExtras("source", element.getSourceElement(), false);
43758      }
43759      if (element.hasScopeElement()) {
43760        composeStringCore("scope", element.getScopeElement(), false);
43761        composeStringExtras("scope", element.getScopeElement(), false);
43762      }
43763  }
43764
43765  protected void composeImplementationGuideImplementationGuideManifestComponent(String name, ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
43766    if (element != null) {
43767      open(name);
43768      composeImplementationGuideImplementationGuideManifestComponentInner(element);
43769      close();
43770    }
43771  }
43772
43773  protected void composeImplementationGuideImplementationGuideManifestComponentInner(ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
43774      composeBackbone(element);
43775      if (element.hasRenderingElement()) {
43776        composeUrlCore("rendering", element.getRenderingElement(), false);
43777        composeUrlExtras("rendering", element.getRenderingElement(), false);
43778      }
43779      if (element.hasResource()) {
43780        openArray("resource");
43781        for (ImplementationGuide.ManifestResourceComponent e : element.getResource()) 
43782          composeImplementationGuideManifestResourceComponent(null, e);
43783        closeArray();
43784      };
43785      if (element.hasPage()) {
43786        openArray("page");
43787        for (ImplementationGuide.ManifestPageComponent e : element.getPage()) 
43788          composeImplementationGuideManifestPageComponent(null, e);
43789        closeArray();
43790      };
43791      if (element.hasImage()) {
43792        openArray("image");
43793        for (StringType e : element.getImage()) 
43794          composeStringCore(null, e, true);
43795        closeArray();
43796        if (anyHasExtras(element.getImage())) {
43797          openArray("_image");
43798          for (StringType e : element.getImage()) 
43799            composeStringExtras(null, e, true);
43800          closeArray();
43801        }
43802      };
43803      if (element.hasOther()) {
43804        openArray("other");
43805        for (StringType e : element.getOther()) 
43806          composeStringCore(null, e, true);
43807        closeArray();
43808        if (anyHasExtras(element.getOther())) {
43809          openArray("_other");
43810          for (StringType e : element.getOther()) 
43811            composeStringExtras(null, e, true);
43812          closeArray();
43813        }
43814      };
43815  }
43816
43817  protected void composeImplementationGuideManifestResourceComponent(String name, ImplementationGuide.ManifestResourceComponent element) throws IOException {
43818    if (element != null) {
43819      open(name);
43820      composeImplementationGuideManifestResourceComponentInner(element);
43821      close();
43822    }
43823  }
43824
43825  protected void composeImplementationGuideManifestResourceComponentInner(ImplementationGuide.ManifestResourceComponent element) throws IOException {
43826      composeBackbone(element);
43827      if (element.hasReference()) {
43828        composeReference("reference", element.getReference());
43829      }
43830      if (element.hasExample()) {
43831        composeType("example", element.getExample());
43832      }
43833      if (element.hasRelativePathElement()) {
43834        composeUrlCore("relativePath", element.getRelativePathElement(), false);
43835        composeUrlExtras("relativePath", element.getRelativePathElement(), false);
43836      }
43837  }
43838
43839  protected void composeImplementationGuideManifestPageComponent(String name, ImplementationGuide.ManifestPageComponent element) throws IOException {
43840    if (element != null) {
43841      open(name);
43842      composeImplementationGuideManifestPageComponentInner(element);
43843      close();
43844    }
43845  }
43846
43847  protected void composeImplementationGuideManifestPageComponentInner(ImplementationGuide.ManifestPageComponent element) throws IOException {
43848      composeBackbone(element);
43849      if (element.hasNameElement()) {
43850        composeStringCore("name", element.getNameElement(), false);
43851        composeStringExtras("name", element.getNameElement(), false);
43852      }
43853      if (element.hasTitleElement()) {
43854        composeStringCore("title", element.getTitleElement(), false);
43855        composeStringExtras("title", element.getTitleElement(), false);
43856      }
43857      if (element.hasAnchor()) {
43858        openArray("anchor");
43859        for (StringType e : element.getAnchor()) 
43860          composeStringCore(null, e, true);
43861        closeArray();
43862        if (anyHasExtras(element.getAnchor())) {
43863          openArray("_anchor");
43864          for (StringType e : element.getAnchor()) 
43865            composeStringExtras(null, e, true);
43866          closeArray();
43867        }
43868      };
43869  }
43870
43871  protected void composeInsurancePlan(String name, InsurancePlan element) throws IOException {
43872    if (element != null) {
43873      prop("resourceType", name);
43874      composeInsurancePlanInner(element);
43875    }
43876  }
43877
43878  protected void composeInsurancePlanInner(InsurancePlan element) throws IOException {
43879      composeDomainResourceElements(element);
43880      if (element.hasIdentifier()) {
43881        openArray("identifier");
43882        for (Identifier e : element.getIdentifier()) 
43883          composeIdentifier(null, e);
43884        closeArray();
43885      };
43886      if (element.hasStatusElement()) {
43887        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43888        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43889      }
43890      if (element.hasType()) {
43891        openArray("type");
43892        for (CodeableConcept e : element.getType()) 
43893          composeCodeableConcept(null, e);
43894        closeArray();
43895      };
43896      if (element.hasNameElement()) {
43897        composeStringCore("name", element.getNameElement(), false);
43898        composeStringExtras("name", element.getNameElement(), false);
43899      }
43900      if (element.hasAlias()) {
43901        openArray("alias");
43902        for (StringType e : element.getAlias()) 
43903          composeStringCore(null, e, true);
43904        closeArray();
43905        if (anyHasExtras(element.getAlias())) {
43906          openArray("_alias");
43907          for (StringType e : element.getAlias()) 
43908            composeStringExtras(null, e, true);
43909          closeArray();
43910        }
43911      };
43912      if (element.hasPeriod()) {
43913        composePeriod("period", element.getPeriod());
43914      }
43915      if (element.hasOwnedBy()) {
43916        composeReference("ownedBy", element.getOwnedBy());
43917      }
43918      if (element.hasAdministeredBy()) {
43919        composeReference("administeredBy", element.getAdministeredBy());
43920      }
43921      if (element.hasCoverageArea()) {
43922        openArray("coverageArea");
43923        for (Reference e : element.getCoverageArea()) 
43924          composeReference(null, e);
43925        closeArray();
43926      };
43927      if (element.hasContact()) {
43928        openArray("contact");
43929        for (InsurancePlan.InsurancePlanContactComponent e : element.getContact()) 
43930          composeInsurancePlanInsurancePlanContactComponent(null, e);
43931        closeArray();
43932      };
43933      if (element.hasEndpoint()) {
43934        openArray("endpoint");
43935        for (Reference e : element.getEndpoint()) 
43936          composeReference(null, e);
43937        closeArray();
43938      };
43939      if (element.hasNetwork()) {
43940        openArray("network");
43941        for (Reference e : element.getNetwork()) 
43942          composeReference(null, e);
43943        closeArray();
43944      };
43945      if (element.hasCoverage()) {
43946        openArray("coverage");
43947        for (InsurancePlan.InsurancePlanCoverageComponent e : element.getCoverage()) 
43948          composeInsurancePlanInsurancePlanCoverageComponent(null, e);
43949        closeArray();
43950      };
43951      if (element.hasPlan()) {
43952        openArray("plan");
43953        for (InsurancePlan.InsurancePlanPlanComponent e : element.getPlan()) 
43954          composeInsurancePlanInsurancePlanPlanComponent(null, e);
43955        closeArray();
43956      };
43957  }
43958
43959  protected void composeInsurancePlanInsurancePlanContactComponent(String name, InsurancePlan.InsurancePlanContactComponent element) throws IOException {
43960    if (element != null) {
43961      open(name);
43962      composeInsurancePlanInsurancePlanContactComponentInner(element);
43963      close();
43964    }
43965  }
43966
43967  protected void composeInsurancePlanInsurancePlanContactComponentInner(InsurancePlan.InsurancePlanContactComponent element) throws IOException {
43968      composeBackbone(element);
43969      if (element.hasPurpose()) {
43970        composeCodeableConcept("purpose", element.getPurpose());
43971      }
43972      if (element.hasName()) {
43973        composeHumanName("name", element.getName());
43974      }
43975      if (element.hasTelecom()) {
43976        openArray("telecom");
43977        for (ContactPoint e : element.getTelecom()) 
43978          composeContactPoint(null, e);
43979        closeArray();
43980      };
43981      if (element.hasAddress()) {
43982        composeAddress("address", element.getAddress());
43983      }
43984  }
43985
43986  protected void composeInsurancePlanInsurancePlanCoverageComponent(String name, InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
43987    if (element != null) {
43988      open(name);
43989      composeInsurancePlanInsurancePlanCoverageComponentInner(element);
43990      close();
43991    }
43992  }
43993
43994  protected void composeInsurancePlanInsurancePlanCoverageComponentInner(InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
43995      composeBackbone(element);
43996      if (element.hasType()) {
43997        composeCodeableConcept("type", element.getType());
43998      }
43999      if (element.hasNetwork()) {
44000        openArray("network");
44001        for (Reference e : element.getNetwork()) 
44002          composeReference(null, e);
44003        closeArray();
44004      };
44005      if (element.hasBenefit()) {
44006        openArray("benefit");
44007        for (InsurancePlan.CoverageBenefitComponent e : element.getBenefit()) 
44008          composeInsurancePlanCoverageBenefitComponent(null, e);
44009        closeArray();
44010      };
44011  }
44012
44013  protected void composeInsurancePlanCoverageBenefitComponent(String name, InsurancePlan.CoverageBenefitComponent element) throws IOException {
44014    if (element != null) {
44015      open(name);
44016      composeInsurancePlanCoverageBenefitComponentInner(element);
44017      close();
44018    }
44019  }
44020
44021  protected void composeInsurancePlanCoverageBenefitComponentInner(InsurancePlan.CoverageBenefitComponent element) throws IOException {
44022      composeBackbone(element);
44023      if (element.hasType()) {
44024        composeCodeableConcept("type", element.getType());
44025      }
44026      if (element.hasRequirementElement()) {
44027        composeStringCore("requirement", element.getRequirementElement(), false);
44028        composeStringExtras("requirement", element.getRequirementElement(), false);
44029      }
44030      if (element.hasLimit()) {
44031        openArray("limit");
44032        for (InsurancePlan.CoverageBenefitLimitComponent e : element.getLimit()) 
44033          composeInsurancePlanCoverageBenefitLimitComponent(null, e);
44034        closeArray();
44035      };
44036  }
44037
44038  protected void composeInsurancePlanCoverageBenefitLimitComponent(String name, InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
44039    if (element != null) {
44040      open(name);
44041      composeInsurancePlanCoverageBenefitLimitComponentInner(element);
44042      close();
44043    }
44044  }
44045
44046  protected void composeInsurancePlanCoverageBenefitLimitComponentInner(InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
44047      composeBackbone(element);
44048      if (element.hasValue()) {
44049        composeQuantity("value", element.getValue());
44050      }
44051      if (element.hasCode()) {
44052        composeCodeableConcept("code", element.getCode());
44053      }
44054  }
44055
44056  protected void composeInsurancePlanInsurancePlanPlanComponent(String name, InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
44057    if (element != null) {
44058      open(name);
44059      composeInsurancePlanInsurancePlanPlanComponentInner(element);
44060      close();
44061    }
44062  }
44063
44064  protected void composeInsurancePlanInsurancePlanPlanComponentInner(InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
44065      composeBackbone(element);
44066      if (element.hasIdentifier()) {
44067        openArray("identifier");
44068        for (Identifier e : element.getIdentifier()) 
44069          composeIdentifier(null, e);
44070        closeArray();
44071      };
44072      if (element.hasType()) {
44073        composeCodeableConcept("type", element.getType());
44074      }
44075      if (element.hasCoverageArea()) {
44076        openArray("coverageArea");
44077        for (Reference e : element.getCoverageArea()) 
44078          composeReference(null, e);
44079        closeArray();
44080      };
44081      if (element.hasNetwork()) {
44082        openArray("network");
44083        for (Reference e : element.getNetwork()) 
44084          composeReference(null, e);
44085        closeArray();
44086      };
44087      if (element.hasGeneralCost()) {
44088        openArray("generalCost");
44089        for (InsurancePlan.InsurancePlanPlanGeneralCostComponent e : element.getGeneralCost()) 
44090          composeInsurancePlanInsurancePlanPlanGeneralCostComponent(null, e);
44091        closeArray();
44092      };
44093      if (element.hasSpecificCost()) {
44094        openArray("specificCost");
44095        for (InsurancePlan.InsurancePlanPlanSpecificCostComponent e : element.getSpecificCost()) 
44096          composeInsurancePlanInsurancePlanPlanSpecificCostComponent(null, e);
44097        closeArray();
44098      };
44099  }
44100
44101  protected void composeInsurancePlanInsurancePlanPlanGeneralCostComponent(String name, InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
44102    if (element != null) {
44103      open(name);
44104      composeInsurancePlanInsurancePlanPlanGeneralCostComponentInner(element);
44105      close();
44106    }
44107  }
44108
44109  protected void composeInsurancePlanInsurancePlanPlanGeneralCostComponentInner(InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
44110      composeBackbone(element);
44111      if (element.hasType()) {
44112        composeCodeableConcept("type", element.getType());
44113      }
44114      if (element.hasGroupSizeElement()) {
44115        composePositiveIntCore("groupSize", element.getGroupSizeElement(), false);
44116        composePositiveIntExtras("groupSize", element.getGroupSizeElement(), false);
44117      }
44118      if (element.hasCost()) {
44119        composeMoney("cost", element.getCost());
44120      }
44121      if (element.hasCommentElement()) {
44122        composeStringCore("comment", element.getCommentElement(), false);
44123        composeStringExtras("comment", element.getCommentElement(), false);
44124      }
44125  }
44126
44127  protected void composeInsurancePlanInsurancePlanPlanSpecificCostComponent(String name, InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
44128    if (element != null) {
44129      open(name);
44130      composeInsurancePlanInsurancePlanPlanSpecificCostComponentInner(element);
44131      close();
44132    }
44133  }
44134
44135  protected void composeInsurancePlanInsurancePlanPlanSpecificCostComponentInner(InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
44136      composeBackbone(element);
44137      if (element.hasCategory()) {
44138        composeCodeableConcept("category", element.getCategory());
44139      }
44140      if (element.hasBenefit()) {
44141        openArray("benefit");
44142        for (InsurancePlan.PlanBenefitComponent e : element.getBenefit()) 
44143          composeInsurancePlanPlanBenefitComponent(null, e);
44144        closeArray();
44145      };
44146  }
44147
44148  protected void composeInsurancePlanPlanBenefitComponent(String name, InsurancePlan.PlanBenefitComponent element) throws IOException {
44149    if (element != null) {
44150      open(name);
44151      composeInsurancePlanPlanBenefitComponentInner(element);
44152      close();
44153    }
44154  }
44155
44156  protected void composeInsurancePlanPlanBenefitComponentInner(InsurancePlan.PlanBenefitComponent element) throws IOException {
44157      composeBackbone(element);
44158      if (element.hasType()) {
44159        composeCodeableConcept("type", element.getType());
44160      }
44161      if (element.hasCost()) {
44162        openArray("cost");
44163        for (InsurancePlan.PlanBenefitCostComponent e : element.getCost()) 
44164          composeInsurancePlanPlanBenefitCostComponent(null, e);
44165        closeArray();
44166      };
44167  }
44168
44169  protected void composeInsurancePlanPlanBenefitCostComponent(String name, InsurancePlan.PlanBenefitCostComponent element) throws IOException {
44170    if (element != null) {
44171      open(name);
44172      composeInsurancePlanPlanBenefitCostComponentInner(element);
44173      close();
44174    }
44175  }
44176
44177  protected void composeInsurancePlanPlanBenefitCostComponentInner(InsurancePlan.PlanBenefitCostComponent element) throws IOException {
44178      composeBackbone(element);
44179      if (element.hasType()) {
44180        composeCodeableConcept("type", element.getType());
44181      }
44182      if (element.hasApplicability()) {
44183        composeCodeableConcept("applicability", element.getApplicability());
44184      }
44185      if (element.hasQualifiers()) {
44186        openArray("qualifiers");
44187        for (CodeableConcept e : element.getQualifiers()) 
44188          composeCodeableConcept(null, e);
44189        closeArray();
44190      };
44191      if (element.hasValue()) {
44192        composeQuantity("value", element.getValue());
44193      }
44194  }
44195
44196  protected void composeInvoice(String name, Invoice element) throws IOException {
44197    if (element != null) {
44198      prop("resourceType", name);
44199      composeInvoiceInner(element);
44200    }
44201  }
44202
44203  protected void composeInvoiceInner(Invoice element) throws IOException {
44204      composeDomainResourceElements(element);
44205      if (element.hasIdentifier()) {
44206        openArray("identifier");
44207        for (Identifier e : element.getIdentifier()) 
44208          composeIdentifier(null, e);
44209        closeArray();
44210      };
44211      if (element.hasStatusElement()) {
44212        composeEnumerationCore("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
44213        composeEnumerationExtras("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
44214      }
44215      if (element.hasCancelledReasonElement()) {
44216        composeStringCore("cancelledReason", element.getCancelledReasonElement(), false);
44217        composeStringExtras("cancelledReason", element.getCancelledReasonElement(), false);
44218      }
44219      if (element.hasType()) {
44220        composeCodeableConcept("type", element.getType());
44221      }
44222      if (element.hasSubject()) {
44223        composeReference("subject", element.getSubject());
44224      }
44225      if (element.hasRecipient()) {
44226        composeReference("recipient", element.getRecipient());
44227      }
44228      if (element.hasDateElement()) {
44229        composeDateTimeCore("date", element.getDateElement(), false);
44230        composeDateTimeExtras("date", element.getDateElement(), false);
44231      }
44232      if (element.hasParticipant()) {
44233        openArray("participant");
44234        for (Invoice.InvoiceParticipantComponent e : element.getParticipant()) 
44235          composeInvoiceInvoiceParticipantComponent(null, e);
44236        closeArray();
44237      };
44238      if (element.hasIssuer()) {
44239        composeReference("issuer", element.getIssuer());
44240      }
44241      if (element.hasAccount()) {
44242        composeReference("account", element.getAccount());
44243      }
44244      if (element.hasLineItem()) {
44245        openArray("lineItem");
44246        for (Invoice.InvoiceLineItemComponent e : element.getLineItem()) 
44247          composeInvoiceInvoiceLineItemComponent(null, e);
44248        closeArray();
44249      };
44250      if (element.hasTotalPriceComponent()) {
44251        openArray("totalPriceComponent");
44252        for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getTotalPriceComponent()) 
44253          composeInvoiceInvoiceLineItemPriceComponentComponent(null, e);
44254        closeArray();
44255      };
44256      if (element.hasTotalNet()) {
44257        composeMoney("totalNet", element.getTotalNet());
44258      }
44259      if (element.hasTotalGross()) {
44260        composeMoney("totalGross", element.getTotalGross());
44261      }
44262      if (element.hasPaymentTermsElement()) {
44263        composeMarkdownCore("paymentTerms", element.getPaymentTermsElement(), false);
44264        composeMarkdownExtras("paymentTerms", element.getPaymentTermsElement(), false);
44265      }
44266      if (element.hasNote()) {
44267        openArray("note");
44268        for (Annotation e : element.getNote()) 
44269          composeAnnotation(null, e);
44270        closeArray();
44271      };
44272  }
44273
44274  protected void composeInvoiceInvoiceParticipantComponent(String name, Invoice.InvoiceParticipantComponent element) throws IOException {
44275    if (element != null) {
44276      open(name);
44277      composeInvoiceInvoiceParticipantComponentInner(element);
44278      close();
44279    }
44280  }
44281
44282  protected void composeInvoiceInvoiceParticipantComponentInner(Invoice.InvoiceParticipantComponent element) throws IOException {
44283      composeBackbone(element);
44284      if (element.hasRole()) {
44285        composeCodeableConcept("role", element.getRole());
44286      }
44287      if (element.hasActor()) {
44288        composeReference("actor", element.getActor());
44289      }
44290  }
44291
44292  protected void composeInvoiceInvoiceLineItemComponent(String name, Invoice.InvoiceLineItemComponent element) throws IOException {
44293    if (element != null) {
44294      open(name);
44295      composeInvoiceInvoiceLineItemComponentInner(element);
44296      close();
44297    }
44298  }
44299
44300  protected void composeInvoiceInvoiceLineItemComponentInner(Invoice.InvoiceLineItemComponent element) throws IOException {
44301      composeBackbone(element);
44302      if (element.hasSequenceElement()) {
44303        composePositiveIntCore("sequence", element.getSequenceElement(), false);
44304        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
44305      }
44306      if (element.hasChargeItem()) {
44307        composeType("chargeItem", element.getChargeItem());
44308      }
44309      if (element.hasPriceComponent()) {
44310        openArray("priceComponent");
44311        for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getPriceComponent()) 
44312          composeInvoiceInvoiceLineItemPriceComponentComponent(null, e);
44313        closeArray();
44314      };
44315  }
44316
44317  protected void composeInvoiceInvoiceLineItemPriceComponentComponent(String name, Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
44318    if (element != null) {
44319      open(name);
44320      composeInvoiceInvoiceLineItemPriceComponentComponentInner(element);
44321      close();
44322    }
44323  }
44324
44325  protected void composeInvoiceInvoiceLineItemPriceComponentComponentInner(Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
44326      composeBackbone(element);
44327      if (element.hasTypeElement()) {
44328        composeEnumerationCore("type", element.getTypeElement(), new Invoice.InvoicePriceComponentTypeEnumFactory(), false);
44329        composeEnumerationExtras("type", element.getTypeElement(), new Invoice.InvoicePriceComponentTypeEnumFactory(), false);
44330      }
44331      if (element.hasCode()) {
44332        composeCodeableConcept("code", element.getCode());
44333      }
44334      if (element.hasFactorElement()) {
44335        composeDecimalCore("factor", element.getFactorElement(), false);
44336        composeDecimalExtras("factor", element.getFactorElement(), false);
44337      }
44338      if (element.hasAmount()) {
44339        composeMoney("amount", element.getAmount());
44340      }
44341  }
44342
44343  protected void composeLibrary(String name, Library element) throws IOException {
44344    if (element != null) {
44345      prop("resourceType", name);
44346      composeLibraryInner(element);
44347    }
44348  }
44349
44350  protected void composeLibraryInner(Library element) throws IOException {
44351      composeDomainResourceElements(element);
44352      if (element.hasUrlElement()) {
44353        composeUriCore("url", element.getUrlElement(), false);
44354        composeUriExtras("url", element.getUrlElement(), false);
44355      }
44356      if (element.hasIdentifier()) {
44357        openArray("identifier");
44358        for (Identifier e : element.getIdentifier()) 
44359          composeIdentifier(null, e);
44360        closeArray();
44361      };
44362      if (element.hasVersionElement()) {
44363        composeStringCore("version", element.getVersionElement(), false);
44364        composeStringExtras("version", element.getVersionElement(), false);
44365      }
44366      if (element.hasNameElement()) {
44367        composeStringCore("name", element.getNameElement(), false);
44368        composeStringExtras("name", element.getNameElement(), false);
44369      }
44370      if (element.hasTitleElement()) {
44371        composeStringCore("title", element.getTitleElement(), false);
44372        composeStringExtras("title", element.getTitleElement(), false);
44373      }
44374      if (element.hasSubtitleElement()) {
44375        composeStringCore("subtitle", element.getSubtitleElement(), false);
44376        composeStringExtras("subtitle", element.getSubtitleElement(), false);
44377      }
44378      if (element.hasStatusElement()) {
44379        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
44380        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
44381      }
44382      if (element.hasExperimentalElement()) {
44383        composeBooleanCore("experimental", element.getExperimentalElement(), false);
44384        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
44385      }
44386      if (element.hasType()) {
44387        composeCodeableConcept("type", element.getType());
44388      }
44389      if (element.hasSubject()) {
44390        composeType("subject", element.getSubject());
44391      }
44392      if (element.hasDateElement()) {
44393        composeDateTimeCore("date", element.getDateElement(), false);
44394        composeDateTimeExtras("date", element.getDateElement(), false);
44395      }
44396      if (element.hasPublisherElement()) {
44397        composeStringCore("publisher", element.getPublisherElement(), false);
44398        composeStringExtras("publisher", element.getPublisherElement(), false);
44399      }
44400      if (element.hasContact()) {
44401        openArray("contact");
44402        for (ContactDetail e : element.getContact()) 
44403          composeContactDetail(null, e);
44404        closeArray();
44405      };
44406      if (element.hasDescriptionElement()) {
44407        composeMarkdownCore("description", element.getDescriptionElement(), false);
44408        composeMarkdownExtras("description", element.getDescriptionElement(), false);
44409      }
44410      if (element.hasUseContext()) {
44411        openArray("useContext");
44412        for (UsageContext e : element.getUseContext()) 
44413          composeUsageContext(null, e);
44414        closeArray();
44415      };
44416      if (element.hasJurisdiction()) {
44417        openArray("jurisdiction");
44418        for (CodeableConcept e : element.getJurisdiction()) 
44419          composeCodeableConcept(null, e);
44420        closeArray();
44421      };
44422      if (element.hasPurposeElement()) {
44423        composeMarkdownCore("purpose", element.getPurposeElement(), false);
44424        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
44425      }
44426      if (element.hasUsageElement()) {
44427        composeStringCore("usage", element.getUsageElement(), false);
44428        composeStringExtras("usage", element.getUsageElement(), false);
44429      }
44430      if (element.hasCopyrightElement()) {
44431        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
44432        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
44433      }
44434      if (element.hasApprovalDateElement()) {
44435        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
44436        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
44437      }
44438      if (element.hasLastReviewDateElement()) {
44439        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
44440        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
44441      }
44442      if (element.hasEffectivePeriod()) {
44443        composePeriod("effectivePeriod", element.getEffectivePeriod());
44444      }
44445      if (element.hasTopic()) {
44446        openArray("topic");
44447        for (CodeableConcept e : element.getTopic()) 
44448          composeCodeableConcept(null, e);
44449        closeArray();
44450      };
44451      if (element.hasAuthor()) {
44452        openArray("author");
44453        for (ContactDetail e : element.getAuthor()) 
44454          composeContactDetail(null, e);
44455        closeArray();
44456      };
44457      if (element.hasEditor()) {
44458        openArray("editor");
44459        for (ContactDetail e : element.getEditor()) 
44460          composeContactDetail(null, e);
44461        closeArray();
44462      };
44463      if (element.hasReviewer()) {
44464        openArray("reviewer");
44465        for (ContactDetail e : element.getReviewer()) 
44466          composeContactDetail(null, e);
44467        closeArray();
44468      };
44469      if (element.hasEndorser()) {
44470        openArray("endorser");
44471        for (ContactDetail e : element.getEndorser()) 
44472          composeContactDetail(null, e);
44473        closeArray();
44474      };
44475      if (element.hasRelatedArtifact()) {
44476        openArray("relatedArtifact");
44477        for (RelatedArtifact e : element.getRelatedArtifact()) 
44478          composeRelatedArtifact(null, e);
44479        closeArray();
44480      };
44481      if (element.hasParameter()) {
44482        openArray("parameter");
44483        for (ParameterDefinition e : element.getParameter()) 
44484          composeParameterDefinition(null, e);
44485        closeArray();
44486      };
44487      if (element.hasDataRequirement()) {
44488        openArray("dataRequirement");
44489        for (DataRequirement e : element.getDataRequirement()) 
44490          composeDataRequirement(null, e);
44491        closeArray();
44492      };
44493      if (element.hasContent()) {
44494        openArray("content");
44495        for (Attachment e : element.getContent()) 
44496          composeAttachment(null, e);
44497        closeArray();
44498      };
44499  }
44500
44501  protected void composeLinkage(String name, Linkage element) throws IOException {
44502    if (element != null) {
44503      prop("resourceType", name);
44504      composeLinkageInner(element);
44505    }
44506  }
44507
44508  protected void composeLinkageInner(Linkage element) throws IOException {
44509      composeDomainResourceElements(element);
44510      if (element.hasActiveElement()) {
44511        composeBooleanCore("active", element.getActiveElement(), false);
44512        composeBooleanExtras("active", element.getActiveElement(), false);
44513      }
44514      if (element.hasAuthor()) {
44515        composeReference("author", element.getAuthor());
44516      }
44517      if (element.hasItem()) {
44518        openArray("item");
44519        for (Linkage.LinkageItemComponent e : element.getItem()) 
44520          composeLinkageLinkageItemComponent(null, e);
44521        closeArray();
44522      };
44523  }
44524
44525  protected void composeLinkageLinkageItemComponent(String name, Linkage.LinkageItemComponent element) throws IOException {
44526    if (element != null) {
44527      open(name);
44528      composeLinkageLinkageItemComponentInner(element);
44529      close();
44530    }
44531  }
44532
44533  protected void composeLinkageLinkageItemComponentInner(Linkage.LinkageItemComponent element) throws IOException {
44534      composeBackbone(element);
44535      if (element.hasTypeElement()) {
44536        composeEnumerationCore("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
44537        composeEnumerationExtras("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
44538      }
44539      if (element.hasResource()) {
44540        composeReference("resource", element.getResource());
44541      }
44542  }
44543
44544  protected void composeListResource(String name, ListResource element) throws IOException {
44545    if (element != null) {
44546      prop("resourceType", name);
44547      composeListResourceInner(element);
44548    }
44549  }
44550
44551  protected void composeListResourceInner(ListResource element) throws IOException {
44552      composeDomainResourceElements(element);
44553      if (element.hasIdentifier()) {
44554        openArray("identifier");
44555        for (Identifier e : element.getIdentifier()) 
44556          composeIdentifier(null, e);
44557        closeArray();
44558      };
44559      if (element.hasStatusElement()) {
44560        composeEnumerationCore("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
44561        composeEnumerationExtras("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
44562      }
44563      if (element.hasModeElement()) {
44564        composeEnumerationCore("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
44565        composeEnumerationExtras("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
44566      }
44567      if (element.hasTitleElement()) {
44568        composeStringCore("title", element.getTitleElement(), false);
44569        composeStringExtras("title", element.getTitleElement(), false);
44570      }
44571      if (element.hasCode()) {
44572        composeCodeableConcept("code", element.getCode());
44573      }
44574      if (element.hasSubject()) {
44575        composeReference("subject", element.getSubject());
44576      }
44577      if (element.hasEncounter()) {
44578        composeReference("encounter", element.getEncounter());
44579      }
44580      if (element.hasDateElement()) {
44581        composeDateTimeCore("date", element.getDateElement(), false);
44582        composeDateTimeExtras("date", element.getDateElement(), false);
44583      }
44584      if (element.hasSource()) {
44585        composeReference("source", element.getSource());
44586      }
44587      if (element.hasOrderedBy()) {
44588        composeCodeableConcept("orderedBy", element.getOrderedBy());
44589      }
44590      if (element.hasNote()) {
44591        openArray("note");
44592        for (Annotation e : element.getNote()) 
44593          composeAnnotation(null, e);
44594        closeArray();
44595      };
44596      if (element.hasEntry()) {
44597        openArray("entry");
44598        for (ListResource.ListEntryComponent e : element.getEntry()) 
44599          composeListResourceListEntryComponent(null, e);
44600        closeArray();
44601      };
44602      if (element.hasEmptyReason()) {
44603        composeCodeableConcept("emptyReason", element.getEmptyReason());
44604      }
44605  }
44606
44607  protected void composeListResourceListEntryComponent(String name, ListResource.ListEntryComponent element) throws IOException {
44608    if (element != null) {
44609      open(name);
44610      composeListResourceListEntryComponentInner(element);
44611      close();
44612    }
44613  }
44614
44615  protected void composeListResourceListEntryComponentInner(ListResource.ListEntryComponent element) throws IOException {
44616      composeBackbone(element);
44617      if (element.hasFlag()) {
44618        composeCodeableConcept("flag", element.getFlag());
44619      }
44620      if (element.hasDeletedElement()) {
44621        composeBooleanCore("deleted", element.getDeletedElement(), false);
44622        composeBooleanExtras("deleted", element.getDeletedElement(), false);
44623      }
44624      if (element.hasDateElement()) {
44625        composeDateTimeCore("date", element.getDateElement(), false);
44626        composeDateTimeExtras("date", element.getDateElement(), false);
44627      }
44628      if (element.hasItem()) {
44629        composeReference("item", element.getItem());
44630      }
44631  }
44632
44633  protected void composeLocation(String name, Location element) throws IOException {
44634    if (element != null) {
44635      prop("resourceType", name);
44636      composeLocationInner(element);
44637    }
44638  }
44639
44640  protected void composeLocationInner(Location element) throws IOException {
44641      composeDomainResourceElements(element);
44642      if (element.hasIdentifier()) {
44643        openArray("identifier");
44644        for (Identifier e : element.getIdentifier()) 
44645          composeIdentifier(null, e);
44646        closeArray();
44647      };
44648      if (element.hasStatusElement()) {
44649        composeEnumerationCore("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
44650        composeEnumerationExtras("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
44651      }
44652      if (element.hasOperationalStatus()) {
44653        composeCoding("operationalStatus", element.getOperationalStatus());
44654      }
44655      if (element.hasNameElement()) {
44656        composeStringCore("name", element.getNameElement(), false);
44657        composeStringExtras("name", element.getNameElement(), false);
44658      }
44659      if (element.hasAlias()) {
44660        openArray("alias");
44661        for (StringType e : element.getAlias()) 
44662          composeStringCore(null, e, true);
44663        closeArray();
44664        if (anyHasExtras(element.getAlias())) {
44665          openArray("_alias");
44666          for (StringType e : element.getAlias()) 
44667            composeStringExtras(null, e, true);
44668          closeArray();
44669        }
44670      };
44671      if (element.hasDescriptionElement()) {
44672        composeStringCore("description", element.getDescriptionElement(), false);
44673        composeStringExtras("description", element.getDescriptionElement(), false);
44674      }
44675      if (element.hasModeElement()) {
44676        composeEnumerationCore("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
44677        composeEnumerationExtras("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
44678      }
44679      if (element.hasType()) {
44680        openArray("type");
44681        for (CodeableConcept e : element.getType()) 
44682          composeCodeableConcept(null, e);
44683        closeArray();
44684      };
44685      if (element.hasTelecom()) {
44686        openArray("telecom");
44687        for (ContactPoint e : element.getTelecom()) 
44688          composeContactPoint(null, e);
44689        closeArray();
44690      };
44691      if (element.hasAddress()) {
44692        composeAddress("address", element.getAddress());
44693      }
44694      if (element.hasPhysicalType()) {
44695        composeCodeableConcept("physicalType", element.getPhysicalType());
44696      }
44697      if (element.hasPosition()) {
44698        composeLocationLocationPositionComponent("position", element.getPosition());
44699      }
44700      if (element.hasManagingOrganization()) {
44701        composeReference("managingOrganization", element.getManagingOrganization());
44702      }
44703      if (element.hasPartOf()) {
44704        composeReference("partOf", element.getPartOf());
44705      }
44706      if (element.hasHoursOfOperation()) {
44707        openArray("hoursOfOperation");
44708        for (Location.LocationHoursOfOperationComponent e : element.getHoursOfOperation()) 
44709          composeLocationLocationHoursOfOperationComponent(null, e);
44710        closeArray();
44711      };
44712      if (element.hasAvailabilityExceptionsElement()) {
44713        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
44714        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
44715      }
44716      if (element.hasEndpoint()) {
44717        openArray("endpoint");
44718        for (Reference e : element.getEndpoint()) 
44719          composeReference(null, e);
44720        closeArray();
44721      };
44722  }
44723
44724  protected void composeLocationLocationPositionComponent(String name, Location.LocationPositionComponent element) throws IOException {
44725    if (element != null) {
44726      open(name);
44727      composeLocationLocationPositionComponentInner(element);
44728      close();
44729    }
44730  }
44731
44732  protected void composeLocationLocationPositionComponentInner(Location.LocationPositionComponent element) throws IOException {
44733      composeBackbone(element);
44734      if (element.hasLongitudeElement()) {
44735        composeDecimalCore("longitude", element.getLongitudeElement(), false);
44736        composeDecimalExtras("longitude", element.getLongitudeElement(), false);
44737      }
44738      if (element.hasLatitudeElement()) {
44739        composeDecimalCore("latitude", element.getLatitudeElement(), false);
44740        composeDecimalExtras("latitude", element.getLatitudeElement(), false);
44741      }
44742      if (element.hasAltitudeElement()) {
44743        composeDecimalCore("altitude", element.getAltitudeElement(), false);
44744        composeDecimalExtras("altitude", element.getAltitudeElement(), false);
44745      }
44746  }
44747
44748  protected void composeLocationLocationHoursOfOperationComponent(String name, Location.LocationHoursOfOperationComponent element) throws IOException {
44749    if (element != null) {
44750      open(name);
44751      composeLocationLocationHoursOfOperationComponentInner(element);
44752      close();
44753    }
44754  }
44755
44756  protected void composeLocationLocationHoursOfOperationComponentInner(Location.LocationHoursOfOperationComponent element) throws IOException {
44757      composeBackbone(element);
44758      if (element.hasDaysOfWeek()) {
44759        openArray("daysOfWeek");
44760        for (Enumeration<Location.DaysOfWeek> e : element.getDaysOfWeek()) 
44761          composeEnumerationCore(null, e, new Location.DaysOfWeekEnumFactory(), true);
44762        closeArray();
44763        if (anyHasExtras(element.getDaysOfWeek())) {
44764          openArray("_daysOfWeek");
44765          for (Enumeration<Location.DaysOfWeek> e : element.getDaysOfWeek()) 
44766            composeEnumerationExtras(null, e, new Location.DaysOfWeekEnumFactory(), true);
44767          closeArray();
44768        }
44769      };
44770      if (element.hasAllDayElement()) {
44771        composeBooleanCore("allDay", element.getAllDayElement(), false);
44772        composeBooleanExtras("allDay", element.getAllDayElement(), false);
44773      }
44774      if (element.hasOpeningTimeElement()) {
44775        composeTimeCore("openingTime", element.getOpeningTimeElement(), false);
44776        composeTimeExtras("openingTime", element.getOpeningTimeElement(), false);
44777      }
44778      if (element.hasClosingTimeElement()) {
44779        composeTimeCore("closingTime", element.getClosingTimeElement(), false);
44780        composeTimeExtras("closingTime", element.getClosingTimeElement(), false);
44781      }
44782  }
44783
44784  protected void composeMeasure(String name, Measure element) throws IOException {
44785    if (element != null) {
44786      prop("resourceType", name);
44787      composeMeasureInner(element);
44788    }
44789  }
44790
44791  protected void composeMeasureInner(Measure element) throws IOException {
44792      composeDomainResourceElements(element);
44793      if (element.hasUrlElement()) {
44794        composeUriCore("url", element.getUrlElement(), false);
44795        composeUriExtras("url", element.getUrlElement(), false);
44796      }
44797      if (element.hasIdentifier()) {
44798        openArray("identifier");
44799        for (Identifier e : element.getIdentifier()) 
44800          composeIdentifier(null, e);
44801        closeArray();
44802      };
44803      if (element.hasVersionElement()) {
44804        composeStringCore("version", element.getVersionElement(), false);
44805        composeStringExtras("version", element.getVersionElement(), false);
44806      }
44807      if (element.hasNameElement()) {
44808        composeStringCore("name", element.getNameElement(), false);
44809        composeStringExtras("name", element.getNameElement(), false);
44810      }
44811      if (element.hasTitleElement()) {
44812        composeStringCore("title", element.getTitleElement(), false);
44813        composeStringExtras("title", element.getTitleElement(), false);
44814      }
44815      if (element.hasSubtitleElement()) {
44816        composeStringCore("subtitle", element.getSubtitleElement(), false);
44817        composeStringExtras("subtitle", element.getSubtitleElement(), false);
44818      }
44819      if (element.hasStatusElement()) {
44820        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
44821        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
44822      }
44823      if (element.hasExperimentalElement()) {
44824        composeBooleanCore("experimental", element.getExperimentalElement(), false);
44825        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
44826      }
44827      if (element.hasSubject()) {
44828        composeType("subject", element.getSubject());
44829      }
44830      if (element.hasDateElement()) {
44831        composeDateTimeCore("date", element.getDateElement(), false);
44832        composeDateTimeExtras("date", element.getDateElement(), false);
44833      }
44834      if (element.hasPublisherElement()) {
44835        composeStringCore("publisher", element.getPublisherElement(), false);
44836        composeStringExtras("publisher", element.getPublisherElement(), false);
44837      }
44838      if (element.hasContact()) {
44839        openArray("contact");
44840        for (ContactDetail e : element.getContact()) 
44841          composeContactDetail(null, e);
44842        closeArray();
44843      };
44844      if (element.hasDescriptionElement()) {
44845        composeMarkdownCore("description", element.getDescriptionElement(), false);
44846        composeMarkdownExtras("description", element.getDescriptionElement(), false);
44847      }
44848      if (element.hasUseContext()) {
44849        openArray("useContext");
44850        for (UsageContext e : element.getUseContext()) 
44851          composeUsageContext(null, e);
44852        closeArray();
44853      };
44854      if (element.hasJurisdiction()) {
44855        openArray("jurisdiction");
44856        for (CodeableConcept e : element.getJurisdiction()) 
44857          composeCodeableConcept(null, e);
44858        closeArray();
44859      };
44860      if (element.hasPurposeElement()) {
44861        composeMarkdownCore("purpose", element.getPurposeElement(), false);
44862        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
44863      }
44864      if (element.hasUsageElement()) {
44865        composeStringCore("usage", element.getUsageElement(), false);
44866        composeStringExtras("usage", element.getUsageElement(), false);
44867      }
44868      if (element.hasCopyrightElement()) {
44869        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
44870        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
44871      }
44872      if (element.hasApprovalDateElement()) {
44873        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
44874        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
44875      }
44876      if (element.hasLastReviewDateElement()) {
44877        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
44878        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
44879      }
44880      if (element.hasEffectivePeriod()) {
44881        composePeriod("effectivePeriod", element.getEffectivePeriod());
44882      }
44883      if (element.hasTopic()) {
44884        openArray("topic");
44885        for (CodeableConcept e : element.getTopic()) 
44886          composeCodeableConcept(null, e);
44887        closeArray();
44888      };
44889      if (element.hasAuthor()) {
44890        openArray("author");
44891        for (ContactDetail e : element.getAuthor()) 
44892          composeContactDetail(null, e);
44893        closeArray();
44894      };
44895      if (element.hasEditor()) {
44896        openArray("editor");
44897        for (ContactDetail e : element.getEditor()) 
44898          composeContactDetail(null, e);
44899        closeArray();
44900      };
44901      if (element.hasReviewer()) {
44902        openArray("reviewer");
44903        for (ContactDetail e : element.getReviewer()) 
44904          composeContactDetail(null, e);
44905        closeArray();
44906      };
44907      if (element.hasEndorser()) {
44908        openArray("endorser");
44909        for (ContactDetail e : element.getEndorser()) 
44910          composeContactDetail(null, e);
44911        closeArray();
44912      };
44913      if (element.hasRelatedArtifact()) {
44914        openArray("relatedArtifact");
44915        for (RelatedArtifact e : element.getRelatedArtifact()) 
44916          composeRelatedArtifact(null, e);
44917        closeArray();
44918      };
44919      if (element.hasLibrary()) {
44920        openArray("library");
44921        for (CanonicalType e : element.getLibrary()) 
44922          composeCanonicalCore(null, e, true);
44923        closeArray();
44924        if (anyHasExtras(element.getLibrary())) {
44925          openArray("_library");
44926          for (CanonicalType e : element.getLibrary()) 
44927            composeCanonicalExtras(null, e, true);
44928          closeArray();
44929        }
44930      };
44931      if (element.hasDisclaimerElement()) {
44932        composeMarkdownCore("disclaimer", element.getDisclaimerElement(), false);
44933        composeMarkdownExtras("disclaimer", element.getDisclaimerElement(), false);
44934      }
44935      if (element.hasScoring()) {
44936        composeCodeableConcept("scoring", element.getScoring());
44937      }
44938      if (element.hasCompositeScoring()) {
44939        composeCodeableConcept("compositeScoring", element.getCompositeScoring());
44940      }
44941      if (element.hasType()) {
44942        openArray("type");
44943        for (CodeableConcept e : element.getType()) 
44944          composeCodeableConcept(null, e);
44945        closeArray();
44946      };
44947      if (element.hasRiskAdjustmentElement()) {
44948        composeStringCore("riskAdjustment", element.getRiskAdjustmentElement(), false);
44949        composeStringExtras("riskAdjustment", element.getRiskAdjustmentElement(), false);
44950      }
44951      if (element.hasRateAggregationElement()) {
44952        composeStringCore("rateAggregation", element.getRateAggregationElement(), false);
44953        composeStringExtras("rateAggregation", element.getRateAggregationElement(), false);
44954      }
44955      if (element.hasRationaleElement()) {
44956        composeMarkdownCore("rationale", element.getRationaleElement(), false);
44957        composeMarkdownExtras("rationale", element.getRationaleElement(), false);
44958      }
44959      if (element.hasClinicalRecommendationStatementElement()) {
44960        composeMarkdownCore("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
44961        composeMarkdownExtras("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
44962      }
44963      if (element.hasImprovementNotation()) {
44964        composeCodeableConcept("improvementNotation", element.getImprovementNotation());
44965      }
44966      if (element.hasDefinition()) {
44967        openArray("definition");
44968        for (MarkdownType e : element.getDefinition()) 
44969          composeMarkdownCore(null, e, true);
44970        closeArray();
44971        if (anyHasExtras(element.getDefinition())) {
44972          openArray("_definition");
44973          for (MarkdownType e : element.getDefinition()) 
44974            composeMarkdownExtras(null, e, true);
44975          closeArray();
44976        }
44977      };
44978      if (element.hasGuidanceElement()) {
44979        composeMarkdownCore("guidance", element.getGuidanceElement(), false);
44980        composeMarkdownExtras("guidance", element.getGuidanceElement(), false);
44981      }
44982      if (element.hasGroup()) {
44983        openArray("group");
44984        for (Measure.MeasureGroupComponent e : element.getGroup()) 
44985          composeMeasureMeasureGroupComponent(null, e);
44986        closeArray();
44987      };
44988      if (element.hasSupplementalData()) {
44989        openArray("supplementalData");
44990        for (Measure.MeasureSupplementalDataComponent e : element.getSupplementalData()) 
44991          composeMeasureMeasureSupplementalDataComponent(null, e);
44992        closeArray();
44993      };
44994  }
44995
44996  protected void composeMeasureMeasureGroupComponent(String name, Measure.MeasureGroupComponent element) throws IOException {
44997    if (element != null) {
44998      open(name);
44999      composeMeasureMeasureGroupComponentInner(element);
45000      close();
45001    }
45002  }
45003
45004  protected void composeMeasureMeasureGroupComponentInner(Measure.MeasureGroupComponent element) throws IOException {
45005      composeBackbone(element);
45006      if (element.hasCode()) {
45007        composeCodeableConcept("code", element.getCode());
45008      }
45009      if (element.hasDescriptionElement()) {
45010        composeStringCore("description", element.getDescriptionElement(), false);
45011        composeStringExtras("description", element.getDescriptionElement(), false);
45012      }
45013      if (element.hasPopulation()) {
45014        openArray("population");
45015        for (Measure.MeasureGroupPopulationComponent e : element.getPopulation()) 
45016          composeMeasureMeasureGroupPopulationComponent(null, e);
45017        closeArray();
45018      };
45019      if (element.hasStratifier()) {
45020        openArray("stratifier");
45021        for (Measure.MeasureGroupStratifierComponent e : element.getStratifier()) 
45022          composeMeasureMeasureGroupStratifierComponent(null, e);
45023        closeArray();
45024      };
45025  }
45026
45027  protected void composeMeasureMeasureGroupPopulationComponent(String name, Measure.MeasureGroupPopulationComponent element) throws IOException {
45028    if (element != null) {
45029      open(name);
45030      composeMeasureMeasureGroupPopulationComponentInner(element);
45031      close();
45032    }
45033  }
45034
45035  protected void composeMeasureMeasureGroupPopulationComponentInner(Measure.MeasureGroupPopulationComponent element) throws IOException {
45036      composeBackbone(element);
45037      if (element.hasCode()) {
45038        composeCodeableConcept("code", element.getCode());
45039      }
45040      if (element.hasDescriptionElement()) {
45041        composeStringCore("description", element.getDescriptionElement(), false);
45042        composeStringExtras("description", element.getDescriptionElement(), false);
45043      }
45044      if (element.hasCriteria()) {
45045        composeExpression("criteria", element.getCriteria());
45046      }
45047  }
45048
45049  protected void composeMeasureMeasureGroupStratifierComponent(String name, Measure.MeasureGroupStratifierComponent element) throws IOException {
45050    if (element != null) {
45051      open(name);
45052      composeMeasureMeasureGroupStratifierComponentInner(element);
45053      close();
45054    }
45055  }
45056
45057  protected void composeMeasureMeasureGroupStratifierComponentInner(Measure.MeasureGroupStratifierComponent element) throws IOException {
45058      composeBackbone(element);
45059      if (element.hasCode()) {
45060        composeCodeableConcept("code", element.getCode());
45061      }
45062      if (element.hasDescriptionElement()) {
45063        composeStringCore("description", element.getDescriptionElement(), false);
45064        composeStringExtras("description", element.getDescriptionElement(), false);
45065      }
45066      if (element.hasCriteria()) {
45067        composeExpression("criteria", element.getCriteria());
45068      }
45069      if (element.hasComponent()) {
45070        openArray("component");
45071        for (Measure.MeasureGroupStratifierComponentComponent e : element.getComponent()) 
45072          composeMeasureMeasureGroupStratifierComponentComponent(null, e);
45073        closeArray();
45074      };
45075  }
45076
45077  protected void composeMeasureMeasureGroupStratifierComponentComponent(String name, Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
45078    if (element != null) {
45079      open(name);
45080      composeMeasureMeasureGroupStratifierComponentComponentInner(element);
45081      close();
45082    }
45083  }
45084
45085  protected void composeMeasureMeasureGroupStratifierComponentComponentInner(Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
45086      composeBackbone(element);
45087      if (element.hasCode()) {
45088        composeCodeableConcept("code", element.getCode());
45089      }
45090      if (element.hasDescriptionElement()) {
45091        composeStringCore("description", element.getDescriptionElement(), false);
45092        composeStringExtras("description", element.getDescriptionElement(), false);
45093      }
45094      if (element.hasCriteria()) {
45095        composeExpression("criteria", element.getCriteria());
45096      }
45097  }
45098
45099  protected void composeMeasureMeasureSupplementalDataComponent(String name, Measure.MeasureSupplementalDataComponent element) throws IOException {
45100    if (element != null) {
45101      open(name);
45102      composeMeasureMeasureSupplementalDataComponentInner(element);
45103      close();
45104    }
45105  }
45106
45107  protected void composeMeasureMeasureSupplementalDataComponentInner(Measure.MeasureSupplementalDataComponent element) throws IOException {
45108      composeBackbone(element);
45109      if (element.hasCode()) {
45110        composeCodeableConcept("code", element.getCode());
45111      }
45112      if (element.hasUsage()) {
45113        openArray("usage");
45114        for (CodeableConcept e : element.getUsage()) 
45115          composeCodeableConcept(null, e);
45116        closeArray();
45117      };
45118      if (element.hasDescriptionElement()) {
45119        composeStringCore("description", element.getDescriptionElement(), false);
45120        composeStringExtras("description", element.getDescriptionElement(), false);
45121      }
45122      if (element.hasCriteria()) {
45123        composeExpression("criteria", element.getCriteria());
45124      }
45125  }
45126
45127  protected void composeMeasureReport(String name, MeasureReport element) throws IOException {
45128    if (element != null) {
45129      prop("resourceType", name);
45130      composeMeasureReportInner(element);
45131    }
45132  }
45133
45134  protected void composeMeasureReportInner(MeasureReport element) throws IOException {
45135      composeDomainResourceElements(element);
45136      if (element.hasIdentifier()) {
45137        openArray("identifier");
45138        for (Identifier e : element.getIdentifier()) 
45139          composeIdentifier(null, e);
45140        closeArray();
45141      };
45142      if (element.hasStatusElement()) {
45143        composeEnumerationCore("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
45144        composeEnumerationExtras("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
45145      }
45146      if (element.hasTypeElement()) {
45147        composeEnumerationCore("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
45148        composeEnumerationExtras("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
45149      }
45150      if (element.hasMeasureElement()) {
45151        composeCanonicalCore("measure", element.getMeasureElement(), false);
45152        composeCanonicalExtras("measure", element.getMeasureElement(), false);
45153      }
45154      if (element.hasSubject()) {
45155        composeReference("subject", element.getSubject());
45156      }
45157      if (element.hasDateElement()) {
45158        composeDateTimeCore("date", element.getDateElement(), false);
45159        composeDateTimeExtras("date", element.getDateElement(), false);
45160      }
45161      if (element.hasReporter()) {
45162        composeReference("reporter", element.getReporter());
45163      }
45164      if (element.hasPeriod()) {
45165        composePeriod("period", element.getPeriod());
45166      }
45167      if (element.hasImprovementNotation()) {
45168        composeCodeableConcept("improvementNotation", element.getImprovementNotation());
45169      }
45170      if (element.hasGroup()) {
45171        openArray("group");
45172        for (MeasureReport.MeasureReportGroupComponent e : element.getGroup()) 
45173          composeMeasureReportMeasureReportGroupComponent(null, e);
45174        closeArray();
45175      };
45176      if (element.hasEvaluatedResource()) {
45177        openArray("evaluatedResource");
45178        for (Reference e : element.getEvaluatedResource()) 
45179          composeReference(null, e);
45180        closeArray();
45181      };
45182  }
45183
45184  protected void composeMeasureReportMeasureReportGroupComponent(String name, MeasureReport.MeasureReportGroupComponent element) throws IOException {
45185    if (element != null) {
45186      open(name);
45187      composeMeasureReportMeasureReportGroupComponentInner(element);
45188      close();
45189    }
45190  }
45191
45192  protected void composeMeasureReportMeasureReportGroupComponentInner(MeasureReport.MeasureReportGroupComponent element) throws IOException {
45193      composeBackbone(element);
45194      if (element.hasCode()) {
45195        composeCodeableConcept("code", element.getCode());
45196      }
45197      if (element.hasPopulation()) {
45198        openArray("population");
45199        for (MeasureReport.MeasureReportGroupPopulationComponent e : element.getPopulation()) 
45200          composeMeasureReportMeasureReportGroupPopulationComponent(null, e);
45201        closeArray();
45202      };
45203      if (element.hasMeasureScore()) {
45204        composeQuantity("measureScore", element.getMeasureScore());
45205      }
45206      if (element.hasStratifier()) {
45207        openArray("stratifier");
45208        for (MeasureReport.MeasureReportGroupStratifierComponent e : element.getStratifier()) 
45209          composeMeasureReportMeasureReportGroupStratifierComponent(null, e);
45210        closeArray();
45211      };
45212  }
45213
45214  protected void composeMeasureReportMeasureReportGroupPopulationComponent(String name, MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
45215    if (element != null) {
45216      open(name);
45217      composeMeasureReportMeasureReportGroupPopulationComponentInner(element);
45218      close();
45219    }
45220  }
45221
45222  protected void composeMeasureReportMeasureReportGroupPopulationComponentInner(MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
45223      composeBackbone(element);
45224      if (element.hasCode()) {
45225        composeCodeableConcept("code", element.getCode());
45226      }
45227      if (element.hasCountElement()) {
45228        composeIntegerCore("count", element.getCountElement(), false);
45229        composeIntegerExtras("count", element.getCountElement(), false);
45230      }
45231      if (element.hasSubjectResults()) {
45232        composeReference("subjectResults", element.getSubjectResults());
45233      }
45234  }
45235
45236  protected void composeMeasureReportMeasureReportGroupStratifierComponent(String name, MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
45237    if (element != null) {
45238      open(name);
45239      composeMeasureReportMeasureReportGroupStratifierComponentInner(element);
45240      close();
45241    }
45242  }
45243
45244  protected void composeMeasureReportMeasureReportGroupStratifierComponentInner(MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
45245      composeBackbone(element);
45246      if (element.hasCode()) {
45247        openArray("code");
45248        for (CodeableConcept e : element.getCode()) 
45249          composeCodeableConcept(null, e);
45250        closeArray();
45251      };
45252      if (element.hasStratum()) {
45253        openArray("stratum");
45254        for (MeasureReport.StratifierGroupComponent e : element.getStratum()) 
45255          composeMeasureReportStratifierGroupComponent(null, e);
45256        closeArray();
45257      };
45258  }
45259
45260  protected void composeMeasureReportStratifierGroupComponent(String name, MeasureReport.StratifierGroupComponent element) throws IOException {
45261    if (element != null) {
45262      open(name);
45263      composeMeasureReportStratifierGroupComponentInner(element);
45264      close();
45265    }
45266  }
45267
45268  protected void composeMeasureReportStratifierGroupComponentInner(MeasureReport.StratifierGroupComponent element) throws IOException {
45269      composeBackbone(element);
45270      if (element.hasValue()) {
45271        composeCodeableConcept("value", element.getValue());
45272      }
45273      if (element.hasComponent()) {
45274        openArray("component");
45275        for (MeasureReport.StratifierGroupComponentComponent e : element.getComponent()) 
45276          composeMeasureReportStratifierGroupComponentComponent(null, e);
45277        closeArray();
45278      };
45279      if (element.hasPopulation()) {
45280        openArray("population");
45281        for (MeasureReport.StratifierGroupPopulationComponent e : element.getPopulation()) 
45282          composeMeasureReportStratifierGroupPopulationComponent(null, e);
45283        closeArray();
45284      };
45285      if (element.hasMeasureScore()) {
45286        composeQuantity("measureScore", element.getMeasureScore());
45287      }
45288  }
45289
45290  protected void composeMeasureReportStratifierGroupComponentComponent(String name, MeasureReport.StratifierGroupComponentComponent element) throws IOException {
45291    if (element != null) {
45292      open(name);
45293      composeMeasureReportStratifierGroupComponentComponentInner(element);
45294      close();
45295    }
45296  }
45297
45298  protected void composeMeasureReportStratifierGroupComponentComponentInner(MeasureReport.StratifierGroupComponentComponent element) throws IOException {
45299      composeBackbone(element);
45300      if (element.hasCode()) {
45301        composeCodeableConcept("code", element.getCode());
45302      }
45303      if (element.hasValue()) {
45304        composeCodeableConcept("value", element.getValue());
45305      }
45306  }
45307
45308  protected void composeMeasureReportStratifierGroupPopulationComponent(String name, MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
45309    if (element != null) {
45310      open(name);
45311      composeMeasureReportStratifierGroupPopulationComponentInner(element);
45312      close();
45313    }
45314  }
45315
45316  protected void composeMeasureReportStratifierGroupPopulationComponentInner(MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
45317      composeBackbone(element);
45318      if (element.hasCode()) {
45319        composeCodeableConcept("code", element.getCode());
45320      }
45321      if (element.hasCountElement()) {
45322        composeIntegerCore("count", element.getCountElement(), false);
45323        composeIntegerExtras("count", element.getCountElement(), false);
45324      }
45325      if (element.hasSubjectResults()) {
45326        composeReference("subjectResults", element.getSubjectResults());
45327      }
45328  }
45329
45330  protected void composeMedia(String name, Media element) throws IOException {
45331    if (element != null) {
45332      prop("resourceType", name);
45333      composeMediaInner(element);
45334    }
45335  }
45336
45337  protected void composeMediaInner(Media element) throws IOException {
45338      composeDomainResourceElements(element);
45339      if (element.hasIdentifier()) {
45340        openArray("identifier");
45341        for (Identifier e : element.getIdentifier()) 
45342          composeIdentifier(null, e);
45343        closeArray();
45344      };
45345      if (element.hasBasedOn()) {
45346        openArray("basedOn");
45347        for (Reference e : element.getBasedOn()) 
45348          composeReference(null, e);
45349        closeArray();
45350      };
45351      if (element.hasPartOf()) {
45352        openArray("partOf");
45353        for (Reference e : element.getPartOf()) 
45354          composeReference(null, e);
45355        closeArray();
45356      };
45357      if (element.hasStatusElement()) {
45358        composeEnumerationCore("status", element.getStatusElement(), new Media.MediaStatusEnumFactory(), false);
45359        composeEnumerationExtras("status", element.getStatusElement(), new Media.MediaStatusEnumFactory(), false);
45360      }
45361      if (element.hasType()) {
45362        composeCodeableConcept("type", element.getType());
45363      }
45364      if (element.hasModality()) {
45365        composeCodeableConcept("modality", element.getModality());
45366      }
45367      if (element.hasView()) {
45368        composeCodeableConcept("view", element.getView());
45369      }
45370      if (element.hasSubject()) {
45371        composeReference("subject", element.getSubject());
45372      }
45373      if (element.hasEncounter()) {
45374        composeReference("encounter", element.getEncounter());
45375      }
45376      if (element.hasCreated()) {
45377        composeType("created", element.getCreated());
45378      }
45379      if (element.hasIssuedElement()) {
45380        composeInstantCore("issued", element.getIssuedElement(), false);
45381        composeInstantExtras("issued", element.getIssuedElement(), false);
45382      }
45383      if (element.hasOperator()) {
45384        composeReference("operator", element.getOperator());
45385      }
45386      if (element.hasReasonCode()) {
45387        openArray("reasonCode");
45388        for (CodeableConcept e : element.getReasonCode()) 
45389          composeCodeableConcept(null, e);
45390        closeArray();
45391      };
45392      if (element.hasBodySite()) {
45393        composeCodeableConcept("bodySite", element.getBodySite());
45394      }
45395      if (element.hasDeviceNameElement()) {
45396        composeStringCore("deviceName", element.getDeviceNameElement(), false);
45397        composeStringExtras("deviceName", element.getDeviceNameElement(), false);
45398      }
45399      if (element.hasDevice()) {
45400        composeReference("device", element.getDevice());
45401      }
45402      if (element.hasHeightElement()) {
45403        composePositiveIntCore("height", element.getHeightElement(), false);
45404        composePositiveIntExtras("height", element.getHeightElement(), false);
45405      }
45406      if (element.hasWidthElement()) {
45407        composePositiveIntCore("width", element.getWidthElement(), false);
45408        composePositiveIntExtras("width", element.getWidthElement(), false);
45409      }
45410      if (element.hasFramesElement()) {
45411        composePositiveIntCore("frames", element.getFramesElement(), false);
45412        composePositiveIntExtras("frames", element.getFramesElement(), false);
45413      }
45414      if (element.hasDurationElement()) {
45415        composeDecimalCore("duration", element.getDurationElement(), false);
45416        composeDecimalExtras("duration", element.getDurationElement(), false);
45417      }
45418      if (element.hasContent()) {
45419        composeAttachment("content", element.getContent());
45420      }
45421      if (element.hasNote()) {
45422        openArray("note");
45423        for (Annotation e : element.getNote()) 
45424          composeAnnotation(null, e);
45425        closeArray();
45426      };
45427  }
45428
45429  protected void composeMedication(String name, Medication element) throws IOException {
45430    if (element != null) {
45431      prop("resourceType", name);
45432      composeMedicationInner(element);
45433    }
45434  }
45435
45436  protected void composeMedicationInner(Medication element) throws IOException {
45437      composeDomainResourceElements(element);
45438      if (element.hasIdentifier()) {
45439        openArray("identifier");
45440        for (Identifier e : element.getIdentifier()) 
45441          composeIdentifier(null, e);
45442        closeArray();
45443      };
45444      if (element.hasCode()) {
45445        composeCodeableConcept("code", element.getCode());
45446      }
45447      if (element.hasStatusElement()) {
45448        composeEnumerationCore("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(), false);
45449        composeEnumerationExtras("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(), false);
45450      }
45451      if (element.hasManufacturer()) {
45452        composeReference("manufacturer", element.getManufacturer());
45453      }
45454      if (element.hasForm()) {
45455        composeCodeableConcept("form", element.getForm());
45456      }
45457      if (element.hasAmount()) {
45458        composeRatio("amount", element.getAmount());
45459      }
45460      if (element.hasIngredient()) {
45461        openArray("ingredient");
45462        for (Medication.MedicationIngredientComponent e : element.getIngredient()) 
45463          composeMedicationMedicationIngredientComponent(null, e);
45464        closeArray();
45465      };
45466      if (element.hasBatch()) {
45467        composeMedicationMedicationBatchComponent("batch", element.getBatch());
45468      }
45469  }
45470
45471  protected void composeMedicationMedicationIngredientComponent(String name, Medication.MedicationIngredientComponent element) throws IOException {
45472    if (element != null) {
45473      open(name);
45474      composeMedicationMedicationIngredientComponentInner(element);
45475      close();
45476    }
45477  }
45478
45479  protected void composeMedicationMedicationIngredientComponentInner(Medication.MedicationIngredientComponent element) throws IOException {
45480      composeBackbone(element);
45481      if (element.hasItem()) {
45482        composeType("item", element.getItem());
45483      }
45484      if (element.hasIsActiveElement()) {
45485        composeBooleanCore("isActive", element.getIsActiveElement(), false);
45486        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
45487      }
45488      if (element.hasStrength()) {
45489        composeRatio("strength", element.getStrength());
45490      }
45491  }
45492
45493  protected void composeMedicationMedicationBatchComponent(String name, Medication.MedicationBatchComponent element) throws IOException {
45494    if (element != null) {
45495      open(name);
45496      composeMedicationMedicationBatchComponentInner(element);
45497      close();
45498    }
45499  }
45500
45501  protected void composeMedicationMedicationBatchComponentInner(Medication.MedicationBatchComponent element) throws IOException {
45502      composeBackbone(element);
45503      if (element.hasLotNumberElement()) {
45504        composeStringCore("lotNumber", element.getLotNumberElement(), false);
45505        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
45506      }
45507      if (element.hasExpirationDateElement()) {
45508        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
45509        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
45510      }
45511  }
45512
45513  protected void composeMedicationAdministration(String name, MedicationAdministration element) throws IOException {
45514    if (element != null) {
45515      prop("resourceType", name);
45516      composeMedicationAdministrationInner(element);
45517    }
45518  }
45519
45520  protected void composeMedicationAdministrationInner(MedicationAdministration element) throws IOException {
45521      composeDomainResourceElements(element);
45522      if (element.hasIdentifier()) {
45523        openArray("identifier");
45524        for (Identifier e : element.getIdentifier()) 
45525          composeIdentifier(null, e);
45526        closeArray();
45527      };
45528      if (element.hasInstantiates()) {
45529        openArray("instantiates");
45530        for (UriType e : element.getInstantiates()) 
45531          composeUriCore(null, e, true);
45532        closeArray();
45533        if (anyHasExtras(element.getInstantiates())) {
45534          openArray("_instantiates");
45535          for (UriType e : element.getInstantiates()) 
45536            composeUriExtras(null, e, true);
45537          closeArray();
45538        }
45539      };
45540      if (element.hasPartOf()) {
45541        openArray("partOf");
45542        for (Reference e : element.getPartOf()) 
45543          composeReference(null, e);
45544        closeArray();
45545      };
45546      if (element.hasStatusElement()) {
45547        composeCodeCore("status", element.getStatusElement(), false);
45548        composeCodeExtras("status", element.getStatusElement(), false);
45549      }
45550      if (element.hasStatusReason()) {
45551        openArray("statusReason");
45552        for (CodeableConcept e : element.getStatusReason()) 
45553          composeCodeableConcept(null, e);
45554        closeArray();
45555      };
45556      if (element.hasCategory()) {
45557        composeCodeableConcept("category", element.getCategory());
45558      }
45559      if (element.hasMedication()) {
45560        composeType("medication", element.getMedication());
45561      }
45562      if (element.hasSubject()) {
45563        composeReference("subject", element.getSubject());
45564      }
45565      if (element.hasContext()) {
45566        composeReference("context", element.getContext());
45567      }
45568      if (element.hasSupportingInformation()) {
45569        openArray("supportingInformation");
45570        for (Reference e : element.getSupportingInformation()) 
45571          composeReference(null, e);
45572        closeArray();
45573      };
45574      if (element.hasEffective()) {
45575        composeType("effective", element.getEffective());
45576      }
45577      if (element.hasPerformer()) {
45578        openArray("performer");
45579        for (MedicationAdministration.MedicationAdministrationPerformerComponent e : element.getPerformer()) 
45580          composeMedicationAdministrationMedicationAdministrationPerformerComponent(null, e);
45581        closeArray();
45582      };
45583      if (element.hasReasonCode()) {
45584        openArray("reasonCode");
45585        for (CodeableConcept e : element.getReasonCode()) 
45586          composeCodeableConcept(null, e);
45587        closeArray();
45588      };
45589      if (element.hasReasonReference()) {
45590        openArray("reasonReference");
45591        for (Reference e : element.getReasonReference()) 
45592          composeReference(null, e);
45593        closeArray();
45594      };
45595      if (element.hasRequest()) {
45596        composeReference("request", element.getRequest());
45597      }
45598      if (element.hasDevice()) {
45599        openArray("device");
45600        for (Reference e : element.getDevice()) 
45601          composeReference(null, e);
45602        closeArray();
45603      };
45604      if (element.hasNote()) {
45605        openArray("note");
45606        for (Annotation e : element.getNote()) 
45607          composeAnnotation(null, e);
45608        closeArray();
45609      };
45610      if (element.hasDosage()) {
45611        composeMedicationAdministrationMedicationAdministrationDosageComponent("dosage", element.getDosage());
45612      }
45613      if (element.hasEventHistory()) {
45614        openArray("eventHistory");
45615        for (Reference e : element.getEventHistory()) 
45616          composeReference(null, e);
45617        closeArray();
45618      };
45619  }
45620
45621  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponent(String name, MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
45622    if (element != null) {
45623      open(name);
45624      composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(element);
45625      close();
45626    }
45627  }
45628
45629  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
45630      composeBackbone(element);
45631      if (element.hasFunction()) {
45632        composeCodeableConcept("function", element.getFunction());
45633      }
45634      if (element.hasActor()) {
45635        composeReference("actor", element.getActor());
45636      }
45637  }
45638
45639  protected void composeMedicationAdministrationMedicationAdministrationDosageComponent(String name, MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
45640    if (element != null) {
45641      open(name);
45642      composeMedicationAdministrationMedicationAdministrationDosageComponentInner(element);
45643      close();
45644    }
45645  }
45646
45647  protected void composeMedicationAdministrationMedicationAdministrationDosageComponentInner(MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
45648      composeBackbone(element);
45649      if (element.hasTextElement()) {
45650        composeStringCore("text", element.getTextElement(), false);
45651        composeStringExtras("text", element.getTextElement(), false);
45652      }
45653      if (element.hasSite()) {
45654        composeCodeableConcept("site", element.getSite());
45655      }
45656      if (element.hasRoute()) {
45657        composeCodeableConcept("route", element.getRoute());
45658      }
45659      if (element.hasMethod()) {
45660        composeCodeableConcept("method", element.getMethod());
45661      }
45662      if (element.hasDose()) {
45663        composeQuantity("dose", element.getDose());
45664      }
45665      if (element.hasRate()) {
45666        composeType("rate", element.getRate());
45667      }
45668  }
45669
45670  protected void composeMedicationDispense(String name, MedicationDispense element) throws IOException {
45671    if (element != null) {
45672      prop("resourceType", name);
45673      composeMedicationDispenseInner(element);
45674    }
45675  }
45676
45677  protected void composeMedicationDispenseInner(MedicationDispense element) throws IOException {
45678      composeDomainResourceElements(element);
45679      if (element.hasIdentifier()) {
45680        openArray("identifier");
45681        for (Identifier e : element.getIdentifier()) 
45682          composeIdentifier(null, e);
45683        closeArray();
45684      };
45685      if (element.hasPartOf()) {
45686        openArray("partOf");
45687        for (Reference e : element.getPartOf()) 
45688          composeReference(null, e);
45689        closeArray();
45690      };
45691      if (element.hasStatusElement()) {
45692        composeCodeCore("status", element.getStatusElement(), false);
45693        composeCodeExtras("status", element.getStatusElement(), false);
45694      }
45695      if (element.hasStatusReason()) {
45696        composeType("statusReason", element.getStatusReason());
45697      }
45698      if (element.hasCategory()) {
45699        composeCodeableConcept("category", element.getCategory());
45700      }
45701      if (element.hasMedication()) {
45702        composeType("medication", element.getMedication());
45703      }
45704      if (element.hasSubject()) {
45705        composeReference("subject", element.getSubject());
45706      }
45707      if (element.hasContext()) {
45708        composeReference("context", element.getContext());
45709      }
45710      if (element.hasSupportingInformation()) {
45711        openArray("supportingInformation");
45712        for (Reference e : element.getSupportingInformation()) 
45713          composeReference(null, e);
45714        closeArray();
45715      };
45716      if (element.hasPerformer()) {
45717        openArray("performer");
45718        for (MedicationDispense.MedicationDispensePerformerComponent e : element.getPerformer()) 
45719          composeMedicationDispenseMedicationDispensePerformerComponent(null, e);
45720        closeArray();
45721      };
45722      if (element.hasLocation()) {
45723        composeReference("location", element.getLocation());
45724      }
45725      if (element.hasAuthorizingPrescription()) {
45726        openArray("authorizingPrescription");
45727        for (Reference e : element.getAuthorizingPrescription()) 
45728          composeReference(null, e);
45729        closeArray();
45730      };
45731      if (element.hasType()) {
45732        composeCodeableConcept("type", element.getType());
45733      }
45734      if (element.hasQuantity()) {
45735        composeQuantity("quantity", element.getQuantity());
45736      }
45737      if (element.hasDaysSupply()) {
45738        composeQuantity("daysSupply", element.getDaysSupply());
45739      }
45740      if (element.hasWhenPreparedElement()) {
45741        composeDateTimeCore("whenPrepared", element.getWhenPreparedElement(), false);
45742        composeDateTimeExtras("whenPrepared", element.getWhenPreparedElement(), false);
45743      }
45744      if (element.hasWhenHandedOverElement()) {
45745        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
45746        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
45747      }
45748      if (element.hasDestination()) {
45749        composeReference("destination", element.getDestination());
45750      }
45751      if (element.hasReceiver()) {
45752        openArray("receiver");
45753        for (Reference e : element.getReceiver()) 
45754          composeReference(null, e);
45755        closeArray();
45756      };
45757      if (element.hasNote()) {
45758        openArray("note");
45759        for (Annotation e : element.getNote()) 
45760          composeAnnotation(null, e);
45761        closeArray();
45762      };
45763      if (element.hasDosageInstruction()) {
45764        openArray("dosageInstruction");
45765        for (Dosage e : element.getDosageInstruction()) 
45766          composeDosage(null, e);
45767        closeArray();
45768      };
45769      if (element.hasSubstitution()) {
45770        composeMedicationDispenseMedicationDispenseSubstitutionComponent("substitution", element.getSubstitution());
45771      }
45772      if (element.hasDetectedIssue()) {
45773        openArray("detectedIssue");
45774        for (Reference e : element.getDetectedIssue()) 
45775          composeReference(null, e);
45776        closeArray();
45777      };
45778      if (element.hasEventHistory()) {
45779        openArray("eventHistory");
45780        for (Reference e : element.getEventHistory()) 
45781          composeReference(null, e);
45782        closeArray();
45783      };
45784  }
45785
45786  protected void composeMedicationDispenseMedicationDispensePerformerComponent(String name, MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
45787    if (element != null) {
45788      open(name);
45789      composeMedicationDispenseMedicationDispensePerformerComponentInner(element);
45790      close();
45791    }
45792  }
45793
45794  protected void composeMedicationDispenseMedicationDispensePerformerComponentInner(MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
45795      composeBackbone(element);
45796      if (element.hasFunction()) {
45797        composeCodeableConcept("function", element.getFunction());
45798      }
45799      if (element.hasActor()) {
45800        composeReference("actor", element.getActor());
45801      }
45802  }
45803
45804  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponent(String name, MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
45805    if (element != null) {
45806      open(name);
45807      composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(element);
45808      close();
45809    }
45810  }
45811
45812  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
45813      composeBackbone(element);
45814      if (element.hasWasSubstitutedElement()) {
45815        composeBooleanCore("wasSubstituted", element.getWasSubstitutedElement(), false);
45816        composeBooleanExtras("wasSubstituted", element.getWasSubstitutedElement(), false);
45817      }
45818      if (element.hasType()) {
45819        composeCodeableConcept("type", element.getType());
45820      }
45821      if (element.hasReason()) {
45822        openArray("reason");
45823        for (CodeableConcept e : element.getReason()) 
45824          composeCodeableConcept(null, e);
45825        closeArray();
45826      };
45827      if (element.hasResponsibleParty()) {
45828        openArray("responsibleParty");
45829        for (Reference e : element.getResponsibleParty()) 
45830          composeReference(null, e);
45831        closeArray();
45832      };
45833  }
45834
45835  protected void composeMedicationKnowledge(String name, MedicationKnowledge element) throws IOException {
45836    if (element != null) {
45837      prop("resourceType", name);
45838      composeMedicationKnowledgeInner(element);
45839    }
45840  }
45841
45842  protected void composeMedicationKnowledgeInner(MedicationKnowledge element) throws IOException {
45843      composeDomainResourceElements(element);
45844      if (element.hasCode()) {
45845        composeCodeableConcept("code", element.getCode());
45846      }
45847      if (element.hasStatusElement()) {
45848        composeCodeCore("status", element.getStatusElement(), false);
45849        composeCodeExtras("status", element.getStatusElement(), false);
45850      }
45851      if (element.hasManufacturer()) {
45852        composeReference("manufacturer", element.getManufacturer());
45853      }
45854      if (element.hasDoseForm()) {
45855        composeCodeableConcept("doseForm", element.getDoseForm());
45856      }
45857      if (element.hasAmount()) {
45858        composeQuantity("amount", element.getAmount());
45859      }
45860      if (element.hasSynonym()) {
45861        openArray("synonym");
45862        for (StringType e : element.getSynonym()) 
45863          composeStringCore(null, e, true);
45864        closeArray();
45865        if (anyHasExtras(element.getSynonym())) {
45866          openArray("_synonym");
45867          for (StringType e : element.getSynonym()) 
45868            composeStringExtras(null, e, true);
45869          closeArray();
45870        }
45871      };
45872      if (element.hasRelatedMedicationKnowledge()) {
45873        openArray("relatedMedicationKnowledge");
45874        for (MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent e : element.getRelatedMedicationKnowledge()) 
45875          composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(null, e);
45876        closeArray();
45877      };
45878      if (element.hasAssociatedMedication()) {
45879        openArray("associatedMedication");
45880        for (Reference e : element.getAssociatedMedication()) 
45881          composeReference(null, e);
45882        closeArray();
45883      };
45884      if (element.hasProductType()) {
45885        openArray("productType");
45886        for (CodeableConcept e : element.getProductType()) 
45887          composeCodeableConcept(null, e);
45888        closeArray();
45889      };
45890      if (element.hasMonograph()) {
45891        openArray("monograph");
45892        for (MedicationKnowledge.MedicationKnowledgeMonographComponent e : element.getMonograph()) 
45893          composeMedicationKnowledgeMedicationKnowledgeMonographComponent(null, e);
45894        closeArray();
45895      };
45896      if (element.hasIngredient()) {
45897        openArray("ingredient");
45898        for (MedicationKnowledge.MedicationKnowledgeIngredientComponent e : element.getIngredient()) 
45899          composeMedicationKnowledgeMedicationKnowledgeIngredientComponent(null, e);
45900        closeArray();
45901      };
45902      if (element.hasPreparationInstructionElement()) {
45903        composeMarkdownCore("preparationInstruction", element.getPreparationInstructionElement(), false);
45904        composeMarkdownExtras("preparationInstruction", element.getPreparationInstructionElement(), false);
45905      }
45906      if (element.hasIntendedRoute()) {
45907        openArray("intendedRoute");
45908        for (CodeableConcept e : element.getIntendedRoute()) 
45909          composeCodeableConcept(null, e);
45910        closeArray();
45911      };
45912      if (element.hasCost()) {
45913        openArray("cost");
45914        for (MedicationKnowledge.MedicationKnowledgeCostComponent e : element.getCost()) 
45915          composeMedicationKnowledgeMedicationKnowledgeCostComponent(null, e);
45916        closeArray();
45917      };
45918      if (element.hasMonitoringProgram()) {
45919        openArray("monitoringProgram");
45920        for (MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent e : element.getMonitoringProgram()) 
45921          composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(null, e);
45922        closeArray();
45923      };
45924      if (element.hasAdministrationGuidelines()) {
45925        openArray("administrationGuidelines");
45926        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent e : element.getAdministrationGuidelines()) 
45927          composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(null, e);
45928        closeArray();
45929      };
45930      if (element.hasMedicineClassification()) {
45931        openArray("medicineClassification");
45932        for (MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent e : element.getMedicineClassification()) 
45933          composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(null, e);
45934        closeArray();
45935      };
45936      if (element.hasPackaging()) {
45937        composeMedicationKnowledgeMedicationKnowledgePackagingComponent("packaging", element.getPackaging());
45938      }
45939      if (element.hasDrugCharacteristic()) {
45940        openArray("drugCharacteristic");
45941        for (MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent e : element.getDrugCharacteristic()) 
45942          composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(null, e);
45943        closeArray();
45944      };
45945      if (element.hasContraindication()) {
45946        openArray("contraindication");
45947        for (Reference e : element.getContraindication()) 
45948          composeReference(null, e);
45949        closeArray();
45950      };
45951      if (element.hasRegulatory()) {
45952        openArray("regulatory");
45953        for (MedicationKnowledge.MedicationKnowledgeRegulatoryComponent e : element.getRegulatory()) 
45954          composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(null, e);
45955        closeArray();
45956      };
45957      if (element.hasKinetics()) {
45958        openArray("kinetics");
45959        for (MedicationKnowledge.MedicationKnowledgeKineticsComponent e : element.getKinetics()) 
45960          composeMedicationKnowledgeMedicationKnowledgeKineticsComponent(null, e);
45961        closeArray();
45962      };
45963  }
45964
45965  protected void composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(String name, MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
45966    if (element != null) {
45967      open(name);
45968      composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentInner(element);
45969      close();
45970    }
45971  }
45972
45973  protected void composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentInner(MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
45974      composeBackbone(element);
45975      if (element.hasType()) {
45976        composeCodeableConcept("type", element.getType());
45977      }
45978      if (element.hasReference()) {
45979        openArray("reference");
45980        for (Reference e : element.getReference()) 
45981          composeReference(null, e);
45982        closeArray();
45983      };
45984  }
45985
45986  protected void composeMedicationKnowledgeMedicationKnowledgeMonographComponent(String name, MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
45987    if (element != null) {
45988      open(name);
45989      composeMedicationKnowledgeMedicationKnowledgeMonographComponentInner(element);
45990      close();
45991    }
45992  }
45993
45994  protected void composeMedicationKnowledgeMedicationKnowledgeMonographComponentInner(MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
45995      composeBackbone(element);
45996      if (element.hasType()) {
45997        composeCodeableConcept("type", element.getType());
45998      }
45999      if (element.hasSource()) {
46000        composeReference("source", element.getSource());
46001      }
46002  }
46003
46004  protected void composeMedicationKnowledgeMedicationKnowledgeIngredientComponent(String name, MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
46005    if (element != null) {
46006      open(name);
46007      composeMedicationKnowledgeMedicationKnowledgeIngredientComponentInner(element);
46008      close();
46009    }
46010  }
46011
46012  protected void composeMedicationKnowledgeMedicationKnowledgeIngredientComponentInner(MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
46013      composeBackbone(element);
46014      if (element.hasItem()) {
46015        composeType("item", element.getItem());
46016      }
46017      if (element.hasIsActiveElement()) {
46018        composeBooleanCore("isActive", element.getIsActiveElement(), false);
46019        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
46020      }
46021      if (element.hasStrength()) {
46022        composeRatio("strength", element.getStrength());
46023      }
46024  }
46025
46026  protected void composeMedicationKnowledgeMedicationKnowledgeCostComponent(String name, MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
46027    if (element != null) {
46028      open(name);
46029      composeMedicationKnowledgeMedicationKnowledgeCostComponentInner(element);
46030      close();
46031    }
46032  }
46033
46034  protected void composeMedicationKnowledgeMedicationKnowledgeCostComponentInner(MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
46035      composeBackbone(element);
46036      if (element.hasType()) {
46037        composeCodeableConcept("type", element.getType());
46038      }
46039      if (element.hasSourceElement()) {
46040        composeStringCore("source", element.getSourceElement(), false);
46041        composeStringExtras("source", element.getSourceElement(), false);
46042      }
46043      if (element.hasCost()) {
46044        composeMoney("cost", element.getCost());
46045      }
46046  }
46047
46048  protected void composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(String name, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
46049    if (element != null) {
46050      open(name);
46051      composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentInner(element);
46052      close();
46053    }
46054  }
46055
46056  protected void composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentInner(MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
46057      composeBackbone(element);
46058      if (element.hasType()) {
46059        composeCodeableConcept("type", element.getType());
46060      }
46061      if (element.hasNameElement()) {
46062        composeStringCore("name", element.getNameElement(), false);
46063        composeStringExtras("name", element.getNameElement(), false);
46064      }
46065  }
46066
46067  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent element) throws IOException {
46068    if (element != null) {
46069      open(name);
46070      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentInner(element);
46071      close();
46072    }
46073  }
46074
46075  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentInner(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent element) throws IOException {
46076      composeBackbone(element);
46077      if (element.hasDosage()) {
46078        openArray("dosage");
46079        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent e : element.getDosage()) 
46080          composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(null, e);
46081        closeArray();
46082      };
46083      if (element.hasIndication()) {
46084        composeType("indication", element.getIndication());
46085      }
46086      if (element.hasPatientCharacteristics()) {
46087        openArray("patientCharacteristics");
46088        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent e : element.getPatientCharacteristics()) 
46089          composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(null, e);
46090        closeArray();
46091      };
46092  }
46093
46094  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent element) throws IOException {
46095    if (element != null) {
46096      open(name);
46097      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentInner(element);
46098      close();
46099    }
46100  }
46101
46102  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentInner(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent element) throws IOException {
46103      composeBackbone(element);
46104      if (element.hasType()) {
46105        composeCodeableConcept("type", element.getType());
46106      }
46107      if (element.hasDosage()) {
46108        openArray("dosage");
46109        for (Dosage e : element.getDosage()) 
46110          composeDosage(null, e);
46111        closeArray();
46112      };
46113  }
46114
46115  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent element) throws IOException {
46116    if (element != null) {
46117      open(name);
46118      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentInner(element);
46119      close();
46120    }
46121  }
46122
46123  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentInner(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent element) throws IOException {
46124      composeBackbone(element);
46125      if (element.hasCharacteristic()) {
46126        composeType("characteristic", element.getCharacteristic());
46127      }
46128      if (element.hasValue()) {
46129        openArray("value");
46130        for (StringType e : element.getValue()) 
46131          composeStringCore(null, e, true);
46132        closeArray();
46133        if (anyHasExtras(element.getValue())) {
46134          openArray("_value");
46135          for (StringType e : element.getValue()) 
46136            composeStringExtras(null, e, true);
46137          closeArray();
46138        }
46139      };
46140  }
46141
46142  protected void composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(String name, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
46143    if (element != null) {
46144      open(name);
46145      composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentInner(element);
46146      close();
46147    }
46148  }
46149
46150  protected void composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentInner(MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
46151      composeBackbone(element);
46152      if (element.hasType()) {
46153        composeCodeableConcept("type", element.getType());
46154      }
46155      if (element.hasClassification()) {
46156        openArray("classification");
46157        for (CodeableConcept e : element.getClassification()) 
46158          composeCodeableConcept(null, e);
46159        closeArray();
46160      };
46161  }
46162
46163  protected void composeMedicationKnowledgeMedicationKnowledgePackagingComponent(String name, MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
46164    if (element != null) {
46165      open(name);
46166      composeMedicationKnowledgeMedicationKnowledgePackagingComponentInner(element);
46167      close();
46168    }
46169  }
46170
46171  protected void composeMedicationKnowledgeMedicationKnowledgePackagingComponentInner(MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
46172      composeBackbone(element);
46173      if (element.hasType()) {
46174        composeCodeableConcept("type", element.getType());
46175      }
46176      if (element.hasQuantity()) {
46177        composeQuantity("quantity", element.getQuantity());
46178      }
46179  }
46180
46181  protected void composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(String name, MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
46182    if (element != null) {
46183      open(name);
46184      composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentInner(element);
46185      close();
46186    }
46187  }
46188
46189  protected void composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentInner(MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
46190      composeBackbone(element);
46191      if (element.hasType()) {
46192        composeCodeableConcept("type", element.getType());
46193      }
46194      if (element.hasValue()) {
46195        composeType("value", element.getValue());
46196      }
46197  }
46198
46199  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
46200    if (element != null) {
46201      open(name);
46202      composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponentInner(element);
46203      close();
46204    }
46205  }
46206
46207  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
46208      composeBackbone(element);
46209      if (element.hasRegulatoryAuthority()) {
46210        composeReference("regulatoryAuthority", element.getRegulatoryAuthority());
46211      }
46212      if (element.hasSubstitution()) {
46213        openArray("substitution");
46214        for (MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent e : element.getSubstitution()) 
46215          composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(null, e);
46216        closeArray();
46217      };
46218      if (element.hasSchedule()) {
46219        openArray("schedule");
46220        for (MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent e : element.getSchedule()) 
46221          composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(null, e);
46222        closeArray();
46223      };
46224      if (element.hasMaxDispense()) {
46225        composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent("maxDispense", element.getMaxDispense());
46226      }
46227  }
46228
46229  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
46230    if (element != null) {
46231      open(name);
46232      composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentInner(element);
46233      close();
46234    }
46235  }
46236
46237  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
46238      composeBackbone(element);
46239      if (element.hasType()) {
46240        composeCodeableConcept("type", element.getType());
46241      }
46242      if (element.hasAllowedElement()) {
46243        composeBooleanCore("allowed", element.getAllowedElement(), false);
46244        composeBooleanExtras("allowed", element.getAllowedElement(), false);
46245      }
46246  }
46247
46248  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent element) throws IOException {
46249    if (element != null) {
46250      open(name);
46251      composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentInner(element);
46252      close();
46253    }
46254  }
46255
46256  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent element) throws IOException {
46257      composeBackbone(element);
46258      if (element.hasSchedule()) {
46259        composeCodeableConcept("schedule", element.getSchedule());
46260      }
46261  }
46262
46263  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
46264    if (element != null) {
46265      open(name);
46266      composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentInner(element);
46267      close();
46268    }
46269  }
46270
46271  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
46272      composeBackbone(element);
46273      if (element.hasQuantity()) {
46274        composeQuantity("quantity", element.getQuantity());
46275      }
46276      if (element.hasPeriod()) {
46277        composeDuration("period", element.getPeriod());
46278      }
46279  }
46280
46281  protected void composeMedicationKnowledgeMedicationKnowledgeKineticsComponent(String name, MedicationKnowledge.MedicationKnowledgeKineticsComponent element) throws IOException {
46282    if (element != null) {
46283      open(name);
46284      composeMedicationKnowledgeMedicationKnowledgeKineticsComponentInner(element);
46285      close();
46286    }
46287  }
46288
46289  protected void composeMedicationKnowledgeMedicationKnowledgeKineticsComponentInner(MedicationKnowledge.MedicationKnowledgeKineticsComponent element) throws IOException {
46290      composeBackbone(element);
46291      if (element.hasAreaUnderCurve()) {
46292        openArray("areaUnderCurve");
46293        for (Quantity e : element.getAreaUnderCurve()) 
46294          composeQuantity(null, e);
46295        closeArray();
46296      };
46297      if (element.hasLethalDose50()) {
46298        openArray("lethalDose50");
46299        for (Quantity e : element.getLethalDose50()) 
46300          composeQuantity(null, e);
46301        closeArray();
46302      };
46303      if (element.hasHalfLifePeriod()) {
46304        composeDuration("halfLifePeriod", element.getHalfLifePeriod());
46305      }
46306  }
46307
46308  protected void composeMedicationRequest(String name, MedicationRequest element) throws IOException {
46309    if (element != null) {
46310      prop("resourceType", name);
46311      composeMedicationRequestInner(element);
46312    }
46313  }
46314
46315  protected void composeMedicationRequestInner(MedicationRequest element) throws IOException {
46316      composeDomainResourceElements(element);
46317      if (element.hasIdentifier()) {
46318        openArray("identifier");
46319        for (Identifier e : element.getIdentifier()) 
46320          composeIdentifier(null, e);
46321        closeArray();
46322      };
46323      if (element.hasStatusElement()) {
46324        composeEnumerationCore("status", element.getStatusElement(), new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
46325        composeEnumerationExtras("status", element.getStatusElement(), new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
46326      }
46327      if (element.hasStatusReason()) {
46328        composeCodeableConcept("statusReason", element.getStatusReason());
46329      }
46330      if (element.hasIntentElement()) {
46331        composeEnumerationCore("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
46332        composeEnumerationExtras("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
46333      }
46334      if (element.hasCategory()) {
46335        openArray("category");
46336        for (CodeableConcept e : element.getCategory()) 
46337          composeCodeableConcept(null, e);
46338        closeArray();
46339      };
46340      if (element.hasPriorityElement()) {
46341        composeEnumerationCore("priority", element.getPriorityElement(), new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
46342        composeEnumerationExtras("priority", element.getPriorityElement(), new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
46343      }
46344      if (element.hasDoNotPerformElement()) {
46345        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
46346        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
46347      }
46348      if (element.hasReported()) {
46349        composeType("reported", element.getReported());
46350      }
46351      if (element.hasMedication()) {
46352        composeType("medication", element.getMedication());
46353      }
46354      if (element.hasSubject()) {
46355        composeReference("subject", element.getSubject());
46356      }
46357      if (element.hasEncounter()) {
46358        composeReference("encounter", element.getEncounter());
46359      }
46360      if (element.hasSupportingInformation()) {
46361        openArray("supportingInformation");
46362        for (Reference e : element.getSupportingInformation()) 
46363          composeReference(null, e);
46364        closeArray();
46365      };
46366      if (element.hasAuthoredOnElement()) {
46367        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
46368        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
46369      }
46370      if (element.hasRequester()) {
46371        composeReference("requester", element.getRequester());
46372      }
46373      if (element.hasPerformer()) {
46374        composeReference("performer", element.getPerformer());
46375      }
46376      if (element.hasPerformerType()) {
46377        composeCodeableConcept("performerType", element.getPerformerType());
46378      }
46379      if (element.hasRecorder()) {
46380        composeReference("recorder", element.getRecorder());
46381      }
46382      if (element.hasReasonCode()) {
46383        openArray("reasonCode");
46384        for (CodeableConcept e : element.getReasonCode()) 
46385          composeCodeableConcept(null, e);
46386        closeArray();
46387      };
46388      if (element.hasReasonReference()) {
46389        openArray("reasonReference");
46390        for (Reference e : element.getReasonReference()) 
46391          composeReference(null, e);
46392        closeArray();
46393      };
46394      if (element.hasInstantiatesCanonical()) {
46395        openArray("instantiatesCanonical");
46396        for (CanonicalType e : element.getInstantiatesCanonical()) 
46397          composeCanonicalCore(null, e, true);
46398        closeArray();
46399        if (anyHasExtras(element.getInstantiatesCanonical())) {
46400          openArray("_instantiatesCanonical");
46401          for (CanonicalType e : element.getInstantiatesCanonical()) 
46402            composeCanonicalExtras(null, e, true);
46403          closeArray();
46404        }
46405      };
46406      if (element.hasInstantiatesUri()) {
46407        openArray("instantiatesUri");
46408        for (UriType e : element.getInstantiatesUri()) 
46409          composeUriCore(null, e, true);
46410        closeArray();
46411        if (anyHasExtras(element.getInstantiatesUri())) {
46412          openArray("_instantiatesUri");
46413          for (UriType e : element.getInstantiatesUri()) 
46414            composeUriExtras(null, e, true);
46415          closeArray();
46416        }
46417      };
46418      if (element.hasBasedOn()) {
46419        openArray("basedOn");
46420        for (Reference e : element.getBasedOn()) 
46421          composeReference(null, e);
46422        closeArray();
46423      };
46424      if (element.hasGroupIdentifier()) {
46425        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
46426      }
46427      if (element.hasCourseOfTherapyType()) {
46428        composeCodeableConcept("courseOfTherapyType", element.getCourseOfTherapyType());
46429      }
46430      if (element.hasInsurance()) {
46431        openArray("insurance");
46432        for (Reference e : element.getInsurance()) 
46433          composeReference(null, e);
46434        closeArray();
46435      };
46436      if (element.hasNote()) {
46437        openArray("note");
46438        for (Annotation e : element.getNote()) 
46439          composeAnnotation(null, e);
46440        closeArray();
46441      };
46442      if (element.hasDosageInstruction()) {
46443        openArray("dosageInstruction");
46444        for (Dosage e : element.getDosageInstruction()) 
46445          composeDosage(null, e);
46446        closeArray();
46447      };
46448      if (element.hasDispenseRequest()) {
46449        composeMedicationRequestMedicationRequestDispenseRequestComponent("dispenseRequest", element.getDispenseRequest());
46450      }
46451      if (element.hasSubstitution()) {
46452        composeMedicationRequestMedicationRequestSubstitutionComponent("substitution", element.getSubstitution());
46453      }
46454      if (element.hasPriorPrescription()) {
46455        composeReference("priorPrescription", element.getPriorPrescription());
46456      }
46457      if (element.hasDetectedIssue()) {
46458        openArray("detectedIssue");
46459        for (Reference e : element.getDetectedIssue()) 
46460          composeReference(null, e);
46461        closeArray();
46462      };
46463      if (element.hasEventHistory()) {
46464        openArray("eventHistory");
46465        for (Reference e : element.getEventHistory()) 
46466          composeReference(null, e);
46467        closeArray();
46468      };
46469  }
46470
46471  protected void composeMedicationRequestMedicationRequestDispenseRequestComponent(String name, MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
46472    if (element != null) {
46473      open(name);
46474      composeMedicationRequestMedicationRequestDispenseRequestComponentInner(element);
46475      close();
46476    }
46477  }
46478
46479  protected void composeMedicationRequestMedicationRequestDispenseRequestComponentInner(MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
46480      composeBackbone(element);
46481      if (element.hasInitialFill()) {
46482        composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponent("initialFill", element.getInitialFill());
46483      }
46484      if (element.hasDispenseInterval()) {
46485        composeDuration("dispenseInterval", element.getDispenseInterval());
46486      }
46487      if (element.hasValidityPeriod()) {
46488        composePeriod("validityPeriod", element.getValidityPeriod());
46489      }
46490      if (element.hasNumberOfRepeatsAllowedElement()) {
46491        composeUnsignedIntCore("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
46492        composeUnsignedIntExtras("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
46493      }
46494      if (element.hasQuantity()) {
46495        composeQuantity("quantity", element.getQuantity());
46496      }
46497      if (element.hasExpectedSupplyDuration()) {
46498        composeDuration("expectedSupplyDuration", element.getExpectedSupplyDuration());
46499      }
46500      if (element.hasPerformer()) {
46501        composeReference("performer", element.getPerformer());
46502      }
46503  }
46504
46505  protected void composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(String name, MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
46506    if (element != null) {
46507      open(name);
46508      composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponentInner(element);
46509      close();
46510    }
46511  }
46512
46513  protected void composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponentInner(MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
46514      composeBackbone(element);
46515      if (element.hasQuantity()) {
46516        composeQuantity("quantity", element.getQuantity());
46517      }
46518      if (element.hasDuration()) {
46519        composeDuration("duration", element.getDuration());
46520      }
46521  }
46522
46523  protected void composeMedicationRequestMedicationRequestSubstitutionComponent(String name, MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
46524    if (element != null) {
46525      open(name);
46526      composeMedicationRequestMedicationRequestSubstitutionComponentInner(element);
46527      close();
46528    }
46529  }
46530
46531  protected void composeMedicationRequestMedicationRequestSubstitutionComponentInner(MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
46532      composeBackbone(element);
46533      if (element.hasAllowed()) {
46534        composeType("allowed", element.getAllowed());
46535      }
46536      if (element.hasReason()) {
46537        composeCodeableConcept("reason", element.getReason());
46538      }
46539  }
46540
46541  protected void composeMedicationStatement(String name, MedicationStatement element) throws IOException {
46542    if (element != null) {
46543      prop("resourceType", name);
46544      composeMedicationStatementInner(element);
46545    }
46546  }
46547
46548  protected void composeMedicationStatementInner(MedicationStatement element) throws IOException {
46549      composeDomainResourceElements(element);
46550      if (element.hasIdentifier()) {
46551        openArray("identifier");
46552        for (Identifier e : element.getIdentifier()) 
46553          composeIdentifier(null, e);
46554        closeArray();
46555      };
46556      if (element.hasBasedOn()) {
46557        openArray("basedOn");
46558        for (Reference e : element.getBasedOn()) 
46559          composeReference(null, e);
46560        closeArray();
46561      };
46562      if (element.hasPartOf()) {
46563        openArray("partOf");
46564        for (Reference e : element.getPartOf()) 
46565          composeReference(null, e);
46566        closeArray();
46567      };
46568      if (element.hasStatusElement()) {
46569        composeEnumerationCore("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
46570        composeEnumerationExtras("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
46571      }
46572      if (element.hasStatusReason()) {
46573        openArray("statusReason");
46574        for (CodeableConcept e : element.getStatusReason()) 
46575          composeCodeableConcept(null, e);
46576        closeArray();
46577      };
46578      if (element.hasCategory()) {
46579        composeCodeableConcept("category", element.getCategory());
46580      }
46581      if (element.hasMedication()) {
46582        composeType("medication", element.getMedication());
46583      }
46584      if (element.hasSubject()) {
46585        composeReference("subject", element.getSubject());
46586      }
46587      if (element.hasContext()) {
46588        composeReference("context", element.getContext());
46589      }
46590      if (element.hasEffective()) {
46591        composeType("effective", element.getEffective());
46592      }
46593      if (element.hasDateAssertedElement()) {
46594        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
46595        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
46596      }
46597      if (element.hasInformationSource()) {
46598        composeReference("informationSource", element.getInformationSource());
46599      }
46600      if (element.hasDerivedFrom()) {
46601        openArray("derivedFrom");
46602        for (Reference e : element.getDerivedFrom()) 
46603          composeReference(null, e);
46604        closeArray();
46605      };
46606      if (element.hasReasonCode()) {
46607        openArray("reasonCode");
46608        for (CodeableConcept e : element.getReasonCode()) 
46609          composeCodeableConcept(null, e);
46610        closeArray();
46611      };
46612      if (element.hasReasonReference()) {
46613        openArray("reasonReference");
46614        for (Reference e : element.getReasonReference()) 
46615          composeReference(null, e);
46616        closeArray();
46617      };
46618      if (element.hasNote()) {
46619        openArray("note");
46620        for (Annotation e : element.getNote()) 
46621          composeAnnotation(null, e);
46622        closeArray();
46623      };
46624      if (element.hasDosage()) {
46625        openArray("dosage");
46626        for (Dosage e : element.getDosage()) 
46627          composeDosage(null, e);
46628        closeArray();
46629      };
46630  }
46631
46632  protected void composeMedicinalProduct(String name, MedicinalProduct element) throws IOException {
46633    if (element != null) {
46634      prop("resourceType", name);
46635      composeMedicinalProductInner(element);
46636    }
46637  }
46638
46639  protected void composeMedicinalProductInner(MedicinalProduct element) throws IOException {
46640      composeDomainResourceElements(element);
46641      if (element.hasIdentifier()) {
46642        openArray("identifier");
46643        for (Identifier e : element.getIdentifier()) 
46644          composeIdentifier(null, e);
46645        closeArray();
46646      };
46647      if (element.hasType()) {
46648        composeCodeableConcept("type", element.getType());
46649      }
46650      if (element.hasDomain()) {
46651        composeCoding("domain", element.getDomain());
46652      }
46653      if (element.hasCombinedPharmaceuticalDoseForm()) {
46654        composeCodeableConcept("combinedPharmaceuticalDoseForm", element.getCombinedPharmaceuticalDoseForm());
46655      }
46656      if (element.hasLegalStatusOfSupply()) {
46657        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
46658      }
46659      if (element.hasAdditionalMonitoringIndicator()) {
46660        composeCodeableConcept("additionalMonitoringIndicator", element.getAdditionalMonitoringIndicator());
46661      }
46662      if (element.hasSpecialMeasures()) {
46663        openArray("specialMeasures");
46664        for (StringType e : element.getSpecialMeasures()) 
46665          composeStringCore(null, e, true);
46666        closeArray();
46667        if (anyHasExtras(element.getSpecialMeasures())) {
46668          openArray("_specialMeasures");
46669          for (StringType e : element.getSpecialMeasures()) 
46670            composeStringExtras(null, e, true);
46671          closeArray();
46672        }
46673      };
46674      if (element.hasPaediatricUseIndicator()) {
46675        composeCodeableConcept("paediatricUseIndicator", element.getPaediatricUseIndicator());
46676      }
46677      if (element.hasProductClassification()) {
46678        openArray("productClassification");
46679        for (CodeableConcept e : element.getProductClassification()) 
46680          composeCodeableConcept(null, e);
46681        closeArray();
46682      };
46683      if (element.hasMarketingStatus()) {
46684        openArray("marketingStatus");
46685        for (MarketingStatus e : element.getMarketingStatus()) 
46686          composeMarketingStatus(null, e);
46687        closeArray();
46688      };
46689      if (element.hasPharmaceuticalProduct()) {
46690        openArray("pharmaceuticalProduct");
46691        for (Reference e : element.getPharmaceuticalProduct()) 
46692          composeReference(null, e);
46693        closeArray();
46694      };
46695      if (element.hasPackagedMedicinalProduct()) {
46696        openArray("packagedMedicinalProduct");
46697        for (Reference e : element.getPackagedMedicinalProduct()) 
46698          composeReference(null, e);
46699        closeArray();
46700      };
46701      if (element.hasAttachedDocument()) {
46702        openArray("attachedDocument");
46703        for (Reference e : element.getAttachedDocument()) 
46704          composeReference(null, e);
46705        closeArray();
46706      };
46707      if (element.hasMasterFile()) {
46708        openArray("masterFile");
46709        for (Reference e : element.getMasterFile()) 
46710          composeReference(null, e);
46711        closeArray();
46712      };
46713      if (element.hasContact()) {
46714        openArray("contact");
46715        for (Reference e : element.getContact()) 
46716          composeReference(null, e);
46717        closeArray();
46718      };
46719      if (element.hasClinicalTrial()) {
46720        openArray("clinicalTrial");
46721        for (Reference e : element.getClinicalTrial()) 
46722          composeReference(null, e);
46723        closeArray();
46724      };
46725      if (element.hasName()) {
46726        openArray("name");
46727        for (MedicinalProduct.MedicinalProductNameComponent e : element.getName()) 
46728          composeMedicinalProductMedicinalProductNameComponent(null, e);
46729        closeArray();
46730      };
46731      if (element.hasCrossReference()) {
46732        openArray("crossReference");
46733        for (Identifier e : element.getCrossReference()) 
46734          composeIdentifier(null, e);
46735        closeArray();
46736      };
46737      if (element.hasManufacturingBusinessOperation()) {
46738        openArray("manufacturingBusinessOperation");
46739        for (MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent e : element.getManufacturingBusinessOperation()) 
46740          composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(null, e);
46741        closeArray();
46742      };
46743      if (element.hasSpecialDesignation()) {
46744        openArray("specialDesignation");
46745        for (MedicinalProduct.MedicinalProductSpecialDesignationComponent e : element.getSpecialDesignation()) 
46746          composeMedicinalProductMedicinalProductSpecialDesignationComponent(null, e);
46747        closeArray();
46748      };
46749  }
46750
46751  protected void composeMedicinalProductMedicinalProductNameComponent(String name, MedicinalProduct.MedicinalProductNameComponent element) throws IOException {
46752    if (element != null) {
46753      open(name);
46754      composeMedicinalProductMedicinalProductNameComponentInner(element);
46755      close();
46756    }
46757  }
46758
46759  protected void composeMedicinalProductMedicinalProductNameComponentInner(MedicinalProduct.MedicinalProductNameComponent element) throws IOException {
46760      composeBackbone(element);
46761      if (element.hasProductNameElement()) {
46762        composeStringCore("productName", element.getProductNameElement(), false);
46763        composeStringExtras("productName", element.getProductNameElement(), false);
46764      }
46765      if (element.hasNamePart()) {
46766        openArray("namePart");
46767        for (MedicinalProduct.MedicinalProductNameNamePartComponent e : element.getNamePart()) 
46768          composeMedicinalProductMedicinalProductNameNamePartComponent(null, e);
46769        closeArray();
46770      };
46771      if (element.hasCountryLanguage()) {
46772        openArray("countryLanguage");
46773        for (MedicinalProduct.MedicinalProductNameCountryLanguageComponent e : element.getCountryLanguage()) 
46774          composeMedicinalProductMedicinalProductNameCountryLanguageComponent(null, e);
46775        closeArray();
46776      };
46777  }
46778
46779  protected void composeMedicinalProductMedicinalProductNameNamePartComponent(String name, MedicinalProduct.MedicinalProductNameNamePartComponent element) throws IOException {
46780    if (element != null) {
46781      open(name);
46782      composeMedicinalProductMedicinalProductNameNamePartComponentInner(element);
46783      close();
46784    }
46785  }
46786
46787  protected void composeMedicinalProductMedicinalProductNameNamePartComponentInner(MedicinalProduct.MedicinalProductNameNamePartComponent element) throws IOException {
46788      composeBackbone(element);
46789      if (element.hasPartElement()) {
46790        composeStringCore("part", element.getPartElement(), false);
46791        composeStringExtras("part", element.getPartElement(), false);
46792      }
46793      if (element.hasType()) {
46794        composeCoding("type", element.getType());
46795      }
46796  }
46797
46798  protected void composeMedicinalProductMedicinalProductNameCountryLanguageComponent(String name, MedicinalProduct.MedicinalProductNameCountryLanguageComponent element) throws IOException {
46799    if (element != null) {
46800      open(name);
46801      composeMedicinalProductMedicinalProductNameCountryLanguageComponentInner(element);
46802      close();
46803    }
46804  }
46805
46806  protected void composeMedicinalProductMedicinalProductNameCountryLanguageComponentInner(MedicinalProduct.MedicinalProductNameCountryLanguageComponent element) throws IOException {
46807      composeBackbone(element);
46808      if (element.hasCountry()) {
46809        composeCodeableConcept("country", element.getCountry());
46810      }
46811      if (element.hasJurisdiction()) {
46812        composeCodeableConcept("jurisdiction", element.getJurisdiction());
46813      }
46814      if (element.hasLanguage()) {
46815        composeCodeableConcept("language", element.getLanguage());
46816      }
46817  }
46818
46819  protected void composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(String name, MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent element) throws IOException {
46820    if (element != null) {
46821      open(name);
46822      composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponentInner(element);
46823      close();
46824    }
46825  }
46826
46827  protected void composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponentInner(MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent element) throws IOException {
46828      composeBackbone(element);
46829      if (element.hasOperationType()) {
46830        composeCodeableConcept("operationType", element.getOperationType());
46831      }
46832      if (element.hasAuthorisationReferenceNumber()) {
46833        composeIdentifier("authorisationReferenceNumber", element.getAuthorisationReferenceNumber());
46834      }
46835      if (element.hasEffectiveDateElement()) {
46836        composeDateTimeCore("effectiveDate", element.getEffectiveDateElement(), false);
46837        composeDateTimeExtras("effectiveDate", element.getEffectiveDateElement(), false);
46838      }
46839      if (element.hasConfidentialityIndicator()) {
46840        composeCodeableConcept("confidentialityIndicator", element.getConfidentialityIndicator());
46841      }
46842      if (element.hasManufacturer()) {
46843        openArray("manufacturer");
46844        for (Reference e : element.getManufacturer()) 
46845          composeReference(null, e);
46846        closeArray();
46847      };
46848      if (element.hasRegulator()) {
46849        composeReference("regulator", element.getRegulator());
46850      }
46851  }
46852
46853  protected void composeMedicinalProductMedicinalProductSpecialDesignationComponent(String name, MedicinalProduct.MedicinalProductSpecialDesignationComponent element) throws IOException {
46854    if (element != null) {
46855      open(name);
46856      composeMedicinalProductMedicinalProductSpecialDesignationComponentInner(element);
46857      close();
46858    }
46859  }
46860
46861  protected void composeMedicinalProductMedicinalProductSpecialDesignationComponentInner(MedicinalProduct.MedicinalProductSpecialDesignationComponent element) throws IOException {
46862      composeBackbone(element);
46863      if (element.hasIdentifier()) {
46864        openArray("identifier");
46865        for (Identifier e : element.getIdentifier()) 
46866          composeIdentifier(null, e);
46867        closeArray();
46868      };
46869      if (element.hasType()) {
46870        composeCodeableConcept("type", element.getType());
46871      }
46872      if (element.hasIntendedUse()) {
46873        composeCodeableConcept("intendedUse", element.getIntendedUse());
46874      }
46875      if (element.hasIndication()) {
46876        composeType("indication", element.getIndication());
46877      }
46878      if (element.hasStatus()) {
46879        composeCodeableConcept("status", element.getStatus());
46880      }
46881      if (element.hasDateElement()) {
46882        composeDateTimeCore("date", element.getDateElement(), false);
46883        composeDateTimeExtras("date", element.getDateElement(), false);
46884      }
46885      if (element.hasSpecies()) {
46886        composeCodeableConcept("species", element.getSpecies());
46887      }
46888  }
46889
46890  protected void composeMedicinalProductAuthorization(String name, MedicinalProductAuthorization element) throws IOException {
46891    if (element != null) {
46892      prop("resourceType", name);
46893      composeMedicinalProductAuthorizationInner(element);
46894    }
46895  }
46896
46897  protected void composeMedicinalProductAuthorizationInner(MedicinalProductAuthorization element) throws IOException {
46898      composeDomainResourceElements(element);
46899      if (element.hasIdentifier()) {
46900        openArray("identifier");
46901        for (Identifier e : element.getIdentifier()) 
46902          composeIdentifier(null, e);
46903        closeArray();
46904      };
46905      if (element.hasSubject()) {
46906        composeReference("subject", element.getSubject());
46907      }
46908      if (element.hasCountry()) {
46909        openArray("country");
46910        for (CodeableConcept e : element.getCountry()) 
46911          composeCodeableConcept(null, e);
46912        closeArray();
46913      };
46914      if (element.hasJurisdiction()) {
46915        openArray("jurisdiction");
46916        for (CodeableConcept e : element.getJurisdiction()) 
46917          composeCodeableConcept(null, e);
46918        closeArray();
46919      };
46920      if (element.hasStatus()) {
46921        composeCodeableConcept("status", element.getStatus());
46922      }
46923      if (element.hasStatusDateElement()) {
46924        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
46925        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
46926      }
46927      if (element.hasRestoreDateElement()) {
46928        composeDateTimeCore("restoreDate", element.getRestoreDateElement(), false);
46929        composeDateTimeExtras("restoreDate", element.getRestoreDateElement(), false);
46930      }
46931      if (element.hasValidityPeriod()) {
46932        composePeriod("validityPeriod", element.getValidityPeriod());
46933      }
46934      if (element.hasDataExclusivityPeriod()) {
46935        composePeriod("dataExclusivityPeriod", element.getDataExclusivityPeriod());
46936      }
46937      if (element.hasDateOfFirstAuthorizationElement()) {
46938        composeDateTimeCore("dateOfFirstAuthorization", element.getDateOfFirstAuthorizationElement(), false);
46939        composeDateTimeExtras("dateOfFirstAuthorization", element.getDateOfFirstAuthorizationElement(), false);
46940      }
46941      if (element.hasInternationalBirthDateElement()) {
46942        composeDateTimeCore("internationalBirthDate", element.getInternationalBirthDateElement(), false);
46943        composeDateTimeExtras("internationalBirthDate", element.getInternationalBirthDateElement(), false);
46944      }
46945      if (element.hasLegalBasis()) {
46946        composeCodeableConcept("legalBasis", element.getLegalBasis());
46947      }
46948      if (element.hasJurisdictionalAuthorization()) {
46949        openArray("jurisdictionalAuthorization");
46950        for (MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent e : element.getJurisdictionalAuthorization()) 
46951          composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(null, e);
46952        closeArray();
46953      };
46954      if (element.hasHolder()) {
46955        composeReference("holder", element.getHolder());
46956      }
46957      if (element.hasRegulator()) {
46958        composeReference("regulator", element.getRegulator());
46959      }
46960      if (element.hasProcedure()) {
46961        composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent("procedure", element.getProcedure());
46962      }
46963  }
46964
46965  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(String name, MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent element) throws IOException {
46966    if (element != null) {
46967      open(name);
46968      composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentInner(element);
46969      close();
46970    }
46971  }
46972
46973  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentInner(MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent element) throws IOException {
46974      composeBackbone(element);
46975      if (element.hasIdentifier()) {
46976        openArray("identifier");
46977        for (Identifier e : element.getIdentifier()) 
46978          composeIdentifier(null, e);
46979        closeArray();
46980      };
46981      if (element.hasCountry()) {
46982        composeCodeableConcept("country", element.getCountry());
46983      }
46984      if (element.hasJurisdiction()) {
46985        openArray("jurisdiction");
46986        for (CodeableConcept e : element.getJurisdiction()) 
46987          composeCodeableConcept(null, e);
46988        closeArray();
46989      };
46990      if (element.hasLegalStatusOfSupply()) {
46991        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
46992      }
46993      if (element.hasValidityPeriod()) {
46994        composePeriod("validityPeriod", element.getValidityPeriod());
46995      }
46996  }
46997
46998  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(String name, MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent element) throws IOException {
46999    if (element != null) {
47000      open(name);
47001      composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentInner(element);
47002      close();
47003    }
47004  }
47005
47006  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentInner(MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent element) throws IOException {
47007      composeBackbone(element);
47008      if (element.hasIdentifier()) {
47009        composeIdentifier("identifier", element.getIdentifier());
47010      }
47011      if (element.hasType()) {
47012        composeCodeableConcept("type", element.getType());
47013      }
47014      if (element.hasDate()) {
47015        composeType("date", element.getDate());
47016      }
47017      if (element.hasApplication()) {
47018        openArray("application");
47019        for (MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent e : element.getApplication()) 
47020          composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(null, e);
47021        closeArray();
47022      };
47023  }
47024
47025  protected void composeMedicinalProductContraindication(String name, MedicinalProductContraindication element) throws IOException {
47026    if (element != null) {
47027      prop("resourceType", name);
47028      composeMedicinalProductContraindicationInner(element);
47029    }
47030  }
47031
47032  protected void composeMedicinalProductContraindicationInner(MedicinalProductContraindication element) throws IOException {
47033      composeDomainResourceElements(element);
47034      if (element.hasSubject()) {
47035        openArray("subject");
47036        for (Reference e : element.getSubject()) 
47037          composeReference(null, e);
47038        closeArray();
47039      };
47040      if (element.hasDisease()) {
47041        composeCodeableConcept("disease", element.getDisease());
47042      }
47043      if (element.hasDiseaseStatus()) {
47044        composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
47045      }
47046      if (element.hasComorbidity()) {
47047        openArray("comorbidity");
47048        for (CodeableConcept e : element.getComorbidity()) 
47049          composeCodeableConcept(null, e);
47050        closeArray();
47051      };
47052      if (element.hasTherapeuticIndication()) {
47053        openArray("therapeuticIndication");
47054        for (Reference e : element.getTherapeuticIndication()) 
47055          composeReference(null, e);
47056        closeArray();
47057      };
47058      if (element.hasOtherTherapy()) {
47059        openArray("otherTherapy");
47060        for (MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent e : element.getOtherTherapy()) 
47061          composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(null, e);
47062        closeArray();
47063      };
47064      if (element.hasPopulation()) {
47065        openArray("population");
47066        for (Population e : element.getPopulation()) 
47067          composePopulation(null, e);
47068        closeArray();
47069      };
47070  }
47071
47072  protected void composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(String name, MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent element) throws IOException {
47073    if (element != null) {
47074      open(name);
47075      composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentInner(element);
47076      close();
47077    }
47078  }
47079
47080  protected void composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentInner(MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent element) throws IOException {
47081      composeBackbone(element);
47082      if (element.hasTherapyRelationshipType()) {
47083        composeCodeableConcept("therapyRelationshipType", element.getTherapyRelationshipType());
47084      }
47085      if (element.hasMedication()) {
47086        composeType("medication", element.getMedication());
47087      }
47088  }
47089
47090  protected void composeMedicinalProductIndication(String name, MedicinalProductIndication element) throws IOException {
47091    if (element != null) {
47092      prop("resourceType", name);
47093      composeMedicinalProductIndicationInner(element);
47094    }
47095  }
47096
47097  protected void composeMedicinalProductIndicationInner(MedicinalProductIndication element) throws IOException {
47098      composeDomainResourceElements(element);
47099      if (element.hasSubject()) {
47100        openArray("subject");
47101        for (Reference e : element.getSubject()) 
47102          composeReference(null, e);
47103        closeArray();
47104      };
47105      if (element.hasDiseaseSymptomProcedure()) {
47106        composeCodeableConcept("diseaseSymptomProcedure", element.getDiseaseSymptomProcedure());
47107      }
47108      if (element.hasDiseaseStatus()) {
47109        composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
47110      }
47111      if (element.hasComorbidity()) {
47112        openArray("comorbidity");
47113        for (CodeableConcept e : element.getComorbidity()) 
47114          composeCodeableConcept(null, e);
47115        closeArray();
47116      };
47117      if (element.hasIntendedEffect()) {
47118        composeCodeableConcept("intendedEffect", element.getIntendedEffect());
47119      }
47120      if (element.hasDuration()) {
47121        composeQuantity("duration", element.getDuration());
47122      }
47123      if (element.hasOtherTherapy()) {
47124        openArray("otherTherapy");
47125        for (MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent e : element.getOtherTherapy()) 
47126          composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(null, e);
47127        closeArray();
47128      };
47129      if (element.hasUndesirableEffect()) {
47130        openArray("undesirableEffect");
47131        for (Reference e : element.getUndesirableEffect()) 
47132          composeReference(null, e);
47133        closeArray();
47134      };
47135      if (element.hasPopulation()) {
47136        openArray("population");
47137        for (Population e : element.getPopulation()) 
47138          composePopulation(null, e);
47139        closeArray();
47140      };
47141  }
47142
47143  protected void composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(String name, MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent element) throws IOException {
47144    if (element != null) {
47145      open(name);
47146      composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentInner(element);
47147      close();
47148    }
47149  }
47150
47151  protected void composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentInner(MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent element) throws IOException {
47152      composeBackbone(element);
47153      if (element.hasTherapyRelationshipType()) {
47154        composeCodeableConcept("therapyRelationshipType", element.getTherapyRelationshipType());
47155      }
47156      if (element.hasMedication()) {
47157        composeType("medication", element.getMedication());
47158      }
47159  }
47160
47161  protected void composeMedicinalProductIngredient(String name, MedicinalProductIngredient element) throws IOException {
47162    if (element != null) {
47163      prop("resourceType", name);
47164      composeMedicinalProductIngredientInner(element);
47165    }
47166  }
47167
47168  protected void composeMedicinalProductIngredientInner(MedicinalProductIngredient element) throws IOException {
47169      composeDomainResourceElements(element);
47170      if (element.hasIdentifier()) {
47171        composeIdentifier("identifier", element.getIdentifier());
47172      }
47173      if (element.hasRole()) {
47174        composeCodeableConcept("role", element.getRole());
47175      }
47176      if (element.hasAllergenicIndicatorElement()) {
47177        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
47178        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
47179      }
47180      if (element.hasManufacturer()) {
47181        openArray("manufacturer");
47182        for (Reference e : element.getManufacturer()) 
47183          composeReference(null, e);
47184        closeArray();
47185      };
47186      if (element.hasSpecifiedSubstance()) {
47187        openArray("specifiedSubstance");
47188        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent e : element.getSpecifiedSubstance()) 
47189          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(null, e);
47190        closeArray();
47191      };
47192      if (element.hasSubstance()) {
47193        composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent("substance", element.getSubstance());
47194      }
47195  }
47196
47197  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent element) throws IOException {
47198    if (element != null) {
47199      open(name);
47200      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentInner(element);
47201      close();
47202    }
47203  }
47204
47205  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent element) throws IOException {
47206      composeBackbone(element);
47207      if (element.hasCode()) {
47208        composeCodeableConcept("code", element.getCode());
47209      }
47210      if (element.hasGroup()) {
47211        composeCodeableConcept("group", element.getGroup());
47212      }
47213      if (element.hasConfidentiality()) {
47214        composeCodeableConcept("confidentiality", element.getConfidentiality());
47215      }
47216      if (element.hasStrength()) {
47217        openArray("strength");
47218        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent e : element.getStrength()) 
47219          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(null, e);
47220        closeArray();
47221      };
47222  }
47223
47224  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent element) throws IOException {
47225    if (element != null) {
47226      open(name);
47227      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentInner(element);
47228      close();
47229    }
47230  }
47231
47232  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent element) throws IOException {
47233      composeBackbone(element);
47234      if (element.hasPresentation()) {
47235        composeRatio("presentation", element.getPresentation());
47236      }
47237      if (element.hasPresentationLowLimit()) {
47238        composeRatio("presentationLowLimit", element.getPresentationLowLimit());
47239      }
47240      if (element.hasConcentration()) {
47241        composeRatio("concentration", element.getConcentration());
47242      }
47243      if (element.hasConcentrationLowLimit()) {
47244        composeRatio("concentrationLowLimit", element.getConcentrationLowLimit());
47245      }
47246      if (element.hasMeasurementPointElement()) {
47247        composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
47248        composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
47249      }
47250      if (element.hasCountry()) {
47251        openArray("country");
47252        for (CodeableConcept e : element.getCountry()) 
47253          composeCodeableConcept(null, e);
47254        closeArray();
47255      };
47256      if (element.hasReferenceStrength()) {
47257        openArray("referenceStrength");
47258        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent e : element.getReferenceStrength()) 
47259          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(null, e);
47260        closeArray();
47261      };
47262  }
47263
47264  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element) throws IOException {
47265    if (element != null) {
47266      open(name);
47267      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentInner(element);
47268      close();
47269    }
47270  }
47271
47272  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element) throws IOException {
47273      composeBackbone(element);
47274      if (element.hasSubstance()) {
47275        composeCodeableConcept("substance", element.getSubstance());
47276      }
47277      if (element.hasStrength()) {
47278        composeRatio("strength", element.getStrength());
47279      }
47280      if (element.hasStrengthLowLimit()) {
47281        composeRatio("strengthLowLimit", element.getStrengthLowLimit());
47282      }
47283      if (element.hasMeasurementPointElement()) {
47284        composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
47285        composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
47286      }
47287      if (element.hasCountry()) {
47288        openArray("country");
47289        for (CodeableConcept e : element.getCountry()) 
47290          composeCodeableConcept(null, e);
47291        closeArray();
47292      };
47293  }
47294
47295  protected void composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent element) throws IOException {
47296    if (element != null) {
47297      open(name);
47298      composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentInner(element);
47299      close();
47300    }
47301  }
47302
47303  protected void composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent element) throws IOException {
47304      composeBackbone(element);
47305      if (element.hasCode()) {
47306        composeCodeableConcept("code", element.getCode());
47307      }
47308      if (element.hasStrength()) {
47309        openArray("strength");
47310        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent e : element.getStrength()) 
47311          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(null, e);
47312        closeArray();
47313      };
47314  }
47315
47316  protected void composeMedicinalProductInteraction(String name, MedicinalProductInteraction element) throws IOException {
47317    if (element != null) {
47318      prop("resourceType", name);
47319      composeMedicinalProductInteractionInner(element);
47320    }
47321  }
47322
47323  protected void composeMedicinalProductInteractionInner(MedicinalProductInteraction element) throws IOException {
47324      composeDomainResourceElements(element);
47325      if (element.hasSubject()) {
47326        openArray("subject");
47327        for (Reference e : element.getSubject()) 
47328          composeReference(null, e);
47329        closeArray();
47330      };
47331      if (element.hasDescriptionElement()) {
47332        composeStringCore("description", element.getDescriptionElement(), false);
47333        composeStringExtras("description", element.getDescriptionElement(), false);
47334      }
47335      if (element.hasInteractant()) {
47336        openArray("interactant");
47337        for (MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent e : element.getInteractant()) 
47338          composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(null, e);
47339        closeArray();
47340      };
47341      if (element.hasType()) {
47342        composeCodeableConcept("type", element.getType());
47343      }
47344      if (element.hasEffect()) {
47345        composeCodeableConcept("effect", element.getEffect());
47346      }
47347      if (element.hasIncidence()) {
47348        composeCodeableConcept("incidence", element.getIncidence());
47349      }
47350      if (element.hasManagement()) {
47351        composeCodeableConcept("management", element.getManagement());
47352      }
47353  }
47354
47355  protected void composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(String name, MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent element) throws IOException {
47356    if (element != null) {
47357      open(name);
47358      composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponentInner(element);
47359      close();
47360    }
47361  }
47362
47363  protected void composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponentInner(MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent element) throws IOException {
47364      composeBackbone(element);
47365      if (element.hasItem()) {
47366        composeType("item", element.getItem());
47367      }
47368  }
47369
47370  protected void composeMedicinalProductManufactured(String name, MedicinalProductManufactured element) throws IOException {
47371    if (element != null) {
47372      prop("resourceType", name);
47373      composeMedicinalProductManufacturedInner(element);
47374    }
47375  }
47376
47377  protected void composeMedicinalProductManufacturedInner(MedicinalProductManufactured element) throws IOException {
47378      composeDomainResourceElements(element);
47379      if (element.hasManufacturedDoseForm()) {
47380        composeCodeableConcept("manufacturedDoseForm", element.getManufacturedDoseForm());
47381      }
47382      if (element.hasUnitOfPresentation()) {
47383        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
47384      }
47385      if (element.hasQuantity()) {
47386        composeQuantity("quantity", element.getQuantity());
47387      }
47388      if (element.hasManufacturer()) {
47389        openArray("manufacturer");
47390        for (Reference e : element.getManufacturer()) 
47391          composeReference(null, e);
47392        closeArray();
47393      };
47394      if (element.hasIngredient()) {
47395        openArray("ingredient");
47396        for (Reference e : element.getIngredient()) 
47397          composeReference(null, e);
47398        closeArray();
47399      };
47400      if (element.hasPhysicalCharacteristics()) {
47401        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
47402      }
47403      if (element.hasOtherCharacteristics()) {
47404        openArray("otherCharacteristics");
47405        for (CodeableConcept e : element.getOtherCharacteristics()) 
47406          composeCodeableConcept(null, e);
47407        closeArray();
47408      };
47409  }
47410
47411  protected void composeMedicinalProductPackaged(String name, MedicinalProductPackaged element) throws IOException {
47412    if (element != null) {
47413      prop("resourceType", name);
47414      composeMedicinalProductPackagedInner(element);
47415    }
47416  }
47417
47418  protected void composeMedicinalProductPackagedInner(MedicinalProductPackaged element) throws IOException {
47419      composeDomainResourceElements(element);
47420      if (element.hasIdentifier()) {
47421        openArray("identifier");
47422        for (Identifier e : element.getIdentifier()) 
47423          composeIdentifier(null, e);
47424        closeArray();
47425      };
47426      if (element.hasSubject()) {
47427        openArray("subject");
47428        for (Reference e : element.getSubject()) 
47429          composeReference(null, e);
47430        closeArray();
47431      };
47432      if (element.hasDescriptionElement()) {
47433        composeStringCore("description", element.getDescriptionElement(), false);
47434        composeStringExtras("description", element.getDescriptionElement(), false);
47435      }
47436      if (element.hasLegalStatusOfSupply()) {
47437        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
47438      }
47439      if (element.hasMarketingStatus()) {
47440        openArray("marketingStatus");
47441        for (MarketingStatus e : element.getMarketingStatus()) 
47442          composeMarketingStatus(null, e);
47443        closeArray();
47444      };
47445      if (element.hasMarketingAuthorization()) {
47446        composeReference("marketingAuthorization", element.getMarketingAuthorization());
47447      }
47448      if (element.hasManufacturer()) {
47449        openArray("manufacturer");
47450        for (Reference e : element.getManufacturer()) 
47451          composeReference(null, e);
47452        closeArray();
47453      };
47454      if (element.hasBatchIdentifier()) {
47455        openArray("batchIdentifier");
47456        for (MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent e : element.getBatchIdentifier()) 
47457          composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(null, e);
47458        closeArray();
47459      };
47460      if (element.hasPackageItem()) {
47461        openArray("packageItem");
47462        for (MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent e : element.getPackageItem()) 
47463          composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(null, e);
47464        closeArray();
47465      };
47466  }
47467
47468  protected void composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(String name, MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent element) throws IOException {
47469    if (element != null) {
47470      open(name);
47471      composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentInner(element);
47472      close();
47473    }
47474  }
47475
47476  protected void composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentInner(MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent element) throws IOException {
47477      composeBackbone(element);
47478      if (element.hasOuterPackaging()) {
47479        composeIdentifier("outerPackaging", element.getOuterPackaging());
47480      }
47481      if (element.hasImmediatePackaging()) {
47482        composeIdentifier("immediatePackaging", element.getImmediatePackaging());
47483      }
47484  }
47485
47486  protected void composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(String name, MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent element) throws IOException {
47487    if (element != null) {
47488      open(name);
47489      composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentInner(element);
47490      close();
47491    }
47492  }
47493
47494  protected void composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentInner(MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent element) throws IOException {
47495      composeBackbone(element);
47496      if (element.hasIdentifier()) {
47497        openArray("identifier");
47498        for (Identifier e : element.getIdentifier()) 
47499          composeIdentifier(null, e);
47500        closeArray();
47501      };
47502      if (element.hasType()) {
47503        composeCodeableConcept("type", element.getType());
47504      }
47505      if (element.hasQuantity()) {
47506        composeQuantity("quantity", element.getQuantity());
47507      }
47508      if (element.hasMaterial()) {
47509        openArray("material");
47510        for (CodeableConcept e : element.getMaterial()) 
47511          composeCodeableConcept(null, e);
47512        closeArray();
47513      };
47514      if (element.hasAlternateMaterial()) {
47515        openArray("alternateMaterial");
47516        for (CodeableConcept e : element.getAlternateMaterial()) 
47517          composeCodeableConcept(null, e);
47518        closeArray();
47519      };
47520      if (element.hasDevice()) {
47521        openArray("device");
47522        for (Reference e : element.getDevice()) 
47523          composeReference(null, e);
47524        closeArray();
47525      };
47526      if (element.hasManufacturedItem()) {
47527        openArray("manufacturedItem");
47528        for (Reference e : element.getManufacturedItem()) 
47529          composeReference(null, e);
47530        closeArray();
47531      };
47532      if (element.hasPackageItem()) {
47533        openArray("packageItem");
47534        for (MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent e : element.getPackageItem()) 
47535          composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(null, e);
47536        closeArray();
47537      };
47538      if (element.hasPhysicalCharacteristics()) {
47539        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
47540      }
47541      if (element.hasOtherCharacteristics()) {
47542        openArray("otherCharacteristics");
47543        for (CodeableConcept e : element.getOtherCharacteristics()) 
47544          composeCodeableConcept(null, e);
47545        closeArray();
47546      };
47547      if (element.hasShelfLifeStorage()) {
47548        openArray("shelfLifeStorage");
47549        for (ProductShelfLife e : element.getShelfLifeStorage()) 
47550          composeProductShelfLife(null, e);
47551        closeArray();
47552      };
47553      if (element.hasManufacturer()) {
47554        openArray("manufacturer");
47555        for (Reference e : element.getManufacturer()) 
47556          composeReference(null, e);
47557        closeArray();
47558      };
47559  }
47560
47561  protected void composeMedicinalProductPharmaceutical(String name, MedicinalProductPharmaceutical element) throws IOException {
47562    if (element != null) {
47563      prop("resourceType", name);
47564      composeMedicinalProductPharmaceuticalInner(element);
47565    }
47566  }
47567
47568  protected void composeMedicinalProductPharmaceuticalInner(MedicinalProductPharmaceutical element) throws IOException {
47569      composeDomainResourceElements(element);
47570      if (element.hasIdentifier()) {
47571        openArray("identifier");
47572        for (Identifier e : element.getIdentifier()) 
47573          composeIdentifier(null, e);
47574        closeArray();
47575      };
47576      if (element.hasAdministrableDoseForm()) {
47577        composeCodeableConcept("administrableDoseForm", element.getAdministrableDoseForm());
47578      }
47579      if (element.hasUnitOfPresentation()) {
47580        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
47581      }
47582      if (element.hasIngredient()) {
47583        openArray("ingredient");
47584        for (Reference e : element.getIngredient()) 
47585          composeReference(null, e);
47586        closeArray();
47587      };
47588      if (element.hasDevice()) {
47589        openArray("device");
47590        for (Reference e : element.getDevice()) 
47591          composeReference(null, e);
47592        closeArray();
47593      };
47594      if (element.hasCharacteristics()) {
47595        openArray("characteristics");
47596        for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent e : element.getCharacteristics()) 
47597          composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(null, e);
47598        closeArray();
47599      };
47600      if (element.hasRouteOfAdministration()) {
47601        openArray("routeOfAdministration");
47602        for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent e : element.getRouteOfAdministration()) 
47603          composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(null, e);
47604        closeArray();
47605      };
47606  }
47607
47608  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent element) throws IOException {
47609    if (element != null) {
47610      open(name);
47611      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentInner(element);
47612      close();
47613    }
47614  }
47615
47616  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentInner(MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent element) throws IOException {
47617      composeBackbone(element);
47618      if (element.hasCode()) {
47619        composeCodeableConcept("code", element.getCode());
47620      }
47621      if (element.hasStatus()) {
47622        composeCodeableConcept("status", element.getStatus());
47623      }
47624  }
47625
47626  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent element) throws IOException {
47627    if (element != null) {
47628      open(name);
47629      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentInner(element);
47630      close();
47631    }
47632  }
47633
47634  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentInner(MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent element) throws IOException {
47635      composeBackbone(element);
47636      if (element.hasCode()) {
47637        composeCodeableConcept("code", element.getCode());
47638      }
47639      if (element.hasFirstDose()) {
47640        composeQuantity("firstDose", element.getFirstDose());
47641      }
47642      if (element.hasMaxSingleDose()) {
47643        composeQuantity("maxSingleDose", element.getMaxSingleDose());
47644      }
47645      if (element.hasMaxDosePerDay()) {
47646        composeQuantity("maxDosePerDay", element.getMaxDosePerDay());
47647      }
47648      if (element.hasMaxDosePerTreatmentPeriod()) {
47649        composeRatio("maxDosePerTreatmentPeriod", element.getMaxDosePerTreatmentPeriod());
47650      }
47651      if (element.hasMaxTreatmentPeriod()) {
47652        composeDuration("maxTreatmentPeriod", element.getMaxTreatmentPeriod());
47653      }
47654      if (element.hasTargetSpecies()) {
47655        openArray("targetSpecies");
47656        for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent e : element.getTargetSpecies()) 
47657          composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(null, e);
47658        closeArray();
47659      };
47660  }
47661
47662  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
47663    if (element != null) {
47664      open(name);
47665      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentInner(element);
47666      close();
47667    }
47668  }
47669
47670  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentInner(MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
47671      composeBackbone(element);
47672      if (element.hasCode()) {
47673        composeCodeableConcept("code", element.getCode());
47674      }
47675      if (element.hasWithdrawalPeriod()) {
47676        openArray("withdrawalPeriod");
47677        for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent e : element.getWithdrawalPeriod()) 
47678          composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(null, e);
47679        closeArray();
47680      };
47681  }
47682
47683  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element) throws IOException {
47684    if (element != null) {
47685      open(name);
47686      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentInner(element);
47687      close();
47688    }
47689  }
47690
47691  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentInner(MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element) throws IOException {
47692      composeBackbone(element);
47693      if (element.hasTissue()) {
47694        composeCodeableConcept("tissue", element.getTissue());
47695      }
47696      if (element.hasValue()) {
47697        composeQuantity("value", element.getValue());
47698      }
47699      if (element.hasSupportingInformationElement()) {
47700        composeStringCore("supportingInformation", element.getSupportingInformationElement(), false);
47701        composeStringExtras("supportingInformation", element.getSupportingInformationElement(), false);
47702      }
47703  }
47704
47705  protected void composeMedicinalProductUndesirableEffect(String name, MedicinalProductUndesirableEffect element) throws IOException {
47706    if (element != null) {
47707      prop("resourceType", name);
47708      composeMedicinalProductUndesirableEffectInner(element);
47709    }
47710  }
47711
47712  protected void composeMedicinalProductUndesirableEffectInner(MedicinalProductUndesirableEffect element) throws IOException {
47713      composeDomainResourceElements(element);
47714      if (element.hasSubject()) {
47715        openArray("subject");
47716        for (Reference e : element.getSubject()) 
47717          composeReference(null, e);
47718        closeArray();
47719      };
47720      if (element.hasSymptomConditionEffect()) {
47721        composeCodeableConcept("symptomConditionEffect", element.getSymptomConditionEffect());
47722      }
47723      if (element.hasClassification()) {
47724        composeCodeableConcept("classification", element.getClassification());
47725      }
47726      if (element.hasFrequencyOfOccurrence()) {
47727        composeCodeableConcept("frequencyOfOccurrence", element.getFrequencyOfOccurrence());
47728      }
47729      if (element.hasPopulation()) {
47730        openArray("population");
47731        for (Population e : element.getPopulation()) 
47732          composePopulation(null, e);
47733        closeArray();
47734      };
47735  }
47736
47737  protected void composeMessageDefinition(String name, MessageDefinition element) throws IOException {
47738    if (element != null) {
47739      prop("resourceType", name);
47740      composeMessageDefinitionInner(element);
47741    }
47742  }
47743
47744  protected void composeMessageDefinitionInner(MessageDefinition element) throws IOException {
47745      composeDomainResourceElements(element);
47746      if (element.hasUrlElement()) {
47747        composeUriCore("url", element.getUrlElement(), false);
47748        composeUriExtras("url", element.getUrlElement(), false);
47749      }
47750      if (element.hasIdentifier()) {
47751        openArray("identifier");
47752        for (Identifier e : element.getIdentifier()) 
47753          composeIdentifier(null, e);
47754        closeArray();
47755      };
47756      if (element.hasVersionElement()) {
47757        composeStringCore("version", element.getVersionElement(), false);
47758        composeStringExtras("version", element.getVersionElement(), false);
47759      }
47760      if (element.hasNameElement()) {
47761        composeStringCore("name", element.getNameElement(), false);
47762        composeStringExtras("name", element.getNameElement(), false);
47763      }
47764      if (element.hasTitleElement()) {
47765        composeStringCore("title", element.getTitleElement(), false);
47766        composeStringExtras("title", element.getTitleElement(), false);
47767      }
47768      if (element.hasReplaces()) {
47769        openArray("replaces");
47770        for (CanonicalType e : element.getReplaces()) 
47771          composeCanonicalCore(null, e, true);
47772        closeArray();
47773        if (anyHasExtras(element.getReplaces())) {
47774          openArray("_replaces");
47775          for (CanonicalType e : element.getReplaces()) 
47776            composeCanonicalExtras(null, e, true);
47777          closeArray();
47778        }
47779      };
47780      if (element.hasStatusElement()) {
47781        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
47782        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
47783      }
47784      if (element.hasExperimentalElement()) {
47785        composeBooleanCore("experimental", element.getExperimentalElement(), false);
47786        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
47787      }
47788      if (element.hasDateElement()) {
47789        composeDateTimeCore("date", element.getDateElement(), false);
47790        composeDateTimeExtras("date", element.getDateElement(), false);
47791      }
47792      if (element.hasPublisherElement()) {
47793        composeStringCore("publisher", element.getPublisherElement(), false);
47794        composeStringExtras("publisher", element.getPublisherElement(), false);
47795      }
47796      if (element.hasContact()) {
47797        openArray("contact");
47798        for (ContactDetail e : element.getContact()) 
47799          composeContactDetail(null, e);
47800        closeArray();
47801      };
47802      if (element.hasDescriptionElement()) {
47803        composeMarkdownCore("description", element.getDescriptionElement(), false);
47804        composeMarkdownExtras("description", element.getDescriptionElement(), false);
47805      }
47806      if (element.hasUseContext()) {
47807        openArray("useContext");
47808        for (UsageContext e : element.getUseContext()) 
47809          composeUsageContext(null, e);
47810        closeArray();
47811      };
47812      if (element.hasJurisdiction()) {
47813        openArray("jurisdiction");
47814        for (CodeableConcept e : element.getJurisdiction()) 
47815          composeCodeableConcept(null, e);
47816        closeArray();
47817      };
47818      if (element.hasPurposeElement()) {
47819        composeMarkdownCore("purpose", element.getPurposeElement(), false);
47820        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
47821      }
47822      if (element.hasCopyrightElement()) {
47823        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
47824        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
47825      }
47826      if (element.hasBaseElement()) {
47827        composeCanonicalCore("base", element.getBaseElement(), false);
47828        composeCanonicalExtras("base", element.getBaseElement(), false);
47829      }
47830      if (element.hasParent()) {
47831        openArray("parent");
47832        for (CanonicalType e : element.getParent()) 
47833          composeCanonicalCore(null, e, true);
47834        closeArray();
47835        if (anyHasExtras(element.getParent())) {
47836          openArray("_parent");
47837          for (CanonicalType e : element.getParent()) 
47838            composeCanonicalExtras(null, e, true);
47839          closeArray();
47840        }
47841      };
47842      if (element.hasEvent()) {
47843        composeType("event", element.getEvent());
47844      }
47845      if (element.hasCategoryElement()) {
47846        composeEnumerationCore("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
47847        composeEnumerationExtras("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
47848      }
47849      if (element.hasFocus()) {
47850        openArray("focus");
47851        for (MessageDefinition.MessageDefinitionFocusComponent e : element.getFocus()) 
47852          composeMessageDefinitionMessageDefinitionFocusComponent(null, e);
47853        closeArray();
47854      };
47855      if (element.hasResponseRequiredElement()) {
47856        composeEnumerationCore("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
47857        composeEnumerationExtras("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
47858      }
47859      if (element.hasAllowedResponse()) {
47860        openArray("allowedResponse");
47861        for (MessageDefinition.MessageDefinitionAllowedResponseComponent e : element.getAllowedResponse()) 
47862          composeMessageDefinitionMessageDefinitionAllowedResponseComponent(null, e);
47863        closeArray();
47864      };
47865      if (element.hasGraph()) {
47866        openArray("graph");
47867        for (CanonicalType e : element.getGraph()) 
47868          composeCanonicalCore(null, e, true);
47869        closeArray();
47870        if (anyHasExtras(element.getGraph())) {
47871          openArray("_graph");
47872          for (CanonicalType e : element.getGraph()) 
47873            composeCanonicalExtras(null, e, true);
47874          closeArray();
47875        }
47876      };
47877  }
47878
47879  protected void composeMessageDefinitionMessageDefinitionFocusComponent(String name, MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
47880    if (element != null) {
47881      open(name);
47882      composeMessageDefinitionMessageDefinitionFocusComponentInner(element);
47883      close();
47884    }
47885  }
47886
47887  protected void composeMessageDefinitionMessageDefinitionFocusComponentInner(MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
47888      composeBackbone(element);
47889      if (element.hasCodeElement()) {
47890        composeCodeCore("code", element.getCodeElement(), false);
47891        composeCodeExtras("code", element.getCodeElement(), false);
47892      }
47893      if (element.hasProfileElement()) {
47894        composeCanonicalCore("profile", element.getProfileElement(), false);
47895        composeCanonicalExtras("profile", element.getProfileElement(), false);
47896      }
47897      if (element.hasMinElement()) {
47898        composeUnsignedIntCore("min", element.getMinElement(), false);
47899        composeUnsignedIntExtras("min", element.getMinElement(), false);
47900      }
47901      if (element.hasMaxElement()) {
47902        composeStringCore("max", element.getMaxElement(), false);
47903        composeStringExtras("max", element.getMaxElement(), false);
47904      }
47905  }
47906
47907  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponent(String name, MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
47908    if (element != null) {
47909      open(name);
47910      composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(element);
47911      close();
47912    }
47913  }
47914
47915  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
47916      composeBackbone(element);
47917      if (element.hasMessageElement()) {
47918        composeCanonicalCore("message", element.getMessageElement(), false);
47919        composeCanonicalExtras("message", element.getMessageElement(), false);
47920      }
47921      if (element.hasSituationElement()) {
47922        composeMarkdownCore("situation", element.getSituationElement(), false);
47923        composeMarkdownExtras("situation", element.getSituationElement(), false);
47924      }
47925  }
47926
47927  protected void composeMessageHeader(String name, MessageHeader element) throws IOException {
47928    if (element != null) {
47929      prop("resourceType", name);
47930      composeMessageHeaderInner(element);
47931    }
47932  }
47933
47934  protected void composeMessageHeaderInner(MessageHeader element) throws IOException {
47935      composeDomainResourceElements(element);
47936      if (element.hasEvent()) {
47937        composeType("event", element.getEvent());
47938      }
47939      if (element.hasDestination()) {
47940        openArray("destination");
47941        for (MessageHeader.MessageDestinationComponent e : element.getDestination()) 
47942          composeMessageHeaderMessageDestinationComponent(null, e);
47943        closeArray();
47944      };
47945      if (element.hasSender()) {
47946        composeReference("sender", element.getSender());
47947      }
47948      if (element.hasEnterer()) {
47949        composeReference("enterer", element.getEnterer());
47950      }
47951      if (element.hasAuthor()) {
47952        composeReference("author", element.getAuthor());
47953      }
47954      if (element.hasSource()) {
47955        composeMessageHeaderMessageSourceComponent("source", element.getSource());
47956      }
47957      if (element.hasResponsible()) {
47958        composeReference("responsible", element.getResponsible());
47959      }
47960      if (element.hasReason()) {
47961        composeCodeableConcept("reason", element.getReason());
47962      }
47963      if (element.hasResponse()) {
47964        composeMessageHeaderMessageHeaderResponseComponent("response", element.getResponse());
47965      }
47966      if (element.hasFocus()) {
47967        openArray("focus");
47968        for (Reference e : element.getFocus()) 
47969          composeReference(null, e);
47970        closeArray();
47971      };
47972      if (element.hasDefinitionElement()) {
47973        composeCanonicalCore("definition", element.getDefinitionElement(), false);
47974        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
47975      }
47976  }
47977
47978  protected void composeMessageHeaderMessageDestinationComponent(String name, MessageHeader.MessageDestinationComponent element) throws IOException {
47979    if (element != null) {
47980      open(name);
47981      composeMessageHeaderMessageDestinationComponentInner(element);
47982      close();
47983    }
47984  }
47985
47986  protected void composeMessageHeaderMessageDestinationComponentInner(MessageHeader.MessageDestinationComponent element) throws IOException {
47987      composeBackbone(element);
47988      if (element.hasNameElement()) {
47989        composeStringCore("name", element.getNameElement(), false);
47990        composeStringExtras("name", element.getNameElement(), false);
47991      }
47992      if (element.hasTarget()) {
47993        composeReference("target", element.getTarget());
47994      }
47995      if (element.hasEndpointElement()) {
47996        composeUrlCore("endpoint", element.getEndpointElement(), false);
47997        composeUrlExtras("endpoint", element.getEndpointElement(), false);
47998      }
47999      if (element.hasReceiver()) {
48000        composeReference("receiver", element.getReceiver());
48001      }
48002  }
48003
48004  protected void composeMessageHeaderMessageSourceComponent(String name, MessageHeader.MessageSourceComponent element) throws IOException {
48005    if (element != null) {
48006      open(name);
48007      composeMessageHeaderMessageSourceComponentInner(element);
48008      close();
48009    }
48010  }
48011
48012  protected void composeMessageHeaderMessageSourceComponentInner(MessageHeader.MessageSourceComponent element) throws IOException {
48013      composeBackbone(element);
48014      if (element.hasNameElement()) {
48015        composeStringCore("name", element.getNameElement(), false);
48016        composeStringExtras("name", element.getNameElement(), false);
48017      }
48018      if (element.hasSoftwareElement()) {
48019        composeStringCore("software", element.getSoftwareElement(), false);
48020        composeStringExtras("software", element.getSoftwareElement(), false);
48021      }
48022      if (element.hasVersionElement()) {
48023        composeStringCore("version", element.getVersionElement(), false);
48024        composeStringExtras("version", element.getVersionElement(), false);
48025      }
48026      if (element.hasContact()) {
48027        composeContactPoint("contact", element.getContact());
48028      }
48029      if (element.hasEndpointElement()) {
48030        composeUrlCore("endpoint", element.getEndpointElement(), false);
48031        composeUrlExtras("endpoint", element.getEndpointElement(), false);
48032      }
48033  }
48034
48035  protected void composeMessageHeaderMessageHeaderResponseComponent(String name, MessageHeader.MessageHeaderResponseComponent element) throws IOException {
48036    if (element != null) {
48037      open(name);
48038      composeMessageHeaderMessageHeaderResponseComponentInner(element);
48039      close();
48040    }
48041  }
48042
48043  protected void composeMessageHeaderMessageHeaderResponseComponentInner(MessageHeader.MessageHeaderResponseComponent element) throws IOException {
48044      composeBackbone(element);
48045      if (element.hasIdentifierElement()) {
48046        composeIdCore("identifier", element.getIdentifierElement(), false);
48047        composeIdExtras("identifier", element.getIdentifierElement(), false);
48048      }
48049      if (element.hasCodeElement()) {
48050        composeEnumerationCore("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
48051        composeEnumerationExtras("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
48052      }
48053      if (element.hasDetails()) {
48054        composeReference("details", element.getDetails());
48055      }
48056  }
48057
48058  protected void composeMolecularSequence(String name, MolecularSequence element) throws IOException {
48059    if (element != null) {
48060      prop("resourceType", name);
48061      composeMolecularSequenceInner(element);
48062    }
48063  }
48064
48065  protected void composeMolecularSequenceInner(MolecularSequence element) throws IOException {
48066      composeDomainResourceElements(element);
48067      if (element.hasIdentifier()) {
48068        openArray("identifier");
48069        for (Identifier e : element.getIdentifier()) 
48070          composeIdentifier(null, e);
48071        closeArray();
48072      };
48073      if (element.hasTypeElement()) {
48074        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.SequenceTypeEnumFactory(), false);
48075        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.SequenceTypeEnumFactory(), false);
48076      }
48077      if (element.hasCoordinateSystemElement()) {
48078        composeIntegerCore("coordinateSystem", element.getCoordinateSystemElement(), false);
48079        composeIntegerExtras("coordinateSystem", element.getCoordinateSystemElement(), false);
48080      }
48081      if (element.hasPatient()) {
48082        composeReference("patient", element.getPatient());
48083      }
48084      if (element.hasSpecimen()) {
48085        composeReference("specimen", element.getSpecimen());
48086      }
48087      if (element.hasDevice()) {
48088        composeReference("device", element.getDevice());
48089      }
48090      if (element.hasPerformer()) {
48091        composeReference("performer", element.getPerformer());
48092      }
48093      if (element.hasQuantity()) {
48094        composeQuantity("quantity", element.getQuantity());
48095      }
48096      if (element.hasReferenceSeq()) {
48097        composeMolecularSequenceMolecularSequenceReferenceSeqComponent("referenceSeq", element.getReferenceSeq());
48098      }
48099      if (element.hasVariant()) {
48100        openArray("variant");
48101        for (MolecularSequence.MolecularSequenceVariantComponent e : element.getVariant()) 
48102          composeMolecularSequenceMolecularSequenceVariantComponent(null, e);
48103        closeArray();
48104      };
48105      if (element.hasObservedSeqElement()) {
48106        composeStringCore("observedSeq", element.getObservedSeqElement(), false);
48107        composeStringExtras("observedSeq", element.getObservedSeqElement(), false);
48108      }
48109      if (element.hasQuality()) {
48110        openArray("quality");
48111        for (MolecularSequence.MolecularSequenceQualityComponent e : element.getQuality()) 
48112          composeMolecularSequenceMolecularSequenceQualityComponent(null, e);
48113        closeArray();
48114      };
48115      if (element.hasReadCoverageElement()) {
48116        composeIntegerCore("readCoverage", element.getReadCoverageElement(), false);
48117        composeIntegerExtras("readCoverage", element.getReadCoverageElement(), false);
48118      }
48119      if (element.hasRepository()) {
48120        openArray("repository");
48121        for (MolecularSequence.MolecularSequenceRepositoryComponent e : element.getRepository()) 
48122          composeMolecularSequenceMolecularSequenceRepositoryComponent(null, e);
48123        closeArray();
48124      };
48125      if (element.hasPointer()) {
48126        openArray("pointer");
48127        for (Reference e : element.getPointer()) 
48128          composeReference(null, e);
48129        closeArray();
48130      };
48131      if (element.hasStructureVariant()) {
48132        openArray("structureVariant");
48133        for (MolecularSequence.MolecularSequenceStructureVariantComponent e : element.getStructureVariant()) 
48134          composeMolecularSequenceMolecularSequenceStructureVariantComponent(null, e);
48135        closeArray();
48136      };
48137  }
48138
48139  protected void composeMolecularSequenceMolecularSequenceReferenceSeqComponent(String name, MolecularSequence.MolecularSequenceReferenceSeqComponent element) throws IOException {
48140    if (element != null) {
48141      open(name);
48142      composeMolecularSequenceMolecularSequenceReferenceSeqComponentInner(element);
48143      close();
48144    }
48145  }
48146
48147  protected void composeMolecularSequenceMolecularSequenceReferenceSeqComponentInner(MolecularSequence.MolecularSequenceReferenceSeqComponent element) throws IOException {
48148      composeBackbone(element);
48149      if (element.hasChromosome()) {
48150        composeCodeableConcept("chromosome", element.getChromosome());
48151      }
48152      if (element.hasGenomeBuildElement()) {
48153        composeStringCore("genomeBuild", element.getGenomeBuildElement(), false);
48154        composeStringExtras("genomeBuild", element.getGenomeBuildElement(), false);
48155      }
48156      if (element.hasOrientationElement()) {
48157        composeEnumerationCore("orientation", element.getOrientationElement(), new MolecularSequence.OrientationTypeEnumFactory(), false);
48158        composeEnumerationExtras("orientation", element.getOrientationElement(), new MolecularSequence.OrientationTypeEnumFactory(), false);
48159      }
48160      if (element.hasReferenceSeqId()) {
48161        composeCodeableConcept("referenceSeqId", element.getReferenceSeqId());
48162      }
48163      if (element.hasReferenceSeqPointer()) {
48164        composeReference("referenceSeqPointer", element.getReferenceSeqPointer());
48165      }
48166      if (element.hasReferenceSeqStringElement()) {
48167        composeStringCore("referenceSeqString", element.getReferenceSeqStringElement(), false);
48168        composeStringExtras("referenceSeqString", element.getReferenceSeqStringElement(), false);
48169      }
48170      if (element.hasStrandElement()) {
48171        composeEnumerationCore("strand", element.getStrandElement(), new MolecularSequence.StrandTypeEnumFactory(), false);
48172        composeEnumerationExtras("strand", element.getStrandElement(), new MolecularSequence.StrandTypeEnumFactory(), false);
48173      }
48174      if (element.hasWindowStartElement()) {
48175        composeIntegerCore("windowStart", element.getWindowStartElement(), false);
48176        composeIntegerExtras("windowStart", element.getWindowStartElement(), false);
48177      }
48178      if (element.hasWindowEndElement()) {
48179        composeIntegerCore("windowEnd", element.getWindowEndElement(), false);
48180        composeIntegerExtras("windowEnd", element.getWindowEndElement(), false);
48181      }
48182  }
48183
48184  protected void composeMolecularSequenceMolecularSequenceVariantComponent(String name, MolecularSequence.MolecularSequenceVariantComponent element) throws IOException {
48185    if (element != null) {
48186      open(name);
48187      composeMolecularSequenceMolecularSequenceVariantComponentInner(element);
48188      close();
48189    }
48190  }
48191
48192  protected void composeMolecularSequenceMolecularSequenceVariantComponentInner(MolecularSequence.MolecularSequenceVariantComponent element) throws IOException {
48193      composeBackbone(element);
48194      if (element.hasStartElement()) {
48195        composeIntegerCore("start", element.getStartElement(), false);
48196        composeIntegerExtras("start", element.getStartElement(), false);
48197      }
48198      if (element.hasEndElement()) {
48199        composeIntegerCore("end", element.getEndElement(), false);
48200        composeIntegerExtras("end", element.getEndElement(), false);
48201      }
48202      if (element.hasObservedAlleleElement()) {
48203        composeStringCore("observedAllele", element.getObservedAlleleElement(), false);
48204        composeStringExtras("observedAllele", element.getObservedAlleleElement(), false);
48205      }
48206      if (element.hasReferenceAlleleElement()) {
48207        composeStringCore("referenceAllele", element.getReferenceAlleleElement(), false);
48208        composeStringExtras("referenceAllele", element.getReferenceAlleleElement(), false);
48209      }
48210      if (element.hasCigarElement()) {
48211        composeStringCore("cigar", element.getCigarElement(), false);
48212        composeStringExtras("cigar", element.getCigarElement(), false);
48213      }
48214      if (element.hasVariantPointer()) {
48215        composeReference("variantPointer", element.getVariantPointer());
48216      }
48217  }
48218
48219  protected void composeMolecularSequenceMolecularSequenceQualityComponent(String name, MolecularSequence.MolecularSequenceQualityComponent element) throws IOException {
48220    if (element != null) {
48221      open(name);
48222      composeMolecularSequenceMolecularSequenceQualityComponentInner(element);
48223      close();
48224    }
48225  }
48226
48227  protected void composeMolecularSequenceMolecularSequenceQualityComponentInner(MolecularSequence.MolecularSequenceQualityComponent element) throws IOException {
48228      composeBackbone(element);
48229      if (element.hasTypeElement()) {
48230        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.QualityTypeEnumFactory(), false);
48231        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.QualityTypeEnumFactory(), false);
48232      }
48233      if (element.hasStandardSequence()) {
48234        composeCodeableConcept("standardSequence", element.getStandardSequence());
48235      }
48236      if (element.hasStartElement()) {
48237        composeIntegerCore("start", element.getStartElement(), false);
48238        composeIntegerExtras("start", element.getStartElement(), false);
48239      }
48240      if (element.hasEndElement()) {
48241        composeIntegerCore("end", element.getEndElement(), false);
48242        composeIntegerExtras("end", element.getEndElement(), false);
48243      }
48244      if (element.hasScore()) {
48245        composeQuantity("score", element.getScore());
48246      }
48247      if (element.hasMethod()) {
48248        composeCodeableConcept("method", element.getMethod());
48249      }
48250      if (element.hasTruthTPElement()) {
48251        composeDecimalCore("truthTP", element.getTruthTPElement(), false);
48252        composeDecimalExtras("truthTP", element.getTruthTPElement(), false);
48253      }
48254      if (element.hasQueryTPElement()) {
48255        composeDecimalCore("queryTP", element.getQueryTPElement(), false);
48256        composeDecimalExtras("queryTP", element.getQueryTPElement(), false);
48257      }
48258      if (element.hasTruthFNElement()) {
48259        composeDecimalCore("truthFN", element.getTruthFNElement(), false);
48260        composeDecimalExtras("truthFN", element.getTruthFNElement(), false);
48261      }
48262      if (element.hasQueryFPElement()) {
48263        composeDecimalCore("queryFP", element.getQueryFPElement(), false);
48264        composeDecimalExtras("queryFP", element.getQueryFPElement(), false);
48265      }
48266      if (element.hasGtFPElement()) {
48267        composeDecimalCore("gtFP", element.getGtFPElement(), false);
48268        composeDecimalExtras("gtFP", element.getGtFPElement(), false);
48269      }
48270      if (element.hasPrecisionElement()) {
48271        composeDecimalCore("precision", element.getPrecisionElement(), false);
48272        composeDecimalExtras("precision", element.getPrecisionElement(), false);
48273      }
48274      if (element.hasRecallElement()) {
48275        composeDecimalCore("recall", element.getRecallElement(), false);
48276        composeDecimalExtras("recall", element.getRecallElement(), false);
48277      }
48278      if (element.hasFScoreElement()) {
48279        composeDecimalCore("fScore", element.getFScoreElement(), false);
48280        composeDecimalExtras("fScore", element.getFScoreElement(), false);
48281      }
48282      if (element.hasRoc()) {
48283        composeMolecularSequenceMolecularSequenceQualityRocComponent("roc", element.getRoc());
48284      }
48285  }
48286
48287  protected void composeMolecularSequenceMolecularSequenceQualityRocComponent(String name, MolecularSequence.MolecularSequenceQualityRocComponent element) throws IOException {
48288    if (element != null) {
48289      open(name);
48290      composeMolecularSequenceMolecularSequenceQualityRocComponentInner(element);
48291      close();
48292    }
48293  }
48294
48295  protected void composeMolecularSequenceMolecularSequenceQualityRocComponentInner(MolecularSequence.MolecularSequenceQualityRocComponent element) throws IOException {
48296      composeBackbone(element);
48297      if (element.hasScore()) {
48298        openArray("score");
48299        for (IntegerType e : element.getScore()) 
48300          composeIntegerCore(null, e, true);
48301        closeArray();
48302        if (anyHasExtras(element.getScore())) {
48303          openArray("_score");
48304          for (IntegerType e : element.getScore()) 
48305            composeIntegerExtras(null, e, true);
48306          closeArray();
48307        }
48308      };
48309      if (element.hasNumTP()) {
48310        openArray("numTP");
48311        for (IntegerType e : element.getNumTP()) 
48312          composeIntegerCore(null, e, true);
48313        closeArray();
48314        if (anyHasExtras(element.getNumTP())) {
48315          openArray("_numTP");
48316          for (IntegerType e : element.getNumTP()) 
48317            composeIntegerExtras(null, e, true);
48318          closeArray();
48319        }
48320      };
48321      if (element.hasNumFP()) {
48322        openArray("numFP");
48323        for (IntegerType e : element.getNumFP()) 
48324          composeIntegerCore(null, e, true);
48325        closeArray();
48326        if (anyHasExtras(element.getNumFP())) {
48327          openArray("_numFP");
48328          for (IntegerType e : element.getNumFP()) 
48329            composeIntegerExtras(null, e, true);
48330          closeArray();
48331        }
48332      };
48333      if (element.hasNumFN()) {
48334        openArray("numFN");
48335        for (IntegerType e : element.getNumFN()) 
48336          composeIntegerCore(null, e, true);
48337        closeArray();
48338        if (anyHasExtras(element.getNumFN())) {
48339          openArray("_numFN");
48340          for (IntegerType e : element.getNumFN()) 
48341            composeIntegerExtras(null, e, true);
48342          closeArray();
48343        }
48344      };
48345      if (element.hasPrecision()) {
48346        openArray("precision");
48347        for (DecimalType e : element.getPrecision()) 
48348          composeDecimalCore(null, e, true);
48349        closeArray();
48350        if (anyHasExtras(element.getPrecision())) {
48351          openArray("_precision");
48352          for (DecimalType e : element.getPrecision()) 
48353            composeDecimalExtras(null, e, true);
48354          closeArray();
48355        }
48356      };
48357      if (element.hasSensitivity()) {
48358        openArray("sensitivity");
48359        for (DecimalType e : element.getSensitivity()) 
48360          composeDecimalCore(null, e, true);
48361        closeArray();
48362        if (anyHasExtras(element.getSensitivity())) {
48363          openArray("_sensitivity");
48364          for (DecimalType e : element.getSensitivity()) 
48365            composeDecimalExtras(null, e, true);
48366          closeArray();
48367        }
48368      };
48369      if (element.hasFMeasure()) {
48370        openArray("fMeasure");
48371        for (DecimalType e : element.getFMeasure()) 
48372          composeDecimalCore(null, e, true);
48373        closeArray();
48374        if (anyHasExtras(element.getFMeasure())) {
48375          openArray("_fMeasure");
48376          for (DecimalType e : element.getFMeasure()) 
48377            composeDecimalExtras(null, e, true);
48378          closeArray();
48379        }
48380      };
48381  }
48382
48383  protected void composeMolecularSequenceMolecularSequenceRepositoryComponent(String name, MolecularSequence.MolecularSequenceRepositoryComponent element) throws IOException {
48384    if (element != null) {
48385      open(name);
48386      composeMolecularSequenceMolecularSequenceRepositoryComponentInner(element);
48387      close();
48388    }
48389  }
48390
48391  protected void composeMolecularSequenceMolecularSequenceRepositoryComponentInner(MolecularSequence.MolecularSequenceRepositoryComponent element) throws IOException {
48392      composeBackbone(element);
48393      if (element.hasTypeElement()) {
48394        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.RepositoryTypeEnumFactory(), false);
48395        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.RepositoryTypeEnumFactory(), false);
48396      }
48397      if (element.hasUrlElement()) {
48398        composeUriCore("url", element.getUrlElement(), false);
48399        composeUriExtras("url", element.getUrlElement(), false);
48400      }
48401      if (element.hasNameElement()) {
48402        composeStringCore("name", element.getNameElement(), false);
48403        composeStringExtras("name", element.getNameElement(), false);
48404      }
48405      if (element.hasDatasetIdElement()) {
48406        composeStringCore("datasetId", element.getDatasetIdElement(), false);
48407        composeStringExtras("datasetId", element.getDatasetIdElement(), false);
48408      }
48409      if (element.hasVariantsetIdElement()) {
48410        composeStringCore("variantsetId", element.getVariantsetIdElement(), false);
48411        composeStringExtras("variantsetId", element.getVariantsetIdElement(), false);
48412      }
48413      if (element.hasReadsetIdElement()) {
48414        composeStringCore("readsetId", element.getReadsetIdElement(), false);
48415        composeStringExtras("readsetId", element.getReadsetIdElement(), false);
48416      }
48417  }
48418
48419  protected void composeMolecularSequenceMolecularSequenceStructureVariantComponent(String name, MolecularSequence.MolecularSequenceStructureVariantComponent element) throws IOException {
48420    if (element != null) {
48421      open(name);
48422      composeMolecularSequenceMolecularSequenceStructureVariantComponentInner(element);
48423      close();
48424    }
48425  }
48426
48427  protected void composeMolecularSequenceMolecularSequenceStructureVariantComponentInner(MolecularSequence.MolecularSequenceStructureVariantComponent element) throws IOException {
48428      composeBackbone(element);
48429      if (element.hasVariantType()) {
48430        composeCodeableConcept("variantType", element.getVariantType());
48431      }
48432      if (element.hasExactElement()) {
48433        composeBooleanCore("exact", element.getExactElement(), false);
48434        composeBooleanExtras("exact", element.getExactElement(), false);
48435      }
48436      if (element.hasLengthElement()) {
48437        composeIntegerCore("length", element.getLengthElement(), false);
48438        composeIntegerExtras("length", element.getLengthElement(), false);
48439      }
48440      if (element.hasOuter()) {
48441        composeMolecularSequenceMolecularSequenceStructureVariantOuterComponent("outer", element.getOuter());
48442      }
48443      if (element.hasInner()) {
48444        composeMolecularSequenceMolecularSequenceStructureVariantInnerComponent("inner", element.getInner());
48445      }
48446  }
48447
48448  protected void composeMolecularSequenceMolecularSequenceStructureVariantOuterComponent(String name, MolecularSequence.MolecularSequenceStructureVariantOuterComponent element) throws IOException {
48449    if (element != null) {
48450      open(name);
48451      composeMolecularSequenceMolecularSequenceStructureVariantOuterComponentInner(element);
48452      close();
48453    }
48454  }
48455
48456  protected void composeMolecularSequenceMolecularSequenceStructureVariantOuterComponentInner(MolecularSequence.MolecularSequenceStructureVariantOuterComponent element) throws IOException {
48457      composeBackbone(element);
48458      if (element.hasStartElement()) {
48459        composeIntegerCore("start", element.getStartElement(), false);
48460        composeIntegerExtras("start", element.getStartElement(), false);
48461      }
48462      if (element.hasEndElement()) {
48463        composeIntegerCore("end", element.getEndElement(), false);
48464        composeIntegerExtras("end", element.getEndElement(), false);
48465      }
48466  }
48467
48468  protected void composeMolecularSequenceMolecularSequenceStructureVariantInnerComponent(String name, MolecularSequence.MolecularSequenceStructureVariantInnerComponent element) throws IOException {
48469    if (element != null) {
48470      open(name);
48471      composeMolecularSequenceMolecularSequenceStructureVariantInnerComponentInner(element);
48472      close();
48473    }
48474  }
48475
48476  protected void composeMolecularSequenceMolecularSequenceStructureVariantInnerComponentInner(MolecularSequence.MolecularSequenceStructureVariantInnerComponent element) throws IOException {
48477      composeBackbone(element);
48478      if (element.hasStartElement()) {
48479        composeIntegerCore("start", element.getStartElement(), false);
48480        composeIntegerExtras("start", element.getStartElement(), false);
48481      }
48482      if (element.hasEndElement()) {
48483        composeIntegerCore("end", element.getEndElement(), false);
48484        composeIntegerExtras("end", element.getEndElement(), false);
48485      }
48486  }
48487
48488  protected void composeNamingSystem(String name, NamingSystem element) throws IOException {
48489    if (element != null) {
48490      prop("resourceType", name);
48491      composeNamingSystemInner(element);
48492    }
48493  }
48494
48495  protected void composeNamingSystemInner(NamingSystem element) throws IOException {
48496      composeDomainResourceElements(element);
48497      if (element.hasNameElement()) {
48498        composeStringCore("name", element.getNameElement(), false);
48499        composeStringExtras("name", element.getNameElement(), false);
48500      }
48501      if (element.hasStatusElement()) {
48502        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
48503        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
48504      }
48505      if (element.hasKindElement()) {
48506        composeEnumerationCore("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
48507        composeEnumerationExtras("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
48508      }
48509      if (element.hasDateElement()) {
48510        composeDateTimeCore("date", element.getDateElement(), false);
48511        composeDateTimeExtras("date", element.getDateElement(), false);
48512      }
48513      if (element.hasPublisherElement()) {
48514        composeStringCore("publisher", element.getPublisherElement(), false);
48515        composeStringExtras("publisher", element.getPublisherElement(), false);
48516      }
48517      if (element.hasContact()) {
48518        openArray("contact");
48519        for (ContactDetail e : element.getContact()) 
48520          composeContactDetail(null, e);
48521        closeArray();
48522      };
48523      if (element.hasResponsibleElement()) {
48524        composeStringCore("responsible", element.getResponsibleElement(), false);
48525        composeStringExtras("responsible", element.getResponsibleElement(), false);
48526      }
48527      if (element.hasType()) {
48528        composeCodeableConcept("type", element.getType());
48529      }
48530      if (element.hasDescriptionElement()) {
48531        composeMarkdownCore("description", element.getDescriptionElement(), false);
48532        composeMarkdownExtras("description", element.getDescriptionElement(), false);
48533      }
48534      if (element.hasUseContext()) {
48535        openArray("useContext");
48536        for (UsageContext e : element.getUseContext()) 
48537          composeUsageContext(null, e);
48538        closeArray();
48539      };
48540      if (element.hasJurisdiction()) {
48541        openArray("jurisdiction");
48542        for (CodeableConcept e : element.getJurisdiction()) 
48543          composeCodeableConcept(null, e);
48544        closeArray();
48545      };
48546      if (element.hasUsageElement()) {
48547        composeStringCore("usage", element.getUsageElement(), false);
48548        composeStringExtras("usage", element.getUsageElement(), false);
48549      }
48550      if (element.hasUniqueId()) {
48551        openArray("uniqueId");
48552        for (NamingSystem.NamingSystemUniqueIdComponent e : element.getUniqueId()) 
48553          composeNamingSystemNamingSystemUniqueIdComponent(null, e);
48554        closeArray();
48555      };
48556  }
48557
48558  protected void composeNamingSystemNamingSystemUniqueIdComponent(String name, NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
48559    if (element != null) {
48560      open(name);
48561      composeNamingSystemNamingSystemUniqueIdComponentInner(element);
48562      close();
48563    }
48564  }
48565
48566  protected void composeNamingSystemNamingSystemUniqueIdComponentInner(NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
48567      composeBackbone(element);
48568      if (element.hasTypeElement()) {
48569        composeEnumerationCore("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
48570        composeEnumerationExtras("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
48571      }
48572      if (element.hasValueElement()) {
48573        composeStringCore("value", element.getValueElement(), false);
48574        composeStringExtras("value", element.getValueElement(), false);
48575      }
48576      if (element.hasPreferredElement()) {
48577        composeBooleanCore("preferred", element.getPreferredElement(), false);
48578        composeBooleanExtras("preferred", element.getPreferredElement(), false);
48579      }
48580      if (element.hasCommentElement()) {
48581        composeStringCore("comment", element.getCommentElement(), false);
48582        composeStringExtras("comment", element.getCommentElement(), false);
48583      }
48584      if (element.hasPeriod()) {
48585        composePeriod("period", element.getPeriod());
48586      }
48587  }
48588
48589  protected void composeNutritionOrder(String name, NutritionOrder element) throws IOException {
48590    if (element != null) {
48591      prop("resourceType", name);
48592      composeNutritionOrderInner(element);
48593    }
48594  }
48595
48596  protected void composeNutritionOrderInner(NutritionOrder element) throws IOException {
48597      composeDomainResourceElements(element);
48598      if (element.hasIdentifier()) {
48599        openArray("identifier");
48600        for (Identifier e : element.getIdentifier()) 
48601          composeIdentifier(null, e);
48602        closeArray();
48603      };
48604      if (element.hasInstantiatesCanonical()) {
48605        openArray("instantiatesCanonical");
48606        for (CanonicalType e : element.getInstantiatesCanonical()) 
48607          composeCanonicalCore(null, e, true);
48608        closeArray();
48609        if (anyHasExtras(element.getInstantiatesCanonical())) {
48610          openArray("_instantiatesCanonical");
48611          for (CanonicalType e : element.getInstantiatesCanonical()) 
48612            composeCanonicalExtras(null, e, true);
48613          closeArray();
48614        }
48615      };
48616      if (element.hasInstantiatesUri()) {
48617        openArray("instantiatesUri");
48618        for (UriType e : element.getInstantiatesUri()) 
48619          composeUriCore(null, e, true);
48620        closeArray();
48621        if (anyHasExtras(element.getInstantiatesUri())) {
48622          openArray("_instantiatesUri");
48623          for (UriType e : element.getInstantiatesUri()) 
48624            composeUriExtras(null, e, true);
48625          closeArray();
48626        }
48627      };
48628      if (element.hasInstantiates()) {
48629        openArray("instantiates");
48630        for (UriType e : element.getInstantiates()) 
48631          composeUriCore(null, e, true);
48632        closeArray();
48633        if (anyHasExtras(element.getInstantiates())) {
48634          openArray("_instantiates");
48635          for (UriType e : element.getInstantiates()) 
48636            composeUriExtras(null, e, true);
48637          closeArray();
48638        }
48639      };
48640      if (element.hasStatusElement()) {
48641        composeEnumerationCore("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
48642        composeEnumerationExtras("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
48643      }
48644      if (element.hasIntentElement()) {
48645        composeEnumerationCore("intent", element.getIntentElement(), new NutritionOrder.NutritiionOrderIntentEnumFactory(), false);
48646        composeEnumerationExtras("intent", element.getIntentElement(), new NutritionOrder.NutritiionOrderIntentEnumFactory(), false);
48647      }
48648      if (element.hasPatient()) {
48649        composeReference("patient", element.getPatient());
48650      }
48651      if (element.hasEncounter()) {
48652        composeReference("encounter", element.getEncounter());
48653      }
48654      if (element.hasDateTimeElement()) {
48655        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
48656        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
48657      }
48658      if (element.hasOrderer()) {
48659        composeReference("orderer", element.getOrderer());
48660      }
48661      if (element.hasAllergyIntolerance()) {
48662        openArray("allergyIntolerance");
48663        for (Reference e : element.getAllergyIntolerance()) 
48664          composeReference(null, e);
48665        closeArray();
48666      };
48667      if (element.hasFoodPreferenceModifier()) {
48668        openArray("foodPreferenceModifier");
48669        for (CodeableConcept e : element.getFoodPreferenceModifier()) 
48670          composeCodeableConcept(null, e);
48671        closeArray();
48672      };
48673      if (element.hasExcludeFoodModifier()) {
48674        openArray("excludeFoodModifier");
48675        for (CodeableConcept e : element.getExcludeFoodModifier()) 
48676          composeCodeableConcept(null, e);
48677        closeArray();
48678      };
48679      if (element.hasOralDiet()) {
48680        composeNutritionOrderNutritionOrderOralDietComponent("oralDiet", element.getOralDiet());
48681      }
48682      if (element.hasSupplement()) {
48683        openArray("supplement");
48684        for (NutritionOrder.NutritionOrderSupplementComponent e : element.getSupplement()) 
48685          composeNutritionOrderNutritionOrderSupplementComponent(null, e);
48686        closeArray();
48687      };
48688      if (element.hasEnteralFormula()) {
48689        composeNutritionOrderNutritionOrderEnteralFormulaComponent("enteralFormula", element.getEnteralFormula());
48690      }
48691      if (element.hasNote()) {
48692        openArray("note");
48693        for (Annotation e : element.getNote()) 
48694          composeAnnotation(null, e);
48695        closeArray();
48696      };
48697  }
48698
48699  protected void composeNutritionOrderNutritionOrderOralDietComponent(String name, NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
48700    if (element != null) {
48701      open(name);
48702      composeNutritionOrderNutritionOrderOralDietComponentInner(element);
48703      close();
48704    }
48705  }
48706
48707  protected void composeNutritionOrderNutritionOrderOralDietComponentInner(NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
48708      composeBackbone(element);
48709      if (element.hasType()) {
48710        openArray("type");
48711        for (CodeableConcept e : element.getType()) 
48712          composeCodeableConcept(null, e);
48713        closeArray();
48714      };
48715      if (element.hasSchedule()) {
48716        openArray("schedule");
48717        for (Timing e : element.getSchedule()) 
48718          composeTiming(null, e);
48719        closeArray();
48720      };
48721      if (element.hasNutrient()) {
48722        openArray("nutrient");
48723        for (NutritionOrder.NutritionOrderOralDietNutrientComponent e : element.getNutrient()) 
48724          composeNutritionOrderNutritionOrderOralDietNutrientComponent(null, e);
48725        closeArray();
48726      };
48727      if (element.hasTexture()) {
48728        openArray("texture");
48729        for (NutritionOrder.NutritionOrderOralDietTextureComponent e : element.getTexture()) 
48730          composeNutritionOrderNutritionOrderOralDietTextureComponent(null, e);
48731        closeArray();
48732      };
48733      if (element.hasFluidConsistencyType()) {
48734        openArray("fluidConsistencyType");
48735        for (CodeableConcept e : element.getFluidConsistencyType()) 
48736          composeCodeableConcept(null, e);
48737        closeArray();
48738      };
48739      if (element.hasInstructionElement()) {
48740        composeStringCore("instruction", element.getInstructionElement(), false);
48741        composeStringExtras("instruction", element.getInstructionElement(), false);
48742      }
48743  }
48744
48745  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponent(String name, NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
48746    if (element != null) {
48747      open(name);
48748      composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(element);
48749      close();
48750    }
48751  }
48752
48753  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
48754      composeBackbone(element);
48755      if (element.hasModifier()) {
48756        composeCodeableConcept("modifier", element.getModifier());
48757      }
48758      if (element.hasAmount()) {
48759        composeQuantity("amount", element.getAmount());
48760      }
48761  }
48762
48763  protected void composeNutritionOrderNutritionOrderOralDietTextureComponent(String name, NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
48764    if (element != null) {
48765      open(name);
48766      composeNutritionOrderNutritionOrderOralDietTextureComponentInner(element);
48767      close();
48768    }
48769  }
48770
48771  protected void composeNutritionOrderNutritionOrderOralDietTextureComponentInner(NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
48772      composeBackbone(element);
48773      if (element.hasModifier()) {
48774        composeCodeableConcept("modifier", element.getModifier());
48775      }
48776      if (element.hasFoodType()) {
48777        composeCodeableConcept("foodType", element.getFoodType());
48778      }
48779  }
48780
48781  protected void composeNutritionOrderNutritionOrderSupplementComponent(String name, NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
48782    if (element != null) {
48783      open(name);
48784      composeNutritionOrderNutritionOrderSupplementComponentInner(element);
48785      close();
48786    }
48787  }
48788
48789  protected void composeNutritionOrderNutritionOrderSupplementComponentInner(NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
48790      composeBackbone(element);
48791      if (element.hasType()) {
48792        composeCodeableConcept("type", element.getType());
48793      }
48794      if (element.hasProductNameElement()) {
48795        composeStringCore("productName", element.getProductNameElement(), false);
48796        composeStringExtras("productName", element.getProductNameElement(), false);
48797      }
48798      if (element.hasSchedule()) {
48799        openArray("schedule");
48800        for (Timing e : element.getSchedule()) 
48801          composeTiming(null, e);
48802        closeArray();
48803      };
48804      if (element.hasQuantity()) {
48805        composeQuantity("quantity", element.getQuantity());
48806      }
48807      if (element.hasInstructionElement()) {
48808        composeStringCore("instruction", element.getInstructionElement(), false);
48809        composeStringExtras("instruction", element.getInstructionElement(), false);
48810      }
48811  }
48812
48813  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
48814    if (element != null) {
48815      open(name);
48816      composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(element);
48817      close();
48818    }
48819  }
48820
48821  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
48822      composeBackbone(element);
48823      if (element.hasBaseFormulaType()) {
48824        composeCodeableConcept("baseFormulaType", element.getBaseFormulaType());
48825      }
48826      if (element.hasBaseFormulaProductNameElement()) {
48827        composeStringCore("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
48828        composeStringExtras("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
48829      }
48830      if (element.hasAdditiveType()) {
48831        composeCodeableConcept("additiveType", element.getAdditiveType());
48832      }
48833      if (element.hasAdditiveProductNameElement()) {
48834        composeStringCore("additiveProductName", element.getAdditiveProductNameElement(), false);
48835        composeStringExtras("additiveProductName", element.getAdditiveProductNameElement(), false);
48836      }
48837      if (element.hasCaloricDensity()) {
48838        composeQuantity("caloricDensity", element.getCaloricDensity());
48839      }
48840      if (element.hasRouteofAdministration()) {
48841        composeCodeableConcept("routeofAdministration", element.getRouteofAdministration());
48842      }
48843      if (element.hasAdministration()) {
48844        openArray("administration");
48845        for (NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent e : element.getAdministration()) 
48846          composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(null, e);
48847        closeArray();
48848      };
48849      if (element.hasMaxVolumeToDeliver()) {
48850        composeQuantity("maxVolumeToDeliver", element.getMaxVolumeToDeliver());
48851      }
48852      if (element.hasAdministrationInstructionElement()) {
48853        composeStringCore("administrationInstruction", element.getAdministrationInstructionElement(), false);
48854        composeStringExtras("administrationInstruction", element.getAdministrationInstructionElement(), false);
48855      }
48856  }
48857
48858  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
48859    if (element != null) {
48860      open(name);
48861      composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(element);
48862      close();
48863    }
48864  }
48865
48866  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
48867      composeBackbone(element);
48868      if (element.hasSchedule()) {
48869        composeTiming("schedule", element.getSchedule());
48870      }
48871      if (element.hasQuantity()) {
48872        composeQuantity("quantity", element.getQuantity());
48873      }
48874      if (element.hasRate()) {
48875        composeType("rate", element.getRate());
48876      }
48877  }
48878
48879  protected void composeObservation(String name, Observation element) throws IOException {
48880    if (element != null) {
48881      prop("resourceType", name);
48882      composeObservationInner(element);
48883    }
48884  }
48885
48886  protected void composeObservationInner(Observation element) throws IOException {
48887      composeDomainResourceElements(element);
48888      if (element.hasIdentifier()) {
48889        openArray("identifier");
48890        for (Identifier e : element.getIdentifier()) 
48891          composeIdentifier(null, e);
48892        closeArray();
48893      };
48894      if (element.hasBasedOn()) {
48895        openArray("basedOn");
48896        for (Reference e : element.getBasedOn()) 
48897          composeReference(null, e);
48898        closeArray();
48899      };
48900      if (element.hasPartOf()) {
48901        openArray("partOf");
48902        for (Reference e : element.getPartOf()) 
48903          composeReference(null, e);
48904        closeArray();
48905      };
48906      if (element.hasStatusElement()) {
48907        composeEnumerationCore("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
48908        composeEnumerationExtras("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
48909      }
48910      if (element.hasCategory()) {
48911        openArray("category");
48912        for (CodeableConcept e : element.getCategory()) 
48913          composeCodeableConcept(null, e);
48914        closeArray();
48915      };
48916      if (element.hasCode()) {
48917        composeCodeableConcept("code", element.getCode());
48918      }
48919      if (element.hasSubject()) {
48920        composeReference("subject", element.getSubject());
48921      }
48922      if (element.hasFocus()) {
48923        openArray("focus");
48924        for (Reference e : element.getFocus()) 
48925          composeReference(null, e);
48926        closeArray();
48927      };
48928      if (element.hasEncounter()) {
48929        composeReference("encounter", element.getEncounter());
48930      }
48931      if (element.hasEffective()) {
48932        composeType("effective", element.getEffective());
48933      }
48934      if (element.hasIssuedElement()) {
48935        composeInstantCore("issued", element.getIssuedElement(), false);
48936        composeInstantExtras("issued", element.getIssuedElement(), false);
48937      }
48938      if (element.hasPerformer()) {
48939        openArray("performer");
48940        for (Reference e : element.getPerformer()) 
48941          composeReference(null, e);
48942        closeArray();
48943      };
48944      if (element.hasValue()) {
48945        composeType("value", element.getValue());
48946      }
48947      if (element.hasDataAbsentReason()) {
48948        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
48949      }
48950      if (element.hasInterpretation()) {
48951        openArray("interpretation");
48952        for (CodeableConcept e : element.getInterpretation()) 
48953          composeCodeableConcept(null, e);
48954        closeArray();
48955      };
48956      if (element.hasNote()) {
48957        openArray("note");
48958        for (Annotation e : element.getNote()) 
48959          composeAnnotation(null, e);
48960        closeArray();
48961      };
48962      if (element.hasBodySite()) {
48963        composeCodeableConcept("bodySite", element.getBodySite());
48964      }
48965      if (element.hasMethod()) {
48966        composeCodeableConcept("method", element.getMethod());
48967      }
48968      if (element.hasSpecimen()) {
48969        composeReference("specimen", element.getSpecimen());
48970      }
48971      if (element.hasDevice()) {
48972        composeReference("device", element.getDevice());
48973      }
48974      if (element.hasReferenceRange()) {
48975        openArray("referenceRange");
48976        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
48977          composeObservationObservationReferenceRangeComponent(null, e);
48978        closeArray();
48979      };
48980      if (element.hasHasMember()) {
48981        openArray("hasMember");
48982        for (Reference e : element.getHasMember()) 
48983          composeReference(null, e);
48984        closeArray();
48985      };
48986      if (element.hasDerivedFrom()) {
48987        openArray("derivedFrom");
48988        for (Reference e : element.getDerivedFrom()) 
48989          composeReference(null, e);
48990        closeArray();
48991      };
48992      if (element.hasComponent()) {
48993        openArray("component");
48994        for (Observation.ObservationComponentComponent e : element.getComponent()) 
48995          composeObservationObservationComponentComponent(null, e);
48996        closeArray();
48997      };
48998  }
48999
49000  protected void composeObservationObservationReferenceRangeComponent(String name, Observation.ObservationReferenceRangeComponent element) throws IOException {
49001    if (element != null) {
49002      open(name);
49003      composeObservationObservationReferenceRangeComponentInner(element);
49004      close();
49005    }
49006  }
49007
49008  protected void composeObservationObservationReferenceRangeComponentInner(Observation.ObservationReferenceRangeComponent element) throws IOException {
49009      composeBackbone(element);
49010      if (element.hasLow()) {
49011        composeQuantity("low", element.getLow());
49012      }
49013      if (element.hasHigh()) {
49014        composeQuantity("high", element.getHigh());
49015      }
49016      if (element.hasType()) {
49017        composeCodeableConcept("type", element.getType());
49018      }
49019      if (element.hasAppliesTo()) {
49020        openArray("appliesTo");
49021        for (CodeableConcept e : element.getAppliesTo()) 
49022          composeCodeableConcept(null, e);
49023        closeArray();
49024      };
49025      if (element.hasAge()) {
49026        composeRange("age", element.getAge());
49027      }
49028      if (element.hasTextElement()) {
49029        composeStringCore("text", element.getTextElement(), false);
49030        composeStringExtras("text", element.getTextElement(), false);
49031      }
49032  }
49033
49034  protected void composeObservationObservationComponentComponent(String name, Observation.ObservationComponentComponent element) throws IOException {
49035    if (element != null) {
49036      open(name);
49037      composeObservationObservationComponentComponentInner(element);
49038      close();
49039    }
49040  }
49041
49042  protected void composeObservationObservationComponentComponentInner(Observation.ObservationComponentComponent element) throws IOException {
49043      composeBackbone(element);
49044      if (element.hasCode()) {
49045        composeCodeableConcept("code", element.getCode());
49046      }
49047      if (element.hasValue()) {
49048        composeType("value", element.getValue());
49049      }
49050      if (element.hasDataAbsentReason()) {
49051        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
49052      }
49053      if (element.hasInterpretation()) {
49054        openArray("interpretation");
49055        for (CodeableConcept e : element.getInterpretation()) 
49056          composeCodeableConcept(null, e);
49057        closeArray();
49058      };
49059      if (element.hasReferenceRange()) {
49060        openArray("referenceRange");
49061        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
49062          composeObservationObservationReferenceRangeComponent(null, e);
49063        closeArray();
49064      };
49065  }
49066
49067  protected void composeObservationDefinition(String name, ObservationDefinition element) throws IOException {
49068    if (element != null) {
49069      prop("resourceType", name);
49070      composeObservationDefinitionInner(element);
49071    }
49072  }
49073
49074  protected void composeObservationDefinitionInner(ObservationDefinition element) throws IOException {
49075      composeDomainResourceElements(element);
49076      if (element.hasCategory()) {
49077        openArray("category");
49078        for (CodeableConcept e : element.getCategory()) 
49079          composeCodeableConcept(null, e);
49080        closeArray();
49081      };
49082      if (element.hasCode()) {
49083        composeCodeableConcept("code", element.getCode());
49084      }
49085      if (element.hasIdentifier()) {
49086        openArray("identifier");
49087        for (Identifier e : element.getIdentifier()) 
49088          composeIdentifier(null, e);
49089        closeArray();
49090      };
49091      if (element.hasPermittedDataType()) {
49092        openArray("permittedDataType");
49093        for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
49094          composeEnumerationCore(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
49095        closeArray();
49096        if (anyHasExtras(element.getPermittedDataType())) {
49097          openArray("_permittedDataType");
49098          for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
49099            composeEnumerationExtras(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
49100          closeArray();
49101        }
49102      };
49103      if (element.hasMultipleResultsAllowedElement()) {
49104        composeBooleanCore("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
49105        composeBooleanExtras("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
49106      }
49107      if (element.hasMethod()) {
49108        composeCodeableConcept("method", element.getMethod());
49109      }
49110      if (element.hasPreferredReportNameElement()) {
49111        composeStringCore("preferredReportName", element.getPreferredReportNameElement(), false);
49112        composeStringExtras("preferredReportName", element.getPreferredReportNameElement(), false);
49113      }
49114      if (element.hasQuantitativeDetails()) {
49115        composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponent("quantitativeDetails", element.getQuantitativeDetails());
49116      }
49117      if (element.hasQualifiedInterval()) {
49118        openArray("qualifiedInterval");
49119        for (ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent e : element.getQualifiedInterval()) 
49120          composeObservationDefinitionObservationDefinitionQualifiedIntervalComponent(null, e);
49121        closeArray();
49122      };
49123      if (element.hasValidCodedValueSet()) {
49124        composeReference("validCodedValueSet", element.getValidCodedValueSet());
49125      }
49126      if (element.hasNormalCodedValueSet()) {
49127        composeReference("normalCodedValueSet", element.getNormalCodedValueSet());
49128      }
49129      if (element.hasAbnormalCodedValueSet()) {
49130        composeReference("abnormalCodedValueSet", element.getAbnormalCodedValueSet());
49131      }
49132      if (element.hasCriticalCodedValueSet()) {
49133        composeReference("criticalCodedValueSet", element.getCriticalCodedValueSet());
49134      }
49135  }
49136
49137  protected void composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(String name, ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
49138    if (element != null) {
49139      open(name);
49140      composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponentInner(element);
49141      close();
49142    }
49143  }
49144
49145  protected void composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponentInner(ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
49146      composeBackbone(element);
49147      if (element.hasCustomaryUnit()) {
49148        composeCodeableConcept("customaryUnit", element.getCustomaryUnit());
49149      }
49150      if (element.hasUnit()) {
49151        composeCodeableConcept("unit", element.getUnit());
49152      }
49153      if (element.hasConversionFactorElement()) {
49154        composeDecimalCore("conversionFactor", element.getConversionFactorElement(), false);
49155        composeDecimalExtras("conversionFactor", element.getConversionFactorElement(), false);
49156      }
49157      if (element.hasDecimalPrecisionElement()) {
49158        composeIntegerCore("decimalPrecision", element.getDecimalPrecisionElement(), false);
49159        composeIntegerExtras("decimalPrecision", element.getDecimalPrecisionElement(), false);
49160      }
49161  }
49162
49163  protected void composeObservationDefinitionObservationDefinitionQualifiedIntervalComponent(String name, ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
49164    if (element != null) {
49165      open(name);
49166      composeObservationDefinitionObservationDefinitionQualifiedIntervalComponentInner(element);
49167      close();
49168    }
49169  }
49170
49171  protected void composeObservationDefinitionObservationDefinitionQualifiedIntervalComponentInner(ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
49172      composeBackbone(element);
49173      if (element.hasCategoryElement()) {
49174        composeEnumerationCore("category", element.getCategoryElement(), new ObservationDefinition.ObservationRangeCategoryEnumFactory(), false);
49175        composeEnumerationExtras("category", element.getCategoryElement(), new ObservationDefinition.ObservationRangeCategoryEnumFactory(), false);
49176      }
49177      if (element.hasRange()) {
49178        composeRange("range", element.getRange());
49179      }
49180      if (element.hasContext()) {
49181        composeCodeableConcept("context", element.getContext());
49182      }
49183      if (element.hasAppliesTo()) {
49184        openArray("appliesTo");
49185        for (CodeableConcept e : element.getAppliesTo()) 
49186          composeCodeableConcept(null, e);
49187        closeArray();
49188      };
49189      if (element.hasGenderElement()) {
49190        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49191        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49192      }
49193      if (element.hasAge()) {
49194        composeRange("age", element.getAge());
49195      }
49196      if (element.hasGestationalAge()) {
49197        composeRange("gestationalAge", element.getGestationalAge());
49198      }
49199      if (element.hasConditionElement()) {
49200        composeStringCore("condition", element.getConditionElement(), false);
49201        composeStringExtras("condition", element.getConditionElement(), false);
49202      }
49203  }
49204
49205  protected void composeOperationDefinition(String name, OperationDefinition element) throws IOException {
49206    if (element != null) {
49207      prop("resourceType", name);
49208      composeOperationDefinitionInner(element);
49209    }
49210  }
49211
49212  protected void composeOperationDefinitionInner(OperationDefinition element) throws IOException {
49213      composeDomainResourceElements(element);
49214      if (element.hasUrlElement()) {
49215        composeUriCore("url", element.getUrlElement(), false);
49216        composeUriExtras("url", element.getUrlElement(), false);
49217      }
49218      if (element.hasVersionElement()) {
49219        composeStringCore("version", element.getVersionElement(), false);
49220        composeStringExtras("version", element.getVersionElement(), false);
49221      }
49222      if (element.hasNameElement()) {
49223        composeStringCore("name", element.getNameElement(), false);
49224        composeStringExtras("name", element.getNameElement(), false);
49225      }
49226      if (element.hasTitleElement()) {
49227        composeStringCore("title", element.getTitleElement(), false);
49228        composeStringExtras("title", element.getTitleElement(), false);
49229      }
49230      if (element.hasStatusElement()) {
49231        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
49232        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
49233      }
49234      if (element.hasKindElement()) {
49235        composeEnumerationCore("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
49236        composeEnumerationExtras("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
49237      }
49238      if (element.hasExperimentalElement()) {
49239        composeBooleanCore("experimental", element.getExperimentalElement(), false);
49240        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
49241      }
49242      if (element.hasDateElement()) {
49243        composeDateTimeCore("date", element.getDateElement(), false);
49244        composeDateTimeExtras("date", element.getDateElement(), false);
49245      }
49246      if (element.hasPublisherElement()) {
49247        composeStringCore("publisher", element.getPublisherElement(), false);
49248        composeStringExtras("publisher", element.getPublisherElement(), false);
49249      }
49250      if (element.hasContact()) {
49251        openArray("contact");
49252        for (ContactDetail e : element.getContact()) 
49253          composeContactDetail(null, e);
49254        closeArray();
49255      };
49256      if (element.hasDescriptionElement()) {
49257        composeMarkdownCore("description", element.getDescriptionElement(), false);
49258        composeMarkdownExtras("description", element.getDescriptionElement(), false);
49259      }
49260      if (element.hasUseContext()) {
49261        openArray("useContext");
49262        for (UsageContext e : element.getUseContext()) 
49263          composeUsageContext(null, e);
49264        closeArray();
49265      };
49266      if (element.hasJurisdiction()) {
49267        openArray("jurisdiction");
49268        for (CodeableConcept e : element.getJurisdiction()) 
49269          composeCodeableConcept(null, e);
49270        closeArray();
49271      };
49272      if (element.hasPurposeElement()) {
49273        composeMarkdownCore("purpose", element.getPurposeElement(), false);
49274        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
49275      }
49276      if (element.hasAffectsStateElement()) {
49277        composeBooleanCore("affectsState", element.getAffectsStateElement(), false);
49278        composeBooleanExtras("affectsState", element.getAffectsStateElement(), false);
49279      }
49280      if (element.hasCodeElement()) {
49281        composeCodeCore("code", element.getCodeElement(), false);
49282        composeCodeExtras("code", element.getCodeElement(), false);
49283      }
49284      if (element.hasCommentElement()) {
49285        composeMarkdownCore("comment", element.getCommentElement(), false);
49286        composeMarkdownExtras("comment", element.getCommentElement(), false);
49287      }
49288      if (element.hasBaseElement()) {
49289        composeCanonicalCore("base", element.getBaseElement(), false);
49290        composeCanonicalExtras("base", element.getBaseElement(), false);
49291      }
49292      if (element.hasResource()) {
49293        openArray("resource");
49294        for (CodeType e : element.getResource()) 
49295          composeCodeCore(null, e, true);
49296        closeArray();
49297        if (anyHasExtras(element.getResource())) {
49298          openArray("_resource");
49299          for (CodeType e : element.getResource()) 
49300            composeCodeExtras(null, e, true);
49301          closeArray();
49302        }
49303      };
49304      if (element.hasSystemElement()) {
49305        composeBooleanCore("system", element.getSystemElement(), false);
49306        composeBooleanExtras("system", element.getSystemElement(), false);
49307      }
49308      if (element.hasTypeElement()) {
49309        composeBooleanCore("type", element.getTypeElement(), false);
49310        composeBooleanExtras("type", element.getTypeElement(), false);
49311      }
49312      if (element.hasInstanceElement()) {
49313        composeBooleanCore("instance", element.getInstanceElement(), false);
49314        composeBooleanExtras("instance", element.getInstanceElement(), false);
49315      }
49316      if (element.hasInputProfileElement()) {
49317        composeCanonicalCore("inputProfile", element.getInputProfileElement(), false);
49318        composeCanonicalExtras("inputProfile", element.getInputProfileElement(), false);
49319      }
49320      if (element.hasOutputProfileElement()) {
49321        composeCanonicalCore("outputProfile", element.getOutputProfileElement(), false);
49322        composeCanonicalExtras("outputProfile", element.getOutputProfileElement(), false);
49323      }
49324      if (element.hasParameter()) {
49325        openArray("parameter");
49326        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getParameter()) 
49327          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
49328        closeArray();
49329      };
49330      if (element.hasOverload()) {
49331        openArray("overload");
49332        for (OperationDefinition.OperationDefinitionOverloadComponent e : element.getOverload()) 
49333          composeOperationDefinitionOperationDefinitionOverloadComponent(null, e);
49334        closeArray();
49335      };
49336  }
49337
49338  protected void composeOperationDefinitionOperationDefinitionParameterComponent(String name, OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
49339    if (element != null) {
49340      open(name);
49341      composeOperationDefinitionOperationDefinitionParameterComponentInner(element);
49342      close();
49343    }
49344  }
49345
49346  protected void composeOperationDefinitionOperationDefinitionParameterComponentInner(OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
49347      composeBackbone(element);
49348      if (element.hasNameElement()) {
49349        composeCodeCore("name", element.getNameElement(), false);
49350        composeCodeExtras("name", element.getNameElement(), false);
49351      }
49352      if (element.hasUseElement()) {
49353        composeEnumerationCore("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
49354        composeEnumerationExtras("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
49355      }
49356      if (element.hasMinElement()) {
49357        composeIntegerCore("min", element.getMinElement(), false);
49358        composeIntegerExtras("min", element.getMinElement(), false);
49359      }
49360      if (element.hasMaxElement()) {
49361        composeStringCore("max", element.getMaxElement(), false);
49362        composeStringExtras("max", element.getMaxElement(), false);
49363      }
49364      if (element.hasDocumentationElement()) {
49365        composeStringCore("documentation", element.getDocumentationElement(), false);
49366        composeStringExtras("documentation", element.getDocumentationElement(), false);
49367      }
49368      if (element.hasTypeElement()) {
49369        composeCodeCore("type", element.getTypeElement(), false);
49370        composeCodeExtras("type", element.getTypeElement(), false);
49371      }
49372      if (element.hasTargetProfile()) {
49373        openArray("targetProfile");
49374        for (CanonicalType e : element.getTargetProfile()) 
49375          composeCanonicalCore(null, e, true);
49376        closeArray();
49377        if (anyHasExtras(element.getTargetProfile())) {
49378          openArray("_targetProfile");
49379          for (CanonicalType e : element.getTargetProfile()) 
49380            composeCanonicalExtras(null, e, true);
49381          closeArray();
49382        }
49383      };
49384      if (element.hasSearchTypeElement()) {
49385        composeEnumerationCore("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
49386        composeEnumerationExtras("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
49387      }
49388      if (element.hasBinding()) {
49389        composeOperationDefinitionOperationDefinitionParameterBindingComponent("binding", element.getBinding());
49390      }
49391      if (element.hasReferencedFrom()) {
49392        openArray("referencedFrom");
49393        for (OperationDefinition.OperationDefinitionParameterReferencedFromComponent e : element.getReferencedFrom()) 
49394          composeOperationDefinitionOperationDefinitionParameterReferencedFromComponent(null, e);
49395        closeArray();
49396      };
49397      if (element.hasPart()) {
49398        openArray("part");
49399        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getPart()) 
49400          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
49401        closeArray();
49402      };
49403  }
49404
49405  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponent(String name, OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
49406    if (element != null) {
49407      open(name);
49408      composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(element);
49409      close();
49410    }
49411  }
49412
49413  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
49414      composeBackbone(element);
49415      if (element.hasStrengthElement()) {
49416        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
49417        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
49418      }
49419      if (element.hasValueSetElement()) {
49420        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
49421        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
49422      }
49423  }
49424
49425  protected void composeOperationDefinitionOperationDefinitionParameterReferencedFromComponent(String name, OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
49426    if (element != null) {
49427      open(name);
49428      composeOperationDefinitionOperationDefinitionParameterReferencedFromComponentInner(element);
49429      close();
49430    }
49431  }
49432
49433  protected void composeOperationDefinitionOperationDefinitionParameterReferencedFromComponentInner(OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
49434      composeBackbone(element);
49435      if (element.hasSourceElement()) {
49436        composeStringCore("source", element.getSourceElement(), false);
49437        composeStringExtras("source", element.getSourceElement(), false);
49438      }
49439      if (element.hasSourceIdElement()) {
49440        composeStringCore("sourceId", element.getSourceIdElement(), false);
49441        composeStringExtras("sourceId", element.getSourceIdElement(), false);
49442      }
49443  }
49444
49445  protected void composeOperationDefinitionOperationDefinitionOverloadComponent(String name, OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
49446    if (element != null) {
49447      open(name);
49448      composeOperationDefinitionOperationDefinitionOverloadComponentInner(element);
49449      close();
49450    }
49451  }
49452
49453  protected void composeOperationDefinitionOperationDefinitionOverloadComponentInner(OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
49454      composeBackbone(element);
49455      if (element.hasParameterName()) {
49456        openArray("parameterName");
49457        for (StringType e : element.getParameterName()) 
49458          composeStringCore(null, e, true);
49459        closeArray();
49460        if (anyHasExtras(element.getParameterName())) {
49461          openArray("_parameterName");
49462          for (StringType e : element.getParameterName()) 
49463            composeStringExtras(null, e, true);
49464          closeArray();
49465        }
49466      };
49467      if (element.hasCommentElement()) {
49468        composeStringCore("comment", element.getCommentElement(), false);
49469        composeStringExtras("comment", element.getCommentElement(), false);
49470      }
49471  }
49472
49473  protected void composeOperationOutcome(String name, OperationOutcome element) throws IOException {
49474    if (element != null) {
49475      prop("resourceType", name);
49476      composeOperationOutcomeInner(element);
49477    }
49478  }
49479
49480  protected void composeOperationOutcomeInner(OperationOutcome element) throws IOException {
49481      composeDomainResourceElements(element);
49482      if (element.hasIssue()) {
49483        openArray("issue");
49484        for (OperationOutcome.OperationOutcomeIssueComponent e : element.getIssue()) 
49485          composeOperationOutcomeOperationOutcomeIssueComponent(null, e);
49486        closeArray();
49487      };
49488  }
49489
49490  protected void composeOperationOutcomeOperationOutcomeIssueComponent(String name, OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
49491    if (element != null) {
49492      open(name);
49493      composeOperationOutcomeOperationOutcomeIssueComponentInner(element);
49494      close();
49495    }
49496  }
49497
49498  protected void composeOperationOutcomeOperationOutcomeIssueComponentInner(OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
49499      composeBackbone(element);
49500      if (element.hasSeverityElement()) {
49501        composeEnumerationCore("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
49502        composeEnumerationExtras("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
49503      }
49504      if (element.hasCodeElement()) {
49505        composeEnumerationCore("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
49506        composeEnumerationExtras("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
49507      }
49508      if (element.hasDetails()) {
49509        composeCodeableConcept("details", element.getDetails());
49510      }
49511      if (element.hasDiagnosticsElement()) {
49512        composeStringCore("diagnostics", element.getDiagnosticsElement(), false);
49513        composeStringExtras("diagnostics", element.getDiagnosticsElement(), false);
49514      }
49515      if (element.hasLocation()) {
49516        openArray("location");
49517        for (StringType e : element.getLocation()) 
49518          composeStringCore(null, e, true);
49519        closeArray();
49520        if (anyHasExtras(element.getLocation())) {
49521          openArray("_location");
49522          for (StringType e : element.getLocation()) 
49523            composeStringExtras(null, e, true);
49524          closeArray();
49525        }
49526      };
49527      if (element.hasExpression()) {
49528        openArray("expression");
49529        for (StringType e : element.getExpression()) 
49530          composeStringCore(null, e, true);
49531        closeArray();
49532        if (anyHasExtras(element.getExpression())) {
49533          openArray("_expression");
49534          for (StringType e : element.getExpression()) 
49535            composeStringExtras(null, e, true);
49536          closeArray();
49537        }
49538      };
49539  }
49540
49541  protected void composeOrganization(String name, Organization element) throws IOException {
49542    if (element != null) {
49543      prop("resourceType", name);
49544      composeOrganizationInner(element);
49545    }
49546  }
49547
49548  protected void composeOrganizationInner(Organization element) throws IOException {
49549      composeDomainResourceElements(element);
49550      if (element.hasIdentifier()) {
49551        openArray("identifier");
49552        for (Identifier e : element.getIdentifier()) 
49553          composeIdentifier(null, e);
49554        closeArray();
49555      };
49556      if (element.hasActiveElement()) {
49557        composeBooleanCore("active", element.getActiveElement(), false);
49558        composeBooleanExtras("active", element.getActiveElement(), false);
49559      }
49560      if (element.hasType()) {
49561        openArray("type");
49562        for (CodeableConcept e : element.getType()) 
49563          composeCodeableConcept(null, e);
49564        closeArray();
49565      };
49566      if (element.hasNameElement()) {
49567        composeStringCore("name", element.getNameElement(), false);
49568        composeStringExtras("name", element.getNameElement(), false);
49569      }
49570      if (element.hasAlias()) {
49571        openArray("alias");
49572        for (StringType e : element.getAlias()) 
49573          composeStringCore(null, e, true);
49574        closeArray();
49575        if (anyHasExtras(element.getAlias())) {
49576          openArray("_alias");
49577          for (StringType e : element.getAlias()) 
49578            composeStringExtras(null, e, true);
49579          closeArray();
49580        }
49581      };
49582      if (element.hasTelecom()) {
49583        openArray("telecom");
49584        for (ContactPoint e : element.getTelecom()) 
49585          composeContactPoint(null, e);
49586        closeArray();
49587      };
49588      if (element.hasAddress()) {
49589        openArray("address");
49590        for (Address e : element.getAddress()) 
49591          composeAddress(null, e);
49592        closeArray();
49593      };
49594      if (element.hasPartOf()) {
49595        composeReference("partOf", element.getPartOf());
49596      }
49597      if (element.hasContact()) {
49598        openArray("contact");
49599        for (Organization.OrganizationContactComponent e : element.getContact()) 
49600          composeOrganizationOrganizationContactComponent(null, e);
49601        closeArray();
49602      };
49603      if (element.hasEndpoint()) {
49604        openArray("endpoint");
49605        for (Reference e : element.getEndpoint()) 
49606          composeReference(null, e);
49607        closeArray();
49608      };
49609  }
49610
49611  protected void composeOrganizationOrganizationContactComponent(String name, Organization.OrganizationContactComponent element) throws IOException {
49612    if (element != null) {
49613      open(name);
49614      composeOrganizationOrganizationContactComponentInner(element);
49615      close();
49616    }
49617  }
49618
49619  protected void composeOrganizationOrganizationContactComponentInner(Organization.OrganizationContactComponent element) throws IOException {
49620      composeBackbone(element);
49621      if (element.hasPurpose()) {
49622        composeCodeableConcept("purpose", element.getPurpose());
49623      }
49624      if (element.hasName()) {
49625        composeHumanName("name", element.getName());
49626      }
49627      if (element.hasTelecom()) {
49628        openArray("telecom");
49629        for (ContactPoint e : element.getTelecom()) 
49630          composeContactPoint(null, e);
49631        closeArray();
49632      };
49633      if (element.hasAddress()) {
49634        composeAddress("address", element.getAddress());
49635      }
49636  }
49637
49638  protected void composeOrganizationAffiliation(String name, OrganizationAffiliation element) throws IOException {
49639    if (element != null) {
49640      prop("resourceType", name);
49641      composeOrganizationAffiliationInner(element);
49642    }
49643  }
49644
49645  protected void composeOrganizationAffiliationInner(OrganizationAffiliation element) throws IOException {
49646      composeDomainResourceElements(element);
49647      if (element.hasIdentifier()) {
49648        openArray("identifier");
49649        for (Identifier e : element.getIdentifier()) 
49650          composeIdentifier(null, e);
49651        closeArray();
49652      };
49653      if (element.hasActiveElement()) {
49654        composeBooleanCore("active", element.getActiveElement(), false);
49655        composeBooleanExtras("active", element.getActiveElement(), false);
49656      }
49657      if (element.hasPeriod()) {
49658        composePeriod("period", element.getPeriod());
49659      }
49660      if (element.hasOrganization()) {
49661        composeReference("organization", element.getOrganization());
49662      }
49663      if (element.hasParticipatingOrganization()) {
49664        composeReference("participatingOrganization", element.getParticipatingOrganization());
49665      }
49666      if (element.hasNetwork()) {
49667        openArray("network");
49668        for (Reference e : element.getNetwork()) 
49669          composeReference(null, e);
49670        closeArray();
49671      };
49672      if (element.hasCode()) {
49673        openArray("code");
49674        for (CodeableConcept e : element.getCode()) 
49675          composeCodeableConcept(null, e);
49676        closeArray();
49677      };
49678      if (element.hasSpecialty()) {
49679        openArray("specialty");
49680        for (CodeableConcept e : element.getSpecialty()) 
49681          composeCodeableConcept(null, e);
49682        closeArray();
49683      };
49684      if (element.hasLocation()) {
49685        openArray("location");
49686        for (Reference e : element.getLocation()) 
49687          composeReference(null, e);
49688        closeArray();
49689      };
49690      if (element.hasHealthcareService()) {
49691        openArray("healthcareService");
49692        for (Reference e : element.getHealthcareService()) 
49693          composeReference(null, e);
49694        closeArray();
49695      };
49696      if (element.hasTelecom()) {
49697        openArray("telecom");
49698        for (ContactPoint e : element.getTelecom()) 
49699          composeContactPoint(null, e);
49700        closeArray();
49701      };
49702      if (element.hasEndpoint()) {
49703        openArray("endpoint");
49704        for (Reference e : element.getEndpoint()) 
49705          composeReference(null, e);
49706        closeArray();
49707      };
49708  }
49709
49710  protected void composePatient(String name, Patient element) throws IOException {
49711    if (element != null) {
49712      prop("resourceType", name);
49713      composePatientInner(element);
49714    }
49715  }
49716
49717  protected void composePatientInner(Patient element) throws IOException {
49718      composeDomainResourceElements(element);
49719      if (element.hasIdentifier()) {
49720        openArray("identifier");
49721        for (Identifier e : element.getIdentifier()) 
49722          composeIdentifier(null, e);
49723        closeArray();
49724      };
49725      if (element.hasActiveElement()) {
49726        composeBooleanCore("active", element.getActiveElement(), false);
49727        composeBooleanExtras("active", element.getActiveElement(), false);
49728      }
49729      if (element.hasName()) {
49730        openArray("name");
49731        for (HumanName e : element.getName()) 
49732          composeHumanName(null, e);
49733        closeArray();
49734      };
49735      if (element.hasTelecom()) {
49736        openArray("telecom");
49737        for (ContactPoint e : element.getTelecom()) 
49738          composeContactPoint(null, e);
49739        closeArray();
49740      };
49741      if (element.hasGenderElement()) {
49742        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49743        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49744      }
49745      if (element.hasBirthDateElement()) {
49746        composeDateCore("birthDate", element.getBirthDateElement(), false);
49747        composeDateExtras("birthDate", element.getBirthDateElement(), false);
49748      }
49749      if (element.hasDeceased()) {
49750        composeType("deceased", element.getDeceased());
49751      }
49752      if (element.hasAddress()) {
49753        openArray("address");
49754        for (Address e : element.getAddress()) 
49755          composeAddress(null, e);
49756        closeArray();
49757      };
49758      if (element.hasMaritalStatus()) {
49759        composeCodeableConcept("maritalStatus", element.getMaritalStatus());
49760      }
49761      if (element.hasMultipleBirth()) {
49762        composeType("multipleBirth", element.getMultipleBirth());
49763      }
49764      if (element.hasPhoto()) {
49765        openArray("photo");
49766        for (Attachment e : element.getPhoto()) 
49767          composeAttachment(null, e);
49768        closeArray();
49769      };
49770      if (element.hasContact()) {
49771        openArray("contact");
49772        for (Patient.ContactComponent e : element.getContact()) 
49773          composePatientContactComponent(null, e);
49774        closeArray();
49775      };
49776      if (element.hasCommunication()) {
49777        openArray("communication");
49778        for (Patient.PatientCommunicationComponent e : element.getCommunication()) 
49779          composePatientPatientCommunicationComponent(null, e);
49780        closeArray();
49781      };
49782      if (element.hasGeneralPractitioner()) {
49783        openArray("generalPractitioner");
49784        for (Reference e : element.getGeneralPractitioner()) 
49785          composeReference(null, e);
49786        closeArray();
49787      };
49788      if (element.hasManagingOrganization()) {
49789        composeReference("managingOrganization", element.getManagingOrganization());
49790      }
49791      if (element.hasLink()) {
49792        openArray("link");
49793        for (Patient.PatientLinkComponent e : element.getLink()) 
49794          composePatientPatientLinkComponent(null, e);
49795        closeArray();
49796      };
49797  }
49798
49799  protected void composePatientContactComponent(String name, Patient.ContactComponent element) throws IOException {
49800    if (element != null) {
49801      open(name);
49802      composePatientContactComponentInner(element);
49803      close();
49804    }
49805  }
49806
49807  protected void composePatientContactComponentInner(Patient.ContactComponent element) throws IOException {
49808      composeBackbone(element);
49809      if (element.hasRelationship()) {
49810        openArray("relationship");
49811        for (CodeableConcept e : element.getRelationship()) 
49812          composeCodeableConcept(null, e);
49813        closeArray();
49814      };
49815      if (element.hasName()) {
49816        composeHumanName("name", element.getName());
49817      }
49818      if (element.hasTelecom()) {
49819        openArray("telecom");
49820        for (ContactPoint e : element.getTelecom()) 
49821          composeContactPoint(null, e);
49822        closeArray();
49823      };
49824      if (element.hasAddress()) {
49825        composeAddress("address", element.getAddress());
49826      }
49827      if (element.hasGenderElement()) {
49828        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49829        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49830      }
49831      if (element.hasOrganization()) {
49832        composeReference("organization", element.getOrganization());
49833      }
49834      if (element.hasPeriod()) {
49835        composePeriod("period", element.getPeriod());
49836      }
49837  }
49838
49839  protected void composePatientPatientCommunicationComponent(String name, Patient.PatientCommunicationComponent element) throws IOException {
49840    if (element != null) {
49841      open(name);
49842      composePatientPatientCommunicationComponentInner(element);
49843      close();
49844    }
49845  }
49846
49847  protected void composePatientPatientCommunicationComponentInner(Patient.PatientCommunicationComponent element) throws IOException {
49848      composeBackbone(element);
49849      if (element.hasLanguage()) {
49850        composeCodeableConcept("language", element.getLanguage());
49851      }
49852      if (element.hasPreferredElement()) {
49853        composeBooleanCore("preferred", element.getPreferredElement(), false);
49854        composeBooleanExtras("preferred", element.getPreferredElement(), false);
49855      }
49856  }
49857
49858  protected void composePatientPatientLinkComponent(String name, Patient.PatientLinkComponent element) throws IOException {
49859    if (element != null) {
49860      open(name);
49861      composePatientPatientLinkComponentInner(element);
49862      close();
49863    }
49864  }
49865
49866  protected void composePatientPatientLinkComponentInner(Patient.PatientLinkComponent element) throws IOException {
49867      composeBackbone(element);
49868      if (element.hasOther()) {
49869        composeReference("other", element.getOther());
49870      }
49871      if (element.hasTypeElement()) {
49872        composeEnumerationCore("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
49873        composeEnumerationExtras("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
49874      }
49875  }
49876
49877  protected void composePaymentNotice(String name, PaymentNotice element) throws IOException {
49878    if (element != null) {
49879      prop("resourceType", name);
49880      composePaymentNoticeInner(element);
49881    }
49882  }
49883
49884  protected void composePaymentNoticeInner(PaymentNotice element) throws IOException {
49885      composeDomainResourceElements(element);
49886      if (element.hasIdentifier()) {
49887        openArray("identifier");
49888        for (Identifier e : element.getIdentifier()) 
49889          composeIdentifier(null, e);
49890        closeArray();
49891      };
49892      if (element.hasStatusElement()) {
49893        composeEnumerationCore("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(), false);
49894        composeEnumerationExtras("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(), false);
49895      }
49896      if (element.hasRequest()) {
49897        composeReference("request", element.getRequest());
49898      }
49899      if (element.hasResponse()) {
49900        composeReference("response", element.getResponse());
49901      }
49902      if (element.hasCreatedElement()) {
49903        composeDateTimeCore("created", element.getCreatedElement(), false);
49904        composeDateTimeExtras("created", element.getCreatedElement(), false);
49905      }
49906      if (element.hasProvider()) {
49907        composeReference("provider", element.getProvider());
49908      }
49909      if (element.hasPayment()) {
49910        composeReference("payment", element.getPayment());
49911      }
49912      if (element.hasPaymentDateElement()) {
49913        composeDateCore("paymentDate", element.getPaymentDateElement(), false);
49914        composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
49915      }
49916      if (element.hasPayee()) {
49917        composeReference("payee", element.getPayee());
49918      }
49919      if (element.hasRecipient()) {
49920        composeReference("recipient", element.getRecipient());
49921      }
49922      if (element.hasAmount()) {
49923        composeMoney("amount", element.getAmount());
49924      }
49925      if (element.hasPaymentStatus()) {
49926        composeCodeableConcept("paymentStatus", element.getPaymentStatus());
49927      }
49928  }
49929
49930  protected void composePaymentReconciliation(String name, PaymentReconciliation element) throws IOException {
49931    if (element != null) {
49932      prop("resourceType", name);
49933      composePaymentReconciliationInner(element);
49934    }
49935  }
49936
49937  protected void composePaymentReconciliationInner(PaymentReconciliation element) throws IOException {
49938      composeDomainResourceElements(element);
49939      if (element.hasIdentifier()) {
49940        openArray("identifier");
49941        for (Identifier e : element.getIdentifier()) 
49942          composeIdentifier(null, e);
49943        closeArray();
49944      };
49945      if (element.hasStatusElement()) {
49946        composeEnumerationCore("status", element.getStatusElement(), new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
49947        composeEnumerationExtras("status", element.getStatusElement(), new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
49948      }
49949      if (element.hasPeriod()) {
49950        composePeriod("period", element.getPeriod());
49951      }
49952      if (element.hasCreatedElement()) {
49953        composeDateTimeCore("created", element.getCreatedElement(), false);
49954        composeDateTimeExtras("created", element.getCreatedElement(), false);
49955      }
49956      if (element.hasPaymentIssuer()) {
49957        composeReference("paymentIssuer", element.getPaymentIssuer());
49958      }
49959      if (element.hasRequest()) {
49960        composeReference("request", element.getRequest());
49961      }
49962      if (element.hasRequestor()) {
49963        composeReference("requestor", element.getRequestor());
49964      }
49965      if (element.hasOutcomeElement()) {
49966        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
49967        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
49968      }
49969      if (element.hasDispositionElement()) {
49970        composeStringCore("disposition", element.getDispositionElement(), false);
49971        composeStringExtras("disposition", element.getDispositionElement(), false);
49972      }
49973      if (element.hasPaymentDateElement()) {
49974        composeDateCore("paymentDate", element.getPaymentDateElement(), false);
49975        composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
49976      }
49977      if (element.hasPaymentAmount()) {
49978        composeMoney("paymentAmount", element.getPaymentAmount());
49979      }
49980      if (element.hasPaymentIdentifier()) {
49981        composeIdentifier("paymentIdentifier", element.getPaymentIdentifier());
49982      }
49983      if (element.hasDetail()) {
49984        openArray("detail");
49985        for (PaymentReconciliation.DetailsComponent e : element.getDetail()) 
49986          composePaymentReconciliationDetailsComponent(null, e);
49987        closeArray();
49988      };
49989      if (element.hasFormCode()) {
49990        composeCodeableConcept("formCode", element.getFormCode());
49991      }
49992      if (element.hasProcessNote()) {
49993        openArray("processNote");
49994        for (PaymentReconciliation.NotesComponent e : element.getProcessNote()) 
49995          composePaymentReconciliationNotesComponent(null, e);
49996        closeArray();
49997      };
49998  }
49999
50000  protected void composePaymentReconciliationDetailsComponent(String name, PaymentReconciliation.DetailsComponent element) throws IOException {
50001    if (element != null) {
50002      open(name);
50003      composePaymentReconciliationDetailsComponentInner(element);
50004      close();
50005    }
50006  }
50007
50008  protected void composePaymentReconciliationDetailsComponentInner(PaymentReconciliation.DetailsComponent element) throws IOException {
50009      composeBackbone(element);
50010      if (element.hasIdentifier()) {
50011        composeIdentifier("identifier", element.getIdentifier());
50012      }
50013      if (element.hasPredecessor()) {
50014        composeIdentifier("predecessor", element.getPredecessor());
50015      }
50016      if (element.hasType()) {
50017        composeCodeableConcept("type", element.getType());
50018      }
50019      if (element.hasRequest()) {
50020        composeReference("request", element.getRequest());
50021      }
50022      if (element.hasSubmitter()) {
50023        composeReference("submitter", element.getSubmitter());
50024      }
50025      if (element.hasResponse()) {
50026        composeReference("response", element.getResponse());
50027      }
50028      if (element.hasDateElement()) {
50029        composeDateCore("date", element.getDateElement(), false);
50030        composeDateExtras("date", element.getDateElement(), false);
50031      }
50032      if (element.hasResponsible()) {
50033        composeReference("responsible", element.getResponsible());
50034      }
50035      if (element.hasPayee()) {
50036        composeReference("payee", element.getPayee());
50037      }
50038      if (element.hasAmount()) {
50039        composeMoney("amount", element.getAmount());
50040      }
50041  }
50042
50043  protected void composePaymentReconciliationNotesComponent(String name, PaymentReconciliation.NotesComponent element) throws IOException {
50044    if (element != null) {
50045      open(name);
50046      composePaymentReconciliationNotesComponentInner(element);
50047      close();
50048    }
50049  }
50050
50051  protected void composePaymentReconciliationNotesComponentInner(PaymentReconciliation.NotesComponent element) throws IOException {
50052      composeBackbone(element);
50053      if (element.hasTypeElement()) {
50054        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
50055        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
50056      }
50057      if (element.hasTextElement()) {
50058        composeStringCore("text", element.getTextElement(), false);
50059        composeStringExtras("text", element.getTextElement(), false);
50060      }
50061  }
50062
50063  protected void composePerson(String name, Person element) throws IOException {
50064    if (element != null) {
50065      prop("resourceType", name);
50066      composePersonInner(element);
50067    }
50068  }
50069
50070  protected void composePersonInner(Person element) throws IOException {
50071      composeDomainResourceElements(element);
50072      if (element.hasIdentifier()) {
50073        openArray("identifier");
50074        for (Identifier e : element.getIdentifier()) 
50075          composeIdentifier(null, e);
50076        closeArray();
50077      };
50078      if (element.hasName()) {
50079        openArray("name");
50080        for (HumanName e : element.getName()) 
50081          composeHumanName(null, e);
50082        closeArray();
50083      };
50084      if (element.hasTelecom()) {
50085        openArray("telecom");
50086        for (ContactPoint e : element.getTelecom()) 
50087          composeContactPoint(null, e);
50088        closeArray();
50089      };
50090      if (element.hasGenderElement()) {
50091        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
50092        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
50093      }
50094      if (element.hasBirthDateElement()) {
50095        composeDateCore("birthDate", element.getBirthDateElement(), false);
50096        composeDateExtras("birthDate", element.getBirthDateElement(), false);
50097      }
50098      if (element.hasAddress()) {
50099        openArray("address");
50100        for (Address e : element.getAddress()) 
50101          composeAddress(null, e);
50102        closeArray();
50103      };
50104      if (element.hasPhoto()) {
50105        composeAttachment("photo", element.getPhoto());
50106      }
50107      if (element.hasManagingOrganization()) {
50108        composeReference("managingOrganization", element.getManagingOrganization());
50109      }
50110      if (element.hasActiveElement()) {
50111        composeBooleanCore("active", element.getActiveElement(), false);
50112        composeBooleanExtras("active", element.getActiveElement(), false);
50113      }
50114      if (element.hasLink()) {
50115        openArray("link");
50116        for (Person.PersonLinkComponent e : element.getLink()) 
50117          composePersonPersonLinkComponent(null, e);
50118        closeArray();
50119      };
50120  }
50121
50122  protected void composePersonPersonLinkComponent(String name, Person.PersonLinkComponent element) throws IOException {
50123    if (element != null) {
50124      open(name);
50125      composePersonPersonLinkComponentInner(element);
50126      close();
50127    }
50128  }
50129
50130  protected void composePersonPersonLinkComponentInner(Person.PersonLinkComponent element) throws IOException {
50131      composeBackbone(element);
50132      if (element.hasTarget()) {
50133        composeReference("target", element.getTarget());
50134      }
50135      if (element.hasAssuranceElement()) {
50136        composeEnumerationCore("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
50137        composeEnumerationExtras("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
50138      }
50139  }
50140
50141  protected void composePlanDefinition(String name, PlanDefinition element) throws IOException {
50142    if (element != null) {
50143      prop("resourceType", name);
50144      composePlanDefinitionInner(element);
50145    }
50146  }
50147
50148  protected void composePlanDefinitionInner(PlanDefinition element) throws IOException {
50149      composeDomainResourceElements(element);
50150      if (element.hasUrlElement()) {
50151        composeUriCore("url", element.getUrlElement(), false);
50152        composeUriExtras("url", element.getUrlElement(), false);
50153      }
50154      if (element.hasIdentifier()) {
50155        openArray("identifier");
50156        for (Identifier e : element.getIdentifier()) 
50157          composeIdentifier(null, e);
50158        closeArray();
50159      };
50160      if (element.hasVersionElement()) {
50161        composeStringCore("version", element.getVersionElement(), false);
50162        composeStringExtras("version", element.getVersionElement(), false);
50163      }
50164      if (element.hasNameElement()) {
50165        composeStringCore("name", element.getNameElement(), false);
50166        composeStringExtras("name", element.getNameElement(), false);
50167      }
50168      if (element.hasTitleElement()) {
50169        composeStringCore("title", element.getTitleElement(), false);
50170        composeStringExtras("title", element.getTitleElement(), false);
50171      }
50172      if (element.hasSubtitleElement()) {
50173        composeStringCore("subtitle", element.getSubtitleElement(), false);
50174        composeStringExtras("subtitle", element.getSubtitleElement(), false);
50175      }
50176      if (element.hasType()) {
50177        composeCodeableConcept("type", element.getType());
50178      }
50179      if (element.hasStatusElement()) {
50180        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
50181        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
50182      }
50183      if (element.hasExperimentalElement()) {
50184        composeBooleanCore("experimental", element.getExperimentalElement(), false);
50185        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
50186      }
50187      if (element.hasSubject()) {
50188        composeType("subject", element.getSubject());
50189      }
50190      if (element.hasDateElement()) {
50191        composeDateTimeCore("date", element.getDateElement(), false);
50192        composeDateTimeExtras("date", element.getDateElement(), false);
50193      }
50194      if (element.hasPublisherElement()) {
50195        composeStringCore("publisher", element.getPublisherElement(), false);
50196        composeStringExtras("publisher", element.getPublisherElement(), false);
50197      }
50198      if (element.hasContact()) {
50199        openArray("contact");
50200        for (ContactDetail e : element.getContact()) 
50201          composeContactDetail(null, e);
50202        closeArray();
50203      };
50204      if (element.hasDescriptionElement()) {
50205        composeMarkdownCore("description", element.getDescriptionElement(), false);
50206        composeMarkdownExtras("description", element.getDescriptionElement(), false);
50207      }
50208      if (element.hasUseContext()) {
50209        openArray("useContext");
50210        for (UsageContext e : element.getUseContext()) 
50211          composeUsageContext(null, e);
50212        closeArray();
50213      };
50214      if (element.hasJurisdiction()) {
50215        openArray("jurisdiction");
50216        for (CodeableConcept e : element.getJurisdiction()) 
50217          composeCodeableConcept(null, e);
50218        closeArray();
50219      };
50220      if (element.hasPurposeElement()) {
50221        composeMarkdownCore("purpose", element.getPurposeElement(), false);
50222        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
50223      }
50224      if (element.hasUsageElement()) {
50225        composeStringCore("usage", element.getUsageElement(), false);
50226        composeStringExtras("usage", element.getUsageElement(), false);
50227      }
50228      if (element.hasCopyrightElement()) {
50229        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
50230        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
50231      }
50232      if (element.hasApprovalDateElement()) {
50233        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
50234        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
50235      }
50236      if (element.hasLastReviewDateElement()) {
50237        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
50238        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
50239      }
50240      if (element.hasEffectivePeriod()) {
50241        composePeriod("effectivePeriod", element.getEffectivePeriod());
50242      }
50243      if (element.hasTopic()) {
50244        openArray("topic");
50245        for (CodeableConcept e : element.getTopic()) 
50246          composeCodeableConcept(null, e);
50247        closeArray();
50248      };
50249      if (element.hasAuthor()) {
50250        openArray("author");
50251        for (ContactDetail e : element.getAuthor()) 
50252          composeContactDetail(null, e);
50253        closeArray();
50254      };
50255      if (element.hasEditor()) {
50256        openArray("editor");
50257        for (ContactDetail e : element.getEditor()) 
50258          composeContactDetail(null, e);
50259        closeArray();
50260      };
50261      if (element.hasReviewer()) {
50262        openArray("reviewer");
50263        for (ContactDetail e : element.getReviewer()) 
50264          composeContactDetail(null, e);
50265        closeArray();
50266      };
50267      if (element.hasEndorser()) {
50268        openArray("endorser");
50269        for (ContactDetail e : element.getEndorser()) 
50270          composeContactDetail(null, e);
50271        closeArray();
50272      };
50273      if (element.hasRelatedArtifact()) {
50274        openArray("relatedArtifact");
50275        for (RelatedArtifact e : element.getRelatedArtifact()) 
50276          composeRelatedArtifact(null, e);
50277        closeArray();
50278      };
50279      if (element.hasLibrary()) {
50280        openArray("library");
50281        for (CanonicalType e : element.getLibrary()) 
50282          composeCanonicalCore(null, e, true);
50283        closeArray();
50284        if (anyHasExtras(element.getLibrary())) {
50285          openArray("_library");
50286          for (CanonicalType e : element.getLibrary()) 
50287            composeCanonicalExtras(null, e, true);
50288          closeArray();
50289        }
50290      };
50291      if (element.hasGoal()) {
50292        openArray("goal");
50293        for (PlanDefinition.PlanDefinitionGoalComponent e : element.getGoal()) 
50294          composePlanDefinitionPlanDefinitionGoalComponent(null, e);
50295        closeArray();
50296      };
50297      if (element.hasAction()) {
50298        openArray("action");
50299        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
50300          composePlanDefinitionPlanDefinitionActionComponent(null, e);
50301        closeArray();
50302      };
50303  }
50304
50305  protected void composePlanDefinitionPlanDefinitionGoalComponent(String name, PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
50306    if (element != null) {
50307      open(name);
50308      composePlanDefinitionPlanDefinitionGoalComponentInner(element);
50309      close();
50310    }
50311  }
50312
50313  protected void composePlanDefinitionPlanDefinitionGoalComponentInner(PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
50314      composeBackbone(element);
50315      if (element.hasCategory()) {
50316        composeCodeableConcept("category", element.getCategory());
50317      }
50318      if (element.hasDescription()) {
50319        composeCodeableConcept("description", element.getDescription());
50320      }
50321      if (element.hasPriority()) {
50322        composeCodeableConcept("priority", element.getPriority());
50323      }
50324      if (element.hasStart()) {
50325        composeCodeableConcept("start", element.getStart());
50326      }
50327      if (element.hasAddresses()) {
50328        openArray("addresses");
50329        for (CodeableConcept e : element.getAddresses()) 
50330          composeCodeableConcept(null, e);
50331        closeArray();
50332      };
50333      if (element.hasDocumentation()) {
50334        openArray("documentation");
50335        for (RelatedArtifact e : element.getDocumentation()) 
50336          composeRelatedArtifact(null, e);
50337        closeArray();
50338      };
50339      if (element.hasTarget()) {
50340        openArray("target");
50341        for (PlanDefinition.PlanDefinitionGoalTargetComponent e : element.getTarget()) 
50342          composePlanDefinitionPlanDefinitionGoalTargetComponent(null, e);
50343        closeArray();
50344      };
50345  }
50346
50347  protected void composePlanDefinitionPlanDefinitionGoalTargetComponent(String name, PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
50348    if (element != null) {
50349      open(name);
50350      composePlanDefinitionPlanDefinitionGoalTargetComponentInner(element);
50351      close();
50352    }
50353  }
50354
50355  protected void composePlanDefinitionPlanDefinitionGoalTargetComponentInner(PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
50356      composeBackbone(element);
50357      if (element.hasMeasure()) {
50358        composeCodeableConcept("measure", element.getMeasure());
50359      }
50360      if (element.hasDetail()) {
50361        composeType("detail", element.getDetail());
50362      }
50363      if (element.hasDue()) {
50364        composeDuration("due", element.getDue());
50365      }
50366  }
50367
50368  protected void composePlanDefinitionPlanDefinitionActionComponent(String name, PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
50369    if (element != null) {
50370      open(name);
50371      composePlanDefinitionPlanDefinitionActionComponentInner(element);
50372      close();
50373    }
50374  }
50375
50376  protected void composePlanDefinitionPlanDefinitionActionComponentInner(PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
50377      composeBackbone(element);
50378      if (element.hasPrefixElement()) {
50379        composeStringCore("prefix", element.getPrefixElement(), false);
50380        composeStringExtras("prefix", element.getPrefixElement(), false);
50381      }
50382      if (element.hasTitleElement()) {
50383        composeStringCore("title", element.getTitleElement(), false);
50384        composeStringExtras("title", element.getTitleElement(), false);
50385      }
50386      if (element.hasDescriptionElement()) {
50387        composeStringCore("description", element.getDescriptionElement(), false);
50388        composeStringExtras("description", element.getDescriptionElement(), false);
50389      }
50390      if (element.hasTextEquivalentElement()) {
50391        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
50392        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
50393      }
50394      if (element.hasPriorityElement()) {
50395        composeEnumerationCore("priority", element.getPriorityElement(), new PlanDefinition.RequestPriorityEnumFactory(), false);
50396        composeEnumerationExtras("priority", element.getPriorityElement(), new PlanDefinition.RequestPriorityEnumFactory(), false);
50397      }
50398      if (element.hasCode()) {
50399        openArray("code");
50400        for (CodeableConcept e : element.getCode()) 
50401          composeCodeableConcept(null, e);
50402        closeArray();
50403      };
50404      if (element.hasReason()) {
50405        openArray("reason");
50406        for (CodeableConcept e : element.getReason()) 
50407          composeCodeableConcept(null, e);
50408        closeArray();
50409      };
50410      if (element.hasDocumentation()) {
50411        openArray("documentation");
50412        for (RelatedArtifact e : element.getDocumentation()) 
50413          composeRelatedArtifact(null, e);
50414        closeArray();
50415      };
50416      if (element.hasGoalId()) {
50417        openArray("goalId");
50418        for (IdType e : element.getGoalId()) 
50419          composeIdCore(null, e, true);
50420        closeArray();
50421        if (anyHasExtras(element.getGoalId())) {
50422          openArray("_goalId");
50423          for (IdType e : element.getGoalId()) 
50424            composeIdExtras(null, e, true);
50425          closeArray();
50426        }
50427      };
50428      if (element.hasSubject()) {
50429        composeType("subject", element.getSubject());
50430      }
50431      if (element.hasTrigger()) {
50432        openArray("trigger");
50433        for (TriggerDefinition e : element.getTrigger()) 
50434          composeTriggerDefinition(null, e);
50435        closeArray();
50436      };
50437      if (element.hasCondition()) {
50438        openArray("condition");
50439        for (PlanDefinition.PlanDefinitionActionConditionComponent e : element.getCondition()) 
50440          composePlanDefinitionPlanDefinitionActionConditionComponent(null, e);
50441        closeArray();
50442      };
50443      if (element.hasInput()) {
50444        openArray("input");
50445        for (DataRequirement e : element.getInput()) 
50446          composeDataRequirement(null, e);
50447        closeArray();
50448      };
50449      if (element.hasOutput()) {
50450        openArray("output");
50451        for (DataRequirement e : element.getOutput()) 
50452          composeDataRequirement(null, e);
50453        closeArray();
50454      };
50455      if (element.hasRelatedAction()) {
50456        openArray("relatedAction");
50457        for (PlanDefinition.PlanDefinitionActionRelatedActionComponent e : element.getRelatedAction()) 
50458          composePlanDefinitionPlanDefinitionActionRelatedActionComponent(null, e);
50459        closeArray();
50460      };
50461      if (element.hasTiming()) {
50462        composeType("timing", element.getTiming());
50463      }
50464      if (element.hasParticipant()) {
50465        openArray("participant");
50466        for (PlanDefinition.PlanDefinitionActionParticipantComponent e : element.getParticipant()) 
50467          composePlanDefinitionPlanDefinitionActionParticipantComponent(null, e);
50468        closeArray();
50469      };
50470      if (element.hasType()) {
50471        composeCodeableConcept("type", element.getType());
50472      }
50473      if (element.hasGroupingBehaviorElement()) {
50474        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
50475        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
50476      }
50477      if (element.hasSelectionBehaviorElement()) {
50478        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
50479        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
50480      }
50481      if (element.hasRequiredBehaviorElement()) {
50482        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
50483        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
50484      }
50485      if (element.hasPrecheckBehaviorElement()) {
50486        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
50487        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
50488      }
50489      if (element.hasCardinalityBehaviorElement()) {
50490        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
50491        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
50492      }
50493      if (element.hasDefinition()) {
50494        composeType("definition", element.getDefinition());
50495      }
50496      if (element.hasTransformElement()) {
50497        composeCanonicalCore("transform", element.getTransformElement(), false);
50498        composeCanonicalExtras("transform", element.getTransformElement(), false);
50499      }
50500      if (element.hasDynamicValue()) {
50501        openArray("dynamicValue");
50502        for (PlanDefinition.PlanDefinitionActionDynamicValueComponent e : element.getDynamicValue()) 
50503          composePlanDefinitionPlanDefinitionActionDynamicValueComponent(null, e);
50504        closeArray();
50505      };
50506      if (element.hasAction()) {
50507        openArray("action");
50508        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
50509          composePlanDefinitionPlanDefinitionActionComponent(null, e);
50510        closeArray();
50511      };
50512  }
50513
50514  protected void composePlanDefinitionPlanDefinitionActionConditionComponent(String name, PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
50515    if (element != null) {
50516      open(name);
50517      composePlanDefinitionPlanDefinitionActionConditionComponentInner(element);
50518      close();
50519    }
50520  }
50521
50522  protected void composePlanDefinitionPlanDefinitionActionConditionComponentInner(PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
50523      composeBackbone(element);
50524      if (element.hasKindElement()) {
50525        composeEnumerationCore("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(), false);
50526        composeEnumerationExtras("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(), false);
50527      }
50528      if (element.hasExpression()) {
50529        composeExpression("expression", element.getExpression());
50530      }
50531  }
50532
50533  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponent(String name, PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
50534    if (element != null) {
50535      open(name);
50536      composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(element);
50537      close();
50538    }
50539  }
50540
50541  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
50542      composeBackbone(element);
50543      if (element.hasActionIdElement()) {
50544        composeIdCore("actionId", element.getActionIdElement(), false);
50545        composeIdExtras("actionId", element.getActionIdElement(), false);
50546      }
50547      if (element.hasRelationshipElement()) {
50548        composeEnumerationCore("relationship", element.getRelationshipElement(), new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
50549        composeEnumerationExtras("relationship", element.getRelationshipElement(), new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
50550      }
50551      if (element.hasOffset()) {
50552        composeType("offset", element.getOffset());
50553      }
50554  }
50555
50556  protected void composePlanDefinitionPlanDefinitionActionParticipantComponent(String name, PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
50557    if (element != null) {
50558      open(name);
50559      composePlanDefinitionPlanDefinitionActionParticipantComponentInner(element);
50560      close();
50561    }
50562  }
50563
50564  protected void composePlanDefinitionPlanDefinitionActionParticipantComponentInner(PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
50565      composeBackbone(element);
50566      if (element.hasTypeElement()) {
50567        composeEnumerationCore("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(), false);
50568        composeEnumerationExtras("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(), false);
50569      }
50570      if (element.hasRole()) {
50571        composeCodeableConcept("role", element.getRole());
50572      }
50573  }
50574
50575  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponent(String name, PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
50576    if (element != null) {
50577      open(name);
50578      composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(element);
50579      close();
50580    }
50581  }
50582
50583  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
50584      composeBackbone(element);
50585      if (element.hasPathElement()) {
50586        composeStringCore("path", element.getPathElement(), false);
50587        composeStringExtras("path", element.getPathElement(), false);
50588      }
50589      if (element.hasExpression()) {
50590        composeExpression("expression", element.getExpression());
50591      }
50592  }
50593
50594  protected void composePractitioner(String name, Practitioner element) throws IOException {
50595    if (element != null) {
50596      prop("resourceType", name);
50597      composePractitionerInner(element);
50598    }
50599  }
50600
50601  protected void composePractitionerInner(Practitioner element) throws IOException {
50602      composeDomainResourceElements(element);
50603      if (element.hasIdentifier()) {
50604        openArray("identifier");
50605        for (Identifier e : element.getIdentifier()) 
50606          composeIdentifier(null, e);
50607        closeArray();
50608      };
50609      if (element.hasActiveElement()) {
50610        composeBooleanCore("active", element.getActiveElement(), false);
50611        composeBooleanExtras("active", element.getActiveElement(), false);
50612      }
50613      if (element.hasName()) {
50614        openArray("name");
50615        for (HumanName e : element.getName()) 
50616          composeHumanName(null, e);
50617        closeArray();
50618      };
50619      if (element.hasTelecom()) {
50620        openArray("telecom");
50621        for (ContactPoint e : element.getTelecom()) 
50622          composeContactPoint(null, e);
50623        closeArray();
50624      };
50625      if (element.hasAddress()) {
50626        openArray("address");
50627        for (Address e : element.getAddress()) 
50628          composeAddress(null, e);
50629        closeArray();
50630      };
50631      if (element.hasGenderElement()) {
50632        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
50633        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
50634      }
50635      if (element.hasBirthDateElement()) {
50636        composeDateCore("birthDate", element.getBirthDateElement(), false);
50637        composeDateExtras("birthDate", element.getBirthDateElement(), false);
50638      }
50639      if (element.hasPhoto()) {
50640        openArray("photo");
50641        for (Attachment e : element.getPhoto()) 
50642          composeAttachment(null, e);
50643        closeArray();
50644      };
50645      if (element.hasQualification()) {
50646        openArray("qualification");
50647        for (Practitioner.PractitionerQualificationComponent e : element.getQualification()) 
50648          composePractitionerPractitionerQualificationComponent(null, e);
50649        closeArray();
50650      };
50651      if (element.hasCommunication()) {
50652        openArray("communication");
50653        for (CodeableConcept e : element.getCommunication()) 
50654          composeCodeableConcept(null, e);
50655        closeArray();
50656      };
50657  }
50658
50659  protected void composePractitionerPractitionerQualificationComponent(String name, Practitioner.PractitionerQualificationComponent element) throws IOException {
50660    if (element != null) {
50661      open(name);
50662      composePractitionerPractitionerQualificationComponentInner(element);
50663      close();
50664    }
50665  }
50666
50667  protected void composePractitionerPractitionerQualificationComponentInner(Practitioner.PractitionerQualificationComponent element) throws IOException {
50668      composeBackbone(element);
50669      if (element.hasIdentifier()) {
50670        openArray("identifier");
50671        for (Identifier e : element.getIdentifier()) 
50672          composeIdentifier(null, e);
50673        closeArray();
50674      };
50675      if (element.hasCode()) {
50676        composeCodeableConcept("code", element.getCode());
50677      }
50678      if (element.hasPeriod()) {
50679        composePeriod("period", element.getPeriod());
50680      }
50681      if (element.hasIssuer()) {
50682        composeReference("issuer", element.getIssuer());
50683      }
50684  }
50685
50686  protected void composePractitionerRole(String name, PractitionerRole element) throws IOException {
50687    if (element != null) {
50688      prop("resourceType", name);
50689      composePractitionerRoleInner(element);
50690    }
50691  }
50692
50693  protected void composePractitionerRoleInner(PractitionerRole element) throws IOException {
50694      composeDomainResourceElements(element);
50695      if (element.hasIdentifier()) {
50696        openArray("identifier");
50697        for (Identifier e : element.getIdentifier()) 
50698          composeIdentifier(null, e);
50699        closeArray();
50700      };
50701      if (element.hasActiveElement()) {
50702        composeBooleanCore("active", element.getActiveElement(), false);
50703        composeBooleanExtras("active", element.getActiveElement(), false);
50704      }
50705      if (element.hasPeriod()) {
50706        composePeriod("period", element.getPeriod());
50707      }
50708      if (element.hasPractitioner()) {
50709        composeReference("practitioner", element.getPractitioner());
50710      }
50711      if (element.hasOrganization()) {
50712        composeReference("organization", element.getOrganization());
50713      }
50714      if (element.hasCode()) {
50715        openArray("code");
50716        for (CodeableConcept e : element.getCode()) 
50717          composeCodeableConcept(null, e);
50718        closeArray();
50719      };
50720      if (element.hasSpecialty()) {
50721        openArray("specialty");
50722        for (CodeableConcept e : element.getSpecialty()) 
50723          composeCodeableConcept(null, e);
50724        closeArray();
50725      };
50726      if (element.hasLocation()) {
50727        openArray("location");
50728        for (Reference e : element.getLocation()) 
50729          composeReference(null, e);
50730        closeArray();
50731      };
50732      if (element.hasHealthcareService()) {
50733        openArray("healthcareService");
50734        for (Reference e : element.getHealthcareService()) 
50735          composeReference(null, e);
50736        closeArray();
50737      };
50738      if (element.hasTelecom()) {
50739        openArray("telecom");
50740        for (ContactPoint e : element.getTelecom()) 
50741          composeContactPoint(null, e);
50742        closeArray();
50743      };
50744      if (element.hasAvailableTime()) {
50745        openArray("availableTime");
50746        for (PractitionerRole.PractitionerRoleAvailableTimeComponent e : element.getAvailableTime()) 
50747          composePractitionerRolePractitionerRoleAvailableTimeComponent(null, e);
50748        closeArray();
50749      };
50750      if (element.hasNotAvailable()) {
50751        openArray("notAvailable");
50752        for (PractitionerRole.PractitionerRoleNotAvailableComponent e : element.getNotAvailable()) 
50753          composePractitionerRolePractitionerRoleNotAvailableComponent(null, e);
50754        closeArray();
50755      };
50756      if (element.hasAvailabilityExceptionsElement()) {
50757        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
50758        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
50759      }
50760      if (element.hasEndpoint()) {
50761        openArray("endpoint");
50762        for (Reference e : element.getEndpoint()) 
50763          composeReference(null, e);
50764        closeArray();
50765      };
50766  }
50767
50768  protected void composePractitionerRolePractitionerRoleAvailableTimeComponent(String name, PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
50769    if (element != null) {
50770      open(name);
50771      composePractitionerRolePractitionerRoleAvailableTimeComponentInner(element);
50772      close();
50773    }
50774  }
50775
50776  protected void composePractitionerRolePractitionerRoleAvailableTimeComponentInner(PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
50777      composeBackbone(element);
50778      if (element.hasDaysOfWeek()) {
50779        openArray("daysOfWeek");
50780        for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek()) 
50781          composeEnumerationCore(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
50782        closeArray();
50783        if (anyHasExtras(element.getDaysOfWeek())) {
50784          openArray("_daysOfWeek");
50785          for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek()) 
50786            composeEnumerationExtras(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
50787          closeArray();
50788        }
50789      };
50790      if (element.hasAllDayElement()) {
50791        composeBooleanCore("allDay", element.getAllDayElement(), false);
50792        composeBooleanExtras("allDay", element.getAllDayElement(), false);
50793      }
50794      if (element.hasAvailableStartTimeElement()) {
50795        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
50796        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
50797      }
50798      if (element.hasAvailableEndTimeElement()) {
50799        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
50800        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
50801      }
50802  }
50803
50804  protected void composePractitionerRolePractitionerRoleNotAvailableComponent(String name, PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
50805    if (element != null) {
50806      open(name);
50807      composePractitionerRolePractitionerRoleNotAvailableComponentInner(element);
50808      close();
50809    }
50810  }
50811
50812  protected void composePractitionerRolePractitionerRoleNotAvailableComponentInner(PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
50813      composeBackbone(element);
50814      if (element.hasDescriptionElement()) {
50815        composeStringCore("description", element.getDescriptionElement(), false);
50816        composeStringExtras("description", element.getDescriptionElement(), false);
50817      }
50818      if (element.hasDuring()) {
50819        composePeriod("during", element.getDuring());
50820      }
50821  }
50822
50823  protected void composeProcedure(String name, Procedure element) throws IOException {
50824    if (element != null) {
50825      prop("resourceType", name);
50826      composeProcedureInner(element);
50827    }
50828  }
50829
50830  protected void composeProcedureInner(Procedure element) throws IOException {
50831      composeDomainResourceElements(element);
50832      if (element.hasIdentifier()) {
50833        openArray("identifier");
50834        for (Identifier e : element.getIdentifier()) 
50835          composeIdentifier(null, e);
50836        closeArray();
50837      };
50838      if (element.hasInstantiatesCanonical()) {
50839        openArray("instantiatesCanonical");
50840        for (CanonicalType e : element.getInstantiatesCanonical()) 
50841          composeCanonicalCore(null, e, true);
50842        closeArray();
50843        if (anyHasExtras(element.getInstantiatesCanonical())) {
50844          openArray("_instantiatesCanonical");
50845          for (CanonicalType e : element.getInstantiatesCanonical()) 
50846            composeCanonicalExtras(null, e, true);
50847          closeArray();
50848        }
50849      };
50850      if (element.hasInstantiatesUri()) {
50851        openArray("instantiatesUri");
50852        for (UriType e : element.getInstantiatesUri()) 
50853          composeUriCore(null, e, true);
50854        closeArray();
50855        if (anyHasExtras(element.getInstantiatesUri())) {
50856          openArray("_instantiatesUri");
50857          for (UriType e : element.getInstantiatesUri()) 
50858            composeUriExtras(null, e, true);
50859          closeArray();
50860        }
50861      };
50862      if (element.hasBasedOn()) {
50863        openArray("basedOn");
50864        for (Reference e : element.getBasedOn()) 
50865          composeReference(null, e);
50866        closeArray();
50867      };
50868      if (element.hasPartOf()) {
50869        openArray("partOf");
50870        for (Reference e : element.getPartOf()) 
50871          composeReference(null, e);
50872        closeArray();
50873      };
50874      if (element.hasStatusElement()) {
50875        composeEnumerationCore("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
50876        composeEnumerationExtras("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
50877      }
50878      if (element.hasStatusReason()) {
50879        composeCodeableConcept("statusReason", element.getStatusReason());
50880      }
50881      if (element.hasCategory()) {
50882        composeCodeableConcept("category", element.getCategory());
50883      }
50884      if (element.hasCode()) {
50885        composeCodeableConcept("code", element.getCode());
50886      }
50887      if (element.hasSubject()) {
50888        composeReference("subject", element.getSubject());
50889      }
50890      if (element.hasEncounter()) {
50891        composeReference("encounter", element.getEncounter());
50892      }
50893      if (element.hasPerformed()) {
50894        composeType("performed", element.getPerformed());
50895      }
50896      if (element.hasRecorder()) {
50897        composeReference("recorder", element.getRecorder());
50898      }
50899      if (element.hasAsserter()) {
50900        composeReference("asserter", element.getAsserter());
50901      }
50902      if (element.hasPerformer()) {
50903        openArray("performer");
50904        for (Procedure.ProcedurePerformerComponent e : element.getPerformer()) 
50905          composeProcedureProcedurePerformerComponent(null, e);
50906        closeArray();
50907      };
50908      if (element.hasLocation()) {
50909        composeReference("location", element.getLocation());
50910      }
50911      if (element.hasReasonCode()) {
50912        openArray("reasonCode");
50913        for (CodeableConcept e : element.getReasonCode()) 
50914          composeCodeableConcept(null, e);
50915        closeArray();
50916      };
50917      if (element.hasReasonReference()) {
50918        openArray("reasonReference");
50919        for (Reference e : element.getReasonReference()) 
50920          composeReference(null, e);
50921        closeArray();
50922      };
50923      if (element.hasBodySite()) {
50924        openArray("bodySite");
50925        for (CodeableConcept e : element.getBodySite()) 
50926          composeCodeableConcept(null, e);
50927        closeArray();
50928      };
50929      if (element.hasOutcome()) {
50930        composeCodeableConcept("outcome", element.getOutcome());
50931      }
50932      if (element.hasReport()) {
50933        openArray("report");
50934        for (Reference e : element.getReport()) 
50935          composeReference(null, e);
50936        closeArray();
50937      };
50938      if (element.hasComplication()) {
50939        openArray("complication");
50940        for (CodeableConcept e : element.getComplication()) 
50941          composeCodeableConcept(null, e);
50942        closeArray();
50943      };
50944      if (element.hasComplicationDetail()) {
50945        openArray("complicationDetail");
50946        for (Reference e : element.getComplicationDetail()) 
50947          composeReference(null, e);
50948        closeArray();
50949      };
50950      if (element.hasFollowUp()) {
50951        openArray("followUp");
50952        for (CodeableConcept e : element.getFollowUp()) 
50953          composeCodeableConcept(null, e);
50954        closeArray();
50955      };
50956      if (element.hasNote()) {
50957        openArray("note");
50958        for (Annotation e : element.getNote()) 
50959          composeAnnotation(null, e);
50960        closeArray();
50961      };
50962      if (element.hasFocalDevice()) {
50963        openArray("focalDevice");
50964        for (Procedure.ProcedureFocalDeviceComponent e : element.getFocalDevice()) 
50965          composeProcedureProcedureFocalDeviceComponent(null, e);
50966        closeArray();
50967      };
50968      if (element.hasUsedReference()) {
50969        openArray("usedReference");
50970        for (Reference e : element.getUsedReference()) 
50971          composeReference(null, e);
50972        closeArray();
50973      };
50974      if (element.hasUsedCode()) {
50975        openArray("usedCode");
50976        for (CodeableConcept e : element.getUsedCode()) 
50977          composeCodeableConcept(null, e);
50978        closeArray();
50979      };
50980  }
50981
50982  protected void composeProcedureProcedurePerformerComponent(String name, Procedure.ProcedurePerformerComponent element) throws IOException {
50983    if (element != null) {
50984      open(name);
50985      composeProcedureProcedurePerformerComponentInner(element);
50986      close();
50987    }
50988  }
50989
50990  protected void composeProcedureProcedurePerformerComponentInner(Procedure.ProcedurePerformerComponent element) throws IOException {
50991      composeBackbone(element);
50992      if (element.hasFunction()) {
50993        composeCodeableConcept("function", element.getFunction());
50994      }
50995      if (element.hasActor()) {
50996        composeReference("actor", element.getActor());
50997      }
50998      if (element.hasOnBehalfOf()) {
50999        composeReference("onBehalfOf", element.getOnBehalfOf());
51000      }
51001  }
51002
51003  protected void composeProcedureProcedureFocalDeviceComponent(String name, Procedure.ProcedureFocalDeviceComponent element) throws IOException {
51004    if (element != null) {
51005      open(name);
51006      composeProcedureProcedureFocalDeviceComponentInner(element);
51007      close();
51008    }
51009  }
51010
51011  protected void composeProcedureProcedureFocalDeviceComponentInner(Procedure.ProcedureFocalDeviceComponent element) throws IOException {
51012      composeBackbone(element);
51013      if (element.hasAction()) {
51014        composeCodeableConcept("action", element.getAction());
51015      }
51016      if (element.hasManipulated()) {
51017        composeReference("manipulated", element.getManipulated());
51018      }
51019  }
51020
51021  protected void composeProvenance(String name, Provenance element) throws IOException {
51022    if (element != null) {
51023      prop("resourceType", name);
51024      composeProvenanceInner(element);
51025    }
51026  }
51027
51028  protected void composeProvenanceInner(Provenance element) throws IOException {
51029      composeDomainResourceElements(element);
51030      if (element.hasTarget()) {
51031        openArray("target");
51032        for (Reference e : element.getTarget()) 
51033          composeReference(null, e);
51034        closeArray();
51035      };
51036      if (element.hasOccurred()) {
51037        composeType("occurred", element.getOccurred());
51038      }
51039      if (element.hasRecordedElement()) {
51040        composeInstantCore("recorded", element.getRecordedElement(), false);
51041        composeInstantExtras("recorded", element.getRecordedElement(), false);
51042      }
51043      if (element.hasPolicy()) {
51044        openArray("policy");
51045        for (UriType e : element.getPolicy()) 
51046          composeUriCore(null, e, true);
51047        closeArray();
51048        if (anyHasExtras(element.getPolicy())) {
51049          openArray("_policy");
51050          for (UriType e : element.getPolicy()) 
51051            composeUriExtras(null, e, true);
51052          closeArray();
51053        }
51054      };
51055      if (element.hasLocation()) {
51056        composeReference("location", element.getLocation());
51057      }
51058      if (element.hasReason()) {
51059        openArray("reason");
51060        for (CodeableConcept e : element.getReason()) 
51061          composeCodeableConcept(null, e);
51062        closeArray();
51063      };
51064      if (element.hasActivity()) {
51065        composeCodeableConcept("activity", element.getActivity());
51066      }
51067      if (element.hasAgent()) {
51068        openArray("agent");
51069        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
51070          composeProvenanceProvenanceAgentComponent(null, e);
51071        closeArray();
51072      };
51073      if (element.hasEntity()) {
51074        openArray("entity");
51075        for (Provenance.ProvenanceEntityComponent e : element.getEntity()) 
51076          composeProvenanceProvenanceEntityComponent(null, e);
51077        closeArray();
51078      };
51079      if (element.hasSignature()) {
51080        openArray("signature");
51081        for (Signature e : element.getSignature()) 
51082          composeSignature(null, e);
51083        closeArray();
51084      };
51085  }
51086
51087  protected void composeProvenanceProvenanceAgentComponent(String name, Provenance.ProvenanceAgentComponent element) throws IOException {
51088    if (element != null) {
51089      open(name);
51090      composeProvenanceProvenanceAgentComponentInner(element);
51091      close();
51092    }
51093  }
51094
51095  protected void composeProvenanceProvenanceAgentComponentInner(Provenance.ProvenanceAgentComponent element) throws IOException {
51096      composeBackbone(element);
51097      if (element.hasType()) {
51098        composeCodeableConcept("type", element.getType());
51099      }
51100      if (element.hasRole()) {
51101        openArray("role");
51102        for (CodeableConcept e : element.getRole()) 
51103          composeCodeableConcept(null, e);
51104        closeArray();
51105      };
51106      if (element.hasWho()) {
51107        composeReference("who", element.getWho());
51108      }
51109      if (element.hasOnBehalfOf()) {
51110        composeReference("onBehalfOf", element.getOnBehalfOf());
51111      }
51112  }
51113
51114  protected void composeProvenanceProvenanceEntityComponent(String name, Provenance.ProvenanceEntityComponent element) throws IOException {
51115    if (element != null) {
51116      open(name);
51117      composeProvenanceProvenanceEntityComponentInner(element);
51118      close();
51119    }
51120  }
51121
51122  protected void composeProvenanceProvenanceEntityComponentInner(Provenance.ProvenanceEntityComponent element) throws IOException {
51123      composeBackbone(element);
51124      if (element.hasRoleElement()) {
51125        composeEnumerationCore("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
51126        composeEnumerationExtras("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
51127      }
51128      if (element.hasWhat()) {
51129        composeReference("what", element.getWhat());
51130      }
51131      if (element.hasAgent()) {
51132        openArray("agent");
51133        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
51134          composeProvenanceProvenanceAgentComponent(null, e);
51135        closeArray();
51136      };
51137  }
51138
51139  protected void composeQuestionnaire(String name, Questionnaire element) throws IOException {
51140    if (element != null) {
51141      prop("resourceType", name);
51142      composeQuestionnaireInner(element);
51143    }
51144  }
51145
51146  protected void composeQuestionnaireInner(Questionnaire element) throws IOException {
51147      composeDomainResourceElements(element);
51148      if (element.hasUrlElement()) {
51149        composeUriCore("url", element.getUrlElement(), false);
51150        composeUriExtras("url", element.getUrlElement(), false);
51151      }
51152      if (element.hasIdentifier()) {
51153        openArray("identifier");
51154        for (Identifier e : element.getIdentifier()) 
51155          composeIdentifier(null, e);
51156        closeArray();
51157      };
51158      if (element.hasVersionElement()) {
51159        composeStringCore("version", element.getVersionElement(), false);
51160        composeStringExtras("version", element.getVersionElement(), false);
51161      }
51162      if (element.hasNameElement()) {
51163        composeStringCore("name", element.getNameElement(), false);
51164        composeStringExtras("name", element.getNameElement(), false);
51165      }
51166      if (element.hasTitleElement()) {
51167        composeStringCore("title", element.getTitleElement(), false);
51168        composeStringExtras("title", element.getTitleElement(), false);
51169      }
51170      if (element.hasDerivedFrom()) {
51171        openArray("derivedFrom");
51172        for (CanonicalType e : element.getDerivedFrom()) 
51173          composeCanonicalCore(null, e, true);
51174        closeArray();
51175        if (anyHasExtras(element.getDerivedFrom())) {
51176          openArray("_derivedFrom");
51177          for (CanonicalType e : element.getDerivedFrom()) 
51178            composeCanonicalExtras(null, e, true);
51179          closeArray();
51180        }
51181      };
51182      if (element.hasStatusElement()) {
51183        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51184        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51185      }
51186      if (element.hasExperimentalElement()) {
51187        composeBooleanCore("experimental", element.getExperimentalElement(), false);
51188        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
51189      }
51190      if (element.hasSubjectType()) {
51191        openArray("subjectType");
51192        for (CodeType e : element.getSubjectType()) 
51193          composeCodeCore(null, e, true);
51194        closeArray();
51195        if (anyHasExtras(element.getSubjectType())) {
51196          openArray("_subjectType");
51197          for (CodeType e : element.getSubjectType()) 
51198            composeCodeExtras(null, e, true);
51199          closeArray();
51200        }
51201      };
51202      if (element.hasDateElement()) {
51203        composeDateTimeCore("date", element.getDateElement(), false);
51204        composeDateTimeExtras("date", element.getDateElement(), false);
51205      }
51206      if (element.hasPublisherElement()) {
51207        composeStringCore("publisher", element.getPublisherElement(), false);
51208        composeStringExtras("publisher", element.getPublisherElement(), false);
51209      }
51210      if (element.hasContact()) {
51211        openArray("contact");
51212        for (ContactDetail e : element.getContact()) 
51213          composeContactDetail(null, e);
51214        closeArray();
51215      };
51216      if (element.hasDescriptionElement()) {
51217        composeMarkdownCore("description", element.getDescriptionElement(), false);
51218        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51219      }
51220      if (element.hasUseContext()) {
51221        openArray("useContext");
51222        for (UsageContext e : element.getUseContext()) 
51223          composeUsageContext(null, e);
51224        closeArray();
51225      };
51226      if (element.hasJurisdiction()) {
51227        openArray("jurisdiction");
51228        for (CodeableConcept e : element.getJurisdiction()) 
51229          composeCodeableConcept(null, e);
51230        closeArray();
51231      };
51232      if (element.hasPurposeElement()) {
51233        composeMarkdownCore("purpose", element.getPurposeElement(), false);
51234        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
51235      }
51236      if (element.hasCopyrightElement()) {
51237        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
51238        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
51239      }
51240      if (element.hasApprovalDateElement()) {
51241        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
51242        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
51243      }
51244      if (element.hasLastReviewDateElement()) {
51245        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
51246        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
51247      }
51248      if (element.hasEffectivePeriod()) {
51249        composePeriod("effectivePeriod", element.getEffectivePeriod());
51250      }
51251      if (element.hasCode()) {
51252        openArray("code");
51253        for (Coding e : element.getCode()) 
51254          composeCoding(null, e);
51255        closeArray();
51256      };
51257      if (element.hasItem()) {
51258        openArray("item");
51259        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
51260          composeQuestionnaireQuestionnaireItemComponent(null, e);
51261        closeArray();
51262      };
51263  }
51264
51265  protected void composeQuestionnaireQuestionnaireItemComponent(String name, Questionnaire.QuestionnaireItemComponent element) throws IOException {
51266    if (element != null) {
51267      open(name);
51268      composeQuestionnaireQuestionnaireItemComponentInner(element);
51269      close();
51270    }
51271  }
51272
51273  protected void composeQuestionnaireQuestionnaireItemComponentInner(Questionnaire.QuestionnaireItemComponent element) throws IOException {
51274      composeBackbone(element);
51275      if (element.hasLinkIdElement()) {
51276        composeStringCore("linkId", element.getLinkIdElement(), false);
51277        composeStringExtras("linkId", element.getLinkIdElement(), false);
51278      }
51279      if (element.hasDefinitionElement()) {
51280        composeUriCore("definition", element.getDefinitionElement(), false);
51281        composeUriExtras("definition", element.getDefinitionElement(), false);
51282      }
51283      if (element.hasCode()) {
51284        openArray("code");
51285        for (Coding e : element.getCode()) 
51286          composeCoding(null, e);
51287        closeArray();
51288      };
51289      if (element.hasPrefixElement()) {
51290        composeStringCore("prefix", element.getPrefixElement(), false);
51291        composeStringExtras("prefix", element.getPrefixElement(), false);
51292      }
51293      if (element.hasTextElement()) {
51294        composeStringCore("text", element.getTextElement(), false);
51295        composeStringExtras("text", element.getTextElement(), false);
51296      }
51297      if (element.hasTypeElement()) {
51298        composeEnumerationCore("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
51299        composeEnumerationExtras("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
51300      }
51301      if (element.hasEnableWhen()) {
51302        openArray("enableWhen");
51303        for (Questionnaire.QuestionnaireItemEnableWhenComponent e : element.getEnableWhen()) 
51304          composeQuestionnaireQuestionnaireItemEnableWhenComponent(null, e);
51305        closeArray();
51306      };
51307      if (element.hasEnableBehaviorElement()) {
51308        composeEnumerationCore("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
51309        composeEnumerationExtras("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
51310      }
51311      if (element.hasRequiredElement()) {
51312        composeBooleanCore("required", element.getRequiredElement(), false);
51313        composeBooleanExtras("required", element.getRequiredElement(), false);
51314      }
51315      if (element.hasRepeatsElement()) {
51316        composeBooleanCore("repeats", element.getRepeatsElement(), false);
51317        composeBooleanExtras("repeats", element.getRepeatsElement(), false);
51318      }
51319      if (element.hasReadOnlyElement()) {
51320        composeBooleanCore("readOnly", element.getReadOnlyElement(), false);
51321        composeBooleanExtras("readOnly", element.getReadOnlyElement(), false);
51322      }
51323      if (element.hasMaxLengthElement()) {
51324        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
51325        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
51326      }
51327      if (element.hasAnswerValueSetElement()) {
51328        composeCanonicalCore("answerValueSet", element.getAnswerValueSetElement(), false);
51329        composeCanonicalExtras("answerValueSet", element.getAnswerValueSetElement(), false);
51330      }
51331      if (element.hasAnswerOption()) {
51332        openArray("answerOption");
51333        for (Questionnaire.QuestionnaireItemAnswerOptionComponent e : element.getAnswerOption()) 
51334          composeQuestionnaireQuestionnaireItemAnswerOptionComponent(null, e);
51335        closeArray();
51336      };
51337      if (element.hasInitial()) {
51338        openArray("initial");
51339        for (Questionnaire.QuestionnaireItemInitialComponent e : element.getInitial()) 
51340          composeQuestionnaireQuestionnaireItemInitialComponent(null, e);
51341        closeArray();
51342      };
51343      if (element.hasItem()) {
51344        openArray("item");
51345        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
51346          composeQuestionnaireQuestionnaireItemComponent(null, e);
51347        closeArray();
51348      };
51349  }
51350
51351  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponent(String name, Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
51352    if (element != null) {
51353      open(name);
51354      composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(element);
51355      close();
51356    }
51357  }
51358
51359  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
51360      composeBackbone(element);
51361      if (element.hasQuestionElement()) {
51362        composeStringCore("question", element.getQuestionElement(), false);
51363        composeStringExtras("question", element.getQuestionElement(), false);
51364      }
51365      if (element.hasOperatorElement()) {
51366        composeEnumerationCore("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
51367        composeEnumerationExtras("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
51368      }
51369      if (element.hasAnswer()) {
51370        composeType("answer", element.getAnswer());
51371      }
51372  }
51373
51374  protected void composeQuestionnaireQuestionnaireItemAnswerOptionComponent(String name, Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
51375    if (element != null) {
51376      open(name);
51377      composeQuestionnaireQuestionnaireItemAnswerOptionComponentInner(element);
51378      close();
51379    }
51380  }
51381
51382  protected void composeQuestionnaireQuestionnaireItemAnswerOptionComponentInner(Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
51383      composeBackbone(element);
51384      if (element.hasValue()) {
51385        composeType("value", element.getValue());
51386      }
51387      if (element.hasInitialSelectedElement()) {
51388        composeBooleanCore("initialSelected", element.getInitialSelectedElement(), false);
51389        composeBooleanExtras("initialSelected", element.getInitialSelectedElement(), false);
51390      }
51391  }
51392
51393  protected void composeQuestionnaireQuestionnaireItemInitialComponent(String name, Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
51394    if (element != null) {
51395      open(name);
51396      composeQuestionnaireQuestionnaireItemInitialComponentInner(element);
51397      close();
51398    }
51399  }
51400
51401  protected void composeQuestionnaireQuestionnaireItemInitialComponentInner(Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
51402      composeBackbone(element);
51403      if (element.hasValue()) {
51404        composeType("value", element.getValue());
51405      }
51406  }
51407
51408  protected void composeQuestionnaireResponse(String name, QuestionnaireResponse element) throws IOException {
51409    if (element != null) {
51410      prop("resourceType", name);
51411      composeQuestionnaireResponseInner(element);
51412    }
51413  }
51414
51415  protected void composeQuestionnaireResponseInner(QuestionnaireResponse element) throws IOException {
51416      composeDomainResourceElements(element);
51417      if (element.hasIdentifier()) {
51418        composeIdentifier("identifier", element.getIdentifier());
51419      }
51420      if (element.hasBasedOn()) {
51421        openArray("basedOn");
51422        for (Reference e : element.getBasedOn()) 
51423          composeReference(null, e);
51424        closeArray();
51425      };
51426      if (element.hasPartOf()) {
51427        openArray("partOf");
51428        for (Reference e : element.getPartOf()) 
51429          composeReference(null, e);
51430        closeArray();
51431      };
51432      if (element.hasQuestionnaireElement()) {
51433        composeCanonicalCore("questionnaire", element.getQuestionnaireElement(), false);
51434        composeCanonicalExtras("questionnaire", element.getQuestionnaireElement(), false);
51435      }
51436      if (element.hasStatusElement()) {
51437        composeEnumerationCore("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
51438        composeEnumerationExtras("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
51439      }
51440      if (element.hasSubject()) {
51441        composeReference("subject", element.getSubject());
51442      }
51443      if (element.hasEncounter()) {
51444        composeReference("encounter", element.getEncounter());
51445      }
51446      if (element.hasAuthoredElement()) {
51447        composeDateTimeCore("authored", element.getAuthoredElement(), false);
51448        composeDateTimeExtras("authored", element.getAuthoredElement(), false);
51449      }
51450      if (element.hasAuthor()) {
51451        composeReference("author", element.getAuthor());
51452      }
51453      if (element.hasSource()) {
51454        composeReference("source", element.getSource());
51455      }
51456      if (element.hasItem()) {
51457        openArray("item");
51458        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
51459          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
51460        closeArray();
51461      };
51462  }
51463
51464  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
51465    if (element != null) {
51466      open(name);
51467      composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(element);
51468      close();
51469    }
51470  }
51471
51472  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
51473      composeBackbone(element);
51474      if (element.hasLinkIdElement()) {
51475        composeStringCore("linkId", element.getLinkIdElement(), false);
51476        composeStringExtras("linkId", element.getLinkIdElement(), false);
51477      }
51478      if (element.hasDefinitionElement()) {
51479        composeUriCore("definition", element.getDefinitionElement(), false);
51480        composeUriExtras("definition", element.getDefinitionElement(), false);
51481      }
51482      if (element.hasTextElement()) {
51483        composeStringCore("text", element.getTextElement(), false);
51484        composeStringExtras("text", element.getTextElement(), false);
51485      }
51486      if (element.hasAnswer()) {
51487        openArray("answer");
51488        for (QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent e : element.getAnswer()) 
51489          composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(null, e);
51490        closeArray();
51491      };
51492      if (element.hasItem()) {
51493        openArray("item");
51494        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
51495          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
51496        closeArray();
51497      };
51498  }
51499
51500  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
51501    if (element != null) {
51502      open(name);
51503      composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(element);
51504      close();
51505    }
51506  }
51507
51508  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
51509      composeBackbone(element);
51510      if (element.hasValue()) {
51511        composeType("value", element.getValue());
51512      }
51513      if (element.hasItem()) {
51514        openArray("item");
51515        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
51516          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
51517        closeArray();
51518      };
51519  }
51520
51521  protected void composeRelatedPerson(String name, RelatedPerson element) throws IOException {
51522    if (element != null) {
51523      prop("resourceType", name);
51524      composeRelatedPersonInner(element);
51525    }
51526  }
51527
51528  protected void composeRelatedPersonInner(RelatedPerson element) throws IOException {
51529      composeDomainResourceElements(element);
51530      if (element.hasIdentifier()) {
51531        openArray("identifier");
51532        for (Identifier e : element.getIdentifier()) 
51533          composeIdentifier(null, e);
51534        closeArray();
51535      };
51536      if (element.hasActiveElement()) {
51537        composeBooleanCore("active", element.getActiveElement(), false);
51538        composeBooleanExtras("active", element.getActiveElement(), false);
51539      }
51540      if (element.hasPatient()) {
51541        composeReference("patient", element.getPatient());
51542      }
51543      if (element.hasRelationship()) {
51544        openArray("relationship");
51545        for (CodeableConcept e : element.getRelationship()) 
51546          composeCodeableConcept(null, e);
51547        closeArray();
51548      };
51549      if (element.hasName()) {
51550        openArray("name");
51551        for (HumanName e : element.getName()) 
51552          composeHumanName(null, e);
51553        closeArray();
51554      };
51555      if (element.hasTelecom()) {
51556        openArray("telecom");
51557        for (ContactPoint e : element.getTelecom()) 
51558          composeContactPoint(null, e);
51559        closeArray();
51560      };
51561      if (element.hasGenderElement()) {
51562        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
51563        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
51564      }
51565      if (element.hasBirthDateElement()) {
51566        composeDateCore("birthDate", element.getBirthDateElement(), false);
51567        composeDateExtras("birthDate", element.getBirthDateElement(), false);
51568      }
51569      if (element.hasAddress()) {
51570        openArray("address");
51571        for (Address e : element.getAddress()) 
51572          composeAddress(null, e);
51573        closeArray();
51574      };
51575      if (element.hasPhoto()) {
51576        openArray("photo");
51577        for (Attachment e : element.getPhoto()) 
51578          composeAttachment(null, e);
51579        closeArray();
51580      };
51581      if (element.hasPeriod()) {
51582        composePeriod("period", element.getPeriod());
51583      }
51584      if (element.hasCommunication()) {
51585        openArray("communication");
51586        for (RelatedPerson.RelatedPersonCommunicationComponent e : element.getCommunication()) 
51587          composeRelatedPersonRelatedPersonCommunicationComponent(null, e);
51588        closeArray();
51589      };
51590  }
51591
51592  protected void composeRelatedPersonRelatedPersonCommunicationComponent(String name, RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
51593    if (element != null) {
51594      open(name);
51595      composeRelatedPersonRelatedPersonCommunicationComponentInner(element);
51596      close();
51597    }
51598  }
51599
51600  protected void composeRelatedPersonRelatedPersonCommunicationComponentInner(RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
51601      composeBackbone(element);
51602      if (element.hasLanguage()) {
51603        composeCodeableConcept("language", element.getLanguage());
51604      }
51605      if (element.hasPreferredElement()) {
51606        composeBooleanCore("preferred", element.getPreferredElement(), false);
51607        composeBooleanExtras("preferred", element.getPreferredElement(), false);
51608      }
51609  }
51610
51611  protected void composeRequestGroup(String name, RequestGroup element) throws IOException {
51612    if (element != null) {
51613      prop("resourceType", name);
51614      composeRequestGroupInner(element);
51615    }
51616  }
51617
51618  protected void composeRequestGroupInner(RequestGroup element) throws IOException {
51619      composeDomainResourceElements(element);
51620      if (element.hasIdentifier()) {
51621        openArray("identifier");
51622        for (Identifier e : element.getIdentifier()) 
51623          composeIdentifier(null, e);
51624        closeArray();
51625      };
51626      if (element.hasInstantiatesCanonical()) {
51627        openArray("instantiatesCanonical");
51628        for (CanonicalType e : element.getInstantiatesCanonical()) 
51629          composeCanonicalCore(null, e, true);
51630        closeArray();
51631        if (anyHasExtras(element.getInstantiatesCanonical())) {
51632          openArray("_instantiatesCanonical");
51633          for (CanonicalType e : element.getInstantiatesCanonical()) 
51634            composeCanonicalExtras(null, e, true);
51635          closeArray();
51636        }
51637      };
51638      if (element.hasInstantiatesUri()) {
51639        openArray("instantiatesUri");
51640        for (UriType e : element.getInstantiatesUri()) 
51641          composeUriCore(null, e, true);
51642        closeArray();
51643        if (anyHasExtras(element.getInstantiatesUri())) {
51644          openArray("_instantiatesUri");
51645          for (UriType e : element.getInstantiatesUri()) 
51646            composeUriExtras(null, e, true);
51647          closeArray();
51648        }
51649      };
51650      if (element.hasBasedOn()) {
51651        openArray("basedOn");
51652        for (Reference e : element.getBasedOn()) 
51653          composeReference(null, e);
51654        closeArray();
51655      };
51656      if (element.hasReplaces()) {
51657        openArray("replaces");
51658        for (Reference e : element.getReplaces()) 
51659          composeReference(null, e);
51660        closeArray();
51661      };
51662      if (element.hasGroupIdentifier()) {
51663        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
51664      }
51665      if (element.hasStatusElement()) {
51666        composeEnumerationCore("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(), false);
51667        composeEnumerationExtras("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(), false);
51668      }
51669      if (element.hasIntentElement()) {
51670        composeEnumerationCore("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(), false);
51671        composeEnumerationExtras("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(), false);
51672      }
51673      if (element.hasPriorityElement()) {
51674        composeEnumerationCore("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
51675        composeEnumerationExtras("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
51676      }
51677      if (element.hasCode()) {
51678        composeCodeableConcept("code", element.getCode());
51679      }
51680      if (element.hasSubject()) {
51681        composeReference("subject", element.getSubject());
51682      }
51683      if (element.hasEncounter()) {
51684        composeReference("encounter", element.getEncounter());
51685      }
51686      if (element.hasAuthoredOnElement()) {
51687        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
51688        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
51689      }
51690      if (element.hasAuthor()) {
51691        composeReference("author", element.getAuthor());
51692      }
51693      if (element.hasReasonCode()) {
51694        openArray("reasonCode");
51695        for (CodeableConcept e : element.getReasonCode()) 
51696          composeCodeableConcept(null, e);
51697        closeArray();
51698      };
51699      if (element.hasReasonReference()) {
51700        openArray("reasonReference");
51701        for (Reference e : element.getReasonReference()) 
51702          composeReference(null, e);
51703        closeArray();
51704      };
51705      if (element.hasNote()) {
51706        openArray("note");
51707        for (Annotation e : element.getNote()) 
51708          composeAnnotation(null, e);
51709        closeArray();
51710      };
51711      if (element.hasAction()) {
51712        openArray("action");
51713        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
51714          composeRequestGroupRequestGroupActionComponent(null, e);
51715        closeArray();
51716      };
51717  }
51718
51719  protected void composeRequestGroupRequestGroupActionComponent(String name, RequestGroup.RequestGroupActionComponent element) throws IOException {
51720    if (element != null) {
51721      open(name);
51722      composeRequestGroupRequestGroupActionComponentInner(element);
51723      close();
51724    }
51725  }
51726
51727  protected void composeRequestGroupRequestGroupActionComponentInner(RequestGroup.RequestGroupActionComponent element) throws IOException {
51728      composeBackbone(element);
51729      if (element.hasPrefixElement()) {
51730        composeStringCore("prefix", element.getPrefixElement(), false);
51731        composeStringExtras("prefix", element.getPrefixElement(), false);
51732      }
51733      if (element.hasTitleElement()) {
51734        composeStringCore("title", element.getTitleElement(), false);
51735        composeStringExtras("title", element.getTitleElement(), false);
51736      }
51737      if (element.hasDescriptionElement()) {
51738        composeStringCore("description", element.getDescriptionElement(), false);
51739        composeStringExtras("description", element.getDescriptionElement(), false);
51740      }
51741      if (element.hasTextEquivalentElement()) {
51742        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
51743        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
51744      }
51745      if (element.hasPriorityElement()) {
51746        composeEnumerationCore("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
51747        composeEnumerationExtras("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
51748      }
51749      if (element.hasCode()) {
51750        openArray("code");
51751        for (CodeableConcept e : element.getCode()) 
51752          composeCodeableConcept(null, e);
51753        closeArray();
51754      };
51755      if (element.hasDocumentation()) {
51756        openArray("documentation");
51757        for (RelatedArtifact e : element.getDocumentation()) 
51758          composeRelatedArtifact(null, e);
51759        closeArray();
51760      };
51761      if (element.hasCondition()) {
51762        openArray("condition");
51763        for (RequestGroup.RequestGroupActionConditionComponent e : element.getCondition()) 
51764          composeRequestGroupRequestGroupActionConditionComponent(null, e);
51765        closeArray();
51766      };
51767      if (element.hasRelatedAction()) {
51768        openArray("relatedAction");
51769        for (RequestGroup.RequestGroupActionRelatedActionComponent e : element.getRelatedAction()) 
51770          composeRequestGroupRequestGroupActionRelatedActionComponent(null, e);
51771        closeArray();
51772      };
51773      if (element.hasTiming()) {
51774        composeType("timing", element.getTiming());
51775      }
51776      if (element.hasParticipant()) {
51777        openArray("participant");
51778        for (Reference e : element.getParticipant()) 
51779          composeReference(null, e);
51780        closeArray();
51781      };
51782      if (element.hasType()) {
51783        composeCodeableConcept("type", element.getType());
51784      }
51785      if (element.hasGroupingBehaviorElement()) {
51786        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
51787        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
51788      }
51789      if (element.hasSelectionBehaviorElement()) {
51790        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
51791        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
51792      }
51793      if (element.hasRequiredBehaviorElement()) {
51794        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
51795        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
51796      }
51797      if (element.hasPrecheckBehaviorElement()) {
51798        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
51799        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
51800      }
51801      if (element.hasCardinalityBehaviorElement()) {
51802        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
51803        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
51804      }
51805      if (element.hasResource()) {
51806        composeReference("resource", element.getResource());
51807      }
51808      if (element.hasAction()) {
51809        openArray("action");
51810        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
51811          composeRequestGroupRequestGroupActionComponent(null, e);
51812        closeArray();
51813      };
51814  }
51815
51816  protected void composeRequestGroupRequestGroupActionConditionComponent(String name, RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
51817    if (element != null) {
51818      open(name);
51819      composeRequestGroupRequestGroupActionConditionComponentInner(element);
51820      close();
51821    }
51822  }
51823
51824  protected void composeRequestGroupRequestGroupActionConditionComponentInner(RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
51825      composeBackbone(element);
51826      if (element.hasKindElement()) {
51827        composeEnumerationCore("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(), false);
51828        composeEnumerationExtras("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(), false);
51829      }
51830      if (element.hasExpression()) {
51831        composeExpression("expression", element.getExpression());
51832      }
51833  }
51834
51835  protected void composeRequestGroupRequestGroupActionRelatedActionComponent(String name, RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
51836    if (element != null) {
51837      open(name);
51838      composeRequestGroupRequestGroupActionRelatedActionComponentInner(element);
51839      close();
51840    }
51841  }
51842
51843  protected void composeRequestGroupRequestGroupActionRelatedActionComponentInner(RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
51844      composeBackbone(element);
51845      if (element.hasActionIdElement()) {
51846        composeIdCore("actionId", element.getActionIdElement(), false);
51847        composeIdExtras("actionId", element.getActionIdElement(), false);
51848      }
51849      if (element.hasRelationshipElement()) {
51850        composeEnumerationCore("relationship", element.getRelationshipElement(), new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
51851        composeEnumerationExtras("relationship", element.getRelationshipElement(), new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
51852      }
51853      if (element.hasOffset()) {
51854        composeType("offset", element.getOffset());
51855      }
51856  }
51857
51858  protected void composeResearchDefinition(String name, ResearchDefinition element) throws IOException {
51859    if (element != null) {
51860      prop("resourceType", name);
51861      composeResearchDefinitionInner(element);
51862    }
51863  }
51864
51865  protected void composeResearchDefinitionInner(ResearchDefinition element) throws IOException {
51866      composeDomainResourceElements(element);
51867      if (element.hasUrlElement()) {
51868        composeUriCore("url", element.getUrlElement(), false);
51869        composeUriExtras("url", element.getUrlElement(), false);
51870      }
51871      if (element.hasIdentifier()) {
51872        openArray("identifier");
51873        for (Identifier e : element.getIdentifier()) 
51874          composeIdentifier(null, e);
51875        closeArray();
51876      };
51877      if (element.hasVersionElement()) {
51878        composeStringCore("version", element.getVersionElement(), false);
51879        composeStringExtras("version", element.getVersionElement(), false);
51880      }
51881      if (element.hasNameElement()) {
51882        composeStringCore("name", element.getNameElement(), false);
51883        composeStringExtras("name", element.getNameElement(), false);
51884      }
51885      if (element.hasTitleElement()) {
51886        composeStringCore("title", element.getTitleElement(), false);
51887        composeStringExtras("title", element.getTitleElement(), false);
51888      }
51889      if (element.hasShortTitleElement()) {
51890        composeStringCore("shortTitle", element.getShortTitleElement(), false);
51891        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
51892      }
51893      if (element.hasSubtitleElement()) {
51894        composeStringCore("subtitle", element.getSubtitleElement(), false);
51895        composeStringExtras("subtitle", element.getSubtitleElement(), false);
51896      }
51897      if (element.hasStatusElement()) {
51898        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51899        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51900      }
51901      if (element.hasExperimentalElement()) {
51902        composeBooleanCore("experimental", element.getExperimentalElement(), false);
51903        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
51904      }
51905      if (element.hasSubject()) {
51906        composeType("subject", element.getSubject());
51907      }
51908      if (element.hasDateElement()) {
51909        composeDateTimeCore("date", element.getDateElement(), false);
51910        composeDateTimeExtras("date", element.getDateElement(), false);
51911      }
51912      if (element.hasPublisherElement()) {
51913        composeStringCore("publisher", element.getPublisherElement(), false);
51914        composeStringExtras("publisher", element.getPublisherElement(), false);
51915      }
51916      if (element.hasContact()) {
51917        openArray("contact");
51918        for (ContactDetail e : element.getContact()) 
51919          composeContactDetail(null, e);
51920        closeArray();
51921      };
51922      if (element.hasDescriptionElement()) {
51923        composeMarkdownCore("description", element.getDescriptionElement(), false);
51924        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51925      }
51926      if (element.hasComment()) {
51927        openArray("comment");
51928        for (StringType e : element.getComment()) 
51929          composeStringCore(null, e, true);
51930        closeArray();
51931        if (anyHasExtras(element.getComment())) {
51932          openArray("_comment");
51933          for (StringType e : element.getComment()) 
51934            composeStringExtras(null, e, true);
51935          closeArray();
51936        }
51937      };
51938      if (element.hasUseContext()) {
51939        openArray("useContext");
51940        for (UsageContext e : element.getUseContext()) 
51941          composeUsageContext(null, e);
51942        closeArray();
51943      };
51944      if (element.hasJurisdiction()) {
51945        openArray("jurisdiction");
51946        for (CodeableConcept e : element.getJurisdiction()) 
51947          composeCodeableConcept(null, e);
51948        closeArray();
51949      };
51950      if (element.hasPurposeElement()) {
51951        composeMarkdownCore("purpose", element.getPurposeElement(), false);
51952        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
51953      }
51954      if (element.hasUsageElement()) {
51955        composeStringCore("usage", element.getUsageElement(), false);
51956        composeStringExtras("usage", element.getUsageElement(), false);
51957      }
51958      if (element.hasCopyrightElement()) {
51959        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
51960        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
51961      }
51962      if (element.hasApprovalDateElement()) {
51963        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
51964        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
51965      }
51966      if (element.hasLastReviewDateElement()) {
51967        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
51968        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
51969      }
51970      if (element.hasEffectivePeriod()) {
51971        composePeriod("effectivePeriod", element.getEffectivePeriod());
51972      }
51973      if (element.hasTopic()) {
51974        openArray("topic");
51975        for (CodeableConcept e : element.getTopic()) 
51976          composeCodeableConcept(null, e);
51977        closeArray();
51978      };
51979      if (element.hasAuthor()) {
51980        openArray("author");
51981        for (ContactDetail e : element.getAuthor()) 
51982          composeContactDetail(null, e);
51983        closeArray();
51984      };
51985      if (element.hasEditor()) {
51986        openArray("editor");
51987        for (ContactDetail e : element.getEditor()) 
51988          composeContactDetail(null, e);
51989        closeArray();
51990      };
51991      if (element.hasReviewer()) {
51992        openArray("reviewer");
51993        for (ContactDetail e : element.getReviewer()) 
51994          composeContactDetail(null, e);
51995        closeArray();
51996      };
51997      if (element.hasEndorser()) {
51998        openArray("endorser");
51999        for (ContactDetail e : element.getEndorser()) 
52000          composeContactDetail(null, e);
52001        closeArray();
52002      };
52003      if (element.hasRelatedArtifact()) {
52004        openArray("relatedArtifact");
52005        for (RelatedArtifact e : element.getRelatedArtifact()) 
52006          composeRelatedArtifact(null, e);
52007        closeArray();
52008      };
52009      if (element.hasLibrary()) {
52010        openArray("library");
52011        for (CanonicalType e : element.getLibrary()) 
52012          composeCanonicalCore(null, e, true);
52013        closeArray();
52014        if (anyHasExtras(element.getLibrary())) {
52015          openArray("_library");
52016          for (CanonicalType e : element.getLibrary()) 
52017            composeCanonicalExtras(null, e, true);
52018          closeArray();
52019        }
52020      };
52021      if (element.hasPopulation()) {
52022        composeReference("population", element.getPopulation());
52023      }
52024      if (element.hasExposure()) {
52025        composeReference("exposure", element.getExposure());
52026      }
52027      if (element.hasExposureAlternative()) {
52028        composeReference("exposureAlternative", element.getExposureAlternative());
52029      }
52030      if (element.hasOutcome()) {
52031        composeReference("outcome", element.getOutcome());
52032      }
52033  }
52034
52035  protected void composeResearchElementDefinition(String name, ResearchElementDefinition element) throws IOException {
52036    if (element != null) {
52037      prop("resourceType", name);
52038      composeResearchElementDefinitionInner(element);
52039    }
52040  }
52041
52042  protected void composeResearchElementDefinitionInner(ResearchElementDefinition element) throws IOException {
52043      composeDomainResourceElements(element);
52044      if (element.hasUrlElement()) {
52045        composeUriCore("url", element.getUrlElement(), false);
52046        composeUriExtras("url", element.getUrlElement(), false);
52047      }
52048      if (element.hasIdentifier()) {
52049        openArray("identifier");
52050        for (Identifier e : element.getIdentifier()) 
52051          composeIdentifier(null, e);
52052        closeArray();
52053      };
52054      if (element.hasVersionElement()) {
52055        composeStringCore("version", element.getVersionElement(), false);
52056        composeStringExtras("version", element.getVersionElement(), false);
52057      }
52058      if (element.hasNameElement()) {
52059        composeStringCore("name", element.getNameElement(), false);
52060        composeStringExtras("name", element.getNameElement(), false);
52061      }
52062      if (element.hasTitleElement()) {
52063        composeStringCore("title", element.getTitleElement(), false);
52064        composeStringExtras("title", element.getTitleElement(), false);
52065      }
52066      if (element.hasShortTitleElement()) {
52067        composeStringCore("shortTitle", element.getShortTitleElement(), false);
52068        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
52069      }
52070      if (element.hasSubtitleElement()) {
52071        composeStringCore("subtitle", element.getSubtitleElement(), false);
52072        composeStringExtras("subtitle", element.getSubtitleElement(), false);
52073      }
52074      if (element.hasStatusElement()) {
52075        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52076        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52077      }
52078      if (element.hasExperimentalElement()) {
52079        composeBooleanCore("experimental", element.getExperimentalElement(), false);
52080        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
52081      }
52082      if (element.hasSubject()) {
52083        composeType("subject", element.getSubject());
52084      }
52085      if (element.hasDateElement()) {
52086        composeDateTimeCore("date", element.getDateElement(), false);
52087        composeDateTimeExtras("date", element.getDateElement(), false);
52088      }
52089      if (element.hasPublisherElement()) {
52090        composeStringCore("publisher", element.getPublisherElement(), false);
52091        composeStringExtras("publisher", element.getPublisherElement(), false);
52092      }
52093      if (element.hasContact()) {
52094        openArray("contact");
52095        for (ContactDetail e : element.getContact()) 
52096          composeContactDetail(null, e);
52097        closeArray();
52098      };
52099      if (element.hasDescriptionElement()) {
52100        composeMarkdownCore("description", element.getDescriptionElement(), false);
52101        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52102      }
52103      if (element.hasComment()) {
52104        openArray("comment");
52105        for (StringType e : element.getComment()) 
52106          composeStringCore(null, e, true);
52107        closeArray();
52108        if (anyHasExtras(element.getComment())) {
52109          openArray("_comment");
52110          for (StringType e : element.getComment()) 
52111            composeStringExtras(null, e, true);
52112          closeArray();
52113        }
52114      };
52115      if (element.hasUseContext()) {
52116        openArray("useContext");
52117        for (UsageContext e : element.getUseContext()) 
52118          composeUsageContext(null, e);
52119        closeArray();
52120      };
52121      if (element.hasJurisdiction()) {
52122        openArray("jurisdiction");
52123        for (CodeableConcept e : element.getJurisdiction()) 
52124          composeCodeableConcept(null, e);
52125        closeArray();
52126      };
52127      if (element.hasPurposeElement()) {
52128        composeMarkdownCore("purpose", element.getPurposeElement(), false);
52129        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
52130      }
52131      if (element.hasUsageElement()) {
52132        composeStringCore("usage", element.getUsageElement(), false);
52133        composeStringExtras("usage", element.getUsageElement(), false);
52134      }
52135      if (element.hasCopyrightElement()) {
52136        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
52137        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
52138      }
52139      if (element.hasApprovalDateElement()) {
52140        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
52141        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
52142      }
52143      if (element.hasLastReviewDateElement()) {
52144        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
52145        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
52146      }
52147      if (element.hasEffectivePeriod()) {
52148        composePeriod("effectivePeriod", element.getEffectivePeriod());
52149      }
52150      if (element.hasTopic()) {
52151        openArray("topic");
52152        for (CodeableConcept e : element.getTopic()) 
52153          composeCodeableConcept(null, e);
52154        closeArray();
52155      };
52156      if (element.hasAuthor()) {
52157        openArray("author");
52158        for (ContactDetail e : element.getAuthor()) 
52159          composeContactDetail(null, e);
52160        closeArray();
52161      };
52162      if (element.hasEditor()) {
52163        openArray("editor");
52164        for (ContactDetail e : element.getEditor()) 
52165          composeContactDetail(null, e);
52166        closeArray();
52167      };
52168      if (element.hasReviewer()) {
52169        openArray("reviewer");
52170        for (ContactDetail e : element.getReviewer()) 
52171          composeContactDetail(null, e);
52172        closeArray();
52173      };
52174      if (element.hasEndorser()) {
52175        openArray("endorser");
52176        for (ContactDetail e : element.getEndorser()) 
52177          composeContactDetail(null, e);
52178        closeArray();
52179      };
52180      if (element.hasRelatedArtifact()) {
52181        openArray("relatedArtifact");
52182        for (RelatedArtifact e : element.getRelatedArtifact()) 
52183          composeRelatedArtifact(null, e);
52184        closeArray();
52185      };
52186      if (element.hasLibrary()) {
52187        openArray("library");
52188        for (CanonicalType e : element.getLibrary()) 
52189          composeCanonicalCore(null, e, true);
52190        closeArray();
52191        if (anyHasExtras(element.getLibrary())) {
52192          openArray("_library");
52193          for (CanonicalType e : element.getLibrary()) 
52194            composeCanonicalExtras(null, e, true);
52195          closeArray();
52196        }
52197      };
52198      if (element.hasTypeElement()) {
52199        composeEnumerationCore("type", element.getTypeElement(), new ResearchElementDefinition.ResearchElementTypeEnumFactory(), false);
52200        composeEnumerationExtras("type", element.getTypeElement(), new ResearchElementDefinition.ResearchElementTypeEnumFactory(), false);
52201      }
52202      if (element.hasVariableTypeElement()) {
52203        composeEnumerationCore("variableType", element.getVariableTypeElement(), new ResearchElementDefinition.VariableTypeEnumFactory(), false);
52204        composeEnumerationExtras("variableType", element.getVariableTypeElement(), new ResearchElementDefinition.VariableTypeEnumFactory(), false);
52205      }
52206      if (element.hasCharacteristic()) {
52207        openArray("characteristic");
52208        for (ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent e : element.getCharacteristic()) 
52209          composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(null, e);
52210        closeArray();
52211      };
52212  }
52213
52214  protected void composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(String name, ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent element) throws IOException {
52215    if (element != null) {
52216      open(name);
52217      composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponentInner(element);
52218      close();
52219    }
52220  }
52221
52222  protected void composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponentInner(ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent element) throws IOException {
52223      composeBackbone(element);
52224      if (element.hasDefinition()) {
52225        composeType("definition", element.getDefinition());
52226      }
52227      if (element.hasUsageContext()) {
52228        openArray("usageContext");
52229        for (UsageContext e : element.getUsageContext()) 
52230          composeUsageContext(null, e);
52231        closeArray();
52232      };
52233      if (element.hasExcludeElement()) {
52234        composeBooleanCore("exclude", element.getExcludeElement(), false);
52235        composeBooleanExtras("exclude", element.getExcludeElement(), false);
52236      }
52237      if (element.hasUnitOfMeasure()) {
52238        composeCodeableConcept("unitOfMeasure", element.getUnitOfMeasure());
52239      }
52240      if (element.hasStudyEffectiveDescriptionElement()) {
52241        composeStringCore("studyEffectiveDescription", element.getStudyEffectiveDescriptionElement(), false);
52242        composeStringExtras("studyEffectiveDescription", element.getStudyEffectiveDescriptionElement(), false);
52243      }
52244      if (element.hasStudyEffective()) {
52245        composeType("studyEffective", element.getStudyEffective());
52246      }
52247      if (element.hasStudyEffectiveTimeFromStart()) {
52248        composeDuration("studyEffectiveTimeFromStart", element.getStudyEffectiveTimeFromStart());
52249      }
52250      if (element.hasStudyEffectiveGroupMeasureElement()) {
52251        composeEnumerationCore("studyEffectiveGroupMeasure", element.getStudyEffectiveGroupMeasureElement(), new ResearchElementDefinition.GroupMeasureEnumFactory(), false);
52252        composeEnumerationExtras("studyEffectiveGroupMeasure", element.getStudyEffectiveGroupMeasureElement(), new ResearchElementDefinition.GroupMeasureEnumFactory(), false);
52253      }
52254      if (element.hasParticipantEffectiveDescriptionElement()) {
52255        composeStringCore("participantEffectiveDescription", element.getParticipantEffectiveDescriptionElement(), false);
52256        composeStringExtras("participantEffectiveDescription", element.getParticipantEffectiveDescriptionElement(), false);
52257      }
52258      if (element.hasParticipantEffective()) {
52259        composeType("participantEffective", element.getParticipantEffective());
52260      }
52261      if (element.hasParticipantEffectiveTimeFromStart()) {
52262        composeDuration("participantEffectiveTimeFromStart", element.getParticipantEffectiveTimeFromStart());
52263      }
52264      if (element.hasParticipantEffectiveGroupMeasureElement()) {
52265        composeEnumerationCore("participantEffectiveGroupMeasure", element.getParticipantEffectiveGroupMeasureElement(), new ResearchElementDefinition.GroupMeasureEnumFactory(), false);
52266        composeEnumerationExtras("participantEffectiveGroupMeasure", element.getParticipantEffectiveGroupMeasureElement(), new ResearchElementDefinition.GroupMeasureEnumFactory(), false);
52267      }
52268  }
52269
52270  protected void composeResearchStudy(String name, ResearchStudy element) throws IOException {
52271    if (element != null) {
52272      prop("resourceType", name);
52273      composeResearchStudyInner(element);
52274    }
52275  }
52276
52277  protected void composeResearchStudyInner(ResearchStudy element) throws IOException {
52278      composeDomainResourceElements(element);
52279      if (element.hasIdentifier()) {
52280        openArray("identifier");
52281        for (Identifier e : element.getIdentifier()) 
52282          composeIdentifier(null, e);
52283        closeArray();
52284      };
52285      if (element.hasTitleElement()) {
52286        composeStringCore("title", element.getTitleElement(), false);
52287        composeStringExtras("title", element.getTitleElement(), false);
52288      }
52289      if (element.hasProtocol()) {
52290        openArray("protocol");
52291        for (Reference e : element.getProtocol()) 
52292          composeReference(null, e);
52293        closeArray();
52294      };
52295      if (element.hasPartOf()) {
52296        openArray("partOf");
52297        for (Reference e : element.getPartOf()) 
52298          composeReference(null, e);
52299        closeArray();
52300      };
52301      if (element.hasStatusElement()) {
52302        composeEnumerationCore("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
52303        composeEnumerationExtras("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
52304      }
52305      if (element.hasPrimaryPurposeType()) {
52306        composeCodeableConcept("primaryPurposeType", element.getPrimaryPurposeType());
52307      }
52308      if (element.hasPhase()) {
52309        composeCodeableConcept("phase", element.getPhase());
52310      }
52311      if (element.hasCategory()) {
52312        openArray("category");
52313        for (CodeableConcept e : element.getCategory()) 
52314          composeCodeableConcept(null, e);
52315        closeArray();
52316      };
52317      if (element.hasFocus()) {
52318        openArray("focus");
52319        for (CodeableConcept e : element.getFocus()) 
52320          composeCodeableConcept(null, e);
52321        closeArray();
52322      };
52323      if (element.hasCondition()) {
52324        openArray("condition");
52325        for (CodeableConcept e : element.getCondition()) 
52326          composeCodeableConcept(null, e);
52327        closeArray();
52328      };
52329      if (element.hasContact()) {
52330        openArray("contact");
52331        for (ContactDetail e : element.getContact()) 
52332          composeContactDetail(null, e);
52333        closeArray();
52334      };
52335      if (element.hasRelatedArtifact()) {
52336        openArray("relatedArtifact");
52337        for (RelatedArtifact e : element.getRelatedArtifact()) 
52338          composeRelatedArtifact(null, e);
52339        closeArray();
52340      };
52341      if (element.hasKeyword()) {
52342        openArray("keyword");
52343        for (CodeableConcept e : element.getKeyword()) 
52344          composeCodeableConcept(null, e);
52345        closeArray();
52346      };
52347      if (element.hasLocation()) {
52348        openArray("location");
52349        for (CodeableConcept e : element.getLocation()) 
52350          composeCodeableConcept(null, e);
52351        closeArray();
52352      };
52353      if (element.hasDescriptionElement()) {
52354        composeMarkdownCore("description", element.getDescriptionElement(), false);
52355        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52356      }
52357      if (element.hasEnrollment()) {
52358        openArray("enrollment");
52359        for (Reference e : element.getEnrollment()) 
52360          composeReference(null, e);
52361        closeArray();
52362      };
52363      if (element.hasPeriod()) {
52364        composePeriod("period", element.getPeriod());
52365      }
52366      if (element.hasSponsor()) {
52367        composeReference("sponsor", element.getSponsor());
52368      }
52369      if (element.hasPrincipalInvestigator()) {
52370        composeReference("principalInvestigator", element.getPrincipalInvestigator());
52371      }
52372      if (element.hasSite()) {
52373        openArray("site");
52374        for (Reference e : element.getSite()) 
52375          composeReference(null, e);
52376        closeArray();
52377      };
52378      if (element.hasReasonStopped()) {
52379        composeCodeableConcept("reasonStopped", element.getReasonStopped());
52380      }
52381      if (element.hasNote()) {
52382        openArray("note");
52383        for (Annotation e : element.getNote()) 
52384          composeAnnotation(null, e);
52385        closeArray();
52386      };
52387      if (element.hasArm()) {
52388        openArray("arm");
52389        for (ResearchStudy.ResearchStudyArmComponent e : element.getArm()) 
52390          composeResearchStudyResearchStudyArmComponent(null, e);
52391        closeArray();
52392      };
52393      if (element.hasObjective()) {
52394        openArray("objective");
52395        for (ResearchStudy.ResearchStudyObjectiveComponent e : element.getObjective()) 
52396          composeResearchStudyResearchStudyObjectiveComponent(null, e);
52397        closeArray();
52398      };
52399  }
52400
52401  protected void composeResearchStudyResearchStudyArmComponent(String name, ResearchStudy.ResearchStudyArmComponent element) throws IOException {
52402    if (element != null) {
52403      open(name);
52404      composeResearchStudyResearchStudyArmComponentInner(element);
52405      close();
52406    }
52407  }
52408
52409  protected void composeResearchStudyResearchStudyArmComponentInner(ResearchStudy.ResearchStudyArmComponent element) throws IOException {
52410      composeBackbone(element);
52411      if (element.hasNameElement()) {
52412        composeStringCore("name", element.getNameElement(), false);
52413        composeStringExtras("name", element.getNameElement(), false);
52414      }
52415      if (element.hasType()) {
52416        composeCodeableConcept("type", element.getType());
52417      }
52418      if (element.hasDescriptionElement()) {
52419        composeStringCore("description", element.getDescriptionElement(), false);
52420        composeStringExtras("description", element.getDescriptionElement(), false);
52421      }
52422  }
52423
52424  protected void composeResearchStudyResearchStudyObjectiveComponent(String name, ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
52425    if (element != null) {
52426      open(name);
52427      composeResearchStudyResearchStudyObjectiveComponentInner(element);
52428      close();
52429    }
52430  }
52431
52432  protected void composeResearchStudyResearchStudyObjectiveComponentInner(ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
52433      composeBackbone(element);
52434      if (element.hasNameElement()) {
52435        composeStringCore("name", element.getNameElement(), false);
52436        composeStringExtras("name", element.getNameElement(), false);
52437      }
52438      if (element.hasType()) {
52439        composeCodeableConcept("type", element.getType());
52440      }
52441  }
52442
52443  protected void composeResearchSubject(String name, ResearchSubject element) throws IOException {
52444    if (element != null) {
52445      prop("resourceType", name);
52446      composeResearchSubjectInner(element);
52447    }
52448  }
52449
52450  protected void composeResearchSubjectInner(ResearchSubject element) throws IOException {
52451      composeDomainResourceElements(element);
52452      if (element.hasIdentifier()) {
52453        openArray("identifier");
52454        for (Identifier e : element.getIdentifier()) 
52455          composeIdentifier(null, e);
52456        closeArray();
52457      };
52458      if (element.hasStatusElement()) {
52459        composeEnumerationCore("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
52460        composeEnumerationExtras("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
52461      }
52462      if (element.hasPeriod()) {
52463        composePeriod("period", element.getPeriod());
52464      }
52465      if (element.hasStudy()) {
52466        composeReference("study", element.getStudy());
52467      }
52468      if (element.hasIndividual()) {
52469        composeReference("individual", element.getIndividual());
52470      }
52471      if (element.hasAssignedArmElement()) {
52472        composeStringCore("assignedArm", element.getAssignedArmElement(), false);
52473        composeStringExtras("assignedArm", element.getAssignedArmElement(), false);
52474      }
52475      if (element.hasActualArmElement()) {
52476        composeStringCore("actualArm", element.getActualArmElement(), false);
52477        composeStringExtras("actualArm", element.getActualArmElement(), false);
52478      }
52479      if (element.hasConsent()) {
52480        composeReference("consent", element.getConsent());
52481      }
52482  }
52483
52484  protected void composeRiskAssessment(String name, RiskAssessment element) throws IOException {
52485    if (element != null) {
52486      prop("resourceType", name);
52487      composeRiskAssessmentInner(element);
52488    }
52489  }
52490
52491  protected void composeRiskAssessmentInner(RiskAssessment element) throws IOException {
52492      composeDomainResourceElements(element);
52493      if (element.hasIdentifier()) {
52494        openArray("identifier");
52495        for (Identifier e : element.getIdentifier()) 
52496          composeIdentifier(null, e);
52497        closeArray();
52498      };
52499      if (element.hasBasedOn()) {
52500        composeReference("basedOn", element.getBasedOn());
52501      }
52502      if (element.hasParent()) {
52503        composeReference("parent", element.getParent());
52504      }
52505      if (element.hasStatusElement()) {
52506        composeEnumerationCore("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory(), false);
52507        composeEnumerationExtras("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory(), false);
52508      }
52509      if (element.hasMethod()) {
52510        composeCodeableConcept("method", element.getMethod());
52511      }
52512      if (element.hasCode()) {
52513        composeCodeableConcept("code", element.getCode());
52514      }
52515      if (element.hasSubject()) {
52516        composeReference("subject", element.getSubject());
52517      }
52518      if (element.hasEncounter()) {
52519        composeReference("encounter", element.getEncounter());
52520      }
52521      if (element.hasOccurrence()) {
52522        composeType("occurrence", element.getOccurrence());
52523      }
52524      if (element.hasCondition()) {
52525        composeReference("condition", element.getCondition());
52526      }
52527      if (element.hasPerformer()) {
52528        composeReference("performer", element.getPerformer());
52529      }
52530      if (element.hasReasonCode()) {
52531        openArray("reasonCode");
52532        for (CodeableConcept e : element.getReasonCode()) 
52533          composeCodeableConcept(null, e);
52534        closeArray();
52535      };
52536      if (element.hasReasonReference()) {
52537        openArray("reasonReference");
52538        for (Reference e : element.getReasonReference()) 
52539          composeReference(null, e);
52540        closeArray();
52541      };
52542      if (element.hasBasis()) {
52543        openArray("basis");
52544        for (Reference e : element.getBasis()) 
52545          composeReference(null, e);
52546        closeArray();
52547      };
52548      if (element.hasPrediction()) {
52549        openArray("prediction");
52550        for (RiskAssessment.RiskAssessmentPredictionComponent e : element.getPrediction()) 
52551          composeRiskAssessmentRiskAssessmentPredictionComponent(null, e);
52552        closeArray();
52553      };
52554      if (element.hasMitigationElement()) {
52555        composeStringCore("mitigation", element.getMitigationElement(), false);
52556        composeStringExtras("mitigation", element.getMitigationElement(), false);
52557      }
52558      if (element.hasNote()) {
52559        openArray("note");
52560        for (Annotation e : element.getNote()) 
52561          composeAnnotation(null, e);
52562        closeArray();
52563      };
52564  }
52565
52566  protected void composeRiskAssessmentRiskAssessmentPredictionComponent(String name, RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
52567    if (element != null) {
52568      open(name);
52569      composeRiskAssessmentRiskAssessmentPredictionComponentInner(element);
52570      close();
52571    }
52572  }
52573
52574  protected void composeRiskAssessmentRiskAssessmentPredictionComponentInner(RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
52575      composeBackbone(element);
52576      if (element.hasOutcome()) {
52577        composeCodeableConcept("outcome", element.getOutcome());
52578      }
52579      if (element.hasProbability()) {
52580        composeType("probability", element.getProbability());
52581      }
52582      if (element.hasQualitativeRisk()) {
52583        composeCodeableConcept("qualitativeRisk", element.getQualitativeRisk());
52584      }
52585      if (element.hasRelativeRiskElement()) {
52586        composeDecimalCore("relativeRisk", element.getRelativeRiskElement(), false);
52587        composeDecimalExtras("relativeRisk", element.getRelativeRiskElement(), false);
52588      }
52589      if (element.hasWhen()) {
52590        composeType("when", element.getWhen());
52591      }
52592      if (element.hasRationaleElement()) {
52593        composeStringCore("rationale", element.getRationaleElement(), false);
52594        composeStringExtras("rationale", element.getRationaleElement(), false);
52595      }
52596  }
52597
52598  protected void composeRiskEvidenceSynthesis(String name, RiskEvidenceSynthesis element) throws IOException {
52599    if (element != null) {
52600      prop("resourceType", name);
52601      composeRiskEvidenceSynthesisInner(element);
52602    }
52603  }
52604
52605  protected void composeRiskEvidenceSynthesisInner(RiskEvidenceSynthesis element) throws IOException {
52606      composeDomainResourceElements(element);
52607      if (element.hasUrlElement()) {
52608        composeUriCore("url", element.getUrlElement(), false);
52609        composeUriExtras("url", element.getUrlElement(), false);
52610      }
52611      if (element.hasIdentifier()) {
52612        openArray("identifier");
52613        for (Identifier e : element.getIdentifier()) 
52614          composeIdentifier(null, e);
52615        closeArray();
52616      };
52617      if (element.hasVersionElement()) {
52618        composeStringCore("version", element.getVersionElement(), false);
52619        composeStringExtras("version", element.getVersionElement(), false);
52620      }
52621      if (element.hasNameElement()) {
52622        composeStringCore("name", element.getNameElement(), false);
52623        composeStringExtras("name", element.getNameElement(), false);
52624      }
52625      if (element.hasTitleElement()) {
52626        composeStringCore("title", element.getTitleElement(), false);
52627        composeStringExtras("title", element.getTitleElement(), false);
52628      }
52629      if (element.hasStatusElement()) {
52630        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52631        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52632      }
52633      if (element.hasDateElement()) {
52634        composeDateTimeCore("date", element.getDateElement(), false);
52635        composeDateTimeExtras("date", element.getDateElement(), false);
52636      }
52637      if (element.hasPublisherElement()) {
52638        composeStringCore("publisher", element.getPublisherElement(), false);
52639        composeStringExtras("publisher", element.getPublisherElement(), false);
52640      }
52641      if (element.hasContact()) {
52642        openArray("contact");
52643        for (ContactDetail e : element.getContact()) 
52644          composeContactDetail(null, e);
52645        closeArray();
52646      };
52647      if (element.hasDescriptionElement()) {
52648        composeMarkdownCore("description", element.getDescriptionElement(), false);
52649        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52650      }
52651      if (element.hasNote()) {
52652        openArray("note");
52653        for (Annotation e : element.getNote()) 
52654          composeAnnotation(null, e);
52655        closeArray();
52656      };
52657      if (element.hasUseContext()) {
52658        openArray("useContext");
52659        for (UsageContext e : element.getUseContext()) 
52660          composeUsageContext(null, e);
52661        closeArray();
52662      };
52663      if (element.hasJurisdiction()) {
52664        openArray("jurisdiction");
52665        for (CodeableConcept e : element.getJurisdiction()) 
52666          composeCodeableConcept(null, e);
52667        closeArray();
52668      };
52669      if (element.hasCopyrightElement()) {
52670        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
52671        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
52672      }
52673      if (element.hasApprovalDateElement()) {
52674        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
52675        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
52676      }
52677      if (element.hasLastReviewDateElement()) {
52678        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
52679        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
52680      }
52681      if (element.hasEffectivePeriod()) {
52682        composePeriod("effectivePeriod", element.getEffectivePeriod());
52683      }
52684      if (element.hasTopic()) {
52685        openArray("topic");
52686        for (CodeableConcept e : element.getTopic()) 
52687          composeCodeableConcept(null, e);
52688        closeArray();
52689      };
52690      if (element.hasAuthor()) {
52691        openArray("author");
52692        for (ContactDetail e : element.getAuthor()) 
52693          composeContactDetail(null, e);
52694        closeArray();
52695      };
52696      if (element.hasEditor()) {
52697        openArray("editor");
52698        for (ContactDetail e : element.getEditor()) 
52699          composeContactDetail(null, e);
52700        closeArray();
52701      };
52702      if (element.hasReviewer()) {
52703        openArray("reviewer");
52704        for (ContactDetail e : element.getReviewer()) 
52705          composeContactDetail(null, e);
52706        closeArray();
52707      };
52708      if (element.hasEndorser()) {
52709        openArray("endorser");
52710        for (ContactDetail e : element.getEndorser()) 
52711          composeContactDetail(null, e);
52712        closeArray();
52713      };
52714      if (element.hasRelatedArtifact()) {
52715        openArray("relatedArtifact");
52716        for (RelatedArtifact e : element.getRelatedArtifact()) 
52717          composeRelatedArtifact(null, e);
52718        closeArray();
52719      };
52720      if (element.hasSynthesisType()) {
52721        composeCodeableConcept("synthesisType", element.getSynthesisType());
52722      }
52723      if (element.hasStudyType()) {
52724        composeCodeableConcept("studyType", element.getStudyType());
52725      }
52726      if (element.hasPopulation()) {
52727        composeReference("population", element.getPopulation());
52728      }
52729      if (element.hasExposure()) {
52730        composeReference("exposure", element.getExposure());
52731      }
52732      if (element.hasOutcome()) {
52733        composeReference("outcome", element.getOutcome());
52734      }
52735      if (element.hasSampleSize()) {
52736        composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent("sampleSize", element.getSampleSize());
52737      }
52738      if (element.hasRiskEstimate()) {
52739        composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent("riskEstimate", element.getRiskEstimate());
52740      }
52741      if (element.hasCertainty()) {
52742        openArray("certainty");
52743        for (RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent e : element.getCertainty()) 
52744          composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(null, e);
52745        closeArray();
52746      };
52747  }
52748
52749  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent(String name, RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent element) throws IOException {
52750    if (element != null) {
52751      open(name);
52752      composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentInner(element);
52753      close();
52754    }
52755  }
52756
52757  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentInner(RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent element) throws IOException {
52758      composeBackbone(element);
52759      if (element.hasDescriptionElement()) {
52760        composeStringCore("description", element.getDescriptionElement(), false);
52761        composeStringExtras("description", element.getDescriptionElement(), false);
52762      }
52763      if (element.hasNumberOfStudiesElement()) {
52764        composeIntegerCore("numberOfStudies", element.getNumberOfStudiesElement(), false);
52765        composeIntegerExtras("numberOfStudies", element.getNumberOfStudiesElement(), false);
52766      }
52767      if (element.hasNumberOfParticipantsElement()) {
52768        composeIntegerCore("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
52769        composeIntegerExtras("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
52770      }
52771  }
52772
52773  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent(String name, RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent element) throws IOException {
52774    if (element != null) {
52775      open(name);
52776      composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentInner(element);
52777      close();
52778    }
52779  }
52780
52781  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentInner(RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent element) throws IOException {
52782      composeBackbone(element);
52783      if (element.hasDescriptionElement()) {
52784        composeStringCore("description", element.getDescriptionElement(), false);
52785        composeStringExtras("description", element.getDescriptionElement(), false);
52786      }
52787      if (element.hasType()) {
52788        composeCodeableConcept("type", element.getType());
52789      }
52790      if (element.hasValueElement()) {
52791        composeDecimalCore("value", element.getValueElement(), false);
52792        composeDecimalExtras("value", element.getValueElement(), false);
52793      }
52794      if (element.hasUnitOfMeasure()) {
52795        composeCodeableConcept("unitOfMeasure", element.getUnitOfMeasure());
52796      }
52797      if (element.hasDenominatorCountElement()) {
52798        composeIntegerCore("denominatorCount", element.getDenominatorCountElement(), false);
52799        composeIntegerExtras("denominatorCount", element.getDenominatorCountElement(), false);
52800      }
52801      if (element.hasNumeratorCountElement()) {
52802        composeIntegerCore("numeratorCount", element.getNumeratorCountElement(), false);
52803        composeIntegerExtras("numeratorCount", element.getNumeratorCountElement(), false);
52804      }
52805      if (element.hasPrecisionEstimate()) {
52806        openArray("precisionEstimate");
52807        for (RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent e : element.getPrecisionEstimate()) 
52808          composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(null, e);
52809        closeArray();
52810      };
52811  }
52812
52813  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(String name, RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent element) throws IOException {
52814    if (element != null) {
52815      open(name);
52816      composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentInner(element);
52817      close();
52818    }
52819  }
52820
52821  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentInner(RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent element) throws IOException {
52822      composeBackbone(element);
52823      if (element.hasType()) {
52824        composeCodeableConcept("type", element.getType());
52825      }
52826      if (element.hasLevelElement()) {
52827        composeDecimalCore("level", element.getLevelElement(), false);
52828        composeDecimalExtras("level", element.getLevelElement(), false);
52829      }
52830      if (element.hasFromElement()) {
52831        composeDecimalCore("from", element.getFromElement(), false);
52832        composeDecimalExtras("from", element.getFromElement(), false);
52833      }
52834      if (element.hasToElement()) {
52835        composeDecimalCore("to", element.getToElement(), false);
52836        composeDecimalExtras("to", element.getToElement(), false);
52837      }
52838  }
52839
52840  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(String name, RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent element) throws IOException {
52841    if (element != null) {
52842      open(name);
52843      composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentInner(element);
52844      close();
52845    }
52846  }
52847
52848  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentInner(RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent element) throws IOException {
52849      composeBackbone(element);
52850      if (element.hasRating()) {
52851        openArray("rating");
52852        for (CodeableConcept e : element.getRating()) 
52853          composeCodeableConcept(null, e);
52854        closeArray();
52855      };
52856      if (element.hasNote()) {
52857        openArray("note");
52858        for (Annotation e : element.getNote()) 
52859          composeAnnotation(null, e);
52860        closeArray();
52861      };
52862      if (element.hasCertaintySubcomponent()) {
52863        openArray("certaintySubcomponent");
52864        for (RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent e : element.getCertaintySubcomponent()) 
52865          composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(null, e);
52866        closeArray();
52867      };
52868  }
52869
52870  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(String name, RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent element) throws IOException {
52871    if (element != null) {
52872      open(name);
52873      composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentInner(element);
52874      close();
52875    }
52876  }
52877
52878  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentInner(RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent element) throws IOException {
52879      composeBackbone(element);
52880      if (element.hasType()) {
52881        composeCodeableConcept("type", element.getType());
52882      }
52883      if (element.hasRating()) {
52884        openArray("rating");
52885        for (CodeableConcept e : element.getRating()) 
52886          composeCodeableConcept(null, e);
52887        closeArray();
52888      };
52889      if (element.hasNote()) {
52890        openArray("note");
52891        for (Annotation e : element.getNote()) 
52892          composeAnnotation(null, e);
52893        closeArray();
52894      };
52895  }
52896
52897  protected void composeSchedule(String name, Schedule element) throws IOException {
52898    if (element != null) {
52899      prop("resourceType", name);
52900      composeScheduleInner(element);
52901    }
52902  }
52903
52904  protected void composeScheduleInner(Schedule element) throws IOException {
52905      composeDomainResourceElements(element);
52906      if (element.hasIdentifier()) {
52907        openArray("identifier");
52908        for (Identifier e : element.getIdentifier()) 
52909          composeIdentifier(null, e);
52910        closeArray();
52911      };
52912      if (element.hasActiveElement()) {
52913        composeBooleanCore("active", element.getActiveElement(), false);
52914        composeBooleanExtras("active", element.getActiveElement(), false);
52915      }
52916      if (element.hasServiceCategory()) {
52917        openArray("serviceCategory");
52918        for (CodeableConcept e : element.getServiceCategory()) 
52919          composeCodeableConcept(null, e);
52920        closeArray();
52921      };
52922      if (element.hasServiceType()) {
52923        openArray("serviceType");
52924        for (CodeableConcept e : element.getServiceType()) 
52925          composeCodeableConcept(null, e);
52926        closeArray();
52927      };
52928      if (element.hasSpecialty()) {
52929        openArray("specialty");
52930        for (CodeableConcept e : element.getSpecialty()) 
52931          composeCodeableConcept(null, e);
52932        closeArray();
52933      };
52934      if (element.hasActor()) {
52935        openArray("actor");
52936        for (Reference e : element.getActor()) 
52937          composeReference(null, e);
52938        closeArray();
52939      };
52940      if (element.hasPlanningHorizon()) {
52941        composePeriod("planningHorizon", element.getPlanningHorizon());
52942      }
52943      if (element.hasCommentElement()) {
52944        composeStringCore("comment", element.getCommentElement(), false);
52945        composeStringExtras("comment", element.getCommentElement(), false);
52946      }
52947  }
52948
52949  protected void composeSearchParameter(String name, SearchParameter element) throws IOException {
52950    if (element != null) {
52951      prop("resourceType", name);
52952      composeSearchParameterInner(element);
52953    }
52954  }
52955
52956  protected void composeSearchParameterInner(SearchParameter element) throws IOException {
52957      composeDomainResourceElements(element);
52958      if (element.hasUrlElement()) {
52959        composeUriCore("url", element.getUrlElement(), false);
52960        composeUriExtras("url", element.getUrlElement(), false);
52961      }
52962      if (element.hasVersionElement()) {
52963        composeStringCore("version", element.getVersionElement(), false);
52964        composeStringExtras("version", element.getVersionElement(), false);
52965      }
52966      if (element.hasNameElement()) {
52967        composeStringCore("name", element.getNameElement(), false);
52968        composeStringExtras("name", element.getNameElement(), false);
52969      }
52970      if (element.hasDerivedFromElement()) {
52971        composeCanonicalCore("derivedFrom", element.getDerivedFromElement(), false);
52972        composeCanonicalExtras("derivedFrom", element.getDerivedFromElement(), false);
52973      }
52974      if (element.hasStatusElement()) {
52975        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52976        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52977      }
52978      if (element.hasExperimentalElement()) {
52979        composeBooleanCore("experimental", element.getExperimentalElement(), false);
52980        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
52981      }
52982      if (element.hasDateElement()) {
52983        composeDateTimeCore("date", element.getDateElement(), false);
52984        composeDateTimeExtras("date", element.getDateElement(), false);
52985      }
52986      if (element.hasPublisherElement()) {
52987        composeStringCore("publisher", element.getPublisherElement(), false);
52988        composeStringExtras("publisher", element.getPublisherElement(), false);
52989      }
52990      if (element.hasContact()) {
52991        openArray("contact");
52992        for (ContactDetail e : element.getContact()) 
52993          composeContactDetail(null, e);
52994        closeArray();
52995      };
52996      if (element.hasDescriptionElement()) {
52997        composeMarkdownCore("description", element.getDescriptionElement(), false);
52998        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52999      }
53000      if (element.hasUseContext()) {
53001        openArray("useContext");
53002        for (UsageContext e : element.getUseContext()) 
53003          composeUsageContext(null, e);
53004        closeArray();
53005      };
53006      if (element.hasJurisdiction()) {
53007        openArray("jurisdiction");
53008        for (CodeableConcept e : element.getJurisdiction()) 
53009          composeCodeableConcept(null, e);
53010        closeArray();
53011      };
53012      if (element.hasPurposeElement()) {
53013        composeMarkdownCore("purpose", element.getPurposeElement(), false);
53014        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
53015      }
53016      if (element.hasCodeElement()) {
53017        composeCodeCore("code", element.getCodeElement(), false);
53018        composeCodeExtras("code", element.getCodeElement(), false);
53019      }
53020      if (element.hasBase()) {
53021        openArray("base");
53022        for (CodeType e : element.getBase()) 
53023          composeCodeCore(null, e, true);
53024        closeArray();
53025        if (anyHasExtras(element.getBase())) {
53026          openArray("_base");
53027          for (CodeType e : element.getBase()) 
53028            composeCodeExtras(null, e, true);
53029          closeArray();
53030        }
53031      };
53032      if (element.hasTypeElement()) {
53033        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
53034        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
53035      }
53036      if (element.hasExpressionElement()) {
53037        composeStringCore("expression", element.getExpressionElement(), false);
53038        composeStringExtras("expression", element.getExpressionElement(), false);
53039      }
53040      if (element.hasXpathElement()) {
53041        composeStringCore("xpath", element.getXpathElement(), false);
53042        composeStringExtras("xpath", element.getXpathElement(), false);
53043      }
53044      if (element.hasXpathUsageElement()) {
53045        composeEnumerationCore("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
53046        composeEnumerationExtras("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
53047      }
53048      if (element.hasTarget()) {
53049        openArray("target");
53050        for (CodeType e : element.getTarget()) 
53051          composeCodeCore(null, e, true);
53052        closeArray();
53053        if (anyHasExtras(element.getTarget())) {
53054          openArray("_target");
53055          for (CodeType e : element.getTarget()) 
53056            composeCodeExtras(null, e, true);
53057          closeArray();
53058        }
53059      };
53060      if (element.hasMultipleOrElement()) {
53061        composeBooleanCore("multipleOr", element.getMultipleOrElement(), false);
53062        composeBooleanExtras("multipleOr", element.getMultipleOrElement(), false);
53063      }
53064      if (element.hasMultipleAndElement()) {
53065        composeBooleanCore("multipleAnd", element.getMultipleAndElement(), false);
53066        composeBooleanExtras("multipleAnd", element.getMultipleAndElement(), false);
53067      }
53068      if (element.hasComparator()) {
53069        openArray("comparator");
53070        for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
53071          composeEnumerationCore(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
53072        closeArray();
53073        if (anyHasExtras(element.getComparator())) {
53074          openArray("_comparator");
53075          for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
53076            composeEnumerationExtras(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
53077          closeArray();
53078        }
53079      };
53080      if (element.hasModifier()) {
53081        openArray("modifier");
53082        for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
53083          composeEnumerationCore(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
53084        closeArray();
53085        if (anyHasExtras(element.getModifier())) {
53086          openArray("_modifier");
53087          for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
53088            composeEnumerationExtras(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
53089          closeArray();
53090        }
53091      };
53092      if (element.hasChain()) {
53093        openArray("chain");
53094        for (StringType e : element.getChain()) 
53095          composeStringCore(null, e, true);
53096        closeArray();
53097        if (anyHasExtras(element.getChain())) {
53098          openArray("_chain");
53099          for (StringType e : element.getChain()) 
53100            composeStringExtras(null, e, true);
53101          closeArray();
53102        }
53103      };
53104      if (element.hasComponent()) {
53105        openArray("component");
53106        for (SearchParameter.SearchParameterComponentComponent e : element.getComponent()) 
53107          composeSearchParameterSearchParameterComponentComponent(null, e);
53108        closeArray();
53109      };
53110  }
53111
53112  protected void composeSearchParameterSearchParameterComponentComponent(String name, SearchParameter.SearchParameterComponentComponent element) throws IOException {
53113    if (element != null) {
53114      open(name);
53115      composeSearchParameterSearchParameterComponentComponentInner(element);
53116      close();
53117    }
53118  }
53119
53120  protected void composeSearchParameterSearchParameterComponentComponentInner(SearchParameter.SearchParameterComponentComponent element) throws IOException {
53121      composeBackbone(element);
53122      if (element.hasDefinitionElement()) {
53123        composeCanonicalCore("definition", element.getDefinitionElement(), false);
53124        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
53125      }
53126      if (element.hasExpressionElement()) {
53127        composeStringCore("expression", element.getExpressionElement(), false);
53128        composeStringExtras("expression", element.getExpressionElement(), false);
53129      }
53130  }
53131
53132  protected void composeServiceRequest(String name, ServiceRequest element) throws IOException {
53133    if (element != null) {
53134      prop("resourceType", name);
53135      composeServiceRequestInner(element);
53136    }
53137  }
53138
53139  protected void composeServiceRequestInner(ServiceRequest element) throws IOException {
53140      composeDomainResourceElements(element);
53141      if (element.hasIdentifier()) {
53142        openArray("identifier");
53143        for (Identifier e : element.getIdentifier()) 
53144          composeIdentifier(null, e);
53145        closeArray();
53146      };
53147      if (element.hasInstantiatesCanonical()) {
53148        openArray("instantiatesCanonical");
53149        for (CanonicalType e : element.getInstantiatesCanonical()) 
53150          composeCanonicalCore(null, e, true);
53151        closeArray();
53152        if (anyHasExtras(element.getInstantiatesCanonical())) {
53153          openArray("_instantiatesCanonical");
53154          for (CanonicalType e : element.getInstantiatesCanonical()) 
53155            composeCanonicalExtras(null, e, true);
53156          closeArray();
53157        }
53158      };
53159      if (element.hasInstantiatesUri()) {
53160        openArray("instantiatesUri");
53161        for (UriType e : element.getInstantiatesUri()) 
53162          composeUriCore(null, e, true);
53163        closeArray();
53164        if (anyHasExtras(element.getInstantiatesUri())) {
53165          openArray("_instantiatesUri");
53166          for (UriType e : element.getInstantiatesUri()) 
53167            composeUriExtras(null, e, true);
53168          closeArray();
53169        }
53170      };
53171      if (element.hasBasedOn()) {
53172        openArray("basedOn");
53173        for (Reference e : element.getBasedOn()) 
53174          composeReference(null, e);
53175        closeArray();
53176      };
53177      if (element.hasReplaces()) {
53178        openArray("replaces");
53179        for (Reference e : element.getReplaces()) 
53180          composeReference(null, e);
53181        closeArray();
53182      };
53183      if (element.hasRequisition()) {
53184        composeIdentifier("requisition", element.getRequisition());
53185      }
53186      if (element.hasStatusElement()) {
53187        composeEnumerationCore("status", element.getStatusElement(), new ServiceRequest.ServiceRequestStatusEnumFactory(), false);
53188        composeEnumerationExtras("status", element.getStatusElement(), new ServiceRequest.ServiceRequestStatusEnumFactory(), false);
53189      }
53190      if (element.hasIntentElement()) {
53191        composeEnumerationCore("intent", element.getIntentElement(), new ServiceRequest.ServiceRequestIntentEnumFactory(), false);
53192        composeEnumerationExtras("intent", element.getIntentElement(), new ServiceRequest.ServiceRequestIntentEnumFactory(), false);
53193      }
53194      if (element.hasCategory()) {
53195        openArray("category");
53196        for (CodeableConcept e : element.getCategory()) 
53197          composeCodeableConcept(null, e);
53198        closeArray();
53199      };
53200      if (element.hasPriorityElement()) {
53201        composeEnumerationCore("priority", element.getPriorityElement(), new ServiceRequest.ServiceRequestPriorityEnumFactory(), false);
53202        composeEnumerationExtras("priority", element.getPriorityElement(), new ServiceRequest.ServiceRequestPriorityEnumFactory(), false);
53203      }
53204      if (element.hasDoNotPerformElement()) {
53205        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
53206        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
53207      }
53208      if (element.hasCode()) {
53209        composeCodeableConcept("code", element.getCode());
53210      }
53211      if (element.hasOrderDetail()) {
53212        openArray("orderDetail");
53213        for (CodeableConcept e : element.getOrderDetail()) 
53214          composeCodeableConcept(null, e);
53215        closeArray();
53216      };
53217      if (element.hasQuantity()) {
53218        composeType("quantity", element.getQuantity());
53219      }
53220      if (element.hasSubject()) {
53221        composeReference("subject", element.getSubject());
53222      }
53223      if (element.hasEncounter()) {
53224        composeReference("encounter", element.getEncounter());
53225      }
53226      if (element.hasOccurrence()) {
53227        composeType("occurrence", element.getOccurrence());
53228      }
53229      if (element.hasAsNeeded()) {
53230        composeType("asNeeded", element.getAsNeeded());
53231      }
53232      if (element.hasAuthoredOnElement()) {
53233        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
53234        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
53235      }
53236      if (element.hasRequester()) {
53237        composeReference("requester", element.getRequester());
53238      }
53239      if (element.hasPerformerType()) {
53240        composeCodeableConcept("performerType", element.getPerformerType());
53241      }
53242      if (element.hasPerformer()) {
53243        openArray("performer");
53244        for (Reference e : element.getPerformer()) 
53245          composeReference(null, e);
53246        closeArray();
53247      };
53248      if (element.hasLocationCode()) {
53249        openArray("locationCode");
53250        for (CodeableConcept e : element.getLocationCode()) 
53251          composeCodeableConcept(null, e);
53252        closeArray();
53253      };
53254      if (element.hasLocationReference()) {
53255        openArray("locationReference");
53256        for (Reference e : element.getLocationReference()) 
53257          composeReference(null, e);
53258        closeArray();
53259      };
53260      if (element.hasReasonCode()) {
53261        openArray("reasonCode");
53262        for (CodeableConcept e : element.getReasonCode()) 
53263          composeCodeableConcept(null, e);
53264        closeArray();
53265      };
53266      if (element.hasReasonReference()) {
53267        openArray("reasonReference");
53268        for (Reference e : element.getReasonReference()) 
53269          composeReference(null, e);
53270        closeArray();
53271      };
53272      if (element.hasInsurance()) {
53273        openArray("insurance");
53274        for (Reference e : element.getInsurance()) 
53275          composeReference(null, e);
53276        closeArray();
53277      };
53278      if (element.hasSupportingInfo()) {
53279        openArray("supportingInfo");
53280        for (Reference e : element.getSupportingInfo()) 
53281          composeReference(null, e);
53282        closeArray();
53283      };
53284      if (element.hasSpecimen()) {
53285        openArray("specimen");
53286        for (Reference e : element.getSpecimen()) 
53287          composeReference(null, e);
53288        closeArray();
53289      };
53290      if (element.hasBodySite()) {
53291        openArray("bodySite");
53292        for (CodeableConcept e : element.getBodySite()) 
53293          composeCodeableConcept(null, e);
53294        closeArray();
53295      };
53296      if (element.hasNote()) {
53297        openArray("note");
53298        for (Annotation e : element.getNote()) 
53299          composeAnnotation(null, e);
53300        closeArray();
53301      };
53302      if (element.hasPatientInstructionElement()) {
53303        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
53304        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
53305      }
53306      if (element.hasRelevantHistory()) {
53307        openArray("relevantHistory");
53308        for (Reference e : element.getRelevantHistory()) 
53309          composeReference(null, e);
53310        closeArray();
53311      };
53312  }
53313
53314  protected void composeSlot(String name, Slot element) throws IOException {
53315    if (element != null) {
53316      prop("resourceType", name);
53317      composeSlotInner(element);
53318    }
53319  }
53320
53321  protected void composeSlotInner(Slot element) throws IOException {
53322      composeDomainResourceElements(element);
53323      if (element.hasIdentifier()) {
53324        openArray("identifier");
53325        for (Identifier e : element.getIdentifier()) 
53326          composeIdentifier(null, e);
53327        closeArray();
53328      };
53329      if (element.hasServiceCategory()) {
53330        openArray("serviceCategory");
53331        for (CodeableConcept e : element.getServiceCategory()) 
53332          composeCodeableConcept(null, e);
53333        closeArray();
53334      };
53335      if (element.hasServiceType()) {
53336        openArray("serviceType");
53337        for (CodeableConcept e : element.getServiceType()) 
53338          composeCodeableConcept(null, e);
53339        closeArray();
53340      };
53341      if (element.hasSpecialty()) {
53342        openArray("specialty");
53343        for (CodeableConcept e : element.getSpecialty()) 
53344          composeCodeableConcept(null, e);
53345        closeArray();
53346      };
53347      if (element.hasAppointmentType()) {
53348        composeCodeableConcept("appointmentType", element.getAppointmentType());
53349      }
53350      if (element.hasSchedule()) {
53351        composeReference("schedule", element.getSchedule());
53352      }
53353      if (element.hasStatusElement()) {
53354        composeEnumerationCore("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
53355        composeEnumerationExtras("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
53356      }
53357      if (element.hasStartElement()) {
53358        composeInstantCore("start", element.getStartElement(), false);
53359        composeInstantExtras("start", element.getStartElement(), false);
53360      }
53361      if (element.hasEndElement()) {
53362        composeInstantCore("end", element.getEndElement(), false);
53363        composeInstantExtras("end", element.getEndElement(), false);
53364      }
53365      if (element.hasOverbookedElement()) {
53366        composeBooleanCore("overbooked", element.getOverbookedElement(), false);
53367        composeBooleanExtras("overbooked", element.getOverbookedElement(), false);
53368      }
53369      if (element.hasCommentElement()) {
53370        composeStringCore("comment", element.getCommentElement(), false);
53371        composeStringExtras("comment", element.getCommentElement(), false);
53372      }
53373  }
53374
53375  protected void composeSpecimen(String name, Specimen element) throws IOException {
53376    if (element != null) {
53377      prop("resourceType", name);
53378      composeSpecimenInner(element);
53379    }
53380  }
53381
53382  protected void composeSpecimenInner(Specimen element) throws IOException {
53383      composeDomainResourceElements(element);
53384      if (element.hasIdentifier()) {
53385        openArray("identifier");
53386        for (Identifier e : element.getIdentifier()) 
53387          composeIdentifier(null, e);
53388        closeArray();
53389      };
53390      if (element.hasAccessionIdentifier()) {
53391        composeIdentifier("accessionIdentifier", element.getAccessionIdentifier());
53392      }
53393      if (element.hasStatusElement()) {
53394        composeEnumerationCore("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
53395        composeEnumerationExtras("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
53396      }
53397      if (element.hasType()) {
53398        composeCodeableConcept("type", element.getType());
53399      }
53400      if (element.hasSubject()) {
53401        composeReference("subject", element.getSubject());
53402      }
53403      if (element.hasReceivedTimeElement()) {
53404        composeDateTimeCore("receivedTime", element.getReceivedTimeElement(), false);
53405        composeDateTimeExtras("receivedTime", element.getReceivedTimeElement(), false);
53406      }
53407      if (element.hasParent()) {
53408        openArray("parent");
53409        for (Reference e : element.getParent()) 
53410          composeReference(null, e);
53411        closeArray();
53412      };
53413      if (element.hasRequest()) {
53414        openArray("request");
53415        for (Reference e : element.getRequest()) 
53416          composeReference(null, e);
53417        closeArray();
53418      };
53419      if (element.hasCollection()) {
53420        composeSpecimenSpecimenCollectionComponent("collection", element.getCollection());
53421      }
53422      if (element.hasProcessing()) {
53423        openArray("processing");
53424        for (Specimen.SpecimenProcessingComponent e : element.getProcessing()) 
53425          composeSpecimenSpecimenProcessingComponent(null, e);
53426        closeArray();
53427      };
53428      if (element.hasContainer()) {
53429        openArray("container");
53430        for (Specimen.SpecimenContainerComponent e : element.getContainer()) 
53431          composeSpecimenSpecimenContainerComponent(null, e);
53432        closeArray();
53433      };
53434      if (element.hasCondition()) {
53435        openArray("condition");
53436        for (CodeableConcept e : element.getCondition()) 
53437          composeCodeableConcept(null, e);
53438        closeArray();
53439      };
53440      if (element.hasNote()) {
53441        openArray("note");
53442        for (Annotation e : element.getNote()) 
53443          composeAnnotation(null, e);
53444        closeArray();
53445      };
53446  }
53447
53448  protected void composeSpecimenSpecimenCollectionComponent(String name, Specimen.SpecimenCollectionComponent element) throws IOException {
53449    if (element != null) {
53450      open(name);
53451      composeSpecimenSpecimenCollectionComponentInner(element);
53452      close();
53453    }
53454  }
53455
53456  protected void composeSpecimenSpecimenCollectionComponentInner(Specimen.SpecimenCollectionComponent element) throws IOException {
53457      composeBackbone(element);
53458      if (element.hasCollector()) {
53459        composeReference("collector", element.getCollector());
53460      }
53461      if (element.hasCollected()) {
53462        composeType("collected", element.getCollected());
53463      }
53464      if (element.hasDuration()) {
53465        composeDuration("duration", element.getDuration());
53466      }
53467      if (element.hasQuantity()) {
53468        composeQuantity("quantity", element.getQuantity());
53469      }
53470      if (element.hasMethod()) {
53471        composeCodeableConcept("method", element.getMethod());
53472      }
53473      if (element.hasBodySite()) {
53474        composeCodeableConcept("bodySite", element.getBodySite());
53475      }
53476      if (element.hasFastingStatus()) {
53477        composeType("fastingStatus", element.getFastingStatus());
53478      }
53479  }
53480
53481  protected void composeSpecimenSpecimenProcessingComponent(String name, Specimen.SpecimenProcessingComponent element) throws IOException {
53482    if (element != null) {
53483      open(name);
53484      composeSpecimenSpecimenProcessingComponentInner(element);
53485      close();
53486    }
53487  }
53488
53489  protected void composeSpecimenSpecimenProcessingComponentInner(Specimen.SpecimenProcessingComponent element) throws IOException {
53490      composeBackbone(element);
53491      if (element.hasDescriptionElement()) {
53492        composeStringCore("description", element.getDescriptionElement(), false);
53493        composeStringExtras("description", element.getDescriptionElement(), false);
53494      }
53495      if (element.hasProcedure()) {
53496        composeCodeableConcept("procedure", element.getProcedure());
53497      }
53498      if (element.hasAdditive()) {
53499        openArray("additive");
53500        for (Reference e : element.getAdditive()) 
53501          composeReference(null, e);
53502        closeArray();
53503      };
53504      if (element.hasTime()) {
53505        composeType("time", element.getTime());
53506      }
53507  }
53508
53509  protected void composeSpecimenSpecimenContainerComponent(String name, Specimen.SpecimenContainerComponent element) throws IOException {
53510    if (element != null) {
53511      open(name);
53512      composeSpecimenSpecimenContainerComponentInner(element);
53513      close();
53514    }
53515  }
53516
53517  protected void composeSpecimenSpecimenContainerComponentInner(Specimen.SpecimenContainerComponent element) throws IOException {
53518      composeBackbone(element);
53519      if (element.hasIdentifier()) {
53520        openArray("identifier");
53521        for (Identifier e : element.getIdentifier()) 
53522          composeIdentifier(null, e);
53523        closeArray();
53524      };
53525      if (element.hasDescriptionElement()) {
53526        composeStringCore("description", element.getDescriptionElement(), false);
53527        composeStringExtras("description", element.getDescriptionElement(), false);
53528      }
53529      if (element.hasType()) {
53530        composeCodeableConcept("type", element.getType());
53531      }
53532      if (element.hasCapacity()) {
53533        composeQuantity("capacity", element.getCapacity());
53534      }
53535      if (element.hasSpecimenQuantity()) {
53536        composeQuantity("specimenQuantity", element.getSpecimenQuantity());
53537      }
53538      if (element.hasAdditive()) {
53539        composeType("additive", element.getAdditive());
53540      }
53541  }
53542
53543  protected void composeSpecimenDefinition(String name, SpecimenDefinition element) throws IOException {
53544    if (element != null) {
53545      prop("resourceType", name);
53546      composeSpecimenDefinitionInner(element);
53547    }
53548  }
53549
53550  protected void composeSpecimenDefinitionInner(SpecimenDefinition element) throws IOException {
53551      composeDomainResourceElements(element);
53552      if (element.hasIdentifier()) {
53553        composeIdentifier("identifier", element.getIdentifier());
53554      }
53555      if (element.hasTypeCollected()) {
53556        composeCodeableConcept("typeCollected", element.getTypeCollected());
53557      }
53558      if (element.hasPatientPreparation()) {
53559        openArray("patientPreparation");
53560        for (CodeableConcept e : element.getPatientPreparation()) 
53561          composeCodeableConcept(null, e);
53562        closeArray();
53563      };
53564      if (element.hasTimeAspectElement()) {
53565        composeStringCore("timeAspect", element.getTimeAspectElement(), false);
53566        composeStringExtras("timeAspect", element.getTimeAspectElement(), false);
53567      }
53568      if (element.hasCollection()) {
53569        openArray("collection");
53570        for (CodeableConcept e : element.getCollection()) 
53571          composeCodeableConcept(null, e);
53572        closeArray();
53573      };
53574      if (element.hasTypeTested()) {
53575        openArray("typeTested");
53576        for (SpecimenDefinition.SpecimenDefinitionTypeTestedComponent e : element.getTypeTested()) 
53577          composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(null, e);
53578        closeArray();
53579      };
53580  }
53581
53582  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
53583    if (element != null) {
53584      open(name);
53585      composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponentInner(element);
53586      close();
53587    }
53588  }
53589
53590  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
53591      composeBackbone(element);
53592      if (element.hasIsDerivedElement()) {
53593        composeBooleanCore("isDerived", element.getIsDerivedElement(), false);
53594        composeBooleanExtras("isDerived", element.getIsDerivedElement(), false);
53595      }
53596      if (element.hasType()) {
53597        composeCodeableConcept("type", element.getType());
53598      }
53599      if (element.hasPreferenceElement()) {
53600        composeEnumerationCore("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
53601        composeEnumerationExtras("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
53602      }
53603      if (element.hasContainer()) {
53604        composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent("container", element.getContainer());
53605      }
53606      if (element.hasRequirementElement()) {
53607        composeStringCore("requirement", element.getRequirementElement(), false);
53608        composeStringExtras("requirement", element.getRequirementElement(), false);
53609      }
53610      if (element.hasRetentionTime()) {
53611        composeDuration("retentionTime", element.getRetentionTime());
53612      }
53613      if (element.hasRejectionCriterion()) {
53614        openArray("rejectionCriterion");
53615        for (CodeableConcept e : element.getRejectionCriterion()) 
53616          composeCodeableConcept(null, e);
53617        closeArray();
53618      };
53619      if (element.hasHandling()) {
53620        openArray("handling");
53621        for (SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent e : element.getHandling()) 
53622          composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(null, e);
53623        closeArray();
53624      };
53625  }
53626
53627  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
53628    if (element != null) {
53629      open(name);
53630      composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentInner(element);
53631      close();
53632    }
53633  }
53634
53635  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
53636      composeBackbone(element);
53637      if (element.hasMaterial()) {
53638        composeCodeableConcept("material", element.getMaterial());
53639      }
53640      if (element.hasType()) {
53641        composeCodeableConcept("type", element.getType());
53642      }
53643      if (element.hasCap()) {
53644        composeCodeableConcept("cap", element.getCap());
53645      }
53646      if (element.hasDescriptionElement()) {
53647        composeStringCore("description", element.getDescriptionElement(), false);
53648        composeStringExtras("description", element.getDescriptionElement(), false);
53649      }
53650      if (element.hasCapacity()) {
53651        composeQuantity("capacity", element.getCapacity());
53652      }
53653      if (element.hasMinimumVolume()) {
53654        composeType("minimumVolume", element.getMinimumVolume());
53655      }
53656      if (element.hasAdditive()) {
53657        openArray("additive");
53658        for (SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent e : element.getAdditive()) 
53659          composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(null, e);
53660        closeArray();
53661      };
53662      if (element.hasPreparationElement()) {
53663        composeStringCore("preparation", element.getPreparationElement(), false);
53664        composeStringExtras("preparation", element.getPreparationElement(), false);
53665      }
53666  }
53667
53668  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
53669    if (element != null) {
53670      open(name);
53671      composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentInner(element);
53672      close();
53673    }
53674  }
53675
53676  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
53677      composeBackbone(element);
53678      if (element.hasAdditive()) {
53679        composeType("additive", element.getAdditive());
53680      }
53681  }
53682
53683  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
53684    if (element != null) {
53685      open(name);
53686      composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentInner(element);
53687      close();
53688    }
53689  }
53690
53691  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
53692      composeBackbone(element);
53693      if (element.hasTemperatureQualifier()) {
53694        composeCodeableConcept("temperatureQualifier", element.getTemperatureQualifier());
53695      }
53696      if (element.hasTemperatureRange()) {
53697        composeRange("temperatureRange", element.getTemperatureRange());
53698      }
53699      if (element.hasMaxDuration()) {
53700        composeDuration("maxDuration", element.getMaxDuration());
53701      }
53702      if (element.hasInstructionElement()) {
53703        composeStringCore("instruction", element.getInstructionElement(), false);
53704        composeStringExtras("instruction", element.getInstructionElement(), false);
53705      }
53706  }
53707
53708  protected void composeStructureDefinition(String name, StructureDefinition element) throws IOException {
53709    if (element != null) {
53710      prop("resourceType", name);
53711      composeStructureDefinitionInner(element);
53712    }
53713  }
53714
53715  protected void composeStructureDefinitionInner(StructureDefinition element) throws IOException {
53716      composeDomainResourceElements(element);
53717      if (element.hasUrlElement()) {
53718        composeUriCore("url", element.getUrlElement(), false);
53719        composeUriExtras("url", element.getUrlElement(), false);
53720      }
53721      if (element.hasIdentifier()) {
53722        openArray("identifier");
53723        for (Identifier e : element.getIdentifier()) 
53724          composeIdentifier(null, e);
53725        closeArray();
53726      };
53727      if (element.hasVersionElement()) {
53728        composeStringCore("version", element.getVersionElement(), false);
53729        composeStringExtras("version", element.getVersionElement(), false);
53730      }
53731      if (element.hasNameElement()) {
53732        composeStringCore("name", element.getNameElement(), false);
53733        composeStringExtras("name", element.getNameElement(), false);
53734      }
53735      if (element.hasTitleElement()) {
53736        composeStringCore("title", element.getTitleElement(), false);
53737        composeStringExtras("title", element.getTitleElement(), false);
53738      }
53739      if (element.hasStatusElement()) {
53740        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53741        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53742      }
53743      if (element.hasExperimentalElement()) {
53744        composeBooleanCore("experimental", element.getExperimentalElement(), false);
53745        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
53746      }
53747      if (element.hasDateElement()) {
53748        composeDateTimeCore("date", element.getDateElement(), false);
53749        composeDateTimeExtras("date", element.getDateElement(), false);
53750      }
53751      if (element.hasPublisherElement()) {
53752        composeStringCore("publisher", element.getPublisherElement(), false);
53753        composeStringExtras("publisher", element.getPublisherElement(), false);
53754      }
53755      if (element.hasContact()) {
53756        openArray("contact");
53757        for (ContactDetail e : element.getContact()) 
53758          composeContactDetail(null, e);
53759        closeArray();
53760      };
53761      if (element.hasDescriptionElement()) {
53762        composeMarkdownCore("description", element.getDescriptionElement(), false);
53763        composeMarkdownExtras("description", element.getDescriptionElement(), false);
53764      }
53765      if (element.hasUseContext()) {
53766        openArray("useContext");
53767        for (UsageContext e : element.getUseContext()) 
53768          composeUsageContext(null, e);
53769        closeArray();
53770      };
53771      if (element.hasJurisdiction()) {
53772        openArray("jurisdiction");
53773        for (CodeableConcept e : element.getJurisdiction()) 
53774          composeCodeableConcept(null, e);
53775        closeArray();
53776      };
53777      if (element.hasPurposeElement()) {
53778        composeMarkdownCore("purpose", element.getPurposeElement(), false);
53779        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
53780      }
53781      if (element.hasCopyrightElement()) {
53782        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
53783        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
53784      }
53785      if (element.hasKeyword()) {
53786        openArray("keyword");
53787        for (Coding e : element.getKeyword()) 
53788          composeCoding(null, e);
53789        closeArray();
53790      };
53791      if (element.hasFhirVersionElement()) {
53792        composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
53793        composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
53794      }
53795      if (element.hasMapping()) {
53796        openArray("mapping");
53797        for (StructureDefinition.StructureDefinitionMappingComponent e : element.getMapping()) 
53798          composeStructureDefinitionStructureDefinitionMappingComponent(null, e);
53799        closeArray();
53800      };
53801      if (element.hasKindElement()) {
53802        composeEnumerationCore("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
53803        composeEnumerationExtras("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
53804      }
53805      if (element.hasAbstractElement()) {
53806        composeBooleanCore("abstract", element.getAbstractElement(), false);
53807        composeBooleanExtras("abstract", element.getAbstractElement(), false);
53808      }
53809      if (element.hasContext()) {
53810        openArray("context");
53811        for (StructureDefinition.StructureDefinitionContextComponent e : element.getContext()) 
53812          composeStructureDefinitionStructureDefinitionContextComponent(null, e);
53813        closeArray();
53814      };
53815      if (element.hasContextInvariant()) {
53816        openArray("contextInvariant");
53817        for (StringType e : element.getContextInvariant()) 
53818          composeStringCore(null, e, true);
53819        closeArray();
53820        if (anyHasExtras(element.getContextInvariant())) {
53821          openArray("_contextInvariant");
53822          for (StringType e : element.getContextInvariant()) 
53823            composeStringExtras(null, e, true);
53824          closeArray();
53825        }
53826      };
53827      if (element.hasTypeElement()) {
53828        composeUriCore("type", element.getTypeElement(), false);
53829        composeUriExtras("type", element.getTypeElement(), false);
53830      }
53831      if (element.hasBaseDefinitionElement()) {
53832        composeCanonicalCore("baseDefinition", element.getBaseDefinitionElement(), false);
53833        composeCanonicalExtras("baseDefinition", element.getBaseDefinitionElement(), false);
53834      }
53835      if (element.hasDerivationElement()) {
53836        composeEnumerationCore("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
53837        composeEnumerationExtras("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
53838      }
53839      if (element.hasSnapshot()) {
53840        composeStructureDefinitionStructureDefinitionSnapshotComponent("snapshot", element.getSnapshot());
53841      }
53842      if (element.hasDifferential()) {
53843        composeStructureDefinitionStructureDefinitionDifferentialComponent("differential", element.getDifferential());
53844      }
53845  }
53846
53847  protected void composeStructureDefinitionStructureDefinitionMappingComponent(String name, StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
53848    if (element != null) {
53849      open(name);
53850      composeStructureDefinitionStructureDefinitionMappingComponentInner(element);
53851      close();
53852    }
53853  }
53854
53855  protected void composeStructureDefinitionStructureDefinitionMappingComponentInner(StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
53856      composeBackbone(element);
53857      if (element.hasIdentityElement()) {
53858        composeIdCore("identity", element.getIdentityElement(), false);
53859        composeIdExtras("identity", element.getIdentityElement(), false);
53860      }
53861      if (element.hasUriElement()) {
53862        composeUriCore("uri", element.getUriElement(), false);
53863        composeUriExtras("uri", element.getUriElement(), false);
53864      }
53865      if (element.hasNameElement()) {
53866        composeStringCore("name", element.getNameElement(), false);
53867        composeStringExtras("name", element.getNameElement(), false);
53868      }
53869      if (element.hasCommentElement()) {
53870        composeStringCore("comment", element.getCommentElement(), false);
53871        composeStringExtras("comment", element.getCommentElement(), false);
53872      }
53873  }
53874
53875  protected void composeStructureDefinitionStructureDefinitionContextComponent(String name, StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
53876    if (element != null) {
53877      open(name);
53878      composeStructureDefinitionStructureDefinitionContextComponentInner(element);
53879      close();
53880    }
53881  }
53882
53883  protected void composeStructureDefinitionStructureDefinitionContextComponentInner(StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
53884      composeBackbone(element);
53885      if (element.hasTypeElement()) {
53886        composeEnumerationCore("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
53887        composeEnumerationExtras("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
53888      }
53889      if (element.hasExpressionElement()) {
53890        composeStringCore("expression", element.getExpressionElement(), false);
53891        composeStringExtras("expression", element.getExpressionElement(), false);
53892      }
53893  }
53894
53895  protected void composeStructureDefinitionStructureDefinitionSnapshotComponent(String name, StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
53896    if (element != null) {
53897      open(name);
53898      composeStructureDefinitionStructureDefinitionSnapshotComponentInner(element);
53899      close();
53900    }
53901  }
53902
53903  protected void composeStructureDefinitionStructureDefinitionSnapshotComponentInner(StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
53904      composeBackbone(element);
53905      if (element.hasElement()) {
53906        openArray("element");
53907        for (ElementDefinition e : element.getElement()) 
53908          composeElementDefinition(null, e);
53909        closeArray();
53910      };
53911  }
53912
53913  protected void composeStructureDefinitionStructureDefinitionDifferentialComponent(String name, StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
53914    if (element != null) {
53915      open(name);
53916      composeStructureDefinitionStructureDefinitionDifferentialComponentInner(element);
53917      close();
53918    }
53919  }
53920
53921  protected void composeStructureDefinitionStructureDefinitionDifferentialComponentInner(StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
53922      composeBackbone(element);
53923      if (element.hasElement()) {
53924        openArray("element");
53925        for (ElementDefinition e : element.getElement()) 
53926          composeElementDefinition(null, e);
53927        closeArray();
53928      };
53929  }
53930
53931  protected void composeStructureMap(String name, StructureMap element) throws IOException {
53932    if (element != null) {
53933      prop("resourceType", name);
53934      composeStructureMapInner(element);
53935    }
53936  }
53937
53938  protected void composeStructureMapInner(StructureMap element) throws IOException {
53939      composeDomainResourceElements(element);
53940      if (element.hasUrlElement()) {
53941        composeUriCore("url", element.getUrlElement(), false);
53942        composeUriExtras("url", element.getUrlElement(), false);
53943      }
53944      if (element.hasIdentifier()) {
53945        openArray("identifier");
53946        for (Identifier e : element.getIdentifier()) 
53947          composeIdentifier(null, e);
53948        closeArray();
53949      };
53950      if (element.hasVersionElement()) {
53951        composeStringCore("version", element.getVersionElement(), false);
53952        composeStringExtras("version", element.getVersionElement(), false);
53953      }
53954      if (element.hasNameElement()) {
53955        composeStringCore("name", element.getNameElement(), false);
53956        composeStringExtras("name", element.getNameElement(), false);
53957      }
53958      if (element.hasTitleElement()) {
53959        composeStringCore("title", element.getTitleElement(), false);
53960        composeStringExtras("title", element.getTitleElement(), false);
53961      }
53962      if (element.hasStatusElement()) {
53963        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53964        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53965      }
53966      if (element.hasExperimentalElement()) {
53967        composeBooleanCore("experimental", element.getExperimentalElement(), false);
53968        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
53969      }
53970      if (element.hasDateElement()) {
53971        composeDateTimeCore("date", element.getDateElement(), false);
53972        composeDateTimeExtras("date", element.getDateElement(), false);
53973      }
53974      if (element.hasPublisherElement()) {
53975        composeStringCore("publisher", element.getPublisherElement(), false);
53976        composeStringExtras("publisher", element.getPublisherElement(), false);
53977      }
53978      if (element.hasContact()) {
53979        openArray("contact");
53980        for (ContactDetail e : element.getContact()) 
53981          composeContactDetail(null, e);
53982        closeArray();
53983      };
53984      if (element.hasDescriptionElement()) {
53985        composeMarkdownCore("description", element.getDescriptionElement(), false);
53986        composeMarkdownExtras("description", element.getDescriptionElement(), false);
53987      }
53988      if (element.hasUseContext()) {
53989        openArray("useContext");
53990        for (UsageContext e : element.getUseContext()) 
53991          composeUsageContext(null, e);
53992        closeArray();
53993      };
53994      if (element.hasJurisdiction()) {
53995        openArray("jurisdiction");
53996        for (CodeableConcept e : element.getJurisdiction()) 
53997          composeCodeableConcept(null, e);
53998        closeArray();
53999      };
54000      if (element.hasPurposeElement()) {
54001        composeMarkdownCore("purpose", element.getPurposeElement(), false);
54002        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
54003      }
54004      if (element.hasCopyrightElement()) {
54005        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
54006        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
54007      }
54008      if (element.hasStructure()) {
54009        openArray("structure");
54010        for (StructureMap.StructureMapStructureComponent e : element.getStructure()) 
54011          composeStructureMapStructureMapStructureComponent(null, e);
54012        closeArray();
54013      };
54014      if (element.hasImport()) {
54015        openArray("import");
54016        for (CanonicalType e : element.getImport()) 
54017          composeCanonicalCore(null, e, true);
54018        closeArray();
54019        if (anyHasExtras(element.getImport())) {
54020          openArray("_import");
54021          for (CanonicalType e : element.getImport()) 
54022            composeCanonicalExtras(null, e, true);
54023          closeArray();
54024        }
54025      };
54026      if (element.hasGroup()) {
54027        openArray("group");
54028        for (StructureMap.StructureMapGroupComponent e : element.getGroup()) 
54029          composeStructureMapStructureMapGroupComponent(null, e);
54030        closeArray();
54031      };
54032  }
54033
54034  protected void composeStructureMapStructureMapStructureComponent(String name, StructureMap.StructureMapStructureComponent element) throws IOException {
54035    if (element != null) {
54036      open(name);
54037      composeStructureMapStructureMapStructureComponentInner(element);
54038      close();
54039    }
54040  }
54041
54042  protected void composeStructureMapStructureMapStructureComponentInner(StructureMap.StructureMapStructureComponent element) throws IOException {
54043      composeBackbone(element);
54044      if (element.hasUrlElement()) {
54045        composeCanonicalCore("url", element.getUrlElement(), false);
54046        composeCanonicalExtras("url", element.getUrlElement(), false);
54047      }
54048      if (element.hasModeElement()) {
54049        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
54050        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
54051      }
54052      if (element.hasAliasElement()) {
54053        composeStringCore("alias", element.getAliasElement(), false);
54054        composeStringExtras("alias", element.getAliasElement(), false);
54055      }
54056      if (element.hasDocumentationElement()) {
54057        composeStringCore("documentation", element.getDocumentationElement(), false);
54058        composeStringExtras("documentation", element.getDocumentationElement(), false);
54059      }
54060  }
54061
54062  protected void composeStructureMapStructureMapGroupComponent(String name, StructureMap.StructureMapGroupComponent element) throws IOException {
54063    if (element != null) {
54064      open(name);
54065      composeStructureMapStructureMapGroupComponentInner(element);
54066      close();
54067    }
54068  }
54069
54070  protected void composeStructureMapStructureMapGroupComponentInner(StructureMap.StructureMapGroupComponent element) throws IOException {
54071      composeBackbone(element);
54072      if (element.hasNameElement()) {
54073        composeIdCore("name", element.getNameElement(), false);
54074        composeIdExtras("name", element.getNameElement(), false);
54075      }
54076      if (element.hasExtendsElement()) {
54077        composeIdCore("extends", element.getExtendsElement(), false);
54078        composeIdExtras("extends", element.getExtendsElement(), false);
54079      }
54080      if (element.hasTypeModeElement()) {
54081        composeEnumerationCore("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
54082        composeEnumerationExtras("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
54083      }
54084      if (element.hasDocumentationElement()) {
54085        composeStringCore("documentation", element.getDocumentationElement(), false);
54086        composeStringExtras("documentation", element.getDocumentationElement(), false);
54087      }
54088      if (element.hasInput()) {
54089        openArray("input");
54090        for (StructureMap.StructureMapGroupInputComponent e : element.getInput()) 
54091          composeStructureMapStructureMapGroupInputComponent(null, e);
54092        closeArray();
54093      };
54094      if (element.hasRule()) {
54095        openArray("rule");
54096        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
54097          composeStructureMapStructureMapGroupRuleComponent(null, e);
54098        closeArray();
54099      };
54100  }
54101
54102  protected void composeStructureMapStructureMapGroupInputComponent(String name, StructureMap.StructureMapGroupInputComponent element) throws IOException {
54103    if (element != null) {
54104      open(name);
54105      composeStructureMapStructureMapGroupInputComponentInner(element);
54106      close();
54107    }
54108  }
54109
54110  protected void composeStructureMapStructureMapGroupInputComponentInner(StructureMap.StructureMapGroupInputComponent element) throws IOException {
54111      composeBackbone(element);
54112      if (element.hasNameElement()) {
54113        composeIdCore("name", element.getNameElement(), false);
54114        composeIdExtras("name", element.getNameElement(), false);
54115      }
54116      if (element.hasTypeElement()) {
54117        composeStringCore("type", element.getTypeElement(), false);
54118        composeStringExtras("type", element.getTypeElement(), false);
54119      }
54120      if (element.hasModeElement()) {
54121        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
54122        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
54123      }
54124      if (element.hasDocumentationElement()) {
54125        composeStringCore("documentation", element.getDocumentationElement(), false);
54126        composeStringExtras("documentation", element.getDocumentationElement(), false);
54127      }
54128  }
54129
54130  protected void composeStructureMapStructureMapGroupRuleComponent(String name, StructureMap.StructureMapGroupRuleComponent element) throws IOException {
54131    if (element != null) {
54132      open(name);
54133      composeStructureMapStructureMapGroupRuleComponentInner(element);
54134      close();
54135    }
54136  }
54137
54138  protected void composeStructureMapStructureMapGroupRuleComponentInner(StructureMap.StructureMapGroupRuleComponent element) throws IOException {
54139      composeBackbone(element);
54140      if (element.hasNameElement()) {
54141        composeIdCore("name", element.getNameElement(), false);
54142        composeIdExtras("name", element.getNameElement(), false);
54143      }
54144      if (element.hasSource()) {
54145        openArray("source");
54146        for (StructureMap.StructureMapGroupRuleSourceComponent e : element.getSource()) 
54147          composeStructureMapStructureMapGroupRuleSourceComponent(null, e);
54148        closeArray();
54149      };
54150      if (element.hasTarget()) {
54151        openArray("target");
54152        for (StructureMap.StructureMapGroupRuleTargetComponent e : element.getTarget()) 
54153          composeStructureMapStructureMapGroupRuleTargetComponent(null, e);
54154        closeArray();
54155      };
54156      if (element.hasRule()) {
54157        openArray("rule");
54158        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
54159          composeStructureMapStructureMapGroupRuleComponent(null, e);
54160        closeArray();
54161      };
54162      if (element.hasDependent()) {
54163        openArray("dependent");
54164        for (StructureMap.StructureMapGroupRuleDependentComponent e : element.getDependent()) 
54165          composeStructureMapStructureMapGroupRuleDependentComponent(null, e);
54166        closeArray();
54167      };
54168      if (element.hasDocumentationElement()) {
54169        composeStringCore("documentation", element.getDocumentationElement(), false);
54170        composeStringExtras("documentation", element.getDocumentationElement(), false);
54171      }
54172  }
54173
54174  protected void composeStructureMapStructureMapGroupRuleSourceComponent(String name, StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
54175    if (element != null) {
54176      open(name);
54177      composeStructureMapStructureMapGroupRuleSourceComponentInner(element);
54178      close();
54179    }
54180  }
54181
54182  protected void composeStructureMapStructureMapGroupRuleSourceComponentInner(StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
54183      composeBackbone(element);
54184      if (element.hasContextElement()) {
54185        composeIdCore("context", element.getContextElement(), false);
54186        composeIdExtras("context", element.getContextElement(), false);
54187      }
54188      if (element.hasMinElement()) {
54189        composeIntegerCore("min", element.getMinElement(), false);
54190        composeIntegerExtras("min", element.getMinElement(), false);
54191      }
54192      if (element.hasMaxElement()) {
54193        composeStringCore("max", element.getMaxElement(), false);
54194        composeStringExtras("max", element.getMaxElement(), false);
54195      }
54196      if (element.hasTypeElement()) {
54197        composeStringCore("type", element.getTypeElement(), false);
54198        composeStringExtras("type", element.getTypeElement(), false);
54199      }
54200      if (element.hasDefaultValue()) {
54201        composeType("defaultValue", element.getDefaultValue());
54202      }
54203      if (element.hasElementElement()) {
54204        composeStringCore("element", element.getElementElement(), false);
54205        composeStringExtras("element", element.getElementElement(), false);
54206      }
54207      if (element.hasListModeElement()) {
54208        composeEnumerationCore("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
54209        composeEnumerationExtras("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
54210      }
54211      if (element.hasVariableElement()) {
54212        composeIdCore("variable", element.getVariableElement(), false);
54213        composeIdExtras("variable", element.getVariableElement(), false);
54214      }
54215      if (element.hasConditionElement()) {
54216        composeStringCore("condition", element.getConditionElement(), false);
54217        composeStringExtras("condition", element.getConditionElement(), false);
54218      }
54219      if (element.hasCheckElement()) {
54220        composeStringCore("check", element.getCheckElement(), false);
54221        composeStringExtras("check", element.getCheckElement(), false);
54222      }
54223      if (element.hasLogMessageElement()) {
54224        composeStringCore("logMessage", element.getLogMessageElement(), false);
54225        composeStringExtras("logMessage", element.getLogMessageElement(), false);
54226      }
54227  }
54228
54229  protected void composeStructureMapStructureMapGroupRuleTargetComponent(String name, StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
54230    if (element != null) {
54231      open(name);
54232      composeStructureMapStructureMapGroupRuleTargetComponentInner(element);
54233      close();
54234    }
54235  }
54236
54237  protected void composeStructureMapStructureMapGroupRuleTargetComponentInner(StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
54238      composeBackbone(element);
54239      if (element.hasContextElement()) {
54240        composeIdCore("context", element.getContextElement(), false);
54241        composeIdExtras("context", element.getContextElement(), false);
54242      }
54243      if (element.hasContextTypeElement()) {
54244        composeEnumerationCore("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
54245        composeEnumerationExtras("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
54246      }
54247      if (element.hasElementElement()) {
54248        composeStringCore("element", element.getElementElement(), false);
54249        composeStringExtras("element", element.getElementElement(), false);
54250      }
54251      if (element.hasVariableElement()) {
54252        composeIdCore("variable", element.getVariableElement(), false);
54253        composeIdExtras("variable", element.getVariableElement(), false);
54254      }
54255      if (element.hasListMode()) {
54256        openArray("listMode");
54257        for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
54258          composeEnumerationCore(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
54259        closeArray();
54260        if (anyHasExtras(element.getListMode())) {
54261          openArray("_listMode");
54262          for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
54263            composeEnumerationExtras(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
54264          closeArray();
54265        }
54266      };
54267      if (element.hasListRuleIdElement()) {
54268        composeIdCore("listRuleId", element.getListRuleIdElement(), false);
54269        composeIdExtras("listRuleId", element.getListRuleIdElement(), false);
54270      }
54271      if (element.hasTransformElement()) {
54272        composeEnumerationCore("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
54273        composeEnumerationExtras("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
54274      }
54275      if (element.hasParameter()) {
54276        openArray("parameter");
54277        for (StructureMap.StructureMapGroupRuleTargetParameterComponent e : element.getParameter()) 
54278          composeStructureMapStructureMapGroupRuleTargetParameterComponent(null, e);
54279        closeArray();
54280      };
54281  }
54282
54283  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponent(String name, StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
54284    if (element != null) {
54285      open(name);
54286      composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(element);
54287      close();
54288    }
54289  }
54290
54291  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
54292      composeBackbone(element);
54293      if (element.hasValue()) {
54294        composeType("value", element.getValue());
54295      }
54296  }
54297
54298  protected void composeStructureMapStructureMapGroupRuleDependentComponent(String name, StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
54299    if (element != null) {
54300      open(name);
54301      composeStructureMapStructureMapGroupRuleDependentComponentInner(element);
54302      close();
54303    }
54304  }
54305
54306  protected void composeStructureMapStructureMapGroupRuleDependentComponentInner(StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
54307      composeBackbone(element);
54308      if (element.hasNameElement()) {
54309        composeIdCore("name", element.getNameElement(), false);
54310        composeIdExtras("name", element.getNameElement(), false);
54311      }
54312      if (element.hasVariable()) {
54313        openArray("variable");
54314        for (StringType e : element.getVariable()) 
54315          composeStringCore(null, e, true);
54316        closeArray();
54317        if (anyHasExtras(element.getVariable())) {
54318          openArray("_variable");
54319          for (StringType e : element.getVariable()) 
54320            composeStringExtras(null, e, true);
54321          closeArray();
54322        }
54323      };
54324  }
54325
54326  protected void composeSubscription(String name, Subscription element) throws IOException {
54327    if (element != null) {
54328      prop("resourceType", name);
54329      composeSubscriptionInner(element);
54330    }
54331  }
54332
54333  protected void composeSubscriptionInner(Subscription element) throws IOException {
54334      composeDomainResourceElements(element);
54335      if (element.hasStatusElement()) {
54336        composeEnumerationCore("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
54337        composeEnumerationExtras("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
54338      }
54339      if (element.hasContact()) {
54340        openArray("contact");
54341        for (ContactPoint e : element.getContact()) 
54342          composeContactPoint(null, e);
54343        closeArray();
54344      };
54345      if (element.hasEndElement()) {
54346        composeInstantCore("end", element.getEndElement(), false);
54347        composeInstantExtras("end", element.getEndElement(), false);
54348      }
54349      if (element.hasReasonElement()) {
54350        composeStringCore("reason", element.getReasonElement(), false);
54351        composeStringExtras("reason", element.getReasonElement(), false);
54352      }
54353      if (element.hasCriteriaElement()) {
54354        composeStringCore("criteria", element.getCriteriaElement(), false);
54355        composeStringExtras("criteria", element.getCriteriaElement(), false);
54356      }
54357      if (element.hasErrorElement()) {
54358        composeStringCore("error", element.getErrorElement(), false);
54359        composeStringExtras("error", element.getErrorElement(), false);
54360      }
54361      if (element.hasChannel()) {
54362        composeSubscriptionSubscriptionChannelComponent("channel", element.getChannel());
54363      }
54364  }
54365
54366  protected void composeSubscriptionSubscriptionChannelComponent(String name, Subscription.SubscriptionChannelComponent element) throws IOException {
54367    if (element != null) {
54368      open(name);
54369      composeSubscriptionSubscriptionChannelComponentInner(element);
54370      close();
54371    }
54372  }
54373
54374  protected void composeSubscriptionSubscriptionChannelComponentInner(Subscription.SubscriptionChannelComponent element) throws IOException {
54375      composeBackbone(element);
54376      if (element.hasTypeElement()) {
54377        composeEnumerationCore("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
54378        composeEnumerationExtras("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
54379      }
54380      if (element.hasEndpointElement()) {
54381        composeUrlCore("endpoint", element.getEndpointElement(), false);
54382        composeUrlExtras("endpoint", element.getEndpointElement(), false);
54383      }
54384      if (element.hasPayloadElement()) {
54385        composeCodeCore("payload", element.getPayloadElement(), false);
54386        composeCodeExtras("payload", element.getPayloadElement(), false);
54387      }
54388      if (element.hasHeader()) {
54389        openArray("header");
54390        for (StringType e : element.getHeader()) 
54391          composeStringCore(null, e, true);
54392        closeArray();
54393        if (anyHasExtras(element.getHeader())) {
54394          openArray("_header");
54395          for (StringType e : element.getHeader()) 
54396            composeStringExtras(null, e, true);
54397          closeArray();
54398        }
54399      };
54400  }
54401
54402  protected void composeSubstance(String name, Substance element) throws IOException {
54403    if (element != null) {
54404      prop("resourceType", name);
54405      composeSubstanceInner(element);
54406    }
54407  }
54408
54409  protected void composeSubstanceInner(Substance element) throws IOException {
54410      composeDomainResourceElements(element);
54411      if (element.hasIdentifier()) {
54412        openArray("identifier");
54413        for (Identifier e : element.getIdentifier()) 
54414          composeIdentifier(null, e);
54415        closeArray();
54416      };
54417      if (element.hasStatusElement()) {
54418        composeEnumerationCore("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
54419        composeEnumerationExtras("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
54420      }
54421      if (element.hasCategory()) {
54422        openArray("category");
54423        for (CodeableConcept e : element.getCategory()) 
54424          composeCodeableConcept(null, e);
54425        closeArray();
54426      };
54427      if (element.hasCode()) {
54428        composeCodeableConcept("code", element.getCode());
54429      }
54430      if (element.hasDescriptionElement()) {
54431        composeStringCore("description", element.getDescriptionElement(), false);
54432        composeStringExtras("description", element.getDescriptionElement(), false);
54433      }
54434      if (element.hasInstance()) {
54435        openArray("instance");
54436        for (Substance.SubstanceInstanceComponent e : element.getInstance()) 
54437          composeSubstanceSubstanceInstanceComponent(null, e);
54438        closeArray();
54439      };
54440      if (element.hasIngredient()) {
54441        openArray("ingredient");
54442        for (Substance.SubstanceIngredientComponent e : element.getIngredient()) 
54443          composeSubstanceSubstanceIngredientComponent(null, e);
54444        closeArray();
54445      };
54446  }
54447
54448  protected void composeSubstanceSubstanceInstanceComponent(String name, Substance.SubstanceInstanceComponent element) throws IOException {
54449    if (element != null) {
54450      open(name);
54451      composeSubstanceSubstanceInstanceComponentInner(element);
54452      close();
54453    }
54454  }
54455
54456  protected void composeSubstanceSubstanceInstanceComponentInner(Substance.SubstanceInstanceComponent element) throws IOException {
54457      composeBackbone(element);
54458      if (element.hasIdentifier()) {
54459        composeIdentifier("identifier", element.getIdentifier());
54460      }
54461      if (element.hasExpiryElement()) {
54462        composeDateTimeCore("expiry", element.getExpiryElement(), false);
54463        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
54464      }
54465      if (element.hasQuantity()) {
54466        composeQuantity("quantity", element.getQuantity());
54467      }
54468  }
54469
54470  protected void composeSubstanceSubstanceIngredientComponent(String name, Substance.SubstanceIngredientComponent element) throws IOException {
54471    if (element != null) {
54472      open(name);
54473      composeSubstanceSubstanceIngredientComponentInner(element);
54474      close();
54475    }
54476  }
54477
54478  protected void composeSubstanceSubstanceIngredientComponentInner(Substance.SubstanceIngredientComponent element) throws IOException {
54479      composeBackbone(element);
54480      if (element.hasQuantity()) {
54481        composeRatio("quantity", element.getQuantity());
54482      }
54483      if (element.hasSubstance()) {
54484        composeType("substance", element.getSubstance());
54485      }
54486  }
54487
54488  protected void composeSubstanceNucleicAcid(String name, SubstanceNucleicAcid element) throws IOException {
54489    if (element != null) {
54490      prop("resourceType", name);
54491      composeSubstanceNucleicAcidInner(element);
54492    }
54493  }
54494
54495  protected void composeSubstanceNucleicAcidInner(SubstanceNucleicAcid element) throws IOException {
54496      composeDomainResourceElements(element);
54497      if (element.hasSequenceType()) {
54498        composeCodeableConcept("sequenceType", element.getSequenceType());
54499      }
54500      if (element.hasNumberOfSubunitsElement()) {
54501        composeIntegerCore("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
54502        composeIntegerExtras("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
54503      }
54504      if (element.hasAreaOfHybridisationElement()) {
54505        composeStringCore("areaOfHybridisation", element.getAreaOfHybridisationElement(), false);
54506        composeStringExtras("areaOfHybridisation", element.getAreaOfHybridisationElement(), false);
54507      }
54508      if (element.hasOligoNucleotideType()) {
54509        composeCodeableConcept("oligoNucleotideType", element.getOligoNucleotideType());
54510      }
54511      if (element.hasSubunit()) {
54512        openArray("subunit");
54513        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent e : element.getSubunit()) 
54514          composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(null, e);
54515        closeArray();
54516      };
54517  }
54518
54519  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent element) throws IOException {
54520    if (element != null) {
54521      open(name);
54522      composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentInner(element);
54523      close();
54524    }
54525  }
54526
54527  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentInner(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent element) throws IOException {
54528      composeBackbone(element);
54529      if (element.hasSubunitElement()) {
54530        composeIntegerCore("subunit", element.getSubunitElement(), false);
54531        composeIntegerExtras("subunit", element.getSubunitElement(), false);
54532      }
54533      if (element.hasSequenceElement()) {
54534        composeStringCore("sequence", element.getSequenceElement(), false);
54535        composeStringExtras("sequence", element.getSequenceElement(), false);
54536      }
54537      if (element.hasLengthElement()) {
54538        composeIntegerCore("length", element.getLengthElement(), false);
54539        composeIntegerExtras("length", element.getLengthElement(), false);
54540      }
54541      if (element.hasSequenceAttachment()) {
54542        composeAttachment("sequenceAttachment", element.getSequenceAttachment());
54543      }
54544      if (element.hasFivePrime()) {
54545        composeCodeableConcept("fivePrime", element.getFivePrime());
54546      }
54547      if (element.hasThreePrime()) {
54548        composeCodeableConcept("threePrime", element.getThreePrime());
54549      }
54550      if (element.hasLinkage()) {
54551        openArray("linkage");
54552        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent e : element.getLinkage()) 
54553          composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(null, e);
54554        closeArray();
54555      };
54556      if (element.hasSugar()) {
54557        openArray("sugar");
54558        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent e : element.getSugar()) 
54559          composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(null, e);
54560        closeArray();
54561      };
54562  }
54563
54564  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent element) throws IOException {
54565    if (element != null) {
54566      open(name);
54567      composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentInner(element);
54568      close();
54569    }
54570  }
54571
54572  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentInner(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent element) throws IOException {
54573      composeBackbone(element);
54574      if (element.hasConnectivityElement()) {
54575        composeStringCore("connectivity", element.getConnectivityElement(), false);
54576        composeStringExtras("connectivity", element.getConnectivityElement(), false);
54577      }
54578      if (element.hasIdentifier()) {
54579        composeIdentifier("identifier", element.getIdentifier());
54580      }
54581      if (element.hasNameElement()) {
54582        composeStringCore("name", element.getNameElement(), false);
54583        composeStringExtras("name", element.getNameElement(), false);
54584      }
54585      if (element.hasResidueSiteElement()) {
54586        composeStringCore("residueSite", element.getResidueSiteElement(), false);
54587        composeStringExtras("residueSite", element.getResidueSiteElement(), false);
54588      }
54589  }
54590
54591  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent element) throws IOException {
54592    if (element != null) {
54593      open(name);
54594      composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentInner(element);
54595      close();
54596    }
54597  }
54598
54599  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentInner(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent element) throws IOException {
54600      composeBackbone(element);
54601      if (element.hasIdentifier()) {
54602        composeIdentifier("identifier", element.getIdentifier());
54603      }
54604      if (element.hasNameElement()) {
54605        composeStringCore("name", element.getNameElement(), false);
54606        composeStringExtras("name", element.getNameElement(), false);
54607      }
54608      if (element.hasResidueSiteElement()) {
54609        composeStringCore("residueSite", element.getResidueSiteElement(), false);
54610        composeStringExtras("residueSite", element.getResidueSiteElement(), false);
54611      }
54612  }
54613
54614  protected void composeSubstancePolymer(String name, SubstancePolymer element) throws IOException {
54615    if (element != null) {
54616      prop("resourceType", name);
54617      composeSubstancePolymerInner(element);
54618    }
54619  }
54620
54621  protected void composeSubstancePolymerInner(SubstancePolymer element) throws IOException {
54622      composeDomainResourceElements(element);
54623      if (element.hasClass_()) {
54624        composeCodeableConcept("class", element.getClass_());
54625      }
54626      if (element.hasGeometry()) {
54627        composeCodeableConcept("geometry", element.getGeometry());
54628      }
54629      if (element.hasCopolymerConnectivity()) {
54630        openArray("copolymerConnectivity");
54631        for (CodeableConcept e : element.getCopolymerConnectivity()) 
54632          composeCodeableConcept(null, e);
54633        closeArray();
54634      };
54635      if (element.hasModification()) {
54636        openArray("modification");
54637        for (StringType e : element.getModification()) 
54638          composeStringCore(null, e, true);
54639        closeArray();
54640        if (anyHasExtras(element.getModification())) {
54641          openArray("_modification");
54642          for (StringType e : element.getModification()) 
54643            composeStringExtras(null, e, true);
54644          closeArray();
54645        }
54646      };
54647      if (element.hasMonomerSet()) {
54648        openArray("monomerSet");
54649        for (SubstancePolymer.SubstancePolymerMonomerSetComponent e : element.getMonomerSet()) 
54650          composeSubstancePolymerSubstancePolymerMonomerSetComponent(null, e);
54651        closeArray();
54652      };
54653      if (element.hasRepeat()) {
54654        openArray("repeat");
54655        for (SubstancePolymer.SubstancePolymerRepeatComponent e : element.getRepeat()) 
54656          composeSubstancePolymerSubstancePolymerRepeatComponent(null, e);
54657        closeArray();
54658      };
54659  }
54660
54661  protected void composeSubstancePolymerSubstancePolymerMonomerSetComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
54662    if (element != null) {
54663      open(name);
54664      composeSubstancePolymerSubstancePolymerMonomerSetComponentInner(element);
54665      close();
54666    }
54667  }
54668
54669  protected void composeSubstancePolymerSubstancePolymerMonomerSetComponentInner(SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
54670      composeBackbone(element);
54671      if (element.hasRatioType()) {
54672        composeCodeableConcept("ratioType", element.getRatioType());
54673      }
54674      if (element.hasStartingMaterial()) {
54675        openArray("startingMaterial");
54676        for (SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent e : element.getStartingMaterial()) 
54677          composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(null, e);
54678        closeArray();
54679      };
54680  }
54681
54682  protected void composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
54683    if (element != null) {
54684      open(name);
54685      composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentInner(element);
54686      close();
54687    }
54688  }
54689
54690  protected void composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentInner(SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
54691      composeBackbone(element);
54692      if (element.hasMaterial()) {
54693        composeCodeableConcept("material", element.getMaterial());
54694      }
54695      if (element.hasType()) {
54696        composeCodeableConcept("type", element.getType());
54697      }
54698      if (element.hasIsDefiningElement()) {
54699        composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
54700        composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
54701      }
54702      if (element.hasAmount()) {
54703        composeSubstanceAmount("amount", element.getAmount());
54704      }
54705  }
54706
54707  protected void composeSubstancePolymerSubstancePolymerRepeatComponent(String name, SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
54708    if (element != null) {
54709      open(name);
54710      composeSubstancePolymerSubstancePolymerRepeatComponentInner(element);
54711      close();
54712    }
54713  }
54714
54715  protected void composeSubstancePolymerSubstancePolymerRepeatComponentInner(SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
54716      composeBackbone(element);
54717      if (element.hasNumberOfUnitsElement()) {
54718        composeIntegerCore("numberOfUnits", element.getNumberOfUnitsElement(), false);
54719        composeIntegerExtras("numberOfUnits", element.getNumberOfUnitsElement(), false);
54720      }
54721      if (element.hasAverageMolecularFormulaElement()) {
54722        composeStringCore("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
54723        composeStringExtras("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
54724      }
54725      if (element.hasRepeatUnitAmountType()) {
54726        composeCodeableConcept("repeatUnitAmountType", element.getRepeatUnitAmountType());
54727      }
54728      if (element.hasRepeatUnit()) {
54729        openArray("repeatUnit");
54730        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent e : element.getRepeatUnit()) 
54731          composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(null, e);
54732        closeArray();
54733      };
54734  }
54735
54736  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
54737    if (element != null) {
54738      open(name);
54739      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentInner(element);
54740      close();
54741    }
54742  }
54743
54744  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentInner(SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
54745      composeBackbone(element);
54746      if (element.hasOrientationOfPolymerisation()) {
54747        composeCodeableConcept("orientationOfPolymerisation", element.getOrientationOfPolymerisation());
54748      }
54749      if (element.hasRepeatUnitElement()) {
54750        composeStringCore("repeatUnit", element.getRepeatUnitElement(), false);
54751        composeStringExtras("repeatUnit", element.getRepeatUnitElement(), false);
54752      }
54753      if (element.hasAmount()) {
54754        composeSubstanceAmount("amount", element.getAmount());
54755      }
54756      if (element.hasDegreeOfPolymerisation()) {
54757        openArray("degreeOfPolymerisation");
54758        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent e : element.getDegreeOfPolymerisation()) 
54759          composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(null, e);
54760        closeArray();
54761      };
54762      if (element.hasStructuralRepresentation()) {
54763        openArray("structuralRepresentation");
54764        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent e : element.getStructuralRepresentation()) 
54765          composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(null, e);
54766        closeArray();
54767      };
54768  }
54769
54770  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
54771    if (element != null) {
54772      open(name);
54773      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentInner(element);
54774      close();
54775    }
54776  }
54777
54778  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentInner(SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
54779      composeBackbone(element);
54780      if (element.hasDegree()) {
54781        composeCodeableConcept("degree", element.getDegree());
54782      }
54783      if (element.hasAmount()) {
54784        composeSubstanceAmount("amount", element.getAmount());
54785      }
54786  }
54787
54788  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
54789    if (element != null) {
54790      open(name);
54791      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentInner(element);
54792      close();
54793    }
54794  }
54795
54796  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentInner(SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
54797      composeBackbone(element);
54798      if (element.hasType()) {
54799        composeCodeableConcept("type", element.getType());
54800      }
54801      if (element.hasRepresentationElement()) {
54802        composeStringCore("representation", element.getRepresentationElement(), false);
54803        composeStringExtras("representation", element.getRepresentationElement(), false);
54804      }
54805      if (element.hasAttachment()) {
54806        composeAttachment("attachment", element.getAttachment());
54807      }
54808  }
54809
54810  protected void composeSubstanceProtein(String name, SubstanceProtein element) throws IOException {
54811    if (element != null) {
54812      prop("resourceType", name);
54813      composeSubstanceProteinInner(element);
54814    }
54815  }
54816
54817  protected void composeSubstanceProteinInner(SubstanceProtein element) throws IOException {
54818      composeDomainResourceElements(element);
54819      if (element.hasSequenceType()) {
54820        composeCodeableConcept("sequenceType", element.getSequenceType());
54821      }
54822      if (element.hasNumberOfSubunitsElement()) {
54823        composeIntegerCore("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
54824        composeIntegerExtras("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
54825      }
54826      if (element.hasDisulfideLinkage()) {
54827        openArray("disulfideLinkage");
54828        for (StringType e : element.getDisulfideLinkage()) 
54829          composeStringCore(null, e, true);
54830        closeArray();
54831        if (anyHasExtras(element.getDisulfideLinkage())) {
54832          openArray("_disulfideLinkage");
54833          for (StringType e : element.getDisulfideLinkage()) 
54834            composeStringExtras(null, e, true);
54835          closeArray();
54836        }
54837      };
54838      if (element.hasSubunit()) {
54839        openArray("subunit");
54840        for (SubstanceProtein.SubstanceProteinSubunitComponent e : element.getSubunit()) 
54841          composeSubstanceProteinSubstanceProteinSubunitComponent(null, e);
54842        closeArray();
54843      };
54844  }
54845
54846  protected void composeSubstanceProteinSubstanceProteinSubunitComponent(String name, SubstanceProtein.SubstanceProteinSubunitComponent element) throws IOException {
54847    if (element != null) {
54848      open(name);
54849      composeSubstanceProteinSubstanceProteinSubunitComponentInner(element);
54850      close();
54851    }
54852  }
54853
54854  protected void composeSubstanceProteinSubstanceProteinSubunitComponentInner(SubstanceProtein.SubstanceProteinSubunitComponent element) throws IOException {
54855      composeBackbone(element);
54856      if (element.hasSubunitElement()) {
54857        composeIntegerCore("subunit", element.getSubunitElement(), false);
54858        composeIntegerExtras("subunit", element.getSubunitElement(), false);
54859      }
54860      if (element.hasSequenceElement()) {
54861        composeStringCore("sequence", element.getSequenceElement(), false);
54862        composeStringExtras("sequence", element.getSequenceElement(), false);
54863      }
54864      if (element.hasLengthElement()) {
54865        composeIntegerCore("length", element.getLengthElement(), false);
54866        composeIntegerExtras("length", element.getLengthElement(), false);
54867      }
54868      if (element.hasSequenceAttachment()) {
54869        composeAttachment("sequenceAttachment", element.getSequenceAttachment());
54870      }
54871      if (element.hasNTerminalModificationId()) {
54872        composeIdentifier("nTerminalModificationId", element.getNTerminalModificationId());
54873      }
54874      if (element.hasNTerminalModificationElement()) {
54875        composeStringCore("nTerminalModification", element.getNTerminalModificationElement(), false);
54876        composeStringExtras("nTerminalModification", element.getNTerminalModificationElement(), false);
54877      }
54878      if (element.hasCTerminalModificationId()) {
54879        composeIdentifier("cTerminalModificationId", element.getCTerminalModificationId());
54880      }
54881      if (element.hasCTerminalModificationElement()) {
54882        composeStringCore("cTerminalModification", element.getCTerminalModificationElement(), false);
54883        composeStringExtras("cTerminalModification", element.getCTerminalModificationElement(), false);
54884      }
54885  }
54886
54887  protected void composeSubstanceReferenceInformation(String name, SubstanceReferenceInformation element) throws IOException {
54888    if (element != null) {
54889      prop("resourceType", name);
54890      composeSubstanceReferenceInformationInner(element);
54891    }
54892  }
54893
54894  protected void composeSubstanceReferenceInformationInner(SubstanceReferenceInformation element) throws IOException {
54895      composeDomainResourceElements(element);
54896      if (element.hasCommentElement()) {
54897        composeStringCore("comment", element.getCommentElement(), false);
54898        composeStringExtras("comment", element.getCommentElement(), false);
54899      }
54900      if (element.hasGene()) {
54901        openArray("gene");
54902        for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent e : element.getGene()) 
54903          composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(null, e);
54904        closeArray();
54905      };
54906      if (element.hasGeneElement()) {
54907        openArray("geneElement");
54908        for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent e : element.getGeneElement()) 
54909          composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(null, e);
54910        closeArray();
54911      };
54912      if (element.hasClassification()) {
54913        openArray("classification");
54914        for (SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent e : element.getClassification()) 
54915          composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(null, e);
54916        closeArray();
54917      };
54918      if (element.hasTarget()) {
54919        openArray("target");
54920        for (SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent e : element.getTarget()) 
54921          composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(null, e);
54922        closeArray();
54923      };
54924  }
54925
54926  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
54927    if (element != null) {
54928      open(name);
54929      composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentInner(element);
54930      close();
54931    }
54932  }
54933
54934  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
54935      composeBackbone(element);
54936      if (element.hasGeneSequenceOrigin()) {
54937        composeCodeableConcept("geneSequenceOrigin", element.getGeneSequenceOrigin());
54938      }
54939      if (element.hasGene()) {
54940        composeCodeableConcept("gene", element.getGene());
54941      }
54942      if (element.hasSource()) {
54943        openArray("source");
54944        for (Reference e : element.getSource()) 
54945          composeReference(null, e);
54946        closeArray();
54947      };
54948  }
54949
54950  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
54951    if (element != null) {
54952      open(name);
54953      composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentInner(element);
54954      close();
54955    }
54956  }
54957
54958  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
54959      composeBackbone(element);
54960      if (element.hasType()) {
54961        composeCodeableConcept("type", element.getType());
54962      }
54963      if (element.hasElement()) {
54964        composeIdentifier("element", element.getElement());
54965      }
54966      if (element.hasSource()) {
54967        openArray("source");
54968        for (Reference e : element.getSource()) 
54969          composeReference(null, e);
54970        closeArray();
54971      };
54972  }
54973
54974  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent element) throws IOException {
54975    if (element != null) {
54976      open(name);
54977      composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentInner(element);
54978      close();
54979    }
54980  }
54981
54982  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent element) throws IOException {
54983      composeBackbone(element);
54984      if (element.hasDomain()) {
54985        composeCodeableConcept("domain", element.getDomain());
54986      }
54987      if (element.hasClassification()) {
54988        composeCodeableConcept("classification", element.getClassification());
54989      }
54990      if (element.hasSubtype()) {
54991        openArray("subtype");
54992        for (CodeableConcept e : element.getSubtype()) 
54993          composeCodeableConcept(null, e);
54994        closeArray();
54995      };
54996      if (element.hasSource()) {
54997        openArray("source");
54998        for (Reference e : element.getSource()) 
54999          composeReference(null, e);
55000        closeArray();
55001      };
55002  }
55003
55004  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
55005    if (element != null) {
55006      open(name);
55007      composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentInner(element);
55008      close();
55009    }
55010  }
55011
55012  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
55013      composeBackbone(element);
55014      if (element.hasTarget()) {
55015        composeIdentifier("target", element.getTarget());
55016      }
55017      if (element.hasType()) {
55018        composeCodeableConcept("type", element.getType());
55019      }
55020      if (element.hasInteraction()) {
55021        composeCodeableConcept("interaction", element.getInteraction());
55022      }
55023      if (element.hasOrganism()) {
55024        composeCodeableConcept("organism", element.getOrganism());
55025      }
55026      if (element.hasOrganismType()) {
55027        composeCodeableConcept("organismType", element.getOrganismType());
55028      }
55029      if (element.hasAmount()) {
55030        composeType("amount", element.getAmount());
55031      }
55032      if (element.hasAmountType()) {
55033        composeCodeableConcept("amountType", element.getAmountType());
55034      }
55035      if (element.hasSource()) {
55036        openArray("source");
55037        for (Reference e : element.getSource()) 
55038          composeReference(null, e);
55039        closeArray();
55040      };
55041  }
55042
55043  protected void composeSubstanceSourceMaterial(String name, SubstanceSourceMaterial element) throws IOException {
55044    if (element != null) {
55045      prop("resourceType", name);
55046      composeSubstanceSourceMaterialInner(element);
55047    }
55048  }
55049
55050  protected void composeSubstanceSourceMaterialInner(SubstanceSourceMaterial element) throws IOException {
55051      composeDomainResourceElements(element);
55052      if (element.hasSourceMaterialClass()) {
55053        composeCodeableConcept("sourceMaterialClass", element.getSourceMaterialClass());
55054      }
55055      if (element.hasSourceMaterialType()) {
55056        composeCodeableConcept("sourceMaterialType", element.getSourceMaterialType());
55057      }
55058      if (element.hasSourceMaterialState()) {
55059        composeCodeableConcept("sourceMaterialState", element.getSourceMaterialState());
55060      }
55061      if (element.hasOrganismId()) {
55062        composeIdentifier("organismId", element.getOrganismId());
55063      }
55064      if (element.hasOrganismNameElement()) {
55065        composeStringCore("organismName", element.getOrganismNameElement(), false);
55066        composeStringExtras("organismName", element.getOrganismNameElement(), false);
55067      }
55068      if (element.hasParentSubstanceId()) {
55069        openArray("parentSubstanceId");
55070        for (Identifier e : element.getParentSubstanceId()) 
55071          composeIdentifier(null, e);
55072        closeArray();
55073      };
55074      if (element.hasParentSubstanceName()) {
55075        openArray("parentSubstanceName");
55076        for (StringType e : element.getParentSubstanceName()) 
55077          composeStringCore(null, e, true);
55078        closeArray();
55079        if (anyHasExtras(element.getParentSubstanceName())) {
55080          openArray("_parentSubstanceName");
55081          for (StringType e : element.getParentSubstanceName()) 
55082            composeStringExtras(null, e, true);
55083          closeArray();
55084        }
55085      };
55086      if (element.hasCountryOfOrigin()) {
55087        openArray("countryOfOrigin");
55088        for (CodeableConcept e : element.getCountryOfOrigin()) 
55089          composeCodeableConcept(null, e);
55090        closeArray();
55091      };
55092      if (element.hasGeographicalLocation()) {
55093        openArray("geographicalLocation");
55094        for (StringType e : element.getGeographicalLocation()) 
55095          composeStringCore(null, e, true);
55096        closeArray();
55097        if (anyHasExtras(element.getGeographicalLocation())) {
55098          openArray("_geographicalLocation");
55099          for (StringType e : element.getGeographicalLocation()) 
55100            composeStringExtras(null, e, true);
55101          closeArray();
55102        }
55103      };
55104      if (element.hasDevelopmentStage()) {
55105        composeCodeableConcept("developmentStage", element.getDevelopmentStage());
55106      }
55107      if (element.hasFractionDescription()) {
55108        openArray("fractionDescription");
55109        for (SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent e : element.getFractionDescription()) 
55110          composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(null, e);
55111        closeArray();
55112      };
55113      if (element.hasOrganism()) {
55114        composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent("organism", element.getOrganism());
55115      }
55116      if (element.hasPartDescription()) {
55117        openArray("partDescription");
55118        for (SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent e : element.getPartDescription()) 
55119          composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(null, e);
55120        closeArray();
55121      };
55122  }
55123
55124  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
55125    if (element != null) {
55126      open(name);
55127      composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentInner(element);
55128      close();
55129    }
55130  }
55131
55132  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
55133      composeBackbone(element);
55134      if (element.hasFractionElement()) {
55135        composeStringCore("fraction", element.getFractionElement(), false);
55136        composeStringExtras("fraction", element.getFractionElement(), false);
55137      }
55138      if (element.hasMaterialType()) {
55139        composeCodeableConcept("materialType", element.getMaterialType());
55140      }
55141  }
55142
55143  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent element) throws IOException {
55144    if (element != null) {
55145      open(name);
55146      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentInner(element);
55147      close();
55148    }
55149  }
55150
55151  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent element) throws IOException {
55152      composeBackbone(element);
55153      if (element.hasFamily()) {
55154        composeCodeableConcept("family", element.getFamily());
55155      }
55156      if (element.hasGenus()) {
55157        composeCodeableConcept("genus", element.getGenus());
55158      }
55159      if (element.hasSpecies()) {
55160        composeCodeableConcept("species", element.getSpecies());
55161      }
55162      if (element.hasIntraspecificType()) {
55163        composeCodeableConcept("intraspecificType", element.getIntraspecificType());
55164      }
55165      if (element.hasIntraspecificDescriptionElement()) {
55166        composeStringCore("intraspecificDescription", element.getIntraspecificDescriptionElement(), false);
55167        composeStringExtras("intraspecificDescription", element.getIntraspecificDescriptionElement(), false);
55168      }
55169      if (element.hasAuthor()) {
55170        openArray("author");
55171        for (SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent e : element.getAuthor()) 
55172          composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(null, e);
55173        closeArray();
55174      };
55175      if (element.hasHybrid()) {
55176        composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent("hybrid", element.getHybrid());
55177      }
55178      if (element.hasOrganismGeneral()) {
55179        composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent("organismGeneral", element.getOrganismGeneral());
55180      }
55181  }
55182
55183  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
55184    if (element != null) {
55185      open(name);
55186      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentInner(element);
55187      close();
55188    }
55189  }
55190
55191  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
55192      composeBackbone(element);
55193      if (element.hasAuthorType()) {
55194        composeCodeableConcept("authorType", element.getAuthorType());
55195      }
55196      if (element.hasAuthorDescriptionElement()) {
55197        composeStringCore("authorDescription", element.getAuthorDescriptionElement(), false);
55198        composeStringExtras("authorDescription", element.getAuthorDescriptionElement(), false);
55199      }
55200  }
55201
55202  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent element) throws IOException {
55203    if (element != null) {
55204      open(name);
55205      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentInner(element);
55206      close();
55207    }
55208  }
55209
55210  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent element) throws IOException {
55211      composeBackbone(element);
55212      if (element.hasMaternalOrganismIdElement()) {
55213        composeStringCore("maternalOrganismId", element.getMaternalOrganismIdElement(), false);
55214        composeStringExtras("maternalOrganismId", element.getMaternalOrganismIdElement(), false);
55215      }
55216      if (element.hasMaternalOrganismNameElement()) {
55217        composeStringCore("maternalOrganismName", element.getMaternalOrganismNameElement(), false);
55218        composeStringExtras("maternalOrganismName", element.getMaternalOrganismNameElement(), false);
55219      }
55220      if (element.hasPaternalOrganismIdElement()) {
55221        composeStringCore("paternalOrganismId", element.getPaternalOrganismIdElement(), false);
55222        composeStringExtras("paternalOrganismId", element.getPaternalOrganismIdElement(), false);
55223      }
55224      if (element.hasPaternalOrganismNameElement()) {
55225        composeStringCore("paternalOrganismName", element.getPaternalOrganismNameElement(), false);
55226        composeStringExtras("paternalOrganismName", element.getPaternalOrganismNameElement(), false);
55227      }
55228      if (element.hasHybridType()) {
55229        composeCodeableConcept("hybridType", element.getHybridType());
55230      }
55231  }
55232
55233  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent element) throws IOException {
55234    if (element != null) {
55235      open(name);
55236      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentInner(element);
55237      close();
55238    }
55239  }
55240
55241  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent element) throws IOException {
55242      composeBackbone(element);
55243      if (element.hasKingdom()) {
55244        composeCodeableConcept("kingdom", element.getKingdom());
55245      }
55246      if (element.hasPhylum()) {
55247        composeCodeableConcept("phylum", element.getPhylum());
55248      }
55249      if (element.hasClass_()) {
55250        composeCodeableConcept("class", element.getClass_());
55251      }
55252      if (element.hasOrder()) {
55253        composeCodeableConcept("order", element.getOrder());
55254      }
55255  }
55256
55257  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
55258    if (element != null) {
55259      open(name);
55260      composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentInner(element);
55261      close();
55262    }
55263  }
55264
55265  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
55266      composeBackbone(element);
55267      if (element.hasPart()) {
55268        composeCodeableConcept("part", element.getPart());
55269      }
55270      if (element.hasPartLocation()) {
55271        composeCodeableConcept("partLocation", element.getPartLocation());
55272      }
55273  }
55274
55275  protected void composeSubstanceSpecification(String name, SubstanceSpecification element) throws IOException {
55276    if (element != null) {
55277      prop("resourceType", name);
55278      composeSubstanceSpecificationInner(element);
55279    }
55280  }
55281
55282  protected void composeSubstanceSpecificationInner(SubstanceSpecification element) throws IOException {
55283      composeDomainResourceElements(element);
55284      if (element.hasIdentifier()) {
55285        composeIdentifier("identifier", element.getIdentifier());
55286      }
55287      if (element.hasType()) {
55288        composeCodeableConcept("type", element.getType());
55289      }
55290      if (element.hasStatus()) {
55291        composeCodeableConcept("status", element.getStatus());
55292      }
55293      if (element.hasDomain()) {
55294        composeCodeableConcept("domain", element.getDomain());
55295      }
55296      if (element.hasDescriptionElement()) {
55297        composeStringCore("description", element.getDescriptionElement(), false);
55298        composeStringExtras("description", element.getDescriptionElement(), false);
55299      }
55300      if (element.hasSource()) {
55301        openArray("source");
55302        for (Reference e : element.getSource()) 
55303          composeReference(null, e);
55304        closeArray();
55305      };
55306      if (element.hasCommentElement()) {
55307        composeStringCore("comment", element.getCommentElement(), false);
55308        composeStringExtras("comment", element.getCommentElement(), false);
55309      }
55310      if (element.hasMoiety()) {
55311        openArray("moiety");
55312        for (SubstanceSpecification.SubstanceSpecificationMoietyComponent e : element.getMoiety()) 
55313          composeSubstanceSpecificationSubstanceSpecificationMoietyComponent(null, e);
55314        closeArray();
55315      };
55316      if (element.hasProperty()) {
55317        openArray("property");
55318        for (SubstanceSpecification.SubstanceSpecificationPropertyComponent e : element.getProperty()) 
55319          composeSubstanceSpecificationSubstanceSpecificationPropertyComponent(null, e);
55320        closeArray();
55321      };
55322      if (element.hasReferenceInformation()) {
55323        composeReference("referenceInformation", element.getReferenceInformation());
55324      }
55325      if (element.hasStructure()) {
55326        composeSubstanceSpecificationSubstanceSpecificationStructureComponent("structure", element.getStructure());
55327      }
55328      if (element.hasCode()) {
55329        openArray("code");
55330        for (SubstanceSpecification.SubstanceSpecificationCodeComponent e : element.getCode()) 
55331          composeSubstanceSpecificationSubstanceSpecificationCodeComponent(null, e);
55332        closeArray();
55333      };
55334      if (element.hasName()) {
55335        openArray("name");
55336        for (SubstanceSpecification.SubstanceSpecificationNameComponent e : element.getName()) 
55337          composeSubstanceSpecificationSubstanceSpecificationNameComponent(null, e);
55338        closeArray();
55339      };
55340      if (element.hasMolecularWeight()) {
55341        openArray("molecularWeight");
55342        for (SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent e : element.getMolecularWeight()) 
55343          composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(null, e);
55344        closeArray();
55345      };
55346      if (element.hasRelationship()) {
55347        openArray("relationship");
55348        for (SubstanceSpecification.SubstanceSpecificationRelationshipComponent e : element.getRelationship()) 
55349          composeSubstanceSpecificationSubstanceSpecificationRelationshipComponent(null, e);
55350        closeArray();
55351      };
55352      if (element.hasNucleicAcid()) {
55353        composeReference("nucleicAcid", element.getNucleicAcid());
55354      }
55355      if (element.hasPolymer()) {
55356        composeReference("polymer", element.getPolymer());
55357      }
55358      if (element.hasProtein()) {
55359        composeReference("protein", element.getProtein());
55360      }
55361      if (element.hasSourceMaterial()) {
55362        composeReference("sourceMaterial", element.getSourceMaterial());
55363      }
55364  }
55365
55366  protected void composeSubstanceSpecificationSubstanceSpecificationMoietyComponent(String name, SubstanceSpecification.SubstanceSpecificationMoietyComponent element) throws IOException {
55367    if (element != null) {
55368      open(name);
55369      composeSubstanceSpecificationSubstanceSpecificationMoietyComponentInner(element);
55370      close();
55371    }
55372  }
55373
55374  protected void composeSubstanceSpecificationSubstanceSpecificationMoietyComponentInner(SubstanceSpecification.SubstanceSpecificationMoietyComponent element) throws IOException {
55375      composeBackbone(element);
55376      if (element.hasRole()) {
55377        composeCodeableConcept("role", element.getRole());
55378      }
55379      if (element.hasIdentifier()) {
55380        composeIdentifier("identifier", element.getIdentifier());
55381      }
55382      if (element.hasNameElement()) {
55383        composeStringCore("name", element.getNameElement(), false);
55384        composeStringExtras("name", element.getNameElement(), false);
55385      }
55386      if (element.hasStereochemistry()) {
55387        composeCodeableConcept("stereochemistry", element.getStereochemistry());
55388      }
55389      if (element.hasOpticalActivity()) {
55390        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
55391      }
55392      if (element.hasMolecularFormulaElement()) {
55393        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
55394        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
55395      }
55396      if (element.hasAmount()) {
55397        composeType("amount", element.getAmount());
55398      }
55399  }
55400
55401  protected void composeSubstanceSpecificationSubstanceSpecificationPropertyComponent(String name, SubstanceSpecification.SubstanceSpecificationPropertyComponent element) throws IOException {
55402    if (element != null) {
55403      open(name);
55404      composeSubstanceSpecificationSubstanceSpecificationPropertyComponentInner(element);
55405      close();
55406    }
55407  }
55408
55409  protected void composeSubstanceSpecificationSubstanceSpecificationPropertyComponentInner(SubstanceSpecification.SubstanceSpecificationPropertyComponent element) throws IOException {
55410      composeBackbone(element);
55411      if (element.hasCategory()) {
55412        composeCodeableConcept("category", element.getCategory());
55413      }
55414      if (element.hasCode()) {
55415        composeCodeableConcept("code", element.getCode());
55416      }
55417      if (element.hasParametersElement()) {
55418        composeStringCore("parameters", element.getParametersElement(), false);
55419        composeStringExtras("parameters", element.getParametersElement(), false);
55420      }
55421      if (element.hasDefiningSubstance()) {
55422        composeType("definingSubstance", element.getDefiningSubstance());
55423      }
55424      if (element.hasAmount()) {
55425        composeType("amount", element.getAmount());
55426      }
55427  }
55428
55429  protected void composeSubstanceSpecificationSubstanceSpecificationStructureComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureComponent element) throws IOException {
55430    if (element != null) {
55431      open(name);
55432      composeSubstanceSpecificationSubstanceSpecificationStructureComponentInner(element);
55433      close();
55434    }
55435  }
55436
55437  protected void composeSubstanceSpecificationSubstanceSpecificationStructureComponentInner(SubstanceSpecification.SubstanceSpecificationStructureComponent element) throws IOException {
55438      composeBackbone(element);
55439      if (element.hasStereochemistry()) {
55440        composeCodeableConcept("stereochemistry", element.getStereochemistry());
55441      }
55442      if (element.hasOpticalActivity()) {
55443        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
55444      }
55445      if (element.hasMolecularFormulaElement()) {
55446        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
55447        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
55448      }
55449      if (element.hasMolecularFormulaByMoietyElement()) {
55450        composeStringCore("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
55451        composeStringExtras("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
55452      }
55453      if (element.hasIsotope()) {
55454        openArray("isotope");
55455        for (SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent e : element.getIsotope()) 
55456          composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(null, e);
55457        closeArray();
55458      };
55459      if (element.hasMolecularWeight()) {
55460        composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent("molecularWeight", element.getMolecularWeight());
55461      }
55462      if (element.hasSource()) {
55463        openArray("source");
55464        for (Reference e : element.getSource()) 
55465          composeReference(null, e);
55466        closeArray();
55467      };
55468      if (element.hasRepresentation()) {
55469        openArray("representation");
55470        for (SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent e : element.getRepresentation()) 
55471          composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(null, e);
55472        closeArray();
55473      };
55474  }
55475
55476  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent element) throws IOException {
55477    if (element != null) {
55478      open(name);
55479      composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentInner(element);
55480      close();
55481    }
55482  }
55483
55484  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentInner(SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent element) throws IOException {
55485      composeBackbone(element);
55486      if (element.hasIdentifier()) {
55487        composeIdentifier("identifier", element.getIdentifier());
55488      }
55489      if (element.hasName()) {
55490        composeCodeableConcept("name", element.getName());
55491      }
55492      if (element.hasSubstitution()) {
55493        composeCodeableConcept("substitution", element.getSubstitution());
55494      }
55495      if (element.hasHalfLife()) {
55496        composeQuantity("halfLife", element.getHalfLife());
55497      }
55498      if (element.hasMolecularWeight()) {
55499        composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent("molecularWeight", element.getMolecularWeight());
55500      }
55501  }
55502
55503  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent element) throws IOException {
55504    if (element != null) {
55505      open(name);
55506      composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentInner(element);
55507      close();
55508    }
55509  }
55510
55511  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentInner(SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent element) throws IOException {
55512      composeBackbone(element);
55513      if (element.hasMethod()) {
55514        composeCodeableConcept("method", element.getMethod());
55515      }
55516      if (element.hasType()) {
55517        composeCodeableConcept("type", element.getType());
55518      }
55519      if (element.hasAmount()) {
55520        composeQuantity("amount", element.getAmount());
55521      }
55522  }
55523
55524  protected void composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent element) throws IOException {
55525    if (element != null) {
55526      open(name);
55527      composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentInner(element);
55528      close();
55529    }
55530  }
55531
55532  protected void composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentInner(SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent element) throws IOException {
55533      composeBackbone(element);
55534      if (element.hasType()) {
55535        composeCodeableConcept("type", element.getType());
55536      }
55537      if (element.hasRepresentationElement()) {
55538        composeStringCore("representation", element.getRepresentationElement(), false);
55539        composeStringExtras("representation", element.getRepresentationElement(), false);
55540      }
55541      if (element.hasAttachment()) {
55542        composeAttachment("attachment", element.getAttachment());
55543      }
55544  }
55545
55546  protected void composeSubstanceSpecificationSubstanceSpecificationCodeComponent(String name, SubstanceSpecification.SubstanceSpecificationCodeComponent element) throws IOException {
55547    if (element != null) {
55548      open(name);
55549      composeSubstanceSpecificationSubstanceSpecificationCodeComponentInner(element);
55550      close();
55551    }
55552  }
55553
55554  protected void composeSubstanceSpecificationSubstanceSpecificationCodeComponentInner(SubstanceSpecification.SubstanceSpecificationCodeComponent element) throws IOException {
55555      composeBackbone(element);
55556      if (element.hasCode()) {
55557        composeCodeableConcept("code", element.getCode());
55558      }
55559      if (element.hasStatus()) {
55560        composeCodeableConcept("status", element.getStatus());
55561      }
55562      if (element.hasStatusDateElement()) {
55563        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
55564        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
55565      }
55566      if (element.hasCommentElement()) {
55567        composeStringCore("comment", element.getCommentElement(), false);
55568        composeStringExtras("comment", element.getCommentElement(), false);
55569      }
55570      if (element.hasSource()) {
55571        openArray("source");
55572        for (Reference e : element.getSource()) 
55573          composeReference(null, e);
55574        closeArray();
55575      };
55576  }
55577
55578  protected void composeSubstanceSpecificationSubstanceSpecificationNameComponent(String name, SubstanceSpecification.SubstanceSpecificationNameComponent element) throws IOException {
55579    if (element != null) {
55580      open(name);
55581      composeSubstanceSpecificationSubstanceSpecificationNameComponentInner(element);
55582      close();
55583    }
55584  }
55585
55586  protected void composeSubstanceSpecificationSubstanceSpecificationNameComponentInner(SubstanceSpecification.SubstanceSpecificationNameComponent element) throws IOException {
55587      composeBackbone(element);
55588      if (element.hasNameElement()) {
55589        composeStringCore("name", element.getNameElement(), false);
55590        composeStringExtras("name", element.getNameElement(), false);
55591      }
55592      if (element.hasType()) {
55593        composeCodeableConcept("type", element.getType());
55594      }
55595      if (element.hasStatus()) {
55596        composeCodeableConcept("status", element.getStatus());
55597      }
55598      if (element.hasPreferredElement()) {
55599        composeBooleanCore("preferred", element.getPreferredElement(), false);
55600        composeBooleanExtras("preferred", element.getPreferredElement(), false);
55601      }
55602      if (element.hasLanguage()) {
55603        openArray("language");
55604        for (CodeableConcept e : element.getLanguage()) 
55605          composeCodeableConcept(null, e);
55606        closeArray();
55607      };
55608      if (element.hasDomain()) {
55609        openArray("domain");
55610        for (CodeableConcept e : element.getDomain()) 
55611          composeCodeableConcept(null, e);
55612        closeArray();
55613      };
55614      if (element.hasJurisdiction()) {
55615        openArray("jurisdiction");
55616        for (CodeableConcept e : element.getJurisdiction()) 
55617          composeCodeableConcept(null, e);
55618        closeArray();
55619      };
55620      if (element.hasSynonym()) {
55621        openArray("synonym");
55622        for (SubstanceSpecification.SubstanceSpecificationNameComponent e : element.getSynonym()) 
55623          composeSubstanceSpecificationSubstanceSpecificationNameComponent(null, e);
55624        closeArray();
55625      };
55626      if (element.hasTranslation()) {
55627        openArray("translation");
55628        for (SubstanceSpecification.SubstanceSpecificationNameComponent e : element.getTranslation()) 
55629          composeSubstanceSpecificationSubstanceSpecificationNameComponent(null, e);
55630        closeArray();
55631      };
55632      if (element.hasOfficial()) {
55633        openArray("official");
55634        for (SubstanceSpecification.SubstanceSpecificationNameOfficialComponent e : element.getOfficial()) 
55635          composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(null, e);
55636        closeArray();
55637      };
55638      if (element.hasSource()) {
55639        openArray("source");
55640        for (Reference e : element.getSource()) 
55641          composeReference(null, e);
55642        closeArray();
55643      };
55644  }
55645
55646  protected void composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(String name, SubstanceSpecification.SubstanceSpecificationNameOfficialComponent element) throws IOException {
55647    if (element != null) {
55648      open(name);
55649      composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponentInner(element);
55650      close();
55651    }
55652  }
55653
55654  protected void composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponentInner(SubstanceSpecification.SubstanceSpecificationNameOfficialComponent element) throws IOException {
55655      composeBackbone(element);
55656      if (element.hasAuthority()) {
55657        composeCodeableConcept("authority", element.getAuthority());
55658      }
55659      if (element.hasStatus()) {
55660        composeCodeableConcept("status", element.getStatus());
55661      }
55662      if (element.hasDateElement()) {
55663        composeDateTimeCore("date", element.getDateElement(), false);
55664        composeDateTimeExtras("date", element.getDateElement(), false);
55665      }
55666  }
55667
55668  protected void composeSubstanceSpecificationSubstanceSpecificationRelationshipComponent(String name, SubstanceSpecification.SubstanceSpecificationRelationshipComponent element) throws IOException {
55669    if (element != null) {
55670      open(name);
55671      composeSubstanceSpecificationSubstanceSpecificationRelationshipComponentInner(element);
55672      close();
55673    }
55674  }
55675
55676  protected void composeSubstanceSpecificationSubstanceSpecificationRelationshipComponentInner(SubstanceSpecification.SubstanceSpecificationRelationshipComponent element) throws IOException {
55677      composeBackbone(element);
55678      if (element.hasSubstance()) {
55679        composeType("substance", element.getSubstance());
55680      }
55681      if (element.hasRelationship()) {
55682        composeCodeableConcept("relationship", element.getRelationship());
55683      }
55684      if (element.hasIsDefiningElement()) {
55685        composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
55686        composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
55687      }
55688      if (element.hasAmount()) {
55689        composeType("amount", element.getAmount());
55690      }
55691      if (element.hasAmountRatioLowLimit()) {
55692        composeRatio("amountRatioLowLimit", element.getAmountRatioLowLimit());
55693      }
55694      if (element.hasAmountType()) {
55695        composeCodeableConcept("amountType", element.getAmountType());
55696      }
55697      if (element.hasSource()) {
55698        openArray("source");
55699        for (Reference e : element.getSource()) 
55700          composeReference(null, e);
55701        closeArray();
55702      };
55703  }
55704
55705  protected void composeSupplyDelivery(String name, SupplyDelivery element) throws IOException {
55706    if (element != null) {
55707      prop("resourceType", name);
55708      composeSupplyDeliveryInner(element);
55709    }
55710  }
55711
55712  protected void composeSupplyDeliveryInner(SupplyDelivery element) throws IOException {
55713      composeDomainResourceElements(element);
55714      if (element.hasIdentifier()) {
55715        openArray("identifier");
55716        for (Identifier e : element.getIdentifier()) 
55717          composeIdentifier(null, e);
55718        closeArray();
55719      };
55720      if (element.hasBasedOn()) {
55721        openArray("basedOn");
55722        for (Reference e : element.getBasedOn()) 
55723          composeReference(null, e);
55724        closeArray();
55725      };
55726      if (element.hasPartOf()) {
55727        openArray("partOf");
55728        for (Reference e : element.getPartOf()) 
55729          composeReference(null, e);
55730        closeArray();
55731      };
55732      if (element.hasStatusElement()) {
55733        composeEnumerationCore("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
55734        composeEnumerationExtras("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
55735      }
55736      if (element.hasPatient()) {
55737        composeReference("patient", element.getPatient());
55738      }
55739      if (element.hasType()) {
55740        composeCodeableConcept("type", element.getType());
55741      }
55742      if (element.hasSuppliedItem()) {
55743        composeSupplyDeliverySupplyDeliverySuppliedItemComponent("suppliedItem", element.getSuppliedItem());
55744      }
55745      if (element.hasOccurrence()) {
55746        composeType("occurrence", element.getOccurrence());
55747      }
55748      if (element.hasSupplier()) {
55749        composeReference("supplier", element.getSupplier());
55750      }
55751      if (element.hasDestination()) {
55752        composeReference("destination", element.getDestination());
55753      }
55754      if (element.hasReceiver()) {
55755        openArray("receiver");
55756        for (Reference e : element.getReceiver()) 
55757          composeReference(null, e);
55758        closeArray();
55759      };
55760  }
55761
55762  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponent(String name, SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
55763    if (element != null) {
55764      open(name);
55765      composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(element);
55766      close();
55767    }
55768  }
55769
55770  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
55771      composeBackbone(element);
55772      if (element.hasQuantity()) {
55773        composeQuantity("quantity", element.getQuantity());
55774      }
55775      if (element.hasItem()) {
55776        composeType("item", element.getItem());
55777      }
55778  }
55779
55780  protected void composeSupplyRequest(String name, SupplyRequest element) throws IOException {
55781    if (element != null) {
55782      prop("resourceType", name);
55783      composeSupplyRequestInner(element);
55784    }
55785  }
55786
55787  protected void composeSupplyRequestInner(SupplyRequest element) throws IOException {
55788      composeDomainResourceElements(element);
55789      if (element.hasIdentifier()) {
55790        openArray("identifier");
55791        for (Identifier e : element.getIdentifier()) 
55792          composeIdentifier(null, e);
55793        closeArray();
55794      };
55795      if (element.hasStatusElement()) {
55796        composeEnumerationCore("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
55797        composeEnumerationExtras("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
55798      }
55799      if (element.hasCategory()) {
55800        composeCodeableConcept("category", element.getCategory());
55801      }
55802      if (element.hasPriorityElement()) {
55803        composeEnumerationCore("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(), false);
55804        composeEnumerationExtras("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(), false);
55805      }
55806      if (element.hasItem()) {
55807        composeType("item", element.getItem());
55808      }
55809      if (element.hasQuantity()) {
55810        composeQuantity("quantity", element.getQuantity());
55811      }
55812      if (element.hasParameter()) {
55813        openArray("parameter");
55814        for (SupplyRequest.SupplyRequestParameterComponent e : element.getParameter()) 
55815          composeSupplyRequestSupplyRequestParameterComponent(null, e);
55816        closeArray();
55817      };
55818      if (element.hasOccurrence()) {
55819        composeType("occurrence", element.getOccurrence());
55820      }
55821      if (element.hasAuthoredOnElement()) {
55822        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
55823        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
55824      }
55825      if (element.hasRequester()) {
55826        composeReference("requester", element.getRequester());
55827      }
55828      if (element.hasSupplier()) {
55829        openArray("supplier");
55830        for (Reference e : element.getSupplier()) 
55831          composeReference(null, e);
55832        closeArray();
55833      };
55834      if (element.hasReasonCode()) {
55835        openArray("reasonCode");
55836        for (CodeableConcept e : element.getReasonCode()) 
55837          composeCodeableConcept(null, e);
55838        closeArray();
55839      };
55840      if (element.hasReasonReference()) {
55841        openArray("reasonReference");
55842        for (Reference e : element.getReasonReference()) 
55843          composeReference(null, e);
55844        closeArray();
55845      };
55846      if (element.hasDeliverFrom()) {
55847        composeReference("deliverFrom", element.getDeliverFrom());
55848      }
55849      if (element.hasDeliverTo()) {
55850        composeReference("deliverTo", element.getDeliverTo());
55851      }
55852  }
55853
55854  protected void composeSupplyRequestSupplyRequestParameterComponent(String name, SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
55855    if (element != null) {
55856      open(name);
55857      composeSupplyRequestSupplyRequestParameterComponentInner(element);
55858      close();
55859    }
55860  }
55861
55862  protected void composeSupplyRequestSupplyRequestParameterComponentInner(SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
55863      composeBackbone(element);
55864      if (element.hasCode()) {
55865        composeCodeableConcept("code", element.getCode());
55866      }
55867      if (element.hasValue()) {
55868        composeType("value", element.getValue());
55869      }
55870  }
55871
55872  protected void composeTask(String name, Task element) throws IOException {
55873    if (element != null) {
55874      prop("resourceType", name);
55875      composeTaskInner(element);
55876    }
55877  }
55878
55879  protected void composeTaskInner(Task element) throws IOException {
55880      composeDomainResourceElements(element);
55881      if (element.hasIdentifier()) {
55882        openArray("identifier");
55883        for (Identifier e : element.getIdentifier()) 
55884          composeIdentifier(null, e);
55885        closeArray();
55886      };
55887      if (element.hasInstantiatesCanonicalElement()) {
55888        composeCanonicalCore("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
55889        composeCanonicalExtras("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
55890      }
55891      if (element.hasInstantiatesUriElement()) {
55892        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
55893        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
55894      }
55895      if (element.hasBasedOn()) {
55896        openArray("basedOn");
55897        for (Reference e : element.getBasedOn()) 
55898          composeReference(null, e);
55899        closeArray();
55900      };
55901      if (element.hasGroupIdentifier()) {
55902        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
55903      }
55904      if (element.hasPartOf()) {
55905        openArray("partOf");
55906        for (Reference e : element.getPartOf()) 
55907          composeReference(null, e);
55908        closeArray();
55909      };
55910      if (element.hasStatusElement()) {
55911        composeEnumerationCore("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
55912        composeEnumerationExtras("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
55913      }
55914      if (element.hasStatusReason()) {
55915        composeCodeableConcept("statusReason", element.getStatusReason());
55916      }
55917      if (element.hasBusinessStatus()) {
55918        composeCodeableConcept("businessStatus", element.getBusinessStatus());
55919      }
55920      if (element.hasIntentElement()) {
55921        composeEnumerationCore("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
55922        composeEnumerationExtras("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
55923      }
55924      if (element.hasPriorityElement()) {
55925        composeEnumerationCore("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
55926        composeEnumerationExtras("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
55927      }
55928      if (element.hasCode()) {
55929        composeCodeableConcept("code", element.getCode());
55930      }
55931      if (element.hasDescriptionElement()) {
55932        composeStringCore("description", element.getDescriptionElement(), false);
55933        composeStringExtras("description", element.getDescriptionElement(), false);
55934      }
55935      if (element.hasFocus()) {
55936        composeReference("focus", element.getFocus());
55937      }
55938      if (element.hasFor()) {
55939        composeReference("for", element.getFor());
55940      }
55941      if (element.hasEncounter()) {
55942        composeReference("encounter", element.getEncounter());
55943      }
55944      if (element.hasExecutionPeriod()) {
55945        composePeriod("executionPeriod", element.getExecutionPeriod());
55946      }
55947      if (element.hasAuthoredOnElement()) {
55948        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
55949        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
55950      }
55951      if (element.hasLastModifiedElement()) {
55952        composeDateTimeCore("lastModified", element.getLastModifiedElement(), false);
55953        composeDateTimeExtras("lastModified", element.getLastModifiedElement(), false);
55954      }
55955      if (element.hasRequester()) {
55956        composeReference("requester", element.getRequester());
55957      }
55958      if (element.hasPerformerType()) {
55959        openArray("performerType");
55960        for (CodeableConcept e : element.getPerformerType()) 
55961          composeCodeableConcept(null, e);
55962        closeArray();
55963      };
55964      if (element.hasOwner()) {
55965        composeReference("owner", element.getOwner());
55966      }
55967      if (element.hasLocation()) {
55968        composeReference("location", element.getLocation());
55969      }
55970      if (element.hasReasonCode()) {
55971        composeCodeableConcept("reasonCode", element.getReasonCode());
55972      }
55973      if (element.hasReasonReference()) {
55974        composeReference("reasonReference", element.getReasonReference());
55975      }
55976      if (element.hasInsurance()) {
55977        openArray("insurance");
55978        for (Reference e : element.getInsurance()) 
55979          composeReference(null, e);
55980        closeArray();
55981      };
55982      if (element.hasNote()) {
55983        openArray("note");
55984        for (Annotation e : element.getNote()) 
55985          composeAnnotation(null, e);
55986        closeArray();
55987      };
55988      if (element.hasRelevantHistory()) {
55989        openArray("relevantHistory");
55990        for (Reference e : element.getRelevantHistory()) 
55991          composeReference(null, e);
55992        closeArray();
55993      };
55994      if (element.hasRestriction()) {
55995        composeTaskTaskRestrictionComponent("restriction", element.getRestriction());
55996      }
55997      if (element.hasInput()) {
55998        openArray("input");
55999        for (Task.ParameterComponent e : element.getInput()) 
56000          composeTaskParameterComponent(null, e);
56001        closeArray();
56002      };
56003      if (element.hasOutput()) {
56004        openArray("output");
56005        for (Task.TaskOutputComponent e : element.getOutput()) 
56006          composeTaskTaskOutputComponent(null, e);
56007        closeArray();
56008      };
56009  }
56010
56011  protected void composeTaskTaskRestrictionComponent(String name, Task.TaskRestrictionComponent element) throws IOException {
56012    if (element != null) {
56013      open(name);
56014      composeTaskTaskRestrictionComponentInner(element);
56015      close();
56016    }
56017  }
56018
56019  protected void composeTaskTaskRestrictionComponentInner(Task.TaskRestrictionComponent element) throws IOException {
56020      composeBackbone(element);
56021      if (element.hasRepetitionsElement()) {
56022        composePositiveIntCore("repetitions", element.getRepetitionsElement(), false);
56023        composePositiveIntExtras("repetitions", element.getRepetitionsElement(), false);
56024      }
56025      if (element.hasPeriod()) {
56026        composePeriod("period", element.getPeriod());
56027      }
56028      if (element.hasRecipient()) {
56029        openArray("recipient");
56030        for (Reference e : element.getRecipient()) 
56031          composeReference(null, e);
56032        closeArray();
56033      };
56034  }
56035
56036  protected void composeTaskParameterComponent(String name, Task.ParameterComponent element) throws IOException {
56037    if (element != null) {
56038      open(name);
56039      composeTaskParameterComponentInner(element);
56040      close();
56041    }
56042  }
56043
56044  protected void composeTaskParameterComponentInner(Task.ParameterComponent element) throws IOException {
56045      composeBackbone(element);
56046      if (element.hasType()) {
56047        composeCodeableConcept("type", element.getType());
56048      }
56049      if (element.hasValue()) {
56050        composeType("value", element.getValue());
56051      }
56052  }
56053
56054  protected void composeTaskTaskOutputComponent(String name, Task.TaskOutputComponent element) throws IOException {
56055    if (element != null) {
56056      open(name);
56057      composeTaskTaskOutputComponentInner(element);
56058      close();
56059    }
56060  }
56061
56062  protected void composeTaskTaskOutputComponentInner(Task.TaskOutputComponent element) throws IOException {
56063      composeBackbone(element);
56064      if (element.hasType()) {
56065        composeCodeableConcept("type", element.getType());
56066      }
56067      if (element.hasValue()) {
56068        composeType("value", element.getValue());
56069      }
56070  }
56071
56072  protected void composeTerminologyCapabilities(String name, TerminologyCapabilities element) throws IOException {
56073    if (element != null) {
56074      prop("resourceType", name);
56075      composeTerminologyCapabilitiesInner(element);
56076    }
56077  }
56078
56079  protected void composeTerminologyCapabilitiesInner(TerminologyCapabilities element) throws IOException {
56080      composeDomainResourceElements(element);
56081      if (element.hasUrlElement()) {
56082        composeUriCore("url", element.getUrlElement(), false);
56083        composeUriExtras("url", element.getUrlElement(), false);
56084      }
56085      if (element.hasVersionElement()) {
56086        composeStringCore("version", element.getVersionElement(), false);
56087        composeStringExtras("version", element.getVersionElement(), false);
56088      }
56089      if (element.hasNameElement()) {
56090        composeStringCore("name", element.getNameElement(), false);
56091        composeStringExtras("name", element.getNameElement(), false);
56092      }
56093      if (element.hasTitleElement()) {
56094        composeStringCore("title", element.getTitleElement(), false);
56095        composeStringExtras("title", element.getTitleElement(), false);
56096      }
56097      if (element.hasStatusElement()) {
56098        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56099        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56100      }
56101      if (element.hasExperimentalElement()) {
56102        composeBooleanCore("experimental", element.getExperimentalElement(), false);
56103        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
56104      }
56105      if (element.hasDateElement()) {
56106        composeDateTimeCore("date", element.getDateElement(), false);
56107        composeDateTimeExtras("date", element.getDateElement(), false);
56108      }
56109      if (element.hasPublisherElement()) {
56110        composeStringCore("publisher", element.getPublisherElement(), false);
56111        composeStringExtras("publisher", element.getPublisherElement(), false);
56112      }
56113      if (element.hasContact()) {
56114        openArray("contact");
56115        for (ContactDetail e : element.getContact()) 
56116          composeContactDetail(null, e);
56117        closeArray();
56118      };
56119      if (element.hasDescriptionElement()) {
56120        composeMarkdownCore("description", element.getDescriptionElement(), false);
56121        composeMarkdownExtras("description", element.getDescriptionElement(), false);
56122      }
56123      if (element.hasUseContext()) {
56124        openArray("useContext");
56125        for (UsageContext e : element.getUseContext()) 
56126          composeUsageContext(null, e);
56127        closeArray();
56128      };
56129      if (element.hasJurisdiction()) {
56130        openArray("jurisdiction");
56131        for (CodeableConcept e : element.getJurisdiction()) 
56132          composeCodeableConcept(null, e);
56133        closeArray();
56134      };
56135      if (element.hasPurposeElement()) {
56136        composeMarkdownCore("purpose", element.getPurposeElement(), false);
56137        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
56138      }
56139      if (element.hasCopyrightElement()) {
56140        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
56141        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
56142      }
56143      if (element.hasKindElement()) {
56144        composeEnumerationCore("kind", element.getKindElement(), new TerminologyCapabilities.CapabilityStatementKindEnumFactory(), false);
56145        composeEnumerationExtras("kind", element.getKindElement(), new TerminologyCapabilities.CapabilityStatementKindEnumFactory(), false);
56146      }
56147      if (element.hasSoftware()) {
56148        composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent("software", element.getSoftware());
56149      }
56150      if (element.hasImplementation()) {
56151        composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent("implementation", element.getImplementation());
56152      }
56153      if (element.hasLockedDateElement()) {
56154        composeBooleanCore("lockedDate", element.getLockedDateElement(), false);
56155        composeBooleanExtras("lockedDate", element.getLockedDateElement(), false);
56156      }
56157      if (element.hasCodeSystem()) {
56158        openArray("codeSystem");
56159        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent e : element.getCodeSystem()) 
56160          composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(null, e);
56161        closeArray();
56162      };
56163      if (element.hasExpansion()) {
56164        composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent("expansion", element.getExpansion());
56165      }
56166      if (element.hasCodeSearchElement()) {
56167        composeEnumerationCore("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
56168        composeEnumerationExtras("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
56169      }
56170      if (element.hasValidateCode()) {
56171        composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent("validateCode", element.getValidateCode());
56172      }
56173      if (element.hasTranslation()) {
56174        composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent("translation", element.getTranslation());
56175      }
56176      if (element.hasClosure()) {
56177        composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent("closure", element.getClosure());
56178      }
56179  }
56180
56181  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
56182    if (element != null) {
56183      open(name);
56184      composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentInner(element);
56185      close();
56186    }
56187  }
56188
56189  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentInner(TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
56190      composeBackbone(element);
56191      if (element.hasNameElement()) {
56192        composeStringCore("name", element.getNameElement(), false);
56193        composeStringExtras("name", element.getNameElement(), false);
56194      }
56195      if (element.hasVersionElement()) {
56196        composeStringCore("version", element.getVersionElement(), false);
56197        composeStringExtras("version", element.getVersionElement(), false);
56198      }
56199  }
56200
56201  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
56202    if (element != null) {
56203      open(name);
56204      composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentInner(element);
56205      close();
56206    }
56207  }
56208
56209  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentInner(TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
56210      composeBackbone(element);
56211      if (element.hasDescriptionElement()) {
56212        composeStringCore("description", element.getDescriptionElement(), false);
56213        composeStringExtras("description", element.getDescriptionElement(), false);
56214      }
56215      if (element.hasUrlElement()) {
56216        composeUrlCore("url", element.getUrlElement(), false);
56217        composeUrlExtras("url", element.getUrlElement(), false);
56218      }
56219  }
56220
56221  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
56222    if (element != null) {
56223      open(name);
56224      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentInner(element);
56225      close();
56226    }
56227  }
56228
56229  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentInner(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
56230      composeBackbone(element);
56231      if (element.hasUriElement()) {
56232        composeCanonicalCore("uri", element.getUriElement(), false);
56233        composeCanonicalExtras("uri", element.getUriElement(), false);
56234      }
56235      if (element.hasVersion()) {
56236        openArray("version");
56237        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent e : element.getVersion()) 
56238          composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(null, e);
56239        closeArray();
56240      };
56241      if (element.hasSubsumptionElement()) {
56242        composeBooleanCore("subsumption", element.getSubsumptionElement(), false);
56243        composeBooleanExtras("subsumption", element.getSubsumptionElement(), false);
56244      }
56245  }
56246
56247  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
56248    if (element != null) {
56249      open(name);
56250      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentInner(element);
56251      close();
56252    }
56253  }
56254
56255  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentInner(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
56256      composeBackbone(element);
56257      if (element.hasCodeElement()) {
56258        composeStringCore("code", element.getCodeElement(), false);
56259        composeStringExtras("code", element.getCodeElement(), false);
56260      }
56261      if (element.hasIsDefaultElement()) {
56262        composeBooleanCore("isDefault", element.getIsDefaultElement(), false);
56263        composeBooleanExtras("isDefault", element.getIsDefaultElement(), false);
56264      }
56265      if (element.hasCompositionalElement()) {
56266        composeBooleanCore("compositional", element.getCompositionalElement(), false);
56267        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
56268      }
56269      if (element.hasLanguage()) {
56270        openArray("language");
56271        for (CodeType e : element.getLanguage()) 
56272          composeCodeCore(null, e, true);
56273        closeArray();
56274        if (anyHasExtras(element.getLanguage())) {
56275          openArray("_language");
56276          for (CodeType e : element.getLanguage()) 
56277            composeCodeExtras(null, e, true);
56278          closeArray();
56279        }
56280      };
56281      if (element.hasFilter()) {
56282        openArray("filter");
56283        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent e : element.getFilter()) 
56284          composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(null, e);
56285        closeArray();
56286      };
56287      if (element.hasProperty()) {
56288        openArray("property");
56289        for (CodeType e : element.getProperty()) 
56290          composeCodeCore(null, e, true);
56291        closeArray();
56292        if (anyHasExtras(element.getProperty())) {
56293          openArray("_property");
56294          for (CodeType e : element.getProperty()) 
56295            composeCodeExtras(null, e, true);
56296          closeArray();
56297        }
56298      };
56299  }
56300
56301  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
56302    if (element != null) {
56303      open(name);
56304      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentInner(element);
56305      close();
56306    }
56307  }
56308
56309  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentInner(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
56310      composeBackbone(element);
56311      if (element.hasCodeElement()) {
56312        composeCodeCore("code", element.getCodeElement(), false);
56313        composeCodeExtras("code", element.getCodeElement(), false);
56314      }
56315      if (element.hasOp()) {
56316        openArray("op");
56317        for (CodeType e : element.getOp()) 
56318          composeCodeCore(null, e, true);
56319        closeArray();
56320        if (anyHasExtras(element.getOp())) {
56321          openArray("_op");
56322          for (CodeType e : element.getOp()) 
56323            composeCodeExtras(null, e, true);
56324          closeArray();
56325        }
56326      };
56327  }
56328
56329  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
56330    if (element != null) {
56331      open(name);
56332      composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentInner(element);
56333      close();
56334    }
56335  }
56336
56337  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentInner(TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
56338      composeBackbone(element);
56339      if (element.hasHierarchicalElement()) {
56340        composeBooleanCore("hierarchical", element.getHierarchicalElement(), false);
56341        composeBooleanExtras("hierarchical", element.getHierarchicalElement(), false);
56342      }
56343      if (element.hasPagingElement()) {
56344        composeBooleanCore("paging", element.getPagingElement(), false);
56345        composeBooleanExtras("paging", element.getPagingElement(), false);
56346      }
56347      if (element.hasIncompleteElement()) {
56348        composeBooleanCore("incomplete", element.getIncompleteElement(), false);
56349        composeBooleanExtras("incomplete", element.getIncompleteElement(), false);
56350      }
56351      if (element.hasParameter()) {
56352        openArray("parameter");
56353        for (TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent e : element.getParameter()) 
56354          composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(null, e);
56355        closeArray();
56356      };
56357      if (element.hasTextFilterElement()) {
56358        composeMarkdownCore("textFilter", element.getTextFilterElement(), false);
56359        composeMarkdownExtras("textFilter", element.getTextFilterElement(), false);
56360      }
56361  }
56362
56363  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
56364    if (element != null) {
56365      open(name);
56366      composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentInner(element);
56367      close();
56368    }
56369  }
56370
56371  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentInner(TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
56372      composeBackbone(element);
56373      if (element.hasNameElement()) {
56374        composeCodeCore("name", element.getNameElement(), false);
56375        composeCodeExtras("name", element.getNameElement(), false);
56376      }
56377      if (element.hasDocumentationElement()) {
56378        composeStringCore("documentation", element.getDocumentationElement(), false);
56379        composeStringExtras("documentation", element.getDocumentationElement(), false);
56380      }
56381  }
56382
56383  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
56384    if (element != null) {
56385      open(name);
56386      composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentInner(element);
56387      close();
56388    }
56389  }
56390
56391  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentInner(TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
56392      composeBackbone(element);
56393      if (element.hasTranslationsElement()) {
56394        composeBooleanCore("translations", element.getTranslationsElement(), false);
56395        composeBooleanExtras("translations", element.getTranslationsElement(), false);
56396      }
56397  }
56398
56399  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
56400    if (element != null) {
56401      open(name);
56402      composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentInner(element);
56403      close();
56404    }
56405  }
56406
56407  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentInner(TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
56408      composeBackbone(element);
56409      if (element.hasNeedsMapElement()) {
56410        composeBooleanCore("needsMap", element.getNeedsMapElement(), false);
56411        composeBooleanExtras("needsMap", element.getNeedsMapElement(), false);
56412      }
56413  }
56414
56415  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
56416    if (element != null) {
56417      open(name);
56418      composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentInner(element);
56419      close();
56420    }
56421  }
56422
56423  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentInner(TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
56424      composeBackbone(element);
56425      if (element.hasTranslationElement()) {
56426        composeBooleanCore("translation", element.getTranslationElement(), false);
56427        composeBooleanExtras("translation", element.getTranslationElement(), false);
56428      }
56429  }
56430
56431  protected void composeTestReport(String name, TestReport element) throws IOException {
56432    if (element != null) {
56433      prop("resourceType", name);
56434      composeTestReportInner(element);
56435    }
56436  }
56437
56438  protected void composeTestReportInner(TestReport element) throws IOException {
56439      composeDomainResourceElements(element);
56440      if (element.hasIdentifier()) {
56441        composeIdentifier("identifier", element.getIdentifier());
56442      }
56443      if (element.hasNameElement()) {
56444        composeStringCore("name", element.getNameElement(), false);
56445        composeStringExtras("name", element.getNameElement(), false);
56446      }
56447      if (element.hasStatusElement()) {
56448        composeEnumerationCore("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
56449        composeEnumerationExtras("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
56450      }
56451      if (element.hasTestScript()) {
56452        composeReference("testScript", element.getTestScript());
56453      }
56454      if (element.hasResultElement()) {
56455        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
56456        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
56457      }
56458      if (element.hasScoreElement()) {
56459        composeDecimalCore("score", element.getScoreElement(), false);
56460        composeDecimalExtras("score", element.getScoreElement(), false);
56461      }
56462      if (element.hasTesterElement()) {
56463        composeStringCore("tester", element.getTesterElement(), false);
56464        composeStringExtras("tester", element.getTesterElement(), false);
56465      }
56466      if (element.hasIssuedElement()) {
56467        composeDateTimeCore("issued", element.getIssuedElement(), false);
56468        composeDateTimeExtras("issued", element.getIssuedElement(), false);
56469      }
56470      if (element.hasParticipant()) {
56471        openArray("participant");
56472        for (TestReport.TestReportParticipantComponent e : element.getParticipant()) 
56473          composeTestReportTestReportParticipantComponent(null, e);
56474        closeArray();
56475      };
56476      if (element.hasSetup()) {
56477        composeTestReportTestReportSetupComponent("setup", element.getSetup());
56478      }
56479      if (element.hasTest()) {
56480        openArray("test");
56481        for (TestReport.TestReportTestComponent e : element.getTest()) 
56482          composeTestReportTestReportTestComponent(null, e);
56483        closeArray();
56484      };
56485      if (element.hasTeardown()) {
56486        composeTestReportTestReportTeardownComponent("teardown", element.getTeardown());
56487      }
56488  }
56489
56490  protected void composeTestReportTestReportParticipantComponent(String name, TestReport.TestReportParticipantComponent element) throws IOException {
56491    if (element != null) {
56492      open(name);
56493      composeTestReportTestReportParticipantComponentInner(element);
56494      close();
56495    }
56496  }
56497
56498  protected void composeTestReportTestReportParticipantComponentInner(TestReport.TestReportParticipantComponent element) throws IOException {
56499      composeBackbone(element);
56500      if (element.hasTypeElement()) {
56501        composeEnumerationCore("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
56502        composeEnumerationExtras("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
56503      }
56504      if (element.hasUriElement()) {
56505        composeUriCore("uri", element.getUriElement(), false);
56506        composeUriExtras("uri", element.getUriElement(), false);
56507      }
56508      if (element.hasDisplayElement()) {
56509        composeStringCore("display", element.getDisplayElement(), false);
56510        composeStringExtras("display", element.getDisplayElement(), false);
56511      }
56512  }
56513
56514  protected void composeTestReportTestReportSetupComponent(String name, TestReport.TestReportSetupComponent element) throws IOException {
56515    if (element != null) {
56516      open(name);
56517      composeTestReportTestReportSetupComponentInner(element);
56518      close();
56519    }
56520  }
56521
56522  protected void composeTestReportTestReportSetupComponentInner(TestReport.TestReportSetupComponent element) throws IOException {
56523      composeBackbone(element);
56524      if (element.hasAction()) {
56525        openArray("action");
56526        for (TestReport.SetupActionComponent e : element.getAction()) 
56527          composeTestReportSetupActionComponent(null, e);
56528        closeArray();
56529      };
56530  }
56531
56532  protected void composeTestReportSetupActionComponent(String name, TestReport.SetupActionComponent element) throws IOException {
56533    if (element != null) {
56534      open(name);
56535      composeTestReportSetupActionComponentInner(element);
56536      close();
56537    }
56538  }
56539
56540  protected void composeTestReportSetupActionComponentInner(TestReport.SetupActionComponent element) throws IOException {
56541      composeBackbone(element);
56542      if (element.hasOperation()) {
56543        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
56544      }
56545      if (element.hasAssert()) {
56546        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
56547      }
56548  }
56549
56550  protected void composeTestReportSetupActionOperationComponent(String name, TestReport.SetupActionOperationComponent element) throws IOException {
56551    if (element != null) {
56552      open(name);
56553      composeTestReportSetupActionOperationComponentInner(element);
56554      close();
56555    }
56556  }
56557
56558  protected void composeTestReportSetupActionOperationComponentInner(TestReport.SetupActionOperationComponent element) throws IOException {
56559      composeBackbone(element);
56560      if (element.hasResultElement()) {
56561        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
56562        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
56563      }
56564      if (element.hasMessageElement()) {
56565        composeMarkdownCore("message", element.getMessageElement(), false);
56566        composeMarkdownExtras("message", element.getMessageElement(), false);
56567      }
56568      if (element.hasDetailElement()) {
56569        composeUriCore("detail", element.getDetailElement(), false);
56570        composeUriExtras("detail", element.getDetailElement(), false);
56571      }
56572  }
56573
56574  protected void composeTestReportSetupActionAssertComponent(String name, TestReport.SetupActionAssertComponent element) throws IOException {
56575    if (element != null) {
56576      open(name);
56577      composeTestReportSetupActionAssertComponentInner(element);
56578      close();
56579    }
56580  }
56581
56582  protected void composeTestReportSetupActionAssertComponentInner(TestReport.SetupActionAssertComponent element) throws IOException {
56583      composeBackbone(element);
56584      if (element.hasResultElement()) {
56585        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
56586        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
56587      }
56588      if (element.hasMessageElement()) {
56589        composeMarkdownCore("message", element.getMessageElement(), false);
56590        composeMarkdownExtras("message", element.getMessageElement(), false);
56591      }
56592      if (element.hasDetailElement()) {
56593        composeStringCore("detail", element.getDetailElement(), false);
56594        composeStringExtras("detail", element.getDetailElement(), false);
56595      }
56596  }
56597
56598  protected void composeTestReportTestReportTestComponent(String name, TestReport.TestReportTestComponent element) throws IOException {
56599    if (element != null) {
56600      open(name);
56601      composeTestReportTestReportTestComponentInner(element);
56602      close();
56603    }
56604  }
56605
56606  protected void composeTestReportTestReportTestComponentInner(TestReport.TestReportTestComponent element) throws IOException {
56607      composeBackbone(element);
56608      if (element.hasNameElement()) {
56609        composeStringCore("name", element.getNameElement(), false);
56610        composeStringExtras("name", element.getNameElement(), false);
56611      }
56612      if (element.hasDescriptionElement()) {
56613        composeStringCore("description", element.getDescriptionElement(), false);
56614        composeStringExtras("description", element.getDescriptionElement(), false);
56615      }
56616      if (element.hasAction()) {
56617        openArray("action");
56618        for (TestReport.TestActionComponent e : element.getAction()) 
56619          composeTestReportTestActionComponent(null, e);
56620        closeArray();
56621      };
56622  }
56623
56624  protected void composeTestReportTestActionComponent(String name, TestReport.TestActionComponent element) throws IOException {
56625    if (element != null) {
56626      open(name);
56627      composeTestReportTestActionComponentInner(element);
56628      close();
56629    }
56630  }
56631
56632  protected void composeTestReportTestActionComponentInner(TestReport.TestActionComponent element) throws IOException {
56633      composeBackbone(element);
56634      if (element.hasOperation()) {
56635        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
56636      }
56637      if (element.hasAssert()) {
56638        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
56639      }
56640  }
56641
56642  protected void composeTestReportTestReportTeardownComponent(String name, TestReport.TestReportTeardownComponent element) throws IOException {
56643    if (element != null) {
56644      open(name);
56645      composeTestReportTestReportTeardownComponentInner(element);
56646      close();
56647    }
56648  }
56649
56650  protected void composeTestReportTestReportTeardownComponentInner(TestReport.TestReportTeardownComponent element) throws IOException {
56651      composeBackbone(element);
56652      if (element.hasAction()) {
56653        openArray("action");
56654        for (TestReport.TeardownActionComponent e : element.getAction()) 
56655          composeTestReportTeardownActionComponent(null, e);
56656        closeArray();
56657      };
56658  }
56659
56660  protected void composeTestReportTeardownActionComponent(String name, TestReport.TeardownActionComponent element) throws IOException {
56661    if (element != null) {
56662      open(name);
56663      composeTestReportTeardownActionComponentInner(element);
56664      close();
56665    }
56666  }
56667
56668  protected void composeTestReportTeardownActionComponentInner(TestReport.TeardownActionComponent element) throws IOException {
56669      composeBackbone(element);
56670      if (element.hasOperation()) {
56671        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
56672      }
56673  }
56674
56675  protected void composeTestScript(String name, TestScript element) throws IOException {
56676    if (element != null) {
56677      prop("resourceType", name);
56678      composeTestScriptInner(element);
56679    }
56680  }
56681
56682  protected void composeTestScriptInner(TestScript element) throws IOException {
56683      composeDomainResourceElements(element);
56684      if (element.hasUrlElement()) {
56685        composeUriCore("url", element.getUrlElement(), false);
56686        composeUriExtras("url", element.getUrlElement(), false);
56687      }
56688      if (element.hasIdentifier()) {
56689        composeIdentifier("identifier", element.getIdentifier());
56690      }
56691      if (element.hasVersionElement()) {
56692        composeStringCore("version", element.getVersionElement(), false);
56693        composeStringExtras("version", element.getVersionElement(), false);
56694      }
56695      if (element.hasNameElement()) {
56696        composeStringCore("name", element.getNameElement(), false);
56697        composeStringExtras("name", element.getNameElement(), false);
56698      }
56699      if (element.hasTitleElement()) {
56700        composeStringCore("title", element.getTitleElement(), false);
56701        composeStringExtras("title", element.getTitleElement(), false);
56702      }
56703      if (element.hasStatusElement()) {
56704        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56705        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56706      }
56707      if (element.hasExperimentalElement()) {
56708        composeBooleanCore("experimental", element.getExperimentalElement(), false);
56709        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
56710      }
56711      if (element.hasDateElement()) {
56712        composeDateTimeCore("date", element.getDateElement(), false);
56713        composeDateTimeExtras("date", element.getDateElement(), false);
56714      }
56715      if (element.hasPublisherElement()) {
56716        composeStringCore("publisher", element.getPublisherElement(), false);
56717        composeStringExtras("publisher", element.getPublisherElement(), false);
56718      }
56719      if (element.hasContact()) {
56720        openArray("contact");
56721        for (ContactDetail e : element.getContact()) 
56722          composeContactDetail(null, e);
56723        closeArray();
56724      };
56725      if (element.hasDescriptionElement()) {
56726        composeMarkdownCore("description", element.getDescriptionElement(), false);
56727        composeMarkdownExtras("description", element.getDescriptionElement(), false);
56728      }
56729      if (element.hasUseContext()) {
56730        openArray("useContext");
56731        for (UsageContext e : element.getUseContext()) 
56732          composeUsageContext(null, e);
56733        closeArray();
56734      };
56735      if (element.hasJurisdiction()) {
56736        openArray("jurisdiction");
56737        for (CodeableConcept e : element.getJurisdiction()) 
56738          composeCodeableConcept(null, e);
56739        closeArray();
56740      };
56741      if (element.hasPurposeElement()) {
56742        composeMarkdownCore("purpose", element.getPurposeElement(), false);
56743        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
56744      }
56745      if (element.hasCopyrightElement()) {
56746        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
56747        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
56748      }
56749      if (element.hasOrigin()) {
56750        openArray("origin");
56751        for (TestScript.TestScriptOriginComponent e : element.getOrigin()) 
56752          composeTestScriptTestScriptOriginComponent(null, e);
56753        closeArray();
56754      };
56755      if (element.hasDestination()) {
56756        openArray("destination");
56757        for (TestScript.TestScriptDestinationComponent e : element.getDestination()) 
56758          composeTestScriptTestScriptDestinationComponent(null, e);
56759        closeArray();
56760      };
56761      if (element.hasMetadata()) {
56762        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
56763      }
56764      if (element.hasFixture()) {
56765        openArray("fixture");
56766        for (TestScript.TestScriptFixtureComponent e : element.getFixture()) 
56767          composeTestScriptTestScriptFixtureComponent(null, e);
56768        closeArray();
56769      };
56770      if (element.hasProfile()) {
56771        openArray("profile");
56772        for (Reference e : element.getProfile()) 
56773          composeReference(null, e);
56774        closeArray();
56775      };
56776      if (element.hasVariable()) {
56777        openArray("variable");
56778        for (TestScript.TestScriptVariableComponent e : element.getVariable()) 
56779          composeTestScriptTestScriptVariableComponent(null, e);
56780        closeArray();
56781      };
56782      if (element.hasSetup()) {
56783        composeTestScriptTestScriptSetupComponent("setup", element.getSetup());
56784      }
56785      if (element.hasTest()) {
56786        openArray("test");
56787        for (TestScript.TestScriptTestComponent e : element.getTest()) 
56788          composeTestScriptTestScriptTestComponent(null, e);
56789        closeArray();
56790      };
56791      if (element.hasTeardown()) {
56792        composeTestScriptTestScriptTeardownComponent("teardown", element.getTeardown());
56793      }
56794  }
56795
56796  protected void composeTestScriptTestScriptOriginComponent(String name, TestScript.TestScriptOriginComponent element) throws IOException {
56797    if (element != null) {
56798      open(name);
56799      composeTestScriptTestScriptOriginComponentInner(element);
56800      close();
56801    }
56802  }
56803
56804  protected void composeTestScriptTestScriptOriginComponentInner(TestScript.TestScriptOriginComponent element) throws IOException {
56805      composeBackbone(element);
56806      if (element.hasIndexElement()) {
56807        composeIntegerCore("index", element.getIndexElement(), false);
56808        composeIntegerExtras("index", element.getIndexElement(), false);
56809      }
56810      if (element.hasProfile()) {
56811        composeCoding("profile", element.getProfile());
56812      }
56813  }
56814
56815  protected void composeTestScriptTestScriptDestinationComponent(String name, TestScript.TestScriptDestinationComponent element) throws IOException {
56816    if (element != null) {
56817      open(name);
56818      composeTestScriptTestScriptDestinationComponentInner(element);
56819      close();
56820    }
56821  }
56822
56823  protected void composeTestScriptTestScriptDestinationComponentInner(TestScript.TestScriptDestinationComponent element) throws IOException {
56824      composeBackbone(element);
56825      if (element.hasIndexElement()) {
56826        composeIntegerCore("index", element.getIndexElement(), false);
56827        composeIntegerExtras("index", element.getIndexElement(), false);
56828      }
56829      if (element.hasProfile()) {
56830        composeCoding("profile", element.getProfile());
56831      }
56832  }
56833
56834  protected void composeTestScriptTestScriptMetadataComponent(String name, TestScript.TestScriptMetadataComponent element) throws IOException {
56835    if (element != null) {
56836      open(name);
56837      composeTestScriptTestScriptMetadataComponentInner(element);
56838      close();
56839    }
56840  }
56841
56842  protected void composeTestScriptTestScriptMetadataComponentInner(TestScript.TestScriptMetadataComponent element) throws IOException {
56843      composeBackbone(element);
56844      if (element.hasLink()) {
56845        openArray("link");
56846        for (TestScript.TestScriptMetadataLinkComponent e : element.getLink()) 
56847          composeTestScriptTestScriptMetadataLinkComponent(null, e);
56848        closeArray();
56849      };
56850      if (element.hasCapability()) {
56851        openArray("capability");
56852        for (TestScript.TestScriptMetadataCapabilityComponent e : element.getCapability()) 
56853          composeTestScriptTestScriptMetadataCapabilityComponent(null, e);
56854        closeArray();
56855      };
56856  }
56857
56858  protected void composeTestScriptTestScriptMetadataLinkComponent(String name, TestScript.TestScriptMetadataLinkComponent element) throws IOException {
56859    if (element != null) {
56860      open(name);
56861      composeTestScriptTestScriptMetadataLinkComponentInner(element);
56862      close();
56863    }
56864  }
56865
56866  protected void composeTestScriptTestScriptMetadataLinkComponentInner(TestScript.TestScriptMetadataLinkComponent element) throws IOException {
56867      composeBackbone(element);
56868      if (element.hasUrlElement()) {
56869        composeUriCore("url", element.getUrlElement(), false);
56870        composeUriExtras("url", element.getUrlElement(), false);
56871      }
56872      if (element.hasDescriptionElement()) {
56873        composeStringCore("description", element.getDescriptionElement(), false);
56874        composeStringExtras("description", element.getDescriptionElement(), false);
56875      }
56876  }
56877
56878  protected void composeTestScriptTestScriptMetadataCapabilityComponent(String name, TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
56879    if (element != null) {
56880      open(name);
56881      composeTestScriptTestScriptMetadataCapabilityComponentInner(element);
56882      close();
56883    }
56884  }
56885
56886  protected void composeTestScriptTestScriptMetadataCapabilityComponentInner(TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
56887      composeBackbone(element);
56888      if (element.hasRequiredElement()) {
56889        composeBooleanCore("required", element.getRequiredElement(), false);
56890        composeBooleanExtras("required", element.getRequiredElement(), false);
56891      }
56892      if (element.hasValidatedElement()) {
56893        composeBooleanCore("validated", element.getValidatedElement(), false);
56894        composeBooleanExtras("validated", element.getValidatedElement(), false);
56895      }
56896      if (element.hasDescriptionElement()) {
56897        composeStringCore("description", element.getDescriptionElement(), false);
56898        composeStringExtras("description", element.getDescriptionElement(), false);
56899      }
56900      if (element.hasOrigin()) {
56901        openArray("origin");
56902        for (IntegerType e : element.getOrigin()) 
56903          composeIntegerCore(null, e, true);
56904        closeArray();
56905        if (anyHasExtras(element.getOrigin())) {
56906          openArray("_origin");
56907          for (IntegerType e : element.getOrigin()) 
56908            composeIntegerExtras(null, e, true);
56909          closeArray();
56910        }
56911      };
56912      if (element.hasDestinationElement()) {
56913        composeIntegerCore("destination", element.getDestinationElement(), false);
56914        composeIntegerExtras("destination", element.getDestinationElement(), false);
56915      }
56916      if (element.hasLink()) {
56917        openArray("link");
56918        for (UriType e : element.getLink()) 
56919          composeUriCore(null, e, true);
56920        closeArray();
56921        if (anyHasExtras(element.getLink())) {
56922          openArray("_link");
56923          for (UriType e : element.getLink()) 
56924            composeUriExtras(null, e, true);
56925          closeArray();
56926        }
56927      };
56928      if (element.hasCapabilitiesElement()) {
56929        composeCanonicalCore("capabilities", element.getCapabilitiesElement(), false);
56930        composeCanonicalExtras("capabilities", element.getCapabilitiesElement(), false);
56931      }
56932  }
56933
56934  protected void composeTestScriptTestScriptFixtureComponent(String name, TestScript.TestScriptFixtureComponent element) throws IOException {
56935    if (element != null) {
56936      open(name);
56937      composeTestScriptTestScriptFixtureComponentInner(element);
56938      close();
56939    }
56940  }
56941
56942  protected void composeTestScriptTestScriptFixtureComponentInner(TestScript.TestScriptFixtureComponent element) throws IOException {
56943      composeBackbone(element);
56944      if (element.hasAutocreateElement()) {
56945        composeBooleanCore("autocreate", element.getAutocreateElement(), false);
56946        composeBooleanExtras("autocreate", element.getAutocreateElement(), false);
56947      }
56948      if (element.hasAutodeleteElement()) {
56949        composeBooleanCore("autodelete", element.getAutodeleteElement(), false);
56950        composeBooleanExtras("autodelete", element.getAutodeleteElement(), false);
56951      }
56952      if (element.hasResource()) {
56953        composeReference("resource", element.getResource());
56954      }
56955  }
56956
56957  protected void composeTestScriptTestScriptVariableComponent(String name, TestScript.TestScriptVariableComponent element) throws IOException {
56958    if (element != null) {
56959      open(name);
56960      composeTestScriptTestScriptVariableComponentInner(element);
56961      close();
56962    }
56963  }
56964
56965  protected void composeTestScriptTestScriptVariableComponentInner(TestScript.TestScriptVariableComponent element) throws IOException {
56966      composeBackbone(element);
56967      if (element.hasNameElement()) {
56968        composeStringCore("name", element.getNameElement(), false);
56969        composeStringExtras("name", element.getNameElement(), false);
56970      }
56971      if (element.hasDefaultValueElement()) {
56972        composeStringCore("defaultValue", element.getDefaultValueElement(), false);
56973        composeStringExtras("defaultValue", element.getDefaultValueElement(), false);
56974      }
56975      if (element.hasDescriptionElement()) {
56976        composeStringCore("description", element.getDescriptionElement(), false);
56977        composeStringExtras("description", element.getDescriptionElement(), false);
56978      }
56979      if (element.hasExpressionElement()) {
56980        composeStringCore("expression", element.getExpressionElement(), false);
56981        composeStringExtras("expression", element.getExpressionElement(), false);
56982      }
56983      if (element.hasHeaderFieldElement()) {
56984        composeStringCore("headerField", element.getHeaderFieldElement(), false);
56985        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
56986      }
56987      if (element.hasHintElement()) {
56988        composeStringCore("hint", element.getHintElement(), false);
56989        composeStringExtras("hint", element.getHintElement(), false);
56990      }
56991      if (element.hasPathElement()) {
56992        composeStringCore("path", element.getPathElement(), false);
56993        composeStringExtras("path", element.getPathElement(), false);
56994      }
56995      if (element.hasSourceIdElement()) {
56996        composeIdCore("sourceId", element.getSourceIdElement(), false);
56997        composeIdExtras("sourceId", element.getSourceIdElement(), false);
56998      }
56999  }
57000
57001  protected void composeTestScriptTestScriptSetupComponent(String name, TestScript.TestScriptSetupComponent element) throws IOException {
57002    if (element != null) {
57003      open(name);
57004      composeTestScriptTestScriptSetupComponentInner(element);
57005      close();
57006    }
57007  }
57008
57009  protected void composeTestScriptTestScriptSetupComponentInner(TestScript.TestScriptSetupComponent element) throws IOException {
57010      composeBackbone(element);
57011      if (element.hasAction()) {
57012        openArray("action");
57013        for (TestScript.SetupActionComponent e : element.getAction()) 
57014          composeTestScriptSetupActionComponent(null, e);
57015        closeArray();
57016      };
57017  }
57018
57019  protected void composeTestScriptSetupActionComponent(String name, TestScript.SetupActionComponent element) throws IOException {
57020    if (element != null) {
57021      open(name);
57022      composeTestScriptSetupActionComponentInner(element);
57023      close();
57024    }
57025  }
57026
57027  protected void composeTestScriptSetupActionComponentInner(TestScript.SetupActionComponent element) throws IOException {
57028      composeBackbone(element);
57029      if (element.hasOperation()) {
57030        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
57031      }
57032      if (element.hasAssert()) {
57033        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
57034      }
57035  }
57036
57037  protected void composeTestScriptSetupActionOperationComponent(String name, TestScript.SetupActionOperationComponent element) throws IOException {
57038    if (element != null) {
57039      open(name);
57040      composeTestScriptSetupActionOperationComponentInner(element);
57041      close();
57042    }
57043  }
57044
57045  protected void composeTestScriptSetupActionOperationComponentInner(TestScript.SetupActionOperationComponent element) throws IOException {
57046      composeBackbone(element);
57047      if (element.hasType()) {
57048        composeCoding("type", element.getType());
57049      }
57050      if (element.hasResourceElement()) {
57051        composeCodeCore("resource", element.getResourceElement(), false);
57052        composeCodeExtras("resource", element.getResourceElement(), false);
57053      }
57054      if (element.hasLabelElement()) {
57055        composeStringCore("label", element.getLabelElement(), false);
57056        composeStringExtras("label", element.getLabelElement(), false);
57057      }
57058      if (element.hasDescriptionElement()) {
57059        composeStringCore("description", element.getDescriptionElement(), false);
57060        composeStringExtras("description", element.getDescriptionElement(), false);
57061      }
57062      if (element.hasAcceptElement()) {
57063        composeCodeCore("accept", element.getAcceptElement(), false);
57064        composeCodeExtras("accept", element.getAcceptElement(), false);
57065      }
57066      if (element.hasContentTypeElement()) {
57067        composeCodeCore("contentType", element.getContentTypeElement(), false);
57068        composeCodeExtras("contentType", element.getContentTypeElement(), false);
57069      }
57070      if (element.hasDestinationElement()) {
57071        composeIntegerCore("destination", element.getDestinationElement(), false);
57072        composeIntegerExtras("destination", element.getDestinationElement(), false);
57073      }
57074      if (element.hasEncodeRequestUrlElement()) {
57075        composeBooleanCore("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
57076        composeBooleanExtras("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
57077      }
57078      if (element.hasMethodElement()) {
57079        composeEnumerationCore("method", element.getMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
57080        composeEnumerationExtras("method", element.getMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
57081      }
57082      if (element.hasOriginElement()) {
57083        composeIntegerCore("origin", element.getOriginElement(), false);
57084        composeIntegerExtras("origin", element.getOriginElement(), false);
57085      }
57086      if (element.hasParamsElement()) {
57087        composeStringCore("params", element.getParamsElement(), false);
57088        composeStringExtras("params", element.getParamsElement(), false);
57089      }
57090      if (element.hasRequestHeader()) {
57091        openArray("requestHeader");
57092        for (TestScript.SetupActionOperationRequestHeaderComponent e : element.getRequestHeader()) 
57093          composeTestScriptSetupActionOperationRequestHeaderComponent(null, e);
57094        closeArray();
57095      };
57096      if (element.hasRequestIdElement()) {
57097        composeIdCore("requestId", element.getRequestIdElement(), false);
57098        composeIdExtras("requestId", element.getRequestIdElement(), false);
57099      }
57100      if (element.hasResponseIdElement()) {
57101        composeIdCore("responseId", element.getResponseIdElement(), false);
57102        composeIdExtras("responseId", element.getResponseIdElement(), false);
57103      }
57104      if (element.hasSourceIdElement()) {
57105        composeIdCore("sourceId", element.getSourceIdElement(), false);
57106        composeIdExtras("sourceId", element.getSourceIdElement(), false);
57107      }
57108      if (element.hasTargetIdElement()) {
57109        composeIdCore("targetId", element.getTargetIdElement(), false);
57110        composeIdExtras("targetId", element.getTargetIdElement(), false);
57111      }
57112      if (element.hasUrlElement()) {
57113        composeStringCore("url", element.getUrlElement(), false);
57114        composeStringExtras("url", element.getUrlElement(), false);
57115      }
57116  }
57117
57118  protected void composeTestScriptSetupActionOperationRequestHeaderComponent(String name, TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
57119    if (element != null) {
57120      open(name);
57121      composeTestScriptSetupActionOperationRequestHeaderComponentInner(element);
57122      close();
57123    }
57124  }
57125
57126  protected void composeTestScriptSetupActionOperationRequestHeaderComponentInner(TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
57127      composeBackbone(element);
57128      if (element.hasFieldElement()) {
57129        composeStringCore("field", element.getFieldElement(), false);
57130        composeStringExtras("field", element.getFieldElement(), false);
57131      }
57132      if (element.hasValueElement()) {
57133        composeStringCore("value", element.getValueElement(), false);
57134        composeStringExtras("value", element.getValueElement(), false);
57135      }
57136  }
57137
57138  protected void composeTestScriptSetupActionAssertComponent(String name, TestScript.SetupActionAssertComponent element) throws IOException {
57139    if (element != null) {
57140      open(name);
57141      composeTestScriptSetupActionAssertComponentInner(element);
57142      close();
57143    }
57144  }
57145
57146  protected void composeTestScriptSetupActionAssertComponentInner(TestScript.SetupActionAssertComponent element) throws IOException {
57147      composeBackbone(element);
57148      if (element.hasLabelElement()) {
57149        composeStringCore("label", element.getLabelElement(), false);
57150        composeStringExtras("label", element.getLabelElement(), false);
57151      }
57152      if (element.hasDescriptionElement()) {
57153        composeStringCore("description", element.getDescriptionElement(), false);
57154        composeStringExtras("description", element.getDescriptionElement(), false);
57155      }
57156      if (element.hasDirectionElement()) {
57157        composeEnumerationCore("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
57158        composeEnumerationExtras("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
57159      }
57160      if (element.hasCompareToSourceIdElement()) {
57161        composeStringCore("compareToSourceId", element.getCompareToSourceIdElement(), false);
57162        composeStringExtras("compareToSourceId", element.getCompareToSourceIdElement(), false);
57163      }
57164      if (element.hasCompareToSourceExpressionElement()) {
57165        composeStringCore("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
57166        composeStringExtras("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
57167      }
57168      if (element.hasCompareToSourcePathElement()) {
57169        composeStringCore("compareToSourcePath", element.getCompareToSourcePathElement(), false);
57170        composeStringExtras("compareToSourcePath", element.getCompareToSourcePathElement(), false);
57171      }
57172      if (element.hasContentTypeElement()) {
57173        composeCodeCore("contentType", element.getContentTypeElement(), false);
57174        composeCodeExtras("contentType", element.getContentTypeElement(), false);
57175      }
57176      if (element.hasExpressionElement()) {
57177        composeStringCore("expression", element.getExpressionElement(), false);
57178        composeStringExtras("expression", element.getExpressionElement(), false);
57179      }
57180      if (element.hasHeaderFieldElement()) {
57181        composeStringCore("headerField", element.getHeaderFieldElement(), false);
57182        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
57183      }
57184      if (element.hasMinimumIdElement()) {
57185        composeStringCore("minimumId", element.getMinimumIdElement(), false);
57186        composeStringExtras("minimumId", element.getMinimumIdElement(), false);
57187      }
57188      if (element.hasNavigationLinksElement()) {
57189        composeBooleanCore("navigationLinks", element.getNavigationLinksElement(), false);
57190        composeBooleanExtras("navigationLinks", element.getNavigationLinksElement(), false);
57191      }
57192      if (element.hasOperatorElement()) {
57193        composeEnumerationCore("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
57194        composeEnumerationExtras("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
57195      }
57196      if (element.hasPathElement()) {
57197        composeStringCore("path", element.getPathElement(), false);
57198        composeStringExtras("path", element.getPathElement(), false);
57199      }
57200      if (element.hasRequestMethodElement()) {
57201        composeEnumerationCore("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
57202        composeEnumerationExtras("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
57203      }
57204      if (element.hasRequestURLElement()) {
57205        composeStringCore("requestURL", element.getRequestURLElement(), false);
57206        composeStringExtras("requestURL", element.getRequestURLElement(), false);
57207      }
57208      if (element.hasResourceElement()) {
57209        composeCodeCore("resource", element.getResourceElement(), false);
57210        composeCodeExtras("resource", element.getResourceElement(), false);
57211      }
57212      if (element.hasResponseElement()) {
57213        composeEnumerationCore("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
57214        composeEnumerationExtras("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
57215      }
57216      if (element.hasResponseCodeElement()) {
57217        composeStringCore("responseCode", element.getResponseCodeElement(), false);
57218        composeStringExtras("responseCode", element.getResponseCodeElement(), false);
57219      }
57220      if (element.hasSourceIdElement()) {
57221        composeIdCore("sourceId", element.getSourceIdElement(), false);
57222        composeIdExtras("sourceId", element.getSourceIdElement(), false);
57223      }
57224      if (element.hasValidateProfileIdElement()) {
57225        composeIdCore("validateProfileId", element.getValidateProfileIdElement(), false);
57226        composeIdExtras("validateProfileId", element.getValidateProfileIdElement(), false);
57227      }
57228      if (element.hasValueElement()) {
57229        composeStringCore("value", element.getValueElement(), false);
57230        composeStringExtras("value", element.getValueElement(), false);
57231      }
57232      if (element.hasWarningOnlyElement()) {
57233        composeBooleanCore("warningOnly", element.getWarningOnlyElement(), false);
57234        composeBooleanExtras("warningOnly", element.getWarningOnlyElement(), false);
57235      }
57236  }
57237
57238  protected void composeTestScriptTestScriptTestComponent(String name, TestScript.TestScriptTestComponent element) throws IOException {
57239    if (element != null) {
57240      open(name);
57241      composeTestScriptTestScriptTestComponentInner(element);
57242      close();
57243    }
57244  }
57245
57246  protected void composeTestScriptTestScriptTestComponentInner(TestScript.TestScriptTestComponent element) throws IOException {
57247      composeBackbone(element);
57248      if (element.hasNameElement()) {
57249        composeStringCore("name", element.getNameElement(), false);
57250        composeStringExtras("name", element.getNameElement(), false);
57251      }
57252      if (element.hasDescriptionElement()) {
57253        composeStringCore("description", element.getDescriptionElement(), false);
57254        composeStringExtras("description", element.getDescriptionElement(), false);
57255      }
57256      if (element.hasAction()) {
57257        openArray("action");
57258        for (TestScript.TestActionComponent e : element.getAction()) 
57259          composeTestScriptTestActionComponent(null, e);
57260        closeArray();
57261      };
57262  }
57263
57264  protected void composeTestScriptTestActionComponent(String name, TestScript.TestActionComponent element) throws IOException {
57265    if (element != null) {
57266      open(name);
57267      composeTestScriptTestActionComponentInner(element);
57268      close();
57269    }
57270  }
57271
57272  protected void composeTestScriptTestActionComponentInner(TestScript.TestActionComponent element) throws IOException {
57273      composeBackbone(element);
57274      if (element.hasOperation()) {
57275        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
57276      }
57277      if (element.hasAssert()) {
57278        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
57279      }
57280  }
57281
57282  protected void composeTestScriptTestScriptTeardownComponent(String name, TestScript.TestScriptTeardownComponent element) throws IOException {
57283    if (element != null) {
57284      open(name);
57285      composeTestScriptTestScriptTeardownComponentInner(element);
57286      close();
57287    }
57288  }
57289
57290  protected void composeTestScriptTestScriptTeardownComponentInner(TestScript.TestScriptTeardownComponent element) throws IOException {
57291      composeBackbone(element);
57292      if (element.hasAction()) {
57293        openArray("action");
57294        for (TestScript.TeardownActionComponent e : element.getAction()) 
57295          composeTestScriptTeardownActionComponent(null, e);
57296        closeArray();
57297      };
57298  }
57299
57300  protected void composeTestScriptTeardownActionComponent(String name, TestScript.TeardownActionComponent element) throws IOException {
57301    if (element != null) {
57302      open(name);
57303      composeTestScriptTeardownActionComponentInner(element);
57304      close();
57305    }
57306  }
57307
57308  protected void composeTestScriptTeardownActionComponentInner(TestScript.TeardownActionComponent element) throws IOException {
57309      composeBackbone(element);
57310      if (element.hasOperation()) {
57311        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
57312      }
57313  }
57314
57315  protected void composeValueSet(String name, ValueSet element) throws IOException {
57316    if (element != null) {
57317      prop("resourceType", name);
57318      composeValueSetInner(element);
57319    }
57320  }
57321
57322  protected void composeValueSetInner(ValueSet element) throws IOException {
57323      composeDomainResourceElements(element);
57324      if (element.hasUrlElement()) {
57325        composeUriCore("url", element.getUrlElement(), false);
57326        composeUriExtras("url", element.getUrlElement(), false);
57327      }
57328      if (element.hasIdentifier()) {
57329        openArray("identifier");
57330        for (Identifier e : element.getIdentifier()) 
57331          composeIdentifier(null, e);
57332        closeArray();
57333      };
57334      if (element.hasVersionElement()) {
57335        composeStringCore("version", element.getVersionElement(), false);
57336        composeStringExtras("version", element.getVersionElement(), false);
57337      }
57338      if (element.hasNameElement()) {
57339        composeStringCore("name", element.getNameElement(), false);
57340        composeStringExtras("name", element.getNameElement(), false);
57341      }
57342      if (element.hasTitleElement()) {
57343        composeStringCore("title", element.getTitleElement(), false);
57344        composeStringExtras("title", element.getTitleElement(), false);
57345      }
57346      if (element.hasStatusElement()) {
57347        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
57348        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
57349      }
57350      if (element.hasExperimentalElement()) {
57351        composeBooleanCore("experimental", element.getExperimentalElement(), false);
57352        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
57353      }
57354      if (element.hasDateElement()) {
57355        composeDateTimeCore("date", element.getDateElement(), false);
57356        composeDateTimeExtras("date", element.getDateElement(), false);
57357      }
57358      if (element.hasPublisherElement()) {
57359        composeStringCore("publisher", element.getPublisherElement(), false);
57360        composeStringExtras("publisher", element.getPublisherElement(), false);
57361      }
57362      if (element.hasContact()) {
57363        openArray("contact");
57364        for (ContactDetail e : element.getContact()) 
57365          composeContactDetail(null, e);
57366        closeArray();
57367      };
57368      if (element.hasDescriptionElement()) {
57369        composeMarkdownCore("description", element.getDescriptionElement(), false);
57370        composeMarkdownExtras("description", element.getDescriptionElement(), false);
57371      }
57372      if (element.hasUseContext()) {
57373        openArray("useContext");
57374        for (UsageContext e : element.getUseContext()) 
57375          composeUsageContext(null, e);
57376        closeArray();
57377      };
57378      if (element.hasJurisdiction()) {
57379        openArray("jurisdiction");
57380        for (CodeableConcept e : element.getJurisdiction()) 
57381          composeCodeableConcept(null, e);
57382        closeArray();
57383      };
57384      if (element.hasImmutableElement()) {
57385        composeBooleanCore("immutable", element.getImmutableElement(), false);
57386        composeBooleanExtras("immutable", element.getImmutableElement(), false);
57387      }
57388      if (element.hasPurposeElement()) {
57389        composeMarkdownCore("purpose", element.getPurposeElement(), false);
57390        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
57391      }
57392      if (element.hasCopyrightElement()) {
57393        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
57394        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
57395      }
57396      if (element.hasCompose()) {
57397        composeValueSetValueSetComposeComponent("compose", element.getCompose());
57398      }
57399      if (element.hasExpansion()) {
57400        composeValueSetValueSetExpansionComponent("expansion", element.getExpansion());
57401      }
57402  }
57403
57404  protected void composeValueSetValueSetComposeComponent(String name, ValueSet.ValueSetComposeComponent element) throws IOException {
57405    if (element != null) {
57406      open(name);
57407      composeValueSetValueSetComposeComponentInner(element);
57408      close();
57409    }
57410  }
57411
57412  protected void composeValueSetValueSetComposeComponentInner(ValueSet.ValueSetComposeComponent element) throws IOException {
57413      composeBackbone(element);
57414      if (element.hasLockedDateElement()) {
57415        composeDateCore("lockedDate", element.getLockedDateElement(), false);
57416        composeDateExtras("lockedDate", element.getLockedDateElement(), false);
57417      }
57418      if (element.hasInactiveElement()) {
57419        composeBooleanCore("inactive", element.getInactiveElement(), false);
57420        composeBooleanExtras("inactive", element.getInactiveElement(), false);
57421      }
57422      if (element.hasInclude()) {
57423        openArray("include");
57424        for (ValueSet.ConceptSetComponent e : element.getInclude()) 
57425          composeValueSetConceptSetComponent(null, e);
57426        closeArray();
57427      };
57428      if (element.hasExclude()) {
57429        openArray("exclude");
57430        for (ValueSet.ConceptSetComponent e : element.getExclude()) 
57431          composeValueSetConceptSetComponent(null, e);
57432        closeArray();
57433      };
57434  }
57435
57436  protected void composeValueSetConceptSetComponent(String name, ValueSet.ConceptSetComponent element) throws IOException {
57437    if (element != null) {
57438      open(name);
57439      composeValueSetConceptSetComponentInner(element);
57440      close();
57441    }
57442  }
57443
57444  protected void composeValueSetConceptSetComponentInner(ValueSet.ConceptSetComponent element) throws IOException {
57445      composeBackbone(element);
57446      if (element.hasSystemElement()) {
57447        composeUriCore("system", element.getSystemElement(), false);
57448        composeUriExtras("system", element.getSystemElement(), false);
57449      }
57450      if (element.hasVersionElement()) {
57451        composeStringCore("version", element.getVersionElement(), false);
57452        composeStringExtras("version", element.getVersionElement(), false);
57453      }
57454      if (element.hasConcept()) {
57455        openArray("concept");
57456        for (ValueSet.ConceptReferenceComponent e : element.getConcept()) 
57457          composeValueSetConceptReferenceComponent(null, e);
57458        closeArray();
57459      };
57460      if (element.hasFilter()) {
57461        openArray("filter");
57462        for (ValueSet.ConceptSetFilterComponent e : element.getFilter()) 
57463          composeValueSetConceptSetFilterComponent(null, e);
57464        closeArray();
57465      };
57466      if (element.hasValueSet()) {
57467        openArray("valueSet");
57468        for (CanonicalType e : element.getValueSet()) 
57469          composeCanonicalCore(null, e, true);
57470        closeArray();
57471        if (anyHasExtras(element.getValueSet())) {
57472          openArray("_valueSet");
57473          for (CanonicalType e : element.getValueSet()) 
57474            composeCanonicalExtras(null, e, true);
57475          closeArray();
57476        }
57477      };
57478  }
57479
57480  protected void composeValueSetConceptReferenceComponent(String name, ValueSet.ConceptReferenceComponent element) throws IOException {
57481    if (element != null) {
57482      open(name);
57483      composeValueSetConceptReferenceComponentInner(element);
57484      close();
57485    }
57486  }
57487
57488  protected void composeValueSetConceptReferenceComponentInner(ValueSet.ConceptReferenceComponent element) throws IOException {
57489      composeBackbone(element);
57490      if (element.hasCodeElement()) {
57491        composeCodeCore("code", element.getCodeElement(), false);
57492        composeCodeExtras("code", element.getCodeElement(), false);
57493      }
57494      if (element.hasDisplayElement()) {
57495        composeStringCore("display", element.getDisplayElement(), false);
57496        composeStringExtras("display", element.getDisplayElement(), false);
57497      }
57498      if (element.hasDesignation()) {
57499        openArray("designation");
57500        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
57501          composeValueSetConceptReferenceDesignationComponent(null, e);
57502        closeArray();
57503      };
57504  }
57505
57506  protected void composeValueSetConceptReferenceDesignationComponent(String name, ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
57507    if (element != null) {
57508      open(name);
57509      composeValueSetConceptReferenceDesignationComponentInner(element);
57510      close();
57511    }
57512  }
57513
57514  protected void composeValueSetConceptReferenceDesignationComponentInner(ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
57515      composeBackbone(element);
57516      if (element.hasLanguageElement()) {
57517        composeCodeCore("language", element.getLanguageElement(), false);
57518        composeCodeExtras("language", element.getLanguageElement(), false);
57519      }
57520      if (element.hasUse()) {
57521        composeCoding("use", element.getUse());
57522      }
57523      if (element.hasValueElement()) {
57524        composeStringCore("value", element.getValueElement(), false);
57525        composeStringExtras("value", element.getValueElement(), false);
57526      }
57527  }
57528
57529  protected void composeValueSetConceptSetFilterComponent(String name, ValueSet.ConceptSetFilterComponent element) throws IOException {
57530    if (element != null) {
57531      open(name);
57532      composeValueSetConceptSetFilterComponentInner(element);
57533      close();
57534    }
57535  }
57536
57537  protected void composeValueSetConceptSetFilterComponentInner(ValueSet.ConceptSetFilterComponent element) throws IOException {
57538      composeBackbone(element);
57539      if (element.hasPropertyElement()) {
57540        composeCodeCore("property", element.getPropertyElement(), false);
57541        composeCodeExtras("property", element.getPropertyElement(), false);
57542      }
57543      if (element.hasOpElement()) {
57544        composeEnumerationCore("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
57545        composeEnumerationExtras("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
57546      }
57547      if (element.hasValueElement()) {
57548        composeStringCore("value", element.getValueElement(), false);
57549        composeStringExtras("value", element.getValueElement(), false);
57550      }
57551  }
57552
57553  protected void composeValueSetValueSetExpansionComponent(String name, ValueSet.ValueSetExpansionComponent element) throws IOException {
57554    if (element != null) {
57555      open(name);
57556      composeValueSetValueSetExpansionComponentInner(element);
57557      close();
57558    }
57559  }
57560
57561  protected void composeValueSetValueSetExpansionComponentInner(ValueSet.ValueSetExpansionComponent element) throws IOException {
57562      composeBackbone(element);
57563      if (element.hasIdentifierElement()) {
57564        composeUriCore("identifier", element.getIdentifierElement(), false);
57565        composeUriExtras("identifier", element.getIdentifierElement(), false);
57566      }
57567      if (element.hasTimestampElement()) {
57568        composeDateTimeCore("timestamp", element.getTimestampElement(), false);
57569        composeDateTimeExtras("timestamp", element.getTimestampElement(), false);
57570      }
57571      if (element.hasTotalElement()) {
57572        composeIntegerCore("total", element.getTotalElement(), false);
57573        composeIntegerExtras("total", element.getTotalElement(), false);
57574      }
57575      if (element.hasOffsetElement()) {
57576        composeIntegerCore("offset", element.getOffsetElement(), false);
57577        composeIntegerExtras("offset", element.getOffsetElement(), false);
57578      }
57579      if (element.hasParameter()) {
57580        openArray("parameter");
57581        for (ValueSet.ValueSetExpansionParameterComponent e : element.getParameter()) 
57582          composeValueSetValueSetExpansionParameterComponent(null, e);
57583        closeArray();
57584      };
57585      if (element.hasContains()) {
57586        openArray("contains");
57587        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
57588          composeValueSetValueSetExpansionContainsComponent(null, e);
57589        closeArray();
57590      };
57591  }
57592
57593  protected void composeValueSetValueSetExpansionParameterComponent(String name, ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
57594    if (element != null) {
57595      open(name);
57596      composeValueSetValueSetExpansionParameterComponentInner(element);
57597      close();
57598    }
57599  }
57600
57601  protected void composeValueSetValueSetExpansionParameterComponentInner(ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
57602      composeBackbone(element);
57603      if (element.hasNameElement()) {
57604        composeStringCore("name", element.getNameElement(), false);
57605        composeStringExtras("name", element.getNameElement(), false);
57606      }
57607      if (element.hasValue()) {
57608        composeType("value", element.getValue());
57609      }
57610  }
57611
57612  protected void composeValueSetValueSetExpansionContainsComponent(String name, ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
57613    if (element != null) {
57614      open(name);
57615      composeValueSetValueSetExpansionContainsComponentInner(element);
57616      close();
57617    }
57618  }
57619
57620  protected void composeValueSetValueSetExpansionContainsComponentInner(ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
57621      composeBackbone(element);
57622      if (element.hasSystemElement()) {
57623        composeUriCore("system", element.getSystemElement(), false);
57624        composeUriExtras("system", element.getSystemElement(), false);
57625      }
57626      if (element.hasAbstractElement()) {
57627        composeBooleanCore("abstract", element.getAbstractElement(), false);
57628        composeBooleanExtras("abstract", element.getAbstractElement(), false);
57629      }
57630      if (element.hasInactiveElement()) {
57631        composeBooleanCore("inactive", element.getInactiveElement(), false);
57632        composeBooleanExtras("inactive", element.getInactiveElement(), false);
57633      }
57634      if (element.hasVersionElement()) {
57635        composeStringCore("version", element.getVersionElement(), false);
57636        composeStringExtras("version", element.getVersionElement(), false);
57637      }
57638      if (element.hasCodeElement()) {
57639        composeCodeCore("code", element.getCodeElement(), false);
57640        composeCodeExtras("code", element.getCodeElement(), false);
57641      }
57642      if (element.hasDisplayElement()) {
57643        composeStringCore("display", element.getDisplayElement(), false);
57644        composeStringExtras("display", element.getDisplayElement(), false);
57645      }
57646      if (element.hasDesignation()) {
57647        openArray("designation");
57648        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
57649          composeValueSetConceptReferenceDesignationComponent(null, e);
57650        closeArray();
57651      };
57652      if (element.hasContains()) {
57653        openArray("contains");
57654        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
57655          composeValueSetValueSetExpansionContainsComponent(null, e);
57656        closeArray();
57657      };
57658  }
57659
57660  protected void composeVerificationResult(String name, VerificationResult element) throws IOException {
57661    if (element != null) {
57662      prop("resourceType", name);
57663      composeVerificationResultInner(element);
57664    }
57665  }
57666
57667  protected void composeVerificationResultInner(VerificationResult element) throws IOException {
57668      composeDomainResourceElements(element);
57669      if (element.hasTarget()) {
57670        openArray("target");
57671        for (Reference e : element.getTarget()) 
57672          composeReference(null, e);
57673        closeArray();
57674      };
57675      if (element.hasTargetLocation()) {
57676        openArray("targetLocation");
57677        for (StringType e : element.getTargetLocation()) 
57678          composeStringCore(null, e, true);
57679        closeArray();
57680        if (anyHasExtras(element.getTargetLocation())) {
57681          openArray("_targetLocation");
57682          for (StringType e : element.getTargetLocation()) 
57683            composeStringExtras(null, e, true);
57684          closeArray();
57685        }
57686      };
57687      if (element.hasNeed()) {
57688        composeCodeableConcept("need", element.getNeed());
57689      }
57690      if (element.hasStatusElement()) {
57691        composeEnumerationCore("status", element.getStatusElement(), new VerificationResult.StatusEnumFactory(), false);
57692        composeEnumerationExtras("status", element.getStatusElement(), new VerificationResult.StatusEnumFactory(), false);
57693      }
57694      if (element.hasStatusDateElement()) {
57695        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
57696        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
57697      }
57698      if (element.hasValidationType()) {
57699        composeCodeableConcept("validationType", element.getValidationType());
57700      }
57701      if (element.hasValidationProcess()) {
57702        openArray("validationProcess");
57703        for (CodeableConcept e : element.getValidationProcess()) 
57704          composeCodeableConcept(null, e);
57705        closeArray();
57706      };
57707      if (element.hasFrequency()) {
57708        composeTiming("frequency", element.getFrequency());
57709      }
57710      if (element.hasLastPerformedElement()) {
57711        composeDateTimeCore("lastPerformed", element.getLastPerformedElement(), false);
57712        composeDateTimeExtras("lastPerformed", element.getLastPerformedElement(), false);
57713      }
57714      if (element.hasNextScheduledElement()) {
57715        composeDateCore("nextScheduled", element.getNextScheduledElement(), false);
57716        composeDateExtras("nextScheduled", element.getNextScheduledElement(), false);
57717      }
57718      if (element.hasFailureAction()) {
57719        composeCodeableConcept("failureAction", element.getFailureAction());
57720      }
57721      if (element.hasPrimarySource()) {
57722        openArray("primarySource");
57723        for (VerificationResult.VerificationResultPrimarySourceComponent e : element.getPrimarySource()) 
57724          composeVerificationResultVerificationResultPrimarySourceComponent(null, e);
57725        closeArray();
57726      };
57727      if (element.hasAttestation()) {
57728        composeVerificationResultVerificationResultAttestationComponent("attestation", element.getAttestation());
57729      }
57730      if (element.hasValidator()) {
57731        openArray("validator");
57732        for (VerificationResult.VerificationResultValidatorComponent e : element.getValidator()) 
57733          composeVerificationResultVerificationResultValidatorComponent(null, e);
57734        closeArray();
57735      };
57736  }
57737
57738  protected void composeVerificationResultVerificationResultPrimarySourceComponent(String name, VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
57739    if (element != null) {
57740      open(name);
57741      composeVerificationResultVerificationResultPrimarySourceComponentInner(element);
57742      close();
57743    }
57744  }
57745
57746  protected void composeVerificationResultVerificationResultPrimarySourceComponentInner(VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
57747      composeBackbone(element);
57748      if (element.hasWho()) {
57749        composeReference("who", element.getWho());
57750      }
57751      if (element.hasType()) {
57752        openArray("type");
57753        for (CodeableConcept e : element.getType()) 
57754          composeCodeableConcept(null, e);
57755        closeArray();
57756      };
57757      if (element.hasCommunicationMethod()) {
57758        openArray("communicationMethod");
57759        for (CodeableConcept e : element.getCommunicationMethod()) 
57760          composeCodeableConcept(null, e);
57761        closeArray();
57762      };
57763      if (element.hasValidationStatus()) {
57764        composeCodeableConcept("validationStatus", element.getValidationStatus());
57765      }
57766      if (element.hasValidationDateElement()) {
57767        composeDateTimeCore("validationDate", element.getValidationDateElement(), false);
57768        composeDateTimeExtras("validationDate", element.getValidationDateElement(), false);
57769      }
57770      if (element.hasCanPushUpdates()) {
57771        composeCodeableConcept("canPushUpdates", element.getCanPushUpdates());
57772      }
57773      if (element.hasPushTypeAvailable()) {
57774        openArray("pushTypeAvailable");
57775        for (CodeableConcept e : element.getPushTypeAvailable()) 
57776          composeCodeableConcept(null, e);
57777        closeArray();
57778      };
57779  }
57780
57781  protected void composeVerificationResultVerificationResultAttestationComponent(String name, VerificationResult.VerificationResultAttestationComponent element) throws IOException {
57782    if (element != null) {
57783      open(name);
57784      composeVerificationResultVerificationResultAttestationComponentInner(element);
57785      close();
57786    }
57787  }
57788
57789  protected void composeVerificationResultVerificationResultAttestationComponentInner(VerificationResult.VerificationResultAttestationComponent element) throws IOException {
57790      composeBackbone(element);
57791      if (element.hasWho()) {
57792        composeReference("who", element.getWho());
57793      }
57794      if (element.hasOnBehalfOf()) {
57795        composeReference("onBehalfOf", element.getOnBehalfOf());
57796      }
57797      if (element.hasCommunicationMethod()) {
57798        composeCodeableConcept("communicationMethod", element.getCommunicationMethod());
57799      }
57800      if (element.hasDateElement()) {
57801        composeDateCore("date", element.getDateElement(), false);
57802        composeDateExtras("date", element.getDateElement(), false);
57803      }
57804      if (element.hasSourceIdentityCertificateElement()) {
57805        composeStringCore("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
57806        composeStringExtras("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
57807      }
57808      if (element.hasProxyIdentityCertificateElement()) {
57809        composeStringCore("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
57810        composeStringExtras("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
57811      }
57812      if (element.hasProxySignature()) {
57813        composeSignature("proxySignature", element.getProxySignature());
57814      }
57815      if (element.hasSourceSignature()) {
57816        composeSignature("sourceSignature", element.getSourceSignature());
57817      }
57818  }
57819
57820  protected void composeVerificationResultVerificationResultValidatorComponent(String name, VerificationResult.VerificationResultValidatorComponent element) throws IOException {
57821    if (element != null) {
57822      open(name);
57823      composeVerificationResultVerificationResultValidatorComponentInner(element);
57824      close();
57825    }
57826  }
57827
57828  protected void composeVerificationResultVerificationResultValidatorComponentInner(VerificationResult.VerificationResultValidatorComponent element) throws IOException {
57829      composeBackbone(element);
57830      if (element.hasOrganization()) {
57831        composeReference("organization", element.getOrganization());
57832      }
57833      if (element.hasIdentityCertificateElement()) {
57834        composeStringCore("identityCertificate", element.getIdentityCertificateElement(), false);
57835        composeStringExtras("identityCertificate", element.getIdentityCertificateElement(), false);
57836      }
57837      if (element.hasAttestationSignature()) {
57838        composeSignature("attestationSignature", element.getAttestationSignature());
57839      }
57840  }
57841
57842  protected void composeVisionPrescription(String name, VisionPrescription element) throws IOException {
57843    if (element != null) {
57844      prop("resourceType", name);
57845      composeVisionPrescriptionInner(element);
57846    }
57847  }
57848
57849  protected void composeVisionPrescriptionInner(VisionPrescription element) throws IOException {
57850      composeDomainResourceElements(element);
57851      if (element.hasIdentifier()) {
57852        openArray("identifier");
57853        for (Identifier e : element.getIdentifier()) 
57854          composeIdentifier(null, e);
57855        closeArray();
57856      };
57857      if (element.hasStatusElement()) {
57858        composeEnumerationCore("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(), false);
57859        composeEnumerationExtras("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(), false);
57860      }
57861      if (element.hasCreatedElement()) {
57862        composeDateTimeCore("created", element.getCreatedElement(), false);
57863        composeDateTimeExtras("created", element.getCreatedElement(), false);
57864      }
57865      if (element.hasPatient()) {
57866        composeReference("patient", element.getPatient());
57867      }
57868      if (element.hasEncounter()) {
57869        composeReference("encounter", element.getEncounter());
57870      }
57871      if (element.hasDateWrittenElement()) {
57872        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
57873        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
57874      }
57875      if (element.hasPrescriber()) {
57876        composeReference("prescriber", element.getPrescriber());
57877      }
57878      if (element.hasLensSpecification()) {
57879        openArray("lensSpecification");
57880        for (VisionPrescription.VisionPrescriptionLensSpecificationComponent e : element.getLensSpecification()) 
57881          composeVisionPrescriptionVisionPrescriptionLensSpecificationComponent(null, e);
57882        closeArray();
57883      };
57884  }
57885
57886  protected void composeVisionPrescriptionVisionPrescriptionLensSpecificationComponent(String name, VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
57887    if (element != null) {
57888      open(name);
57889      composeVisionPrescriptionVisionPrescriptionLensSpecificationComponentInner(element);
57890      close();
57891    }
57892  }
57893
57894  protected void composeVisionPrescriptionVisionPrescriptionLensSpecificationComponentInner(VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
57895      composeBackbone(element);
57896      if (element.hasProduct()) {
57897        composeCodeableConcept("product", element.getProduct());
57898      }
57899      if (element.hasEyeElement()) {
57900        composeEnumerationCore("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
57901        composeEnumerationExtras("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
57902      }
57903      if (element.hasSphereElement()) {
57904        composeDecimalCore("sphere", element.getSphereElement(), false);
57905        composeDecimalExtras("sphere", element.getSphereElement(), false);
57906      }
57907      if (element.hasCylinderElement()) {
57908        composeDecimalCore("cylinder", element.getCylinderElement(), false);
57909        composeDecimalExtras("cylinder", element.getCylinderElement(), false);
57910      }
57911      if (element.hasAxisElement()) {
57912        composeIntegerCore("axis", element.getAxisElement(), false);
57913        composeIntegerExtras("axis", element.getAxisElement(), false);
57914      }
57915      if (element.hasPrism()) {
57916        openArray("prism");
57917        for (VisionPrescription.PrismComponent e : element.getPrism()) 
57918          composeVisionPrescriptionPrismComponent(null, e);
57919        closeArray();
57920      };
57921      if (element.hasAddElement()) {
57922        composeDecimalCore("add", element.getAddElement(), false);
57923        composeDecimalExtras("add", element.getAddElement(), false);
57924      }
57925      if (element.hasPowerElement()) {
57926        composeDecimalCore("power", element.getPowerElement(), false);
57927        composeDecimalExtras("power", element.getPowerElement(), false);
57928      }
57929      if (element.hasBackCurveElement()) {
57930        composeDecimalCore("backCurve", element.getBackCurveElement(), false);
57931        composeDecimalExtras("backCurve", element.getBackCurveElement(), false);
57932      }
57933      if (element.hasDiameterElement()) {
57934        composeDecimalCore("diameter", element.getDiameterElement(), false);
57935        composeDecimalExtras("diameter", element.getDiameterElement(), false);
57936      }
57937      if (element.hasDuration()) {
57938        composeQuantity("duration", element.getDuration());
57939      }
57940      if (element.hasColorElement()) {
57941        composeStringCore("color", element.getColorElement(), false);
57942        composeStringExtras("color", element.getColorElement(), false);
57943      }
57944      if (element.hasBrandElement()) {
57945        composeStringCore("brand", element.getBrandElement(), false);
57946        composeStringExtras("brand", element.getBrandElement(), false);
57947      }
57948      if (element.hasNote()) {
57949        openArray("note");
57950        for (Annotation e : element.getNote()) 
57951          composeAnnotation(null, e);
57952        closeArray();
57953      };
57954  }
57955
57956  protected void composeVisionPrescriptionPrismComponent(String name, VisionPrescription.PrismComponent element) throws IOException {
57957    if (element != null) {
57958      open(name);
57959      composeVisionPrescriptionPrismComponentInner(element);
57960      close();
57961    }
57962  }
57963
57964  protected void composeVisionPrescriptionPrismComponentInner(VisionPrescription.PrismComponent element) throws IOException {
57965      composeBackbone(element);
57966      if (element.hasAmountElement()) {
57967        composeDecimalCore("amount", element.getAmountElement(), false);
57968        composeDecimalExtras("amount", element.getAmountElement(), false);
57969      }
57970      if (element.hasBaseElement()) {
57971        composeEnumerationCore("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
57972        composeEnumerationExtras("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
57973      }
57974  }
57975
57976  @Override
57977  protected void composeResource(Resource resource) throws IOException {
57978    if (resource instanceof Parameters)
57979      composeParameters("Parameters", (Parameters)resource);
57980    else if (resource instanceof Account)
57981      composeAccount("Account", (Account)resource);
57982    else if (resource instanceof ActivityDefinition)
57983      composeActivityDefinition("ActivityDefinition", (ActivityDefinition)resource);
57984    else if (resource instanceof AdverseEvent)
57985      composeAdverseEvent("AdverseEvent", (AdverseEvent)resource);
57986    else if (resource instanceof AllergyIntolerance)
57987      composeAllergyIntolerance("AllergyIntolerance", (AllergyIntolerance)resource);
57988    else if (resource instanceof Appointment)
57989      composeAppointment("Appointment", (Appointment)resource);
57990    else if (resource instanceof AppointmentResponse)
57991      composeAppointmentResponse("AppointmentResponse", (AppointmentResponse)resource);
57992    else if (resource instanceof AuditEvent)
57993      composeAuditEvent("AuditEvent", (AuditEvent)resource);
57994    else if (resource instanceof Basic)
57995      composeBasic("Basic", (Basic)resource);
57996    else if (resource instanceof Binary)
57997      composeBinary("Binary", (Binary)resource);
57998    else if (resource instanceof BiologicallyDerivedProduct)
57999      composeBiologicallyDerivedProduct("BiologicallyDerivedProduct", (BiologicallyDerivedProduct)resource);
58000    else if (resource instanceof BodyStructure)
58001      composeBodyStructure("BodyStructure", (BodyStructure)resource);
58002    else if (resource instanceof Bundle)
58003      composeBundle("Bundle", (Bundle)resource);
58004    else if (resource instanceof CapabilityStatement)
58005      composeCapabilityStatement("CapabilityStatement", (CapabilityStatement)resource);
58006    else if (resource instanceof CarePlan)
58007      composeCarePlan("CarePlan", (CarePlan)resource);
58008    else if (resource instanceof CareTeam)
58009      composeCareTeam("CareTeam", (CareTeam)resource);
58010    else if (resource instanceof CatalogEntry)
58011      composeCatalogEntry("CatalogEntry", (CatalogEntry)resource);
58012    else if (resource instanceof ChargeItem)
58013      composeChargeItem("ChargeItem", (ChargeItem)resource);
58014    else if (resource instanceof ChargeItemDefinition)
58015      composeChargeItemDefinition("ChargeItemDefinition", (ChargeItemDefinition)resource);
58016    else if (resource instanceof Claim)
58017      composeClaim("Claim", (Claim)resource);
58018    else if (resource instanceof ClaimResponse)
58019      composeClaimResponse("ClaimResponse", (ClaimResponse)resource);
58020    else if (resource instanceof ClinicalImpression)
58021      composeClinicalImpression("ClinicalImpression", (ClinicalImpression)resource);
58022    else if (resource instanceof CodeSystem)
58023      composeCodeSystem("CodeSystem", (CodeSystem)resource);
58024    else if (resource instanceof Communication)
58025      composeCommunication("Communication", (Communication)resource);
58026    else if (resource instanceof CommunicationRequest)
58027      composeCommunicationRequest("CommunicationRequest", (CommunicationRequest)resource);
58028    else if (resource instanceof CompartmentDefinition)
58029      composeCompartmentDefinition("CompartmentDefinition", (CompartmentDefinition)resource);
58030    else if (resource instanceof Composition)
58031      composeComposition("Composition", (Composition)resource);
58032    else if (resource instanceof ConceptMap)
58033      composeConceptMap("ConceptMap", (ConceptMap)resource);
58034    else if (resource instanceof Condition)
58035      composeCondition("Condition", (Condition)resource);
58036    else if (resource instanceof Consent)
58037      composeConsent("Consent", (Consent)resource);
58038    else if (resource instanceof Contract)
58039      composeContract("Contract", (Contract)resource);
58040    else if (resource instanceof Coverage)
58041      composeCoverage("Coverage", (Coverage)resource);
58042    else if (resource instanceof CoverageEligibilityRequest)
58043      composeCoverageEligibilityRequest("CoverageEligibilityRequest", (CoverageEligibilityRequest)resource);
58044    else if (resource instanceof CoverageEligibilityResponse)
58045      composeCoverageEligibilityResponse("CoverageEligibilityResponse", (CoverageEligibilityResponse)resource);
58046    else if (resource instanceof DetectedIssue)
58047      composeDetectedIssue("DetectedIssue", (DetectedIssue)resource);
58048    else if (resource instanceof Device)
58049      composeDevice("Device", (Device)resource);
58050    else if (resource instanceof DeviceDefinition)
58051      composeDeviceDefinition("DeviceDefinition", (DeviceDefinition)resource);
58052    else if (resource instanceof DeviceMetric)
58053      composeDeviceMetric("DeviceMetric", (DeviceMetric)resource);
58054    else if (resource instanceof DeviceRequest)
58055      composeDeviceRequest("DeviceRequest", (DeviceRequest)resource);
58056    else if (resource instanceof DeviceUseStatement)
58057      composeDeviceUseStatement("DeviceUseStatement", (DeviceUseStatement)resource);
58058    else if (resource instanceof DiagnosticReport)
58059      composeDiagnosticReport("DiagnosticReport", (DiagnosticReport)resource);
58060    else if (resource instanceof DocumentManifest)
58061      composeDocumentManifest("DocumentManifest", (DocumentManifest)resource);
58062    else if (resource instanceof DocumentReference)
58063      composeDocumentReference("DocumentReference", (DocumentReference)resource);
58064    else if (resource instanceof EffectEvidenceSynthesis)
58065      composeEffectEvidenceSynthesis("EffectEvidenceSynthesis", (EffectEvidenceSynthesis)resource);
58066    else if (resource instanceof Encounter)
58067      composeEncounter("Encounter", (Encounter)resource);
58068    else if (resource instanceof Endpoint)
58069      composeEndpoint("Endpoint", (Endpoint)resource);
58070    else if (resource instanceof EnrollmentRequest)
58071      composeEnrollmentRequest("EnrollmentRequest", (EnrollmentRequest)resource);
58072    else if (resource instanceof EnrollmentResponse)
58073      composeEnrollmentResponse("EnrollmentResponse", (EnrollmentResponse)resource);
58074    else if (resource instanceof EpisodeOfCare)
58075      composeEpisodeOfCare("EpisodeOfCare", (EpisodeOfCare)resource);
58076    else if (resource instanceof EventDefinition)
58077      composeEventDefinition("EventDefinition", (EventDefinition)resource);
58078    else if (resource instanceof Evidence)
58079      composeEvidence("Evidence", (Evidence)resource);
58080    else if (resource instanceof EvidenceVariable)
58081      composeEvidenceVariable("EvidenceVariable", (EvidenceVariable)resource);
58082    else if (resource instanceof ExampleScenario)
58083      composeExampleScenario("ExampleScenario", (ExampleScenario)resource);
58084    else if (resource instanceof ExplanationOfBenefit)
58085      composeExplanationOfBenefit("ExplanationOfBenefit", (ExplanationOfBenefit)resource);
58086    else if (resource instanceof FamilyMemberHistory)
58087      composeFamilyMemberHistory("FamilyMemberHistory", (FamilyMemberHistory)resource);
58088    else if (resource instanceof Flag)
58089      composeFlag("Flag", (Flag)resource);
58090    else if (resource instanceof Goal)
58091      composeGoal("Goal", (Goal)resource);
58092    else if (resource instanceof GraphDefinition)
58093      composeGraphDefinition("GraphDefinition", (GraphDefinition)resource);
58094    else if (resource instanceof Group)
58095      composeGroup("Group", (Group)resource);
58096    else if (resource instanceof GuidanceResponse)
58097      composeGuidanceResponse("GuidanceResponse", (GuidanceResponse)resource);
58098    else if (resource instanceof HealthcareService)
58099      composeHealthcareService("HealthcareService", (HealthcareService)resource);
58100    else if (resource instanceof ImagingStudy)
58101      composeImagingStudy("ImagingStudy", (ImagingStudy)resource);
58102    else if (resource instanceof Immunization)
58103      composeImmunization("Immunization", (Immunization)resource);
58104    else if (resource instanceof ImmunizationEvaluation)
58105      composeImmunizationEvaluation("ImmunizationEvaluation", (ImmunizationEvaluation)resource);
58106    else if (resource instanceof ImmunizationRecommendation)
58107      composeImmunizationRecommendation("ImmunizationRecommendation", (ImmunizationRecommendation)resource);
58108    else if (resource instanceof ImplementationGuide)
58109      composeImplementationGuide("ImplementationGuide", (ImplementationGuide)resource);
58110    else if (resource instanceof InsurancePlan)
58111      composeInsurancePlan("InsurancePlan", (InsurancePlan)resource);
58112    else if (resource instanceof Invoice)
58113      composeInvoice("Invoice", (Invoice)resource);
58114    else if (resource instanceof Library)
58115      composeLibrary("Library", (Library)resource);
58116    else if (resource instanceof Linkage)
58117      composeLinkage("Linkage", (Linkage)resource);
58118    else if (resource instanceof ListResource)
58119      composeListResource("List", (ListResource)resource);
58120    else if (resource instanceof Location)
58121      composeLocation("Location", (Location)resource);
58122    else if (resource instanceof Measure)
58123      composeMeasure("Measure", (Measure)resource);
58124    else if (resource instanceof MeasureReport)
58125      composeMeasureReport("MeasureReport", (MeasureReport)resource);
58126    else if (resource instanceof Media)
58127      composeMedia("Media", (Media)resource);
58128    else if (resource instanceof Medication)
58129      composeMedication("Medication", (Medication)resource);
58130    else if (resource instanceof MedicationAdministration)
58131      composeMedicationAdministration("MedicationAdministration", (MedicationAdministration)resource);
58132    else if (resource instanceof MedicationDispense)
58133      composeMedicationDispense("MedicationDispense", (MedicationDispense)resource);
58134    else if (resource instanceof MedicationKnowledge)
58135      composeMedicationKnowledge("MedicationKnowledge", (MedicationKnowledge)resource);
58136    else if (resource instanceof MedicationRequest)
58137      composeMedicationRequest("MedicationRequest", (MedicationRequest)resource);
58138    else if (resource instanceof MedicationStatement)
58139      composeMedicationStatement("MedicationStatement", (MedicationStatement)resource);
58140    else if (resource instanceof MedicinalProduct)
58141      composeMedicinalProduct("MedicinalProduct", (MedicinalProduct)resource);
58142    else if (resource instanceof MedicinalProductAuthorization)
58143      composeMedicinalProductAuthorization("MedicinalProductAuthorization", (MedicinalProductAuthorization)resource);
58144    else if (resource instanceof MedicinalProductContraindication)
58145      composeMedicinalProductContraindication("MedicinalProductContraindication", (MedicinalProductContraindication)resource);
58146    else if (resource instanceof MedicinalProductIndication)
58147      composeMedicinalProductIndication("MedicinalProductIndication", (MedicinalProductIndication)resource);
58148    else if (resource instanceof MedicinalProductIngredient)
58149      composeMedicinalProductIngredient("MedicinalProductIngredient", (MedicinalProductIngredient)resource);
58150    else if (resource instanceof MedicinalProductInteraction)
58151      composeMedicinalProductInteraction("MedicinalProductInteraction", (MedicinalProductInteraction)resource);
58152    else if (resource instanceof MedicinalProductManufactured)
58153      composeMedicinalProductManufactured("MedicinalProductManufactured", (MedicinalProductManufactured)resource);
58154    else if (resource instanceof MedicinalProductPackaged)
58155      composeMedicinalProductPackaged("MedicinalProductPackaged", (MedicinalProductPackaged)resource);
58156    else if (resource instanceof MedicinalProductPharmaceutical)
58157      composeMedicinalProductPharmaceutical("MedicinalProductPharmaceutical", (MedicinalProductPharmaceutical)resource);
58158    else if (resource instanceof MedicinalProductUndesirableEffect)
58159      composeMedicinalProductUndesirableEffect("MedicinalProductUndesirableEffect", (MedicinalProductUndesirableEffect)resource);
58160    else if (resource instanceof MessageDefinition)
58161      composeMessageDefinition("MessageDefinition", (MessageDefinition)resource);
58162    else if (resource instanceof MessageHeader)
58163      composeMessageHeader("MessageHeader", (MessageHeader)resource);
58164    else if (resource instanceof MolecularSequence)
58165      composeMolecularSequence("MolecularSequence", (MolecularSequence)resource);
58166    else if (resource instanceof NamingSystem)
58167      composeNamingSystem("NamingSystem", (NamingSystem)resource);
58168    else if (resource instanceof NutritionOrder)
58169      composeNutritionOrder("NutritionOrder", (NutritionOrder)resource);
58170    else if (resource instanceof Observation)
58171      composeObservation("Observation", (Observation)resource);
58172    else if (resource instanceof ObservationDefinition)
58173      composeObservationDefinition("ObservationDefinition", (ObservationDefinition)resource);
58174    else if (resource instanceof OperationDefinition)
58175      composeOperationDefinition("OperationDefinition", (OperationDefinition)resource);
58176    else if (resource instanceof OperationOutcome)
58177      composeOperationOutcome("OperationOutcome", (OperationOutcome)resource);
58178    else if (resource instanceof Organization)
58179      composeOrganization("Organization", (Organization)resource);
58180    else if (resource instanceof OrganizationAffiliation)
58181      composeOrganizationAffiliation("OrganizationAffiliation", (OrganizationAffiliation)resource);
58182    else if (resource instanceof Patient)
58183      composePatient("Patient", (Patient)resource);
58184    else if (resource instanceof PaymentNotice)
58185      composePaymentNotice("PaymentNotice", (PaymentNotice)resource);
58186    else if (resource instanceof PaymentReconciliation)
58187      composePaymentReconciliation("PaymentReconciliation", (PaymentReconciliation)resource);
58188    else if (resource instanceof Person)
58189      composePerson("Person", (Person)resource);
58190    else if (resource instanceof PlanDefinition)
58191      composePlanDefinition("PlanDefinition", (PlanDefinition)resource);
58192    else if (resource instanceof Practitioner)
58193      composePractitioner("Practitioner", (Practitioner)resource);
58194    else if (resource instanceof PractitionerRole)
58195      composePractitionerRole("PractitionerRole", (PractitionerRole)resource);
58196    else if (resource instanceof Procedure)
58197      composeProcedure("Procedure", (Procedure)resource);
58198    else if (resource instanceof Provenance)
58199      composeProvenance("Provenance", (Provenance)resource);
58200    else if (resource instanceof Questionnaire)
58201      composeQuestionnaire("Questionnaire", (Questionnaire)resource);
58202    else if (resource instanceof QuestionnaireResponse)
58203      composeQuestionnaireResponse("QuestionnaireResponse", (QuestionnaireResponse)resource);
58204    else if (resource instanceof RelatedPerson)
58205      composeRelatedPerson("RelatedPerson", (RelatedPerson)resource);
58206    else if (resource instanceof RequestGroup)
58207      composeRequestGroup("RequestGroup", (RequestGroup)resource);
58208    else if (resource instanceof ResearchDefinition)
58209      composeResearchDefinition("ResearchDefinition", (ResearchDefinition)resource);
58210    else if (resource instanceof ResearchElementDefinition)
58211      composeResearchElementDefinition("ResearchElementDefinition", (ResearchElementDefinition)resource);
58212    else if (resource instanceof ResearchStudy)
58213      composeResearchStudy("ResearchStudy", (ResearchStudy)resource);
58214    else if (resource instanceof ResearchSubject)
58215      composeResearchSubject("ResearchSubject", (ResearchSubject)resource);
58216    else if (resource instanceof RiskAssessment)
58217      composeRiskAssessment("RiskAssessment", (RiskAssessment)resource);
58218    else if (resource instanceof RiskEvidenceSynthesis)
58219      composeRiskEvidenceSynthesis("RiskEvidenceSynthesis", (RiskEvidenceSynthesis)resource);
58220    else if (resource instanceof Schedule)
58221      composeSchedule("Schedule", (Schedule)resource);
58222    else if (resource instanceof SearchParameter)
58223      composeSearchParameter("SearchParameter", (SearchParameter)resource);
58224    else if (resource instanceof ServiceRequest)
58225      composeServiceRequest("ServiceRequest", (ServiceRequest)resource);
58226    else if (resource instanceof Slot)
58227      composeSlot("Slot", (Slot)resource);
58228    else if (resource instanceof Specimen)
58229      composeSpecimen("Specimen", (Specimen)resource);
58230    else if (resource instanceof SpecimenDefinition)
58231      composeSpecimenDefinition("SpecimenDefinition", (SpecimenDefinition)resource);
58232    else if (resource instanceof StructureDefinition)
58233      composeStructureDefinition("StructureDefinition", (StructureDefinition)resource);
58234    else if (resource instanceof StructureMap)
58235      composeStructureMap("StructureMap", (StructureMap)resource);
58236    else if (resource instanceof Subscription)
58237      composeSubscription("Subscription", (Subscription)resource);
58238    else if (resource instanceof Substance)
58239      composeSubstance("Substance", (Substance)resource);
58240    else if (resource instanceof SubstanceNucleicAcid)
58241      composeSubstanceNucleicAcid("SubstanceNucleicAcid", (SubstanceNucleicAcid)resource);
58242    else if (resource instanceof SubstancePolymer)
58243      composeSubstancePolymer("SubstancePolymer", (SubstancePolymer)resource);
58244    else if (resource instanceof SubstanceProtein)
58245      composeSubstanceProtein("SubstanceProtein", (SubstanceProtein)resource);
58246    else if (resource instanceof SubstanceReferenceInformation)
58247      composeSubstanceReferenceInformation("SubstanceReferenceInformation", (SubstanceReferenceInformation)resource);
58248    else if (resource instanceof SubstanceSourceMaterial)
58249      composeSubstanceSourceMaterial("SubstanceSourceMaterial", (SubstanceSourceMaterial)resource);
58250    else if (resource instanceof SubstanceSpecification)
58251      composeSubstanceSpecification("SubstanceSpecification", (SubstanceSpecification)resource);
58252    else if (resource instanceof SupplyDelivery)
58253      composeSupplyDelivery("SupplyDelivery", (SupplyDelivery)resource);
58254    else if (resource instanceof SupplyRequest)
58255      composeSupplyRequest("SupplyRequest", (SupplyRequest)resource);
58256    else if (resource instanceof Task)
58257      composeTask("Task", (Task)resource);
58258    else if (resource instanceof TerminologyCapabilities)
58259      composeTerminologyCapabilities("TerminologyCapabilities", (TerminologyCapabilities)resource);
58260    else if (resource instanceof TestReport)
58261      composeTestReport("TestReport", (TestReport)resource);
58262    else if (resource instanceof TestScript)
58263      composeTestScript("TestScript", (TestScript)resource);
58264    else if (resource instanceof ValueSet)
58265      composeValueSet("ValueSet", (ValueSet)resource);
58266    else if (resource instanceof VerificationResult)
58267      composeVerificationResult("VerificationResult", (VerificationResult)resource);
58268    else if (resource instanceof VisionPrescription)
58269      composeVisionPrescription("VisionPrescription", (VisionPrescription)resource);
58270    else if (resource instanceof Binary)
58271      composeBinary("Binary", (Binary)resource);
58272    else
58273      throw new Error("Unhandled resource type "+resource.getClass().getName());
58274  }
58275
58276  protected void composeNamedReference(String name, Resource resource) throws IOException {
58277    if (resource instanceof Parameters)
58278      composeParameters(name, (Parameters)resource);
58279    else if (resource instanceof Account)
58280      composeAccount(name, (Account)resource);
58281    else if (resource instanceof ActivityDefinition)
58282      composeActivityDefinition(name, (ActivityDefinition)resource);
58283    else if (resource instanceof AdverseEvent)
58284      composeAdverseEvent(name, (AdverseEvent)resource);
58285    else if (resource instanceof AllergyIntolerance)
58286      composeAllergyIntolerance(name, (AllergyIntolerance)resource);
58287    else if (resource instanceof Appointment)
58288      composeAppointment(name, (Appointment)resource);
58289    else if (resource instanceof AppointmentResponse)
58290      composeAppointmentResponse(name, (AppointmentResponse)resource);
58291    else if (resource instanceof AuditEvent)
58292      composeAuditEvent(name, (AuditEvent)resource);
58293    else if (resource instanceof Basic)
58294      composeBasic(name, (Basic)resource);
58295    else if (resource instanceof Binary)
58296      composeBinary(name, (Binary)resource);
58297    else if (resource instanceof BiologicallyDerivedProduct)
58298      composeBiologicallyDerivedProduct(name, (BiologicallyDerivedProduct)resource);
58299    else if (resource instanceof BodyStructure)
58300      composeBodyStructure(name, (BodyStructure)resource);
58301    else if (resource instanceof Bundle)
58302      composeBundle(name, (Bundle)resource);
58303    else if (resource instanceof CapabilityStatement)
58304      composeCapabilityStatement(name, (CapabilityStatement)resource);
58305    else if (resource instanceof CarePlan)
58306      composeCarePlan(name, (CarePlan)resource);
58307    else if (resource instanceof CareTeam)
58308      composeCareTeam(name, (CareTeam)resource);
58309    else if (resource instanceof CatalogEntry)
58310      composeCatalogEntry(name, (CatalogEntry)resource);
58311    else if (resource instanceof ChargeItem)
58312      composeChargeItem(name, (ChargeItem)resource);
58313    else if (resource instanceof ChargeItemDefinition)
58314      composeChargeItemDefinition(name, (ChargeItemDefinition)resource);
58315    else if (resource instanceof Claim)
58316      composeClaim(name, (Claim)resource);
58317    else if (resource instanceof ClaimResponse)
58318      composeClaimResponse(name, (ClaimResponse)resource);
58319    else if (resource instanceof ClinicalImpression)
58320      composeClinicalImpression(name, (ClinicalImpression)resource);
58321    else if (resource instanceof CodeSystem)
58322      composeCodeSystem(name, (CodeSystem)resource);
58323    else if (resource instanceof Communication)
58324      composeCommunication(name, (Communication)resource);
58325    else if (resource instanceof CommunicationRequest)
58326      composeCommunicationRequest(name, (CommunicationRequest)resource);
58327    else if (resource instanceof CompartmentDefinition)
58328      composeCompartmentDefinition(name, (CompartmentDefinition)resource);
58329    else if (resource instanceof Composition)
58330      composeComposition(name, (Composition)resource);
58331    else if (resource instanceof ConceptMap)
58332      composeConceptMap(name, (ConceptMap)resource);
58333    else if (resource instanceof Condition)
58334      composeCondition(name, (Condition)resource);
58335    else if (resource instanceof Consent)
58336      composeConsent(name, (Consent)resource);
58337    else if (resource instanceof Contract)
58338      composeContract(name, (Contract)resource);
58339    else if (resource instanceof Coverage)
58340      composeCoverage(name, (Coverage)resource);
58341    else if (resource instanceof CoverageEligibilityRequest)
58342      composeCoverageEligibilityRequest(name, (CoverageEligibilityRequest)resource);
58343    else if (resource instanceof CoverageEligibilityResponse)
58344      composeCoverageEligibilityResponse(name, (CoverageEligibilityResponse)resource);
58345    else if (resource instanceof DetectedIssue)
58346      composeDetectedIssue(name, (DetectedIssue)resource);
58347    else if (resource instanceof Device)
58348      composeDevice(name, (Device)resource);
58349    else if (resource instanceof DeviceDefinition)
58350      composeDeviceDefinition(name, (DeviceDefinition)resource);
58351    else if (resource instanceof DeviceMetric)
58352      composeDeviceMetric(name, (DeviceMetric)resource);
58353    else if (resource instanceof DeviceRequest)
58354      composeDeviceRequest(name, (DeviceRequest)resource);
58355    else if (resource instanceof DeviceUseStatement)
58356      composeDeviceUseStatement(name, (DeviceUseStatement)resource);
58357    else if (resource instanceof DiagnosticReport)
58358      composeDiagnosticReport(name, (DiagnosticReport)resource);
58359    else if (resource instanceof DocumentManifest)
58360      composeDocumentManifest(name, (DocumentManifest)resource);
58361    else if (resource instanceof DocumentReference)
58362      composeDocumentReference(name, (DocumentReference)resource);
58363    else if (resource instanceof EffectEvidenceSynthesis)
58364      composeEffectEvidenceSynthesis(name, (EffectEvidenceSynthesis)resource);
58365    else if (resource instanceof Encounter)
58366      composeEncounter(name, (Encounter)resource);
58367    else if (resource instanceof Endpoint)
58368      composeEndpoint(name, (Endpoint)resource);
58369    else if (resource instanceof EnrollmentRequest)
58370      composeEnrollmentRequest(name, (EnrollmentRequest)resource);
58371    else if (resource instanceof EnrollmentResponse)
58372      composeEnrollmentResponse(name, (EnrollmentResponse)resource);
58373    else if (resource instanceof EpisodeOfCare)
58374      composeEpisodeOfCare(name, (EpisodeOfCare)resource);
58375    else if (resource instanceof EventDefinition)
58376      composeEventDefinition(name, (EventDefinition)resource);
58377    else if (resource instanceof Evidence)
58378      composeEvidence(name, (Evidence)resource);
58379    else if (resource instanceof EvidenceVariable)
58380      composeEvidenceVariable(name, (EvidenceVariable)resource);
58381    else if (resource instanceof ExampleScenario)
58382      composeExampleScenario(name, (ExampleScenario)resource);
58383    else if (resource instanceof ExplanationOfBenefit)
58384      composeExplanationOfBenefit(name, (ExplanationOfBenefit)resource);
58385    else if (resource instanceof FamilyMemberHistory)
58386      composeFamilyMemberHistory(name, (FamilyMemberHistory)resource);
58387    else if (resource instanceof Flag)
58388      composeFlag(name, (Flag)resource);
58389    else if (resource instanceof Goal)
58390      composeGoal(name, (Goal)resource);
58391    else if (resource instanceof GraphDefinition)
58392      composeGraphDefinition(name, (GraphDefinition)resource);
58393    else if (resource instanceof Group)
58394      composeGroup(name, (Group)resource);
58395    else if (resource instanceof GuidanceResponse)
58396      composeGuidanceResponse(name, (GuidanceResponse)resource);
58397    else if (resource instanceof HealthcareService)
58398      composeHealthcareService(name, (HealthcareService)resource);
58399    else if (resource instanceof ImagingStudy)
58400      composeImagingStudy(name, (ImagingStudy)resource);
58401    else if (resource instanceof Immunization)
58402      composeImmunization(name, (Immunization)resource);
58403    else if (resource instanceof ImmunizationEvaluation)
58404      composeImmunizationEvaluation(name, (ImmunizationEvaluation)resource);
58405    else if (resource instanceof ImmunizationRecommendation)
58406      composeImmunizationRecommendation(name, (ImmunizationRecommendation)resource);
58407    else if (resource instanceof ImplementationGuide)
58408      composeImplementationGuide(name, (ImplementationGuide)resource);
58409    else if (resource instanceof InsurancePlan)
58410      composeInsurancePlan(name, (InsurancePlan)resource);
58411    else if (resource instanceof Invoice)
58412      composeInvoice(name, (Invoice)resource);
58413    else if (resource instanceof Library)
58414      composeLibrary(name, (Library)resource);
58415    else if (resource instanceof Linkage)
58416      composeLinkage(name, (Linkage)resource);
58417    else if (resource instanceof ListResource)
58418      composeListResource(name, (ListResource)resource);
58419    else if (resource instanceof Location)
58420      composeLocation(name, (Location)resource);
58421    else if (resource instanceof Measure)
58422      composeMeasure(name, (Measure)resource);
58423    else if (resource instanceof MeasureReport)
58424      composeMeasureReport(name, (MeasureReport)resource);
58425    else if (resource instanceof Media)
58426      composeMedia(name, (Media)resource);
58427    else if (resource instanceof Medication)
58428      composeMedication(name, (Medication)resource);
58429    else if (resource instanceof MedicationAdministration)
58430      composeMedicationAdministration(name, (MedicationAdministration)resource);
58431    else if (resource instanceof MedicationDispense)
58432      composeMedicationDispense(name, (MedicationDispense)resource);
58433    else if (resource instanceof MedicationKnowledge)
58434      composeMedicationKnowledge(name, (MedicationKnowledge)resource);
58435    else if (resource instanceof MedicationRequest)
58436      composeMedicationRequest(name, (MedicationRequest)resource);
58437    else if (resource instanceof MedicationStatement)
58438      composeMedicationStatement(name, (MedicationStatement)resource);
58439    else if (resource instanceof MedicinalProduct)
58440      composeMedicinalProduct(name, (MedicinalProduct)resource);
58441    else if (resource instanceof MedicinalProductAuthorization)
58442      composeMedicinalProductAuthorization(name, (MedicinalProductAuthorization)resource);
58443    else if (resource instanceof MedicinalProductContraindication)
58444      composeMedicinalProductContraindication(name, (MedicinalProductContraindication)resource);
58445    else if (resource instanceof MedicinalProductIndication)
58446      composeMedicinalProductIndication(name, (MedicinalProductIndication)resource);
58447    else if (resource instanceof MedicinalProductIngredient)
58448      composeMedicinalProductIngredient(name, (MedicinalProductIngredient)resource);
58449    else if (resource instanceof MedicinalProductInteraction)
58450      composeMedicinalProductInteraction(name, (MedicinalProductInteraction)resource);
58451    else if (resource instanceof MedicinalProductManufactured)
58452      composeMedicinalProductManufactured(name, (MedicinalProductManufactured)resource);
58453    else if (resource instanceof MedicinalProductPackaged)
58454      composeMedicinalProductPackaged(name, (MedicinalProductPackaged)resource);
58455    else if (resource instanceof MedicinalProductPharmaceutical)
58456      composeMedicinalProductPharmaceutical(name, (MedicinalProductPharmaceutical)resource);
58457    else if (resource instanceof MedicinalProductUndesirableEffect)
58458      composeMedicinalProductUndesirableEffect(name, (MedicinalProductUndesirableEffect)resource);
58459    else if (resource instanceof MessageDefinition)
58460      composeMessageDefinition(name, (MessageDefinition)resource);
58461    else if (resource instanceof MessageHeader)
58462      composeMessageHeader(name, (MessageHeader)resource);
58463    else if (resource instanceof MolecularSequence)
58464      composeMolecularSequence(name, (MolecularSequence)resource);
58465    else if (resource instanceof NamingSystem)
58466      composeNamingSystem(name, (NamingSystem)resource);
58467    else if (resource instanceof NutritionOrder)
58468      composeNutritionOrder(name, (NutritionOrder)resource);
58469    else if (resource instanceof Observation)
58470      composeObservation(name, (Observation)resource);
58471    else if (resource instanceof ObservationDefinition)
58472      composeObservationDefinition(name, (ObservationDefinition)resource);
58473    else if (resource instanceof OperationDefinition)
58474      composeOperationDefinition(name, (OperationDefinition)resource);
58475    else if (resource instanceof OperationOutcome)
58476      composeOperationOutcome(name, (OperationOutcome)resource);
58477    else if (resource instanceof Organization)
58478      composeOrganization(name, (Organization)resource);
58479    else if (resource instanceof OrganizationAffiliation)
58480      composeOrganizationAffiliation(name, (OrganizationAffiliation)resource);
58481    else if (resource instanceof Patient)
58482      composePatient(name, (Patient)resource);
58483    else if (resource instanceof PaymentNotice)
58484      composePaymentNotice(name, (PaymentNotice)resource);
58485    else if (resource instanceof PaymentReconciliation)
58486      composePaymentReconciliation(name, (PaymentReconciliation)resource);
58487    else if (resource instanceof Person)
58488      composePerson(name, (Person)resource);
58489    else if (resource instanceof PlanDefinition)
58490      composePlanDefinition(name, (PlanDefinition)resource);
58491    else if (resource instanceof Practitioner)
58492      composePractitioner(name, (Practitioner)resource);
58493    else if (resource instanceof PractitionerRole)
58494      composePractitionerRole(name, (PractitionerRole)resource);
58495    else if (resource instanceof Procedure)
58496      composeProcedure(name, (Procedure)resource);
58497    else if (resource instanceof Provenance)
58498      composeProvenance(name, (Provenance)resource);
58499    else if (resource instanceof Questionnaire)
58500      composeQuestionnaire(name, (Questionnaire)resource);
58501    else if (resource instanceof QuestionnaireResponse)
58502      composeQuestionnaireResponse(name, (QuestionnaireResponse)resource);
58503    else if (resource instanceof RelatedPerson)
58504      composeRelatedPerson(name, (RelatedPerson)resource);
58505    else if (resource instanceof RequestGroup)
58506      composeRequestGroup(name, (RequestGroup)resource);
58507    else if (resource instanceof ResearchDefinition)
58508      composeResearchDefinition(name, (ResearchDefinition)resource);
58509    else if (resource instanceof ResearchElementDefinition)
58510      composeResearchElementDefinition(name, (ResearchElementDefinition)resource);
58511    else if (resource instanceof ResearchStudy)
58512      composeResearchStudy(name, (ResearchStudy)resource);
58513    else if (resource instanceof ResearchSubject)
58514      composeResearchSubject(name, (ResearchSubject)resource);
58515    else if (resource instanceof RiskAssessment)
58516      composeRiskAssessment(name, (RiskAssessment)resource);
58517    else if (resource instanceof RiskEvidenceSynthesis)
58518      composeRiskEvidenceSynthesis(name, (RiskEvidenceSynthesis)resource);
58519    else if (resource instanceof Schedule)
58520      composeSchedule(name, (Schedule)resource);
58521    else if (resource instanceof SearchParameter)
58522      composeSearchParameter(name, (SearchParameter)resource);
58523    else if (resource instanceof ServiceRequest)
58524      composeServiceRequest(name, (ServiceRequest)resource);
58525    else if (resource instanceof Slot)
58526      composeSlot(name, (Slot)resource);
58527    else if (resource instanceof Specimen)
58528      composeSpecimen(name, (Specimen)resource);
58529    else if (resource instanceof SpecimenDefinition)
58530      composeSpecimenDefinition(name, (SpecimenDefinition)resource);
58531    else if (resource instanceof StructureDefinition)
58532      composeStructureDefinition(name, (StructureDefinition)resource);
58533    else if (resource instanceof StructureMap)
58534      composeStructureMap(name, (StructureMap)resource);
58535    else if (resource instanceof Subscription)
58536      composeSubscription(name, (Subscription)resource);
58537    else if (resource instanceof Substance)
58538      composeSubstance(name, (Substance)resource);
58539    else if (resource instanceof SubstanceNucleicAcid)
58540      composeSubstanceNucleicAcid(name, (SubstanceNucleicAcid)resource);
58541    else if (resource instanceof SubstancePolymer)
58542      composeSubstancePolymer(name, (SubstancePolymer)resource);
58543    else if (resource instanceof SubstanceProtein)
58544      composeSubstanceProtein(name, (SubstanceProtein)resource);
58545    else if (resource instanceof SubstanceReferenceInformation)
58546      composeSubstanceReferenceInformation(name, (SubstanceReferenceInformation)resource);
58547    else if (resource instanceof SubstanceSourceMaterial)
58548      composeSubstanceSourceMaterial(name, (SubstanceSourceMaterial)resource);
58549    else if (resource instanceof SubstanceSpecification)
58550      composeSubstanceSpecification(name, (SubstanceSpecification)resource);
58551    else if (resource instanceof SupplyDelivery)
58552      composeSupplyDelivery(name, (SupplyDelivery)resource);
58553    else if (resource instanceof SupplyRequest)
58554      composeSupplyRequest(name, (SupplyRequest)resource);
58555    else if (resource instanceof Task)
58556      composeTask(name, (Task)resource);
58557    else if (resource instanceof TerminologyCapabilities)
58558      composeTerminologyCapabilities(name, (TerminologyCapabilities)resource);
58559    else if (resource instanceof TestReport)
58560      composeTestReport(name, (TestReport)resource);
58561    else if (resource instanceof TestScript)
58562      composeTestScript(name, (TestScript)resource);
58563    else if (resource instanceof ValueSet)
58564      composeValueSet(name, (ValueSet)resource);
58565    else if (resource instanceof VerificationResult)
58566      composeVerificationResult(name, (VerificationResult)resource);
58567    else if (resource instanceof VisionPrescription)
58568      composeVisionPrescription(name, (VisionPrescription)resource);
58569    else if (resource instanceof Binary)
58570      composeBinary(name, (Binary)resource);
58571    else
58572      throw new Error("Unhandled resource type "+resource.getClass().getName());
58573  }
58574
58575  protected void composeType(String prefix, Type type) throws IOException {
58576    if (type == null)
58577      ;
58578    else if (type instanceof Extension)
58579       composeExtension(prefix+"Extension", (Extension) type);
58580    else if (type instanceof Narrative)
58581       composeNarrative(prefix+"Narrative", (Narrative) type);
58582    else if (type instanceof Count)
58583       composeCount(prefix+"Count", (Count) type);
58584    else if (type instanceof Dosage)
58585       composeDosage(prefix+"Dosage", (Dosage) type);
58586    else if (type instanceof MarketingStatus)
58587       composeMarketingStatus(prefix+"MarketingStatus", (MarketingStatus) type);
58588    else if (type instanceof SubstanceAmount)
58589       composeSubstanceAmount(prefix+"SubstanceAmount", (SubstanceAmount) type);
58590    else if (type instanceof Population)
58591       composePopulation(prefix+"Population", (Population) type);
58592    else if (type instanceof Distance)
58593       composeDistance(prefix+"Distance", (Distance) type);
58594    else if (type instanceof Age)
58595       composeAge(prefix+"Age", (Age) type);
58596    else if (type instanceof Duration)
58597       composeDuration(prefix+"Duration", (Duration) type);
58598    else if (type instanceof ProductShelfLife)
58599       composeProductShelfLife(prefix+"ProductShelfLife", (ProductShelfLife) type);
58600    else if (type instanceof Timing)
58601       composeTiming(prefix+"Timing", (Timing) type);
58602    else if (type instanceof ProdCharacteristic)
58603       composeProdCharacteristic(prefix+"ProdCharacteristic", (ProdCharacteristic) type);
58604    else if (type instanceof Meta)
58605       composeMeta(prefix+"Meta", (Meta) type);
58606    else if (type instanceof Address)
58607       composeAddress(prefix+"Address", (Address) type);
58608    else if (type instanceof Contributor)
58609       composeContributor(prefix+"Contributor", (Contributor) type);
58610    else if (type instanceof Attachment)
58611       composeAttachment(prefix+"Attachment", (Attachment) type);
58612    else if (type instanceof DataRequirement)
58613       composeDataRequirement(prefix+"DataRequirement", (DataRequirement) type);
58614    else if (type instanceof Money)
58615       composeMoney(prefix+"Money", (Money) type);
58616    else if (type instanceof HumanName)
58617       composeHumanName(prefix+"HumanName", (HumanName) type);
58618    else if (type instanceof ContactPoint)
58619       composeContactPoint(prefix+"ContactPoint", (ContactPoint) type);
58620    else if (type instanceof Identifier)
58621       composeIdentifier(prefix+"Identifier", (Identifier) type);
58622    else if (type instanceof Coding)
58623       composeCoding(prefix+"Coding", (Coding) type);
58624    else if (type instanceof SampledData)
58625       composeSampledData(prefix+"SampledData", (SampledData) type);
58626    else if (type instanceof Ratio)
58627       composeRatio(prefix+"Ratio", (Ratio) type);
58628    else if (type instanceof Reference)
58629       composeReference(prefix+"Reference", (Reference) type);
58630    else if (type instanceof TriggerDefinition)
58631       composeTriggerDefinition(prefix+"TriggerDefinition", (TriggerDefinition) type);
58632    else if (type instanceof Quantity)
58633       composeQuantity(prefix+"Quantity", (Quantity) type);
58634    else if (type instanceof Period)
58635       composePeriod(prefix+"Period", (Period) type);
58636    else if (type instanceof Range)
58637       composeRange(prefix+"Range", (Range) type);
58638    else if (type instanceof RelatedArtifact)
58639       composeRelatedArtifact(prefix+"RelatedArtifact", (RelatedArtifact) type);
58640    else if (type instanceof Annotation)
58641       composeAnnotation(prefix+"Annotation", (Annotation) type);
58642    else if (type instanceof ContactDetail)
58643       composeContactDetail(prefix+"ContactDetail", (ContactDetail) type);
58644    else if (type instanceof UsageContext)
58645       composeUsageContext(prefix+"UsageContext", (UsageContext) type);
58646    else if (type instanceof Expression)
58647       composeExpression(prefix+"Expression", (Expression) type);
58648    else if (type instanceof Signature)
58649       composeSignature(prefix+"Signature", (Signature) type);
58650    else if (type instanceof CodeableConcept)
58651       composeCodeableConcept(prefix+"CodeableConcept", (CodeableConcept) type);
58652    else if (type instanceof ParameterDefinition)
58653       composeParameterDefinition(prefix+"ParameterDefinition", (ParameterDefinition) type);
58654    else if (type instanceof CodeType) {
58655      composeCodeCore(prefix+"Code", (CodeType) type, false);
58656      composeCodeExtras(prefix+"Code", (CodeType) type, false);
58657    }
58658    else if (type instanceof OidType) {
58659      composeOidCore(prefix+"Oid", (OidType) type, false);
58660      composeOidExtras(prefix+"Oid", (OidType) type, false);
58661    }
58662    else if (type instanceof CanonicalType) {
58663      composeCanonicalCore(prefix+"Canonical", (CanonicalType) type, false);
58664      composeCanonicalExtras(prefix+"Canonical", (CanonicalType) type, false);
58665    }
58666    else if (type instanceof UuidType) {
58667      composeUuidCore(prefix+"Uuid", (UuidType) type, false);
58668      composeUuidExtras(prefix+"Uuid", (UuidType) type, false);
58669    }
58670    else if (type instanceof UrlType) {
58671      composeUrlCore(prefix+"Url", (UrlType) type, false);
58672      composeUrlExtras(prefix+"Url", (UrlType) type, false);
58673    }
58674    else if (type instanceof UnsignedIntType) {
58675      composeUnsignedIntCore(prefix+"UnsignedInt", (UnsignedIntType) type, false);
58676      composeUnsignedIntExtras(prefix+"UnsignedInt", (UnsignedIntType) type, false);
58677    }
58678    else if (type instanceof MarkdownType) {
58679      composeMarkdownCore(prefix+"Markdown", (MarkdownType) type, false);
58680      composeMarkdownExtras(prefix+"Markdown", (MarkdownType) type, false);
58681    }
58682    else if (type instanceof IdType) {
58683      composeIdCore(prefix+"Id", (IdType) type, false);
58684      composeIdExtras(prefix+"Id", (IdType) type, false);
58685    }
58686    else if (type instanceof PositiveIntType) {
58687      composePositiveIntCore(prefix+"PositiveInt", (PositiveIntType) type, false);
58688      composePositiveIntExtras(prefix+"PositiveInt", (PositiveIntType) type, false);
58689    }
58690    else if (type instanceof DateType) {
58691      composeDateCore(prefix+"Date", (DateType) type, false);
58692      composeDateExtras(prefix+"Date", (DateType) type, false);
58693    }
58694    else if (type instanceof DateTimeType) {
58695      composeDateTimeCore(prefix+"DateTime", (DateTimeType) type, false);
58696      composeDateTimeExtras(prefix+"DateTime", (DateTimeType) type, false);
58697    }
58698    else if (type instanceof StringType) {
58699      composeStringCore(prefix+"String", (StringType) type, false);
58700      composeStringExtras(prefix+"String", (StringType) type, false);
58701    }
58702    else if (type instanceof IntegerType) {
58703      composeIntegerCore(prefix+"Integer", (IntegerType) type, false);
58704      composeIntegerExtras(prefix+"Integer", (IntegerType) type, false);
58705    }
58706    else if (type instanceof UriType) {
58707      composeUriCore(prefix+"Uri", (UriType) type, false);
58708      composeUriExtras(prefix+"Uri", (UriType) type, false);
58709    }
58710    else if (type instanceof InstantType) {
58711      composeInstantCore(prefix+"Instant", (InstantType) type, false);
58712      composeInstantExtras(prefix+"Instant", (InstantType) type, false);
58713    }
58714    else if (type instanceof BooleanType) {
58715      composeBooleanCore(prefix+"Boolean", (BooleanType) type, false);
58716      composeBooleanExtras(prefix+"Boolean", (BooleanType) type, false);
58717    }
58718    else if (type instanceof Base64BinaryType) {
58719      composeBase64BinaryCore(prefix+"Base64Binary", (Base64BinaryType) type, false);
58720      composeBase64BinaryExtras(prefix+"Base64Binary", (Base64BinaryType) type, false);
58721    }
58722    else if (type instanceof TimeType) {
58723      composeTimeCore(prefix+"Time", (TimeType) type, false);
58724      composeTimeExtras(prefix+"Time", (TimeType) type, false);
58725    }
58726    else if (type instanceof DecimalType) {
58727      composeDecimalCore(prefix+"Decimal", (DecimalType) type, false);
58728      composeDecimalExtras(prefix+"Decimal", (DecimalType) type, false);
58729    }
58730    else
58731      throw new Error("Unhandled type");
58732  }
58733
58734  protected void composeTypeInner(Type type) throws IOException {
58735    if (type == null)
58736      ;
58737    else if (type instanceof Extension)
58738       composeExtensionInner((Extension) type);
58739    else if (type instanceof Narrative)
58740       composeNarrativeInner((Narrative) type);
58741    else if (type instanceof Count)
58742       composeCountInner((Count) type);
58743    else if (type instanceof Dosage)
58744       composeDosageInner((Dosage) type);
58745    else if (type instanceof MarketingStatus)
58746       composeMarketingStatusInner((MarketingStatus) type);
58747    else if (type instanceof SubstanceAmount)
58748       composeSubstanceAmountInner((SubstanceAmount) type);
58749    else if (type instanceof Population)
58750       composePopulationInner((Population) type);
58751    else if (type instanceof Distance)
58752       composeDistanceInner((Distance) type);
58753    else if (type instanceof Age)
58754       composeAgeInner((Age) type);
58755    else if (type instanceof Duration)
58756       composeDurationInner((Duration) type);
58757    else if (type instanceof ProductShelfLife)
58758       composeProductShelfLifeInner((ProductShelfLife) type);
58759    else if (type instanceof Timing)
58760       composeTimingInner((Timing) type);
58761    else if (type instanceof ProdCharacteristic)
58762       composeProdCharacteristicInner((ProdCharacteristic) type);
58763    else if (type instanceof Meta)
58764       composeMetaInner((Meta) type);
58765    else if (type instanceof Address)
58766       composeAddressInner((Address) type);
58767    else if (type instanceof Contributor)
58768       composeContributorInner((Contributor) type);
58769    else if (type instanceof Attachment)
58770       composeAttachmentInner((Attachment) type);
58771    else if (type instanceof DataRequirement)
58772       composeDataRequirementInner((DataRequirement) type);
58773    else if (type instanceof Money)
58774       composeMoneyInner((Money) type);
58775    else if (type instanceof HumanName)
58776       composeHumanNameInner((HumanName) type);
58777    else if (type instanceof ContactPoint)
58778       composeContactPointInner((ContactPoint) type);
58779    else if (type instanceof Identifier)
58780       composeIdentifierInner((Identifier) type);
58781    else if (type instanceof Coding)
58782       composeCodingInner((Coding) type);
58783    else if (type instanceof SampledData)
58784       composeSampledDataInner((SampledData) type);
58785    else if (type instanceof Ratio)
58786       composeRatioInner((Ratio) type);
58787    else if (type instanceof Reference)
58788       composeReferenceInner((Reference) type);
58789    else if (type instanceof TriggerDefinition)
58790       composeTriggerDefinitionInner((TriggerDefinition) type);
58791    else if (type instanceof Quantity)
58792       composeQuantityInner((Quantity) type);
58793    else if (type instanceof Period)
58794       composePeriodInner((Period) type);
58795    else if (type instanceof Range)
58796       composeRangeInner((Range) type);
58797    else if (type instanceof RelatedArtifact)
58798       composeRelatedArtifactInner((RelatedArtifact) type);
58799    else if (type instanceof Annotation)
58800       composeAnnotationInner((Annotation) type);
58801    else if (type instanceof ContactDetail)
58802       composeContactDetailInner((ContactDetail) type);
58803    else if (type instanceof UsageContext)
58804       composeUsageContextInner((UsageContext) type);
58805    else if (type instanceof Expression)
58806       composeExpressionInner((Expression) type);
58807    else if (type instanceof Signature)
58808       composeSignatureInner((Signature) type);
58809    else if (type instanceof CodeableConcept)
58810       composeCodeableConceptInner((CodeableConcept) type);
58811    else if (type instanceof ParameterDefinition)
58812       composeParameterDefinitionInner((ParameterDefinition) type);
58813    else
58814      throw new Error("Unhandled type");
58815  }
58816
58817}
58818